A2osX/DRV/DHGR.DRV.S.LBUF.txt
2018-11-17 18:17:13 +01:00

318 lines
6.4 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
AUTO 4,1
.LIST OFF
*--------------------------------------
LBUF.SetBounds1YA
jsr DIVMOD7YA A=DIV, X=MOD
sta LBUF.C1
lda C1.MASK,x
sta LBUF.C1.MASK
lda C1.DATA,x
sta LBUF.C1.DATA
rts
*--------------------------------------
LBUF.SetBounds2YA
jsr DIVMOD7YA A=DIV, X=MOD
sta LBUF.C2
cmp LBUF.C1 C1=C2, go combine in C1
beq .1
lda C2.MASK,x
sta LBUF.C2.MASK
lda C2.DATA,x
sta LBUF.C2.DATA
rts
.1 lda C1.MASK,x
and C2.MASK,x
sta LBUF.C1.MASK
lda C1.DATA,x
ora C2.DATA,x
sta LBUF.C1.DATA
rts
*--------------------------------------
LBUF.DrawAtY lda BASEL,y setup line Base Ptr
sta ZPBasePtr
lda BASEH,y
sta ZPBasePtr+1
lda CB.Cache+S.CB.OP
bit #S.CB.OP.RESTORE
bne .4
bit #S.CB.OP.SAVE
beq .3
ldx LBUF.C1
.1 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y
sta (ZPBMSavePtr)
inc ZPBMSavePtr
bne .2
inc ZPBMSavePtr+1
.2 cpx LBUF.C2
inx
bcc .1
lda CB.Cache+S.CB.OP
.3 and #$F
tax
jmp (J.LBUF.DrawAtY,x)
.4 ldx LBUF.C1
.5 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBMSavePtr)
sta (ZPBasePtr),y
inc ZPBMSavePtr
bne .6
inc ZPBMSavePtr+1
.6 cpx LBUF.C2
inx
bcc .5
rts
*--------------------------------------
LBUF.DrawAtY.XOR
LBUF.DrawAtY.AND.XOR
ldx LBUF.C1 x C1->C2
ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y Get C1
and LBUF.C1.MASK clear ONLY bits starting at X1 mod 7
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora ZPTmpByte
eor (ZPBasePtr),y
sta (ZPBasePtr),y update screen
inx
cpx LBUF.C2
beq .2 C1=C2, go setup C2
bcs .8 C1+1 > C2, we are done...
.1 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda LBUF.DATA,x
eor (ZPBasePtr),y
sta (ZPBasePtr),y
inx
cpx LBUF.C2
bne .1
.2 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y Get C2
and LBUF.C2.MASK clear ONLY bits ending at X2 mod 7
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora ZPTmpByte
eor (ZPBasePtr),y
sta (ZPBasePtr),y update screen
.8 rts
*--------------------------------------
LBUF.DrawAtY.SET
LBUF.DrawAtY.AND.SET
ldx LBUF.C1 x C1->C2
ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y Clear screen at C1
and LBUF.C1.MASK with MASK bits
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora ZPTmpByte ora with screen bits
sta (ZPBasePtr),y update screen
inx
cpx LBUF.C2
beq .7 C1=C2, go setup C2
bcs .8 C1+1 > C2, we are done...
phx
ldy COL.BANK,x C1+1,3,5,7.....
sta $C000,y
ldy COL.OFS,x
.1 lda LBUF.DATA,x set all bytes between C1+1 & C2-1
sta (ZPBasePtr),y
iny
inx
inx
cpx LBUF.C2
bcc .1
plx
inx
cpx LBUF.C2
beq .7
ldy COL.BANK,x C1+2,4,6,8....
sta $C000,y
ldy COL.OFS,x
.2 lda LBUF.DATA,x set all bytes between C1+1 & C2-1
sta (ZPBasePtr),y
iny
inx
inx
cpx LBUF.C2
bcc .2
ldx LBUF.C2
.7 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y Get C2
and LBUF.C2.MASK clear ONLY bits ending at X2 mod 7
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora ZPTmpByte
sta (ZPBasePtr),y update screen
.8 rts
*--------------------------------------
LBUF.DrawAtY.ORA
ldx LBUF.C1 x C1->C2
ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y Get C1
and LBUF.C1.MASK clear ONLY bits starting at X1 mod 7
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora ZPTmpByte
ora (ZPBasePtr),y
sta (ZPBasePtr),y update screen
inx
cpx LBUF.C2
beq .2 C1=C2, go setup C2
bcs .8 C1+1 > C2, we are done...
.1 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda LBUF.DATA,x set all bytes between C1+1 & C2-1
ora (ZPBasePtr),y
sta (ZPBasePtr),y
inx
cpx LBUF.C2
bne .1
.2 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda LBUF.MASK,x get MASK bits
ora LBUF.C2.MASK
and (ZPBasePtr),y
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora ZPTmpByte
sta (ZPBasePtr),y update screen
.8 rts
*--------------------------------------
LBUF.DrawAtY.AND.ORA
ldx LBUF.C1 x C1->C2
ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda LBUF.MASK,x get MASK bits
ora LBUF.C1.MASK clear ONLY bits starting at X1 mod 7
and (ZPBasePtr),y Clear screen at C1
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora ZPTmpByte ora with screen bits
sta (ZPBasePtr),y update screen
inx
cpx LBUF.C2
beq .2 C1=C2, go setup C2
bcs .8 C1+1 > C2, we are done...
.1 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y
and LBUF.MASK,x
ora LBUF.DATA,x set all bytes between C1+1 & C2-1
sta (ZPBasePtr),y
inx
cpx LBUF.C2
bne .1
.2 ldy COL.BANK,x
sta $C000,y
ldy COL.OFS,x
lda LBUF.MASK,x get MASK bits
ora LBUF.C2.MASK
and (ZPBasePtr),y
sta ZPTmpByte
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora ZPTmpByte
sta (ZPBasePtr),y update screen
.8 rts
*--------------------------------------
MAN
SAVE USR/SRC/BIN/DRV/DHGR.DRV.S.LBUF
LOAD USR/SRC/BIN/DRV/DHGR.DRV.S
ASM