Kernel 0.9.1 : GUI, BitBlt debugging....

This commit is contained in:
Rémy GIBERT 2017-11-27 08:11:31 +01:00
parent e520199eb5
commit c19f98bd81
9 changed files with 260 additions and 158 deletions

Binary file not shown.

Binary file not shown.

View File

@ -27,6 +27,14 @@ BITBLT >LDYA CB.CACHE+S.CB.SrcPtr
dey
bpl .1
lda ZPBMDataPtr
clc
adc BM.Cache+S.BM.MASK.OFS
sta ZPBMMaskPtr
lda ZPBMDataPtr+1
adc BM.Cache+S.BM.MASK.OFS+1
sta ZPBMMaskPtr+1
lda ZPBMDataPtr
clc
adc #S.BM
@ -43,19 +51,19 @@ BITBLT >LDYA CB.CACHE+S.CB.SrcPtr
pha
tya
clc
adc ZPBMDataPtr0
sta ZPBMDataPtr0
adc ZPBMDataPtr
sta BLT.BMDataPtr
pla
pha
adc ZPBMDataPtr0+1
sta ZPBMDataPtr0+1
adc ZPBMDataPtr+1
sta BLT.BMDataPtr+1
tya
adc BM.Cache+S.BM.MASK.OFS
sta ZPBMMaskPtr0
adc ZPBMMaskPtr
sta BLT.BMMaskPtr
pla
adc BM.Cache+S.BM.MASK.OFS+1
sta ZPBMMaskPtr0+1
adc ZPBMMaskPtr+1
sta BLT.BMMaskPtr+1
lda CB.Cache+S.CB.X1
pha
@ -72,133 +80,141 @@ BITBLT >LDYA CB.CACHE+S.CB.SrcPtr
pha
clc
adc ZPBMDataPtr0
sta ZPBMDataPtr0
adc BLT.BMDataPtr
sta BLT.BMDataPtr
bcc .3
inc ZPBMDataPtr0+1
inc BLT.BMDataPtr+1
.3 pla
adc ZPBMMaskPtr0
sta ZPBMMaskPtr0
adc BLT.BMMaskPtr
sta BLT.BMMaskPtr
bcc .4
inc ZPBMMaskPtr0+1
inc BLT.BMMaskPtr+1
.4 lda S.CB.X2
.4 lda CB.Cache+S.CB.X2
sec
sbc S.CB.X1
sbc CB.Cache+S.CB.X1
sta BLT.DX
lda S.CB.X2+1
sbc S.CB.X1+1
lda CB.Cache+S.CB.X2+1
sbc CB.Cache+S.CB.X1+1
sta BLT.DX+1
>LDYA S.CB.DestX
>LDYA CB.Cache+S.CB.DestX
jsr LBUF.SetBounds1YA
stx BLT.SCRBitOfs
lda S.CB.DestX
lda CB.Cache+S.CB.DestX
clc
adc BLT.DX
tay
lda S.CB.DestX+1
lda CB.Cache+S.CB.DestX+1
adc BLT.DX+1
jsr LBUF.SetBounds2YA
lda S.CB.Y2
lda CB.Cache+S.CB.Y2
sec
sbc S.CB.Y1
sbc CB.Cache+S.CB.Y1
inc
sta BLT.DY
lda BLT.BMBitOfs
sta BLT.BMBitOfsL
lda LBUF.C1
sta BLT.ScreenC
>LDYA ZPBMDataPtr0
>STYA ZPBMDataPtr
>LDYA ZPBMMaskPtr0
>STYA ZPBMMaskPtr
ldx BLT.SCRBitOfs
beq BITBLT.LOOP
ldy Shift.L.LO,x X = 1->6
sty ZPShiftPtr
sty ZPScrShiftPtr
ldy Shift.L.HI,x X = 1->6
sty ZPShiftPtr+1
sty ZPScrShiftPtr+1
BITBLT.LOOP >LDYA BLT.BMDataPtr
>STYA ZPBMDataPtr
>LDYA BLT.BMMaskPtr
>STYA ZPBMMaskPtr
BITBLT.LOOP ldx BLT.SCRBitOfs
lda BLT.BMBitOfs
sta BLT.BMBitOfsL
stz BLT.BMIdx
ldx LBUF.C1
stx BLT.ScrColIdx
stz LBUF.DATA,x make sure C1 not ORed with trash in "ora LBUF.DATA,x"
ldx BLT.SCRBitOfs
bne .2
*------------ Shift 0
.1 jsr BLT.Get7BMDBits we have 0xxxxxxxx in A
ldx BLT.ScreenC
ldx BLT.ScrColIdx
sta LBUF.DATA,x
inc BLT.ScreenC
inc BLT.ScrColIdx
cpx LBUF.C2
bne .1
bra BITBLT.DRAW
.2 jsr BLT.Get7BMDBits we have 0xxxxxxxx in A
*------------ Shift 1->6 Comment : SCRBitOfs=X=3
pha save it for 2nd part
.2 lda Shift7BitsCol1,x get #%00001111, BM bits that go in Col1
sta .4+1
lda Shift7BitsCol2,x get #%01110000, BM bits that go in Col2
sta .5+1
ldx BLT.SCRBitOfs
and Mask7BitsH,x 0000xxxx, keep col1 bits only
.3 jsr BLT.Get7BMDBits we have c6543210 in A, destination : COL=3210xxx, COL+1=xxxx654
pha save BM byte for 2nd col
.4 and #$ff SELF MODIFIED : MASK WITH #%00001111, keep col1 bits only
tay
lda (ZPShiftPtr),y make 0xxxx000
lda (ZPScrShiftPtr),y make 0000dddd Shift left 3 : 0dddd000
ldy BLT.ScreenC
ora LBUF.DATA,y
sta LBUF.DATA,y
ldx BLT.ScrColIdx Get actual COL index
ora LBUF.DATA,x Light proper bits : 0dddd???
sta LBUF.DATA,x store 0xdddd???
pla
pla Get back BM Byte
inc BLT.ScreenC
cpy LBUF.C2
beq BITBLT.DRAW
and Mask7BitsL,x 0yyy0000
.5 and #$ff SELF MODIFIED : #%01110000 get only col2 bites
tay
lda (ZPShiftPtr),y 00000yyy
lda (ZPScrShiftPtr),y shift right 4 (=shift left 3!!!) : 00000ddd
ldy BLT.ScreenC
sta LBUF.DATA,y
sta LBUF.DATA+1,x
inc BLT.ScreenC
cpy LBUF.C2
bne .2
inx
stx BLT.ScrColIdx
cpx LBUF.C2
bne .3
BITBLT.DRAW ldy S.CB.Y1
BITBLT.DRAW ldy CB.Cache+S.CB.DestY
jsr LBUF.DrawAtY
inc S.CB.Y1
inc CB.Cache+S.CB.DestY
lda ZPBMDataPtr0
lda BLT.BMDataPtr
clc
adc BM.Cache+S.BM.RowBytes
sta ZPBMDataPtr0
sta BLT.BMDataPtr
bcc .6
inc ZPBMDataPtr0+1
inc BLT.BMDataPtr+1
.6 lda ZPBMMaskPtr0
.6 lda BLT.BMMaskPtr
clc
adc BM.Cache+S.BM.RowBytes
sta ZPBMMaskPtr0
sta BLT.BMMaskPtr
bcc .7
inc ZPBMMaskPtr0+1
inc BLT.BMMaskPtr+1
.7 dec BLT.DY
bne BITBLT.LOOP
clc
beq .8
jmp BITBLT.LOOP
.8 clc
rts
*--------------------------------------
* BMD/BMM bits :
@ -210,7 +226,8 @@ BITBLT.DRAW ldy S.CB.Y1
* ^
* SCRBitOfs (0->6)
*--------------------------------------
BLT.Get7BMDBits lda (ZPBMDataPtr)
BLT.Get7BMDBits ldy BLT.BMIdx
lda (ZPBMDataPtr),y
ldx BLT.BMBitOfsL
beq BLT.Get7BMBits0 OFS=0, done! and no need to advance ZPBMDataPtr
@ -219,28 +236,28 @@ BLT.Get7BMDBits lda (ZPBMDataPtr)
beq BLT.Get7BMBits1 OFS was 1....done and go to next byte, OFS=0
ldy Shift.R.LO,x X = 1->6
sty ZPShiftPtr
sty ZPBMShiftPtr
ldy Shift.R.HI,x X = 1->6
sty ZPShiftPtr+1
sty ZPBMShiftPtr+1
and Mask7BitsL,x Get only left upper X bits
and Mask7BitsH,x Get only left upper X bits
tay xxxxx000
lda (ZPShiftPtr),y shift'em RIGHT 000xxxxx
lda (ZPBMShiftPtr),y shift'em RIGHT 000xxxxx
pha
inc ZPBMDataPtr Next BM data byte
bne .2
inc ZPBMDataPtr+1
inc BLT.BMIdx Next BM data byte
.2 lda (ZPBMDataPtr) get next byte
and Mask7BitsH,x only first Y bits 000000yy
ldy BLT.BMIdx
lda (ZPBMDataPtr),y get next byte
and Mask7BitsL,x only first Y bits 000000yy
tay
pla get back right part bits 000xxxxx
ora (ZPShiftPtr),y shift right 000000yy and ORA with 000xxxxx=0yyxxxxx
ora (ZPBMShiftPtr),y shift right 000000yy and ORA with 000xxxxx=0yyxxxxx
dec BLT.BMBitOfsL X = 1->6, ADD 7 MOD 8.....
rts
@ -251,12 +268,8 @@ BLT.Get7BMBits0 and #%01111111 Get only 7 needed 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
inc BLT.BMIdx go to next byte in BM line
rts LSR did already 0xxxxxxx
*--------------------------------------
MAN
SAVE /A2OSX.SRC/DRV/DHGR.DRV.S.RECT

View File

@ -70,6 +70,7 @@ LBUF.DrawAtY.XOR
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora GBYTE
eor (ZPBasePtr),y
sta (ZPBasePtr),y update screen
inx
@ -81,7 +82,8 @@ LBUF.DrawAtY.XOR
sta $C000,y
ldy COL.OFS,x
lda LBUF.DATA,x set all bytes between C1+1 & C2-1
lda LBUF.DATA,x
eor (ZPBasePtr),y
sta (ZPBasePtr),y
inx
@ -98,6 +100,7 @@ LBUF.DrawAtY.XOR
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora GBYTE
eor (ZPBasePtr),y
sta (ZPBasePtr),y update screen
.8 rts
@ -109,7 +112,7 @@ LBUF.DrawAtY.SET
sta $C000,y
ldy COL.OFS,x
lda (ZPBasePtr),y Get C1
lda (ZPBasePtr),y data for Get C1
and LBUF.C1.MASK clear ONLY bits starting at X1 mod 7
sta GBYTE
lda LBUF.DATA,x get DATA bits
@ -160,6 +163,7 @@ LBUF.DrawAtY.ORA
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora GBYTE
ora (ZPBasePtr),y
sta (ZPBasePtr),y update screen
inx
@ -172,6 +176,7 @@ LBUF.DrawAtY.ORA
ldy COL.OFS,x
lda LBUF.DATA,x set all bytes between C1+1 & C2-1
ora (ZPBasePtr),y
sta (ZPBasePtr),y
inx
@ -188,6 +193,7 @@ LBUF.DrawAtY.ORA
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora GBYTE
ora (ZPBasePtr),y
sta (ZPBasePtr),y update screen
.8 rts
@ -205,6 +211,7 @@ LBUF.DrawAtY.AND
lda LBUF.DATA,x get DATA bits
and LBUF.C1.DATA set ONLY bits starting at X1 mod 7
ora GBYTE
and (ZPBasePtr),y
sta (ZPBasePtr),y update screen
inx
@ -217,6 +224,7 @@ LBUF.DrawAtY.AND
ldy COL.OFS,x
lda LBUF.DATA,x set all bytes between C1+1 & C2-1
and (ZPBasePtr),y
sta (ZPBasePtr),y
inx
@ -233,6 +241,7 @@ LBUF.DrawAtY.AND
lda LBUF.DATA,x get DATA bits
and LBUF.C2.DATA set ONLY bits ending at X2 mod 7
ora GBYTE
and (ZPBasePtr),y
sta (ZPBasePtr),y update screen
.8 rts

View File

@ -17,9 +17,9 @@ AUTO 6
*--------------------------------------
ZPCmdPtr .EQ ZPDRV
ZPBasePtr .EQ ZPDRV+2
ZPShiftPtr .EQ ZPDRV+4
ZPBMDataPtr0 .EQ ZPDRV+6
ZPBMMaskPtr0 .EQ ZPDRV+8
ZPBMShiftPtr .EQ ZPDRV+4
ZPScrShiftPtr .EQ ZPDRV+8
ZPBMDataPtr .EQ ZPDRV+10
ZPBMMaskPtr .EQ ZPDRV+12
ZPBMSavePtr .EQ ZPDRV+14
@ -171,7 +171,7 @@ OPEN sta A2osX.SCRNDEVS+2 DEV.ID in A
inx
lda L.SHIFT,x Get relocated HI BYTE
sta Shift.L.LO,y
sta Shift.L.HI,y
inx
iny
cpx #12
@ -181,11 +181,11 @@ OPEN sta A2osX.SCRNDEVS+2 DEV.ID in A
ldy #6
.2 lda L.SHIFT,x Get relocated LO BYTE
sta Shift.L.LO,y
sta Shift.R.LO,y
inx
lda L.SHIFT,x Get relocated HI BYTE
sta Shift.L.LO,y
sta Shift.R.HI,y
inx
dey
bne .2
@ -402,12 +402,15 @@ LBUF.C2.DATA .BS 1
LBUF.MASK .BS 80
LBUF.DATA .BS 80
*--------------------------------------
BLT.BMBitOfs .BS 1
BLT.BMBitOfsL .BS 1
BLT.SCRBitOfs .BS 1
BLT.BMDataPtr .BS 2
BLT.BMMaskPtr .BS 2
BLT.DX .BS 2
BLT.DY .BS 1
BLT.ScreenC .BS 1
BLT.BMBitOfs .BS 1
BLT.BMBitOfsL .BS 1
BLT.BMIdx .BS 1
BLT.SCRBitOfs .BS 1
BLT.ScrColIdx .BS 1
*--------------------------------------
GBYTE .BS 1
GWORD .BS 2

