A2osX/DRV/DHGR.DRV.S.LINE.txt
2017-12-22 22:24:30 +01:00

247 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
* HLINE X1,X2 at Y1 (XOR,SET,ORA)
*--------------------------------------
HLINE lda CB.Cache+S.CB.M
cmp #S.CB.M.MONO
bne HLINE.C16
HLINE.MONO >LDYA CB.Cache+S.CB.X1
jsr LBUF.SetBounds1YA
>LDYA CB.Cache+S.CB.X2
jsr LBUF.SetBounds2YA
lda CB.Cache+S.CB.COLOR
beq .1
lda #%01111111
.1 ldx LBUF.C1
.2 sta LBUF.DATA,x
cpx LBUF.C2
inx
bcc .2
ldy CB.Cache+S.CB.Y1
jmp LBUF.DrawAtY
HLINE.C16 lda CB.Cache+S.CB.X1
and #%11111100
tay
lda CB.Cache+S.CB.X1+1
jsr LBUF.SetBounds1YA
lda CB.Cache+S.CB.X2
ora #%00000011
tay
lda CB.Cache+S.CB.X2+1
jsr LBUF.SetBounds2YA
lda CB.Cache+S.CB.COLOR
asl
asl
clc
adc L.Color.Pixels
sta .2+1
lda L.Color.Pixels+1
adc #0
sta .2+2
ldx LBUF.C1
.1 txa
and #3 Compute index in Palette (Mod 4)
tay
.2 lda $ffff,y SELF MODIFIED
sta LBUF.DATA,x
cpx LBUF.C2
inx
bcc .1
ldy CB.Cache+S.CB.Y1
jmp LBUF.DrawAtY
rts
*--------------------------------------
* VLINE Y1,Y2 at X1 (XOR,SET,ORA)
*--------------------------------------
VLINE lda CB.Cache+S.CB.M
cmp #S.CB.M.MONO
bne VLINE.C16
VLINE.MONO >LDYA CB.Cache+S.CB.X1
jsr DIVMOD7YA
tay
lda COL.OFS,y
sta GBYTE Save COL (DIV)
lda COL.BANK,y
tay
sta $C000,y Select proper BANK
lda CB.Cache+S.CB.OP
* cmp #S.CB.OP.XOR
beq VLINE.MONO.XOR
lda CB.Cache+S.CB.COLOR
bne VLINE.MONO.WHITE
VLINE.MONO.BLACK
ldy CB.Cache+S.CB.Y1
clc
.1 lda BASEL,y
adc GBYTE
sta ZPBasePtr
lda BASEH,y
sta ZPBasePtr+1
lda (ZPBasePtr)
and Mono.NMasks,x
sta (ZPBasePtr)
cpy CB.Cache+S.CB.Y2
iny
bcc .1
rts
VLINE.MONO.WHITE
.1 lda BASEL,y
adc GBYTE
sta ZPBasePtr
lda BASEH,y
sta ZPBasePtr+1
lda (ZPBasePtr)
ora Mono.Masks,x
sta (ZPBasePtr)
cpy CB.Cache+S.CB.Y2
iny
bcc .1
rts
VLINE.MONO.XOR
.1 lda BASEL,y
adc GBYTE
sta ZPBasePtr
lda BASEH,y
sta ZPBasePtr+1
lda (ZPBasePtr)
eor Mono.Masks,x
sta (ZPBasePtr)
cpy CB.Cache+S.CB.Y2
iny
bcc .1
rts
VLINE.C16 lda CB.Cache+S.CB.X1
lsr CB.Cache+S.CB.X1+1 divide by 4
ror
lsr CB.Cache+S.CB.X1+1
ror
tay Y=X/4 (range 0->139)
lda DIV7.0,y A=X/4/7 (range 0->19)
asl times 2 (range 0->38)
ldx CB.Cache+S.CB.Y1
adc BASEL,x setup line Base Ptr (cc by asl)
sta ZPBasePtr ZPBasePtr now point to first of...
lda BASEH,x
sta ZPBasePtr+1 ...the 4 columns
lda MOD7.0,y get MOD
asl times 4 to compute index in MASK tables
asl
tax set in X for Masks,NMasks
lda CB.Cache+S.CB.COLOR
asl times 4 to compute index in PIXELS table
asl
tay
lda Color.Masks,x bits in 1st byte to light?
beq .10
and Color.Pixels,y apply color
sta GBYTE
sta SETPAGE2
lda (ZPBasePtr)
and Color.NMasks,x reset existing pixel,
ora GBYTE
sta (ZPBasePtr)
.10 inx
iny
lda Color.Masks,x
beq .11
and Color.Pixels,y apply color
sta GBYTE
sta CLRPAGE2
lda (ZPBasePtr)
and Color.NMasks,x reset existing pixel,
ora GBYTE
sta (ZPBasePtr)
.11 inc ZPBasePtr
inx
iny
lda Color.Masks,x
beq .12
and Color.Pixels,y apply color
sta GBYTE
sta SETPAGE2
lda (ZPBasePtr)
and Color.NMasks,x reset existing pixel,
ora GBYTE
sta (ZPBasePtr)
.12 inx
iny
lda Color.Masks,x
beq .13
and Color.Pixels,y apply color
sta GBYTE
sta CLRPAGE2
lda (ZPBasePtr)
and Color.NMasks,x reset existing pixel,
ora GBYTE
sta (ZPBasePtr)
.13 rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/DRV/DHGR.DRV.S.LINE
LOAD /A2OSX.SRC/DRV/DHGR.DRV.S
ASM