Kernel 0.9.1 : LibGui, Clipping....

This commit is contained in:
Rémy GIBERT 2017-12-04 17:42:08 +01:00
parent aaf40d628b
commit 19cf1081e1
8 changed files with 148 additions and 110 deletions

Binary file not shown.

Binary file not shown.

View File

@ -157,21 +157,46 @@ LBUF.DrawAtY.SET
inx
cpx LBUF.C2
beq .2 C1=C2, go setup C2
beq .7 C1=C2, go setup C2
bcs .8 C1+1 > C2, we are done...
.1 ldy COL.BANK,x
phx
ldy COL.BANK,x C1+1,3,5,7.....
sta $C000,y
ldy COL.OFS,x
lda LBUF.DATA,x set all bytes between C1+1 & C2-1
.1 lda LBUF.DATA,x set all bytes between C1+1 & C2-1
sta (ZPBasePtr),y
iny
inx
inx
cpx LBUF.C2
bne .1
bcc .1
.2 ldy COL.BANK,x
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

View File

@ -19,8 +19,8 @@ CUR.HotPoints .DA #0,#0 CUR.T.ARROW
.DA #5,#6 CUR.Wait2
.DA #5,#6 CUR.Wait3
.DA #5,#6 CUR.Wait4
.DA #8,#8 CUR.Wait5
.DA #8,#8 CUR.Wait6
.DA #8,#7 CUR.Wait5
.DA #8,#7 CUR.Wait6
*--------------------------------------
CUR.CB .DA #S.CB.CMD.BITBLT
.BS 1
@ -154,7 +154,7 @@ CUR.Wait4 .DA #S.BM.F.BBP1
.DA %001.11111100
.DA %000.00000000
CUR.Wait4.MASK .DA %000.00000000
CUR.Wait4.MASK .DA %110.00000011
.DA %100.00000001
.DA %100.00000001
.DA %110.00000011
@ -166,15 +166,14 @@ CUR.Wait4.MASK .DA %000.00000000
.DA %110.00000011
.DA %100.00000001
.DA %100.00000001
.DA %000.00000000
.DA %110.00000011
*--------------------------------------
CUR.Wait5 .DA #S.BM.F.BBP1
.DA #2 RowBytes
.DA 16 W
.DA 16 H
.DA 14 H
.DA CUR.Wait5.MASK-CUR.Wait5
.DA %00000000.00000000
.DA %00000000.00000000
.DA %00000010.00000000
.DA %00000110.00000000
@ -189,32 +188,28 @@ CUR.Wait5 .DA #S.BM.F.BBP1
.DA %00000000.01100000
.DA %00000000.01000000
.DA %00000000.00000000
.DA %00000000.00000000
CUR.Wait5.MASK .DA %11111110.11111111
.DA %11111100.11111111
CUR.Wait5.MASK .DA %11111100.11111111
.DA %11111000.11111111
.DA %11110000.11111111
.DA %11100000.11111111
.DA %11000000.11111111
.DA %10000000.01111111
.DA %00000000.00111111
.DA %11111100.00000000
.DA %10000000.00111111
.DA %11111100.00000001
.DA %11111110.00000001
.DA %11111111.00000011
.DA %11111111.00000111
.DA %11111111.00001111
.DA %11111111.00011111
.DA %11111111.00111111
.DA %11111111.01111111
*--------------------------------------
CUR.Wait6 .DA #S.BM.F.BBP1
.DA #2 RowBytes
.DA 16 W
.DA 16 H
.DA 14 H
.DA CUR.Wait6.MASK-CUR.Wait6
.DA %00000000.00000000
.DA %00000000.00000000
.DA %00000000.01000000
.DA %00000000.01100000
@ -229,24 +224,21 @@ CUR.Wait6 .DA #S.BM.F.BBP1
.DA %00000110.00000000
.DA %00000010.00000000
.DA %00000000.00000000
.DA %00000000.00000000
CUR.Wait6.MASK .DA %11111111.01111111
.DA %11111111.00111111
CUR.Wait6.MASK .DA %11111111.00111111
.DA %11111111.00011111
.DA %11111111.00001111
.DA %11111111.00000111
.DA %11111111.00000011
.DA %11111110.00000001
.DA %11111100.00000000
.DA %00000000.00111111
.DA %11111100.00000001
.DA %10000000.00111111
.DA %10000000.01111111
.DA %11000000.11111111
.DA %11100000.11111111
.DA %11110000.11111111
.DA %11111000.11111111
.DA %11111100.11111111
.DA %11111110.11111111
*--------------------------------------
MAN
SAVE /A2OSX.SRC/LIB/LIBGUI.G.CUR

View File

@ -13,9 +13,8 @@ AUTO 6
* CC : CB.Cache clipped & visible
* CS : CB.Cache invisible
*--------------------------------------
CLIP.YA >STYA ZPCBPtr
lda (ZPCBPtr)
tax
CLIP.YA jsr CB.Get
ldx CB.Cache+S.CB.CMD
jmp (J.CLIP,x)
*--------------------------------------
CLIP.Point
@ -34,99 +33,86 @@ CLIP.BitBlt.99 sec
CLIP.BitBlt clc
rts
>DEBUG
ldy #S.CB.DestX+1
lda (ZPCBPtr),y
tax
dey
lda (ZPCBPtr),y
lda CB.Cache+S.CB.DestX
ldx CB.Cache+S.CB.DestX+1
pha
>SCMPAX GC.Cache+S.GC.X2 DestX after X2....exit
bmi CLIP.BitBlt.9
>SCMPAX GC.Cache+S.GC.X2
bpl CLIP.BitBlt.9 DestX after X2....exit
pla
>SCMPAX GC.Cache+S.GC.X1 DestX Inside X1-X2, go check if X1+W fit in
bpl .1
>SCMPAX GC.Cache+S.GC.X1
bpl .1 DestX Inside X1-X2, go check if X1+W fit in
* S.CB.DestX before S.GC.X1: D=S.GC.X1-S.CB.DestX, S.CB.SrcW-=D, S.CB.DestX=0, S.CB.X1+=D
lda GC.Cache+S.GC.X1 Compute D....
sec
ldy #S.CB.DestX
sbc (ZPCBPtr),y
sbc CB.Cache+S.CB.DestX
sta D
lda GC.Cache+S.GC.X1+1
iny
sbc (ZPCBPtr),y
sbc CB.Cache+S.CB.DestX+1
sta D+1 ....always positive
ldy #S.CB.SrcW S.CB.SrcW-=D
lda (ZPCBPtr),y
lda CB.Cache+S.CB.SrcW S.CB.SrcW-=D
sec
sbc D
sta (ZPCBPtr),y
sta CB.Cache+S.CB.SrcW
iny
lda (ZPCBPtr),y
lda CB.Cache+S.CB.SrcW+1
sbc D
sta (ZPCBPtr),y
sta CB.Cache+S.CB.SrcW+1
bcc CLIP.BitBlt.99 Negative!!!! nothing to do,exit...
lda #0 Dext.X=0
ldy #S.CB.DestX
sta (ZPCBPtr),y
iny
sta (ZPCBPtr),y
stz CB.Cache+S.CB.DestX Dext.X=0
stz CB.Cache+S.CB.DestX+1
ldy #S.CB.X1 S.CB.X1+=D
lda (ZPCBPtr),y
lda CB.Cache+S.CB.X1 S.CB.X1+=D
clc
adc D
sta (ZPCBPtr),y
iny
lda (ZPCBPtr),y
sta CB.Cache+S.CB.X1
lda CB.Cache+S.CB.X1+1
adc D+1
sta (ZPCBPtr),y S.CB.DestX=0, new between S.GC.X1 & S.GC.X2....
sta CB.Cache+S.CB.X1+1 S.CB.DestX=0, new between S.GC.X1 & S.GC.X2....
* S.CB.DestX between S.GC.X1 & S.GC.X2: D=S.GC.X2-S.CB.DestX
.1 lda GC.Cache+S.GC.X2
sec
ldy #S.CB.DestY
sbc (ZPCBPtr),y
sbc CB.Cache+S.CB.DestX
sta D
iny
lda GC.Cache+S.GC.X2
sbc (ZPCBPtr),y
lda GC.Cache+S.GC.X2+1
sbc CB.Cache+S.CB.DestX+1
sta D+1 Always positive...
lda D
ldy #S.CB.SrcW
cmp (ZPCBPtr),y
iny
cmp CB.Cache+S.CB.SrcW
lda D+1
cmp (ZPCBPtr),y
sbc CB.Cache+S.CB.SrcW+1
bcs CLIP.BitBlt.Y D >= SrcW....nothing to clip
lda D+1 SrcW < D, amke SrcW=D
sta (ZPCBPtr),y
dey
lda D
sta (ZPCBPtr),y
lda D SrcW < D, make SrcW=D
sta CB.Cache+S.CB.SrcW
lda D+1
sta CB.Cache+S.CB.SrcW+1
CLIP.BitBlt.Y ldy #S.CB.DestY+1
lda (ZPCBPtr),y
tax
dey
lda (ZPCBPtr),y
CLIP.BitBlt.Y lda CB.Cache+S.CB.DestY
ldx CB.Cache+S.CB.DestY+1
pha
>SCMPAX GC.Cache+S.GC.Y2 DestY after Y2....exit
bmi .9
bpl .9
pla
>SCMPAX GC.Cache+S.GC.Y1
bpl .1 DestY Inside Y1-Y2, go check if Y1+H fit in
* S.CB.DestY above S.GC.Y1: D=S.GC.Y1-S.CB.DestY, S.CB.SrcH-=D, S.CB.DestY=0, S.CB.Y1+=D
* S.CB.DestY between S.GC.Y1 & S.GC.Y2: D=S.GC.Y2-S.CB.DestY
.1
clc
rts

View File

@ -124,10 +124,16 @@ ShowCursor.I lda #S.CB.OP.ORA+S.CB.OP.MASK+S.CB.OP.SAVE
sbc #0
sta CUR.CB+S.CB.DestY+1
DrawCursor.I >LDYA L.CUR.CB
DrawCursor.I >LDYA L.GC.Screen
jsr GC.Get
>LDYA L.CUR.CB
jsr CLIP.YA
bcs .9
>LDYA L.CUR.CB
>LDYA L.CB.Cache
* >LDYA L.CUR.CB
jmp GoDevGfx.YA
.9 rts

View File

@ -202,21 +202,32 @@ CloseGUI lda hDevMouse
sec
rts
*--------------------------------------
GC.SetX2Y2 >STYA ZPGCPtr
GC.Get >STYA .1+1
ldx #S.GC-1
.1 lda $ffff,x SELF MODIFIED
sta GC.Cache,x
dex
bpl .1
rts
*--------------------------------------
GC.SetX2Y2 >STYA ZPPtr1
ldy #S.GC.X1+1
lda (ZPGCPtr),y
lda (ZPPtr1),y
tax
dey
lda (ZPGCPtr),y
lda (ZPPtr1),y
clc
ldy #S.GC.W
adc (ZPGCPtr),y
adc (ZPPtr1),y
pha
iny
txa
adc (ZPGCPtr),y
adc (ZPPtr1),y
tax
pla
sbc #0
@ -224,24 +235,24 @@ GC.SetX2Y2 >STYA ZPGCPtr
dex
.1 ldy #S.GC.X2
sta (ZPGCPtr),y
sta (ZPPtr1),y
iny
txa
sta (ZPGCPtr),y
sta (ZPPtr1),y
ldy #S.GC.Y1+1
lda (ZPGCPtr),y
lda (ZPPtr1),y
tax
dey
lda (ZPGCPtr),y
lda (ZPPtr1),y
clc
ldy #S.GC.H
adc (ZPGCPtr),y
adc (ZPPtr1),y
pha
iny
txa
adc (ZPGCPtr),y
adc (ZPPtr1),y
tax
pla
sbc #0
@ -249,10 +260,21 @@ GC.SetX2Y2 >STYA ZPGCPtr
dex
.2 ldy #S.GC.Y2
sta (ZPGCPtr),y
sta (ZPPtr1),y
iny
txa
sta (ZPGCPtr),y
sta (ZPPtr1),y
rts
*--------------------------------------
CB.Get >STYA .1+1
ldx #S.CB-1
.1 lda $ffff,x SELF MODIFIED
sta CB.Cache,x
dex
bpl .1
rts
*--------------------------------------
ReadMouse >PULLYA

View File

@ -110,17 +110,21 @@ CS.RUN lda A2osX.ASCREEN GUI screen active ?
lda MouseData+S.MOUSE.S
.1 bit #S.MOUSE.S.DOWN
.1 bit #S.MOUSE.S.CLK
beq .4
sta $C056
>DEBUG
sta $C057
lda MouseData+S.MOUSE.X1
sta CB.BitBlt+S.CB.DestX
lda MouseData+S.MOUSE.X1+1
sta CB.BitBlt+S.CB.DestX+1
lda MouseData+S.MOUSE.Y1
sta CB.BitBlt+S.CB.DestY
lda MouseData+S.MOUSE.Y1+1
sta CB.BitBlt+S.CB.DestY+1
jsr Destop.Paint
>LIBCALL hLIBGUI,LIBGUI.ShowCursor
.4
.8 clc
@ -128,8 +132,8 @@ CS.RUN lda A2osX.ASCREEN GUI screen active ?
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9
* asl
* bpl .9
asl
bpl .9
>LIBCALL hLIBGUI,LIBGUI.UpdateCursor
@ -139,12 +143,15 @@ CS.DOEVENT lda (pEvent)
CS.QUIT clc
rts
*--------------------------------------
Destop.Paint >PUSHW L.CB.Rect
Destop.Paint >LIBCALL hLIBGUI,LIBGUI.HideCursor
>PUSHW L.CB.Rect
>LIBCALL hLIBGUI,LIBGUI.Draw
>PUSHW L.CB.BitBlt
>LIBCALL hLIBGUI,LIBGUI.Draw
>LIBCALL hLIBGUI,LIBGUI.ShowCursor
rts
*--------------------------------------
CS.END
@ -154,7 +161,7 @@ hLIBGUI .BS 1
*--------------------------------------
Filename >CSTR "/A2OSX.BUILD/MARILYN"
*--------------------------------------
MouseData .DA S.MOUSE
MouseData .BS S.MOUSE
*--------------------------------------
CB.Rect .DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET