A2osX/DRV/DHGR.DRV.S.BLT.txt

178 lines
3.2 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.

PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* BitBlt
* S.CB.X1 : SrcX1 in bitmap/mask
* S.CB.Y1 : SrcY1
* S.CB.X2 : SrcX2
* S.CB.Y2 : SrcY2
* S.CB.DestX : Destination X (screen)
* S.CB.DestY : Destination Y (screen)
* S.CB.SrcPtr : pointer to S.BM
* S.CB.DstPtr : pointer to Save Buffer
*--------------------------------------
BITBLT >LDYA CB.CACHE+S.CB.SrcPtr
>STYA ZPBMDataPtr
ldy #S.BM-1
.1 lda (ZPBMDataPtr),y
sta BM.Cache,y
dey
bpl .1
lda ZPBMDataPtr
clc
adc #S.BM
sta ZPBMDataPtr
bcc .2
inc ZPBMDataPtr+1
.2 >LDYA CB.Cache+S.CB.Y1
ldx BM.Cache+S.BM.RowBytes
jsr YAMultX
pha
tya
clc
adc ZPBMDataPtr
sta ZPBMDataPtr
pla
pha
adc ZPBMDataPtr+1
sta ZPBMDataPtr+1
tya
adc BM.Cache+S.BM.MASK.OFS
sta ZPBMMaskPtr
pla
adc BM.Cache+S.BM.MASK.OFS+1
sta ZPBMMaskPtr+1
lda CB.Cache+S.CB.X1
pha
and #7
sta BLT.BMBitOfs
pla
lsr CB.Cache+S.CB.X1+1
ror
lsr CB.Cache+S.CB.X1+1
ror
lsr CB.Cache+S.CB.X1+1
ror
pha
clc
adc ZPBMDataPtr
sta ZPBMDataPtr
bcc .3
inc ZPBMDataPtr+1
.3 pla
adc ZPBMMaskPtr
sta ZPBMMaskPtr
bcc .4
inc ZPBMMaskPtr+1
.4 lda S.CB.X2
sec
sbc S.CB.X1
sta BLT.DX
lda S.CB.X2+1
sbc S.CB.X1+1
sta BLT.DX+1
>LDYA S.CB.DestX
jsr LBUF.SetBounds1YA
stx BLT.SCRBitOfs
lda S.CB.DestX
clc
adc BLT.DX
tay
lda S.CB.DestX+1
adc BLT.DX+1
jsr LBUF.SetBounds2YA
.5 lda BLT.BMBitOfs
sta BLT.BMBitOfsL
.6 jsr BLT.Get7BMBits
clc
rts
*--------------------------------------
* BMD/BMM bits :
* 76543210 76543210
* ^
* BMBitOfsL (0->7)
* LBUF DATA/MASK Bits
* c6543210 c6543210
* ^
* SCRBitOfsL (0->6)
*--------------------------------------
BLT.Get7BMBits lda (ZPBMDataPtr)
ldx BLT.BMBitOfsL
beq BLT.Get7BMBits0 done! and no need to advance ZPBMDataPtr
lsr Range 0->127
dex Range 0->6
beq BLT.Get7BMBits1
ldy Shift7.LO-1,x X = 1->6
sty ZPBMShiftPtr+1
ldy Shift7.HI-1,x X = 1->6
sty ZPBMShiftPtr+1
and Mask7BitsL,x Get only needed bits
tay
lda (ZPBMShiftPtr),y
pha
inc ZPBMDataPtr Next BM data byte
bne .1
inc ZPBMDataPtr+1
.1 lda (ZPBMDataPtr)
and Mask7BitsH,x
tay
pla
ora (ZPBMShiftPtr),y
dec BLT.BMBitOfsL X = 1->6, ADD 7 MOD 8.....
rts
BLT.Get7BMBits0 and #%01111111 Get only 7 needed bits
ldx #7
stx BLT.BMBitOfsL Was 0, add 7 bits
rts
BLT.Get7BMBits1 stz BLT.BMBitOfsL Was 1, add 7 bits, MOD 8=0
inc ZPBMDataPtr go to next byte
bne .1
inc ZPBMDataPtr+1
.1 rts LSR did already 0xxxxxxx
*--------------------------------------
MAN
SAVE /A2OSX.SRC/DRV/DHGR.DRV.S.RECT
LOAD /A2OSX.SRC/DRV/DHGR.DRV.S
ASM