View File

@ -5,36 +5,69 @@ INC 1
AUTO 6
.LIST OFF
*--------------------------------------
Mask7BitsL .DA #01111111 Useless
.DA #01111110
.DA #01111100
.DA #01111000
.DA #01110000
.DA #01100000
.DA #01000000
Mask7BitsH .DA #00000000 Useless
.DA #00000001
.DA #00000011
.DA #00000111
.DA #00001111
.DA #00011111
.DA #00111111
Mask7BitsH .DA #%01111111 Useless
.DA #%01111110
.DA #%01111100
.DA #%01111000
.DA #%01110000
.DA #%01100000
.DA #%01000000
Mask7BitsL .DA #%00000000 Useless
.DA #%00000001
.DA #%00000011
.DA #%00000111
.DA #%00001111
.DA #%00011111
.DA #%00111111
*--------------------------------------
C1.MASK .DA #%10000000 mod 0.....
C2.DATA .DA #%10000001 ->C1.DATA
Shift7BitsCol1 .DA #%01111111 Useless
.DA #%00111111
.DA #%00011111
.DA #%00001111
.DA #%00000111
.DA #%00000011
.DA #%00000001
Shift7BitsCol2 .DA #%00000000 Useless
.DA #%01000000
.DA #%01100000
.DA #%01110000
.DA #%01111000
.DA #%01111100
.DA #%01111111
*--------------------------------------
C1.MASK .DA #%10000000 Clear (AND) Col 1 bits
.DA #%10000001
.DA #%10000011
.DA #%10000111
.DA #%10001111
.DA #%10011111
.DA #%10111111 ...to 6
C1.DATA .DA #%11111111
C2.MASK .DA #%11111110
.DA #%10111111
C1.DATA .DA #%11111111 set (ORA) COL 1 bits
.DA #%11111110
.DA #%11111100
.DA #%11111000
.DA #%11110000
.DA #%11100000
.DA #%11000000
*--------------------------------------
C2.MASK .DA #%11111110 Clear (AND) Col 1 bits
.DA #%11111100
.DA #%11111000
.DA #%11110000
.DA #%11100000
.DA #%11000000
.DA #%10000000
C2.DATA .DA #%10000001 set (ORA) COL 1 bits
.DA #%10000011
.DA #%10000111
.DA #%10001111
.DA #%10011111
.DA #%10111111
.DA #%11111111
*--------------------------------------
Mono.NMasks .DA #%01111110
.DA #%01111101
@ -82,19 +115,19 @@ Color.Masks .DA #%10001111,#%00000000,#%00000000,#%00000000
* c1110000 c3322221 c5444433 c6666555
Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit disable)
.DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable)
.DA #%10010001,#%10100010,#%11000100,#%10001000 dark blue
.DA #%10100010,#%11000100,#%10001000,#%10010001 dark green
.DA #%10110011,#%11100110,#%11001100,#%10011001 medium blue
.DA #%11000100,#%10001000,#%10010001,#%10100010 brown
.DA #%10101010,#%11010101,#%10101010,#%11010101 grey1
.DA #%11010101,#%10101010,#%11010101,#%10101010 grey2
.DA #%10010001,#%10100010,#%11000100,#%10001000 dark blue
.DA #%10110011,#%11100110,#%11001100,#%10011001 medium blue
.DA #%10111011,#%11110111,#%11101110,#%11011101 light blue
.DA #%10100010,#%11000100,#%10001000,#%10010001 dark green
.DA #%11100110,#%11001100,#%10011001,#%10110011 green
.DA #%11110111,#%11101110,#%11011101,#%10111011 aqua
.DA #%10001000,#%10010001,#%10100010,#%11000100 Magenta
.DA #%10011001,#%10110011,#%11100110,#%11001100 violet
.DA #%10101010,#%11010101,#%10101010,#%11010101 grey1
.DA #%10111011,#%11110111,#%11101110,#%11011101 light blue
.DA #%11001100,#%10011001,#%10110011,#%11100110 orange
.DA #%11011101,#%10111011,#%11110111,#%11101110 pink
.DA #%11000100,#%10001000,#%10010001,#%10100010 brown
.DA #%11001100,#%10011001,#%10110011,#%11100110 orange
.DA #%11101110,#%11011101,#%10111011,#%11110111 yellow
*--------------------------------------
COL.BANK .DA #SETPAGE2,#CLRPAGE2,#SETPAGE2,#CLRPAGE2

View File

@ -21,7 +21,7 @@ S.CB.OP.SET .EQ %00000010 replace screen with bitmap
S.CB.OP.ORA .EQ %00000100 combine screen & bitmap -> Screen
S.CB.OP.AND .EQ %00000110 Apply BitMap mask before painting
S.CB.OP.SAVE .EQ %00010000 Save Screen to DstPtr before painting
S.CB.OP.RESTORE .EQ %00100000 Restore Screen From DstPtr before painting
S.CB.OP.RESTORE .EQ %00100000 Restore Screen From DstPtr
S.CB.OP.COLOR .EQ %01000000 Assume BitMap is COLOR
S.CB.MODE .EQ 2
S.CB.MODE.MONO .EQ %00000001 b/w (1 bit/pixel)

View File

@ -43,6 +43,8 @@ L.MouseData .DA MouseData
L.Rect.CB .DA Rect.CB
L.SetPixel.CB .DA SetPixel.CB
L.DrawLines.CB .DA DrawLines.CB
L.Filename .DA Filename
L.BitBlT.CB .DA BitBlT.CB
.DA 0
*--------------------------------------
CS.INIT >LDYA L.MSG.INIT
@ -222,8 +224,32 @@ Destop.Paint >PUSHW L.Rect.CB
cmp #16
bne .1
.4
>PUSHW L.DrawLines.CB
.4 >PUSHW L.DrawLines.CB
>LIBCALL hLIBGUI,LIBGUI.Draw
>PUSHWI 0 Aux type
>PUSHBI $CB Type
>PUSHBI SYS.FOpen.R
>PUSHW L.FILENAME
>SYSCALL LoadFile
txa
>SYSCALL GetMemPtr.A
>STYA BitBlT.CB+S.CB.SrcPtr
>LDYAI 105
>STYA BitBlT.CB+S.CB.DestX
>PUSHW L.BitBlt.CB
>LIBCALL hLIBGUI,LIBGUI.Draw
>LDYAI 246
>STYA BitBlT.CB+S.CB.DestX
>PUSHW L.BitBlt.CB
>LIBCALL hLIBGUI,LIBGUI.Draw
>LDYAI 387
>STYA BitBlT.CB+S.CB.DestX
>PUSHW L.BitBlt.CB
>LIBCALL hLIBGUI,LIBGUI.Draw
rts
@ -247,7 +273,7 @@ MouseData .BS 5
Rect.CB .DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET
.DA #S.CB.MODE.C16
.DA #11
.DA #2
.DA 0
.DA 0
.DA 559
@ -258,36 +284,36 @@ Rect.CB .DA #S.CB.CMD.FILLRECT
.DA #S.CB.MODE.MONO
.DA #1
.DA 10
.DA 10
.DA 550
.DA 180
.DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.ORA
.DA #S.CB.MODE.C16
.DA #0
.DA 20
.DA 20
.DA 540
.DA 170
.DA 5
.DA 549
.DA 186
.DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET
.DA #S.CB.MODE.C16
.DA #9
.DA 30
.DA 30
.DA 530
.DA 160
.DA #7
.DA 20
.DA 10
.DA 539
.DA 181
.DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.XOR
.DA #S.CB.OP.SET
.DA #S.CB.MODE.C16
.DA #8
.DA #4
.DA 30
.DA 15
.DA 529
.DA 176
.DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET
.DA #S.CB.MODE.MONO
.DA #0
.DA 40
.DA 40
.DA 520
.DA 150
.DA 20
.DA 519
.DA 171
.DA #0
*--------------------------------------
@ -356,12 +382,30 @@ DrawLines.CB .DA #S.CB.CMD.DRAWLINE
.DA #0
*--------------------------------------
Filename >CSTR "/A2OSX.BUILD/MARILYN"
*--------------------------------------
BitBlT.CB .DA #S.CB.CMD.BITBLT
.DA #S.CB.OP.SET
.DA #S.CB.MODE.MONO
.DA #0
.DA 0 X1
.DA 0 Y1
.DA 140 X2
.DA 149 y2
.DA 196 DestX
.DA 21 DestY
.BS 2 SrcPtr
.DA 0
.DA #0
*--------------------------------------
SetPixel.CB .DA #S.CB.CMD.SETPIXEL
SetPixel.OP .BS 1
SetPixel.Mode .BS 1
SetPixel.Color .BS 1
SetPixel.X .BS 2
SetPixel.Y .BS 2
.DA #0
*--------------------------------------
.DUMMY

BIN
marilyn.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB