A2osX/LIB/LIBGUI.S.CLIP.txt

444 lines
7.3 KiB
Plaintext
Raw Normal View History

NEW
2019-07-30 08:57:25 +00:00
AUTO 3,1
*--------------------------------------
* CLIPPING Functions:
2020-09-05 13:38:04 +00:00
* In:
2019-01-10 16:26:58 +00:00
* Graphic Context in OBJ.Cache
* YA = Control Block
* Out:
* CC : CB.Cache clipped & visible
* CS : CB.Cache invisible
*--------------------------------------
2020-10-02 14:57:05 +00:00
CLIP.YA jsr CB.GetInCache
2020-09-03 15:19:25 +00:00
2020-10-01 15:30:25 +00:00
CLIP.CB.Cache lda CB.Cache+S.CB.CMD
and #$7F remove S.CB.CMD.OSD
2020-09-02 15:47:23 +00:00
tax
2020-10-01 15:30:25 +00:00
jmp (J.CLIP-2,x)
*--------------------------------------
CLIP.Point
2020-09-03 15:19:25 +00:00
clc
rts
*--------------------------------------
2020-09-10 15:28:59 +00:00
CLIP.HLine >LDYA CB.Cache+S.CB.Y1
>SCMPYA OBJ.Cache+S.OBJ.Y2
bpl .9
>LDYA CB.Cache+S.CB.Y2
>SCMPYA OBJ.Cache+S.OBJ.Y1
bmi .9
>LDYA OBJ.Cache+S.OBJ.X1
>STYAIFGTR CB.Cache+S.CB.X1
>LDYA OBJ.Cache+S.OBJ.X2
>STYAIFLWR CB.Cache+S.CB.X2
clc
rts
2020-09-10 15:28:59 +00:00
.9 sec
rts
*--------------------------------------
2020-09-10 15:28:59 +00:00
CLIP.VLine >LDYA CB.Cache+S.CB.X1
>SCMPYA OBJ.Cache+S.OBJ.X2
bpl .9
>LDYA CB.Cache+S.CB.X2
>SCMPYA OBJ.Cache+S.OBJ.X1
bmi .9
>LDYA OBJ.Cache+S.OBJ.Y1
>STYAIFGTR CB.Cache+S.CB.Y1
>LDYA OBJ.Cache+S.OBJ.Y2
>STYAIFLWR CB.Cache+S.CB.Y2
2020-09-04 15:21:15 +00:00
clc
rts
2020-09-05 13:38:04 +00:00
2020-09-10 15:28:59 +00:00
.9 sec
rts
2020-09-04 15:21:15 +00:00
*--------------------------------------
CLIP.Rect jsr CB.Cache.Overlap
bcs .9
2020-09-02 15:47:23 +00:00
2020-09-04 15:21:15 +00:00
>LDYA OBJ.Cache+S.OBJ.X1
>STYAIFGTR CB.Cache+S.CB.X1
2017-12-04 16:42:08 +00:00
2020-09-04 15:21:15 +00:00
>LDYA OBJ.Cache+S.OBJ.X2
>STYAIFLWR CB.Cache+S.CB.X2
2017-12-04 07:18:24 +00:00
2020-09-04 15:21:15 +00:00
>LDYA OBJ.Cache+S.OBJ.Y1
>STYAIFGTR CB.Cache+S.CB.Y1
2020-09-03 15:19:25 +00:00
2020-09-04 15:21:15 +00:00
>LDYA OBJ.Cache+S.OBJ.Y2
>STYAIFLWR CB.Cache+S.CB.Y2
2020-09-03 15:19:25 +00:00
clc
2020-09-04 15:21:15 +00:00
.9 rts
*--------------------------------------
CLIP.Text
2017-12-04 07:18:24 +00:00
clc
2020-09-05 13:38:04 +00:00
rts
CLIP.Text.9 sec
2020-09-04 15:21:15 +00:00
CLIP.Text.RTS rts
*--------------------------------------
2020-09-05 13:38:04 +00:00
* BitBlt :
2020-09-04 15:21:15 +00:00
*--------------------------------------
CLIP.BitBlt jsr CB.Cache.SetX2Y2 set X2=X1+W-1 Y2=X1+H-1
2017-12-04 07:18:24 +00:00
2020-09-04 15:21:15 +00:00
jsr CB.Cache.Overlap
bcs CLIP.Text.RTS
2017-12-04 16:42:08 +00:00
2020-09-04 15:21:15 +00:00
lda OBJ.Cache+S.OBJ.X1
2017-12-04 07:18:24 +00:00
sec
2020-09-04 15:21:15 +00:00
sbc CB.Cache+S.CB.X1
sta DX
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
lda OBJ.Cache+S.OBJ.X1+1
sbc CB.Cache+S.CB.X1+1
sta DX+1
bvc .1
eor #$80
.1 bmi .2
2020-09-05 13:38:04 +00:00
lda CB.Cache+S.CB.X1
2020-09-04 15:21:15 +00:00
clc
adc DX
2020-09-05 13:38:04 +00:00
sta CB.Cache+S.CB.X1
2020-09-03 15:19:25 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.X1+1
adc DX+1
sta CB.Cache+S.CB.X1+1
2020-09-03 15:19:25 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.SrcX
clc
adc DX
sta CB.Cache+S.CB.SrcX
lda CB.Cache+S.CB.SrcX+1
adc DX+1
sta CB.Cache+S.CB.SrcX+1
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.SrcW
2017-12-05 07:09:16 +00:00
sec
2020-09-04 15:21:15 +00:00
sbc DX
sta CB.Cache+S.CB.SrcW
2020-09-03 15:19:25 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.SrcW+1
sbc DX+1
sta CB.Cache+S.CB.SrcW+1
2020-09-05 13:38:04 +00:00
bcc CLIP.Text.9
2020-09-03 15:19:25 +00:00
2020-09-04 15:21:15 +00:00
.2 lda CB.Cache+S.CB.X2
2017-12-05 07:09:16 +00:00
sec
2020-09-04 15:21:15 +00:00
sbc OBJ.Cache+S.OBJ.X2
sta DX
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.X2+1
sbc OBJ.Cache+S.OBJ.X2+1
sta DX+1
bvc .3
eor #$80
.3 bmi .4
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.SrcW
2017-12-05 07:09:16 +00:00
sec
2020-09-04 15:21:15 +00:00
sbc DX
sta CB.Cache+S.CB.SrcW
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.SrcW+1
sbc DX+1
sta CB.Cache+S.CB.SrcW+1
2020-09-05 13:38:04 +00:00
bcc .9
.4 lda OBJ.Cache+S.OBJ.Y1
sec
sbc CB.Cache+S.CB.Y1
sta DX
lda OBJ.Cache+S.OBJ.Y1+1
sbc CB.Cache+S.CB.Y1+1
sta DX+1
bvc .5
eor #$80
.5 bmi .6
lda CB.Cache+S.CB.Y1
clc
adc DX
sta CB.Cache+S.CB.Y1
lda CB.Cache+S.CB.Y1+1
adc DX+1
sta CB.Cache+S.CB.Y1+1
lda CB.Cache+S.CB.SrcY
clc
adc DX
sta CB.Cache+S.CB.SrcY
lda CB.Cache+S.CB.SrcY+1
adc DX+1
sta CB.Cache+S.CB.SrcY+1
2020-09-05 13:38:04 +00:00
lda CB.Cache+S.CB.SrcH
sec
sbc DX
sta CB.Cache+S.CB.SrcH
lda CB.Cache+S.CB.SrcH+1
sbc DX+1
sta CB.Cache+S.CB.SrcH+1
bcc .9
.6 lda CB.Cache+S.CB.Y2
sec
sbc OBJ.Cache+S.OBJ.Y2
sta DX
lda CB.Cache+S.CB.Y2+1
sbc OBJ.Cache+S.OBJ.Y2+1
sta DX+1
bvc .7
eor #$80
.7 bmi .8
lda CB.Cache+S.CB.SrcH
sec
sbc DX
sta CB.Cache+S.CB.SrcH
2020-09-03 15:19:25 +00:00
2020-09-05 13:38:04 +00:00
lda CB.Cache+S.CB.SrcH+1
sbc DX+1
sta CB.Cache+S.CB.SrcH+1
bcc .9
2020-09-03 15:19:25 +00:00
2020-09-05 13:38:04 +00:00
.8 clc
2020-09-04 15:21:15 +00:00
.99 rts
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
.9 sec
rts
*--------------------------------------
CLIP.Line.LEFT .EQ 1
CLIP.Line.RIGHT .EQ 2
CLIP.Line.BOTTOM .EQ 4
CLIP.Line.TOP .EQ 8
*--------------------------------------
2020-10-26 06:38:50 +00:00
CLIP.Line jsr CLIP.Line.EncodeP1
jsr CLIP.Line.EncodeP2
2020-10-06 06:27:35 +00:00
.1 lda CLIP.Line.P1
ora CLIP.Line.P2
beq .88
2020-10-06 06:27:35 +00:00
lda CLIP.Line.P1
and CLIP.Line.P2
bne .99
2020-10-06 06:27:35 +00:00
lda CLIP.Line.P1
beq .5
2020-10-06 06:27:35 +00:00
bit #CLIP.Line.TOP
beq .2
2020-10-06 06:27:35 +00:00
2020-09-05 13:38:04 +00:00
* Y1 is above S.CB.Y1....
2019-10-03 06:25:27 +00:00
* DY=Y2-Y1;
jsr CLIP.Line.EncodeP1
bra .1
2020-10-06 06:27:35 +00:00
.2 bit #CLIP.Line.BOTTOM
2020-09-05 13:38:04 +00:00
beq .3
2020-10-06 06:27:35 +00:00
2019-10-03 06:25:27 +00:00
* Y1 is below S.CB.Y2....
2020-10-06 06:27:35 +00:00
jsr CLIP.Line.EncodeP1
bra .1
2020-10-06 06:27:35 +00:00
.3 bit #CLIP.Line.RIGHT
2020-09-05 13:38:04 +00:00
beq .4
2020-10-06 06:27:35 +00:00
* X1 is after S.CB.X2....
2020-10-06 06:27:35 +00:00
jsr CLIP.Line.EncodeP1
bra .1
2020-10-06 06:27:35 +00:00
2019-10-03 06:25:27 +00:00
* X1 is before S.CB.X1....
2020-10-06 06:27:35 +00:00
.4 jsr CLIP.Line.EncodeP1
bra .1
2020-10-06 06:27:35 +00:00
* P2
2020-10-06 06:27:35 +00:00
.5 lda CLIP.Line.P2
bit #CLIP.Line.TOP
beq .6
2020-10-06 06:27:35 +00:00
2019-10-03 06:25:27 +00:00
* Y2 is above S.CB.Y1....
2020-10-06 06:27:35 +00:00
jsr CLIP.Line.EncodeP2
bra .1
2020-10-06 06:27:35 +00:00
.6 bit #CLIP.Line.BOTTOM
2020-09-05 13:38:04 +00:00
beq .7
2020-10-06 06:27:35 +00:00
* Y2 is below S.CB.Y2....
2020-10-06 06:27:35 +00:00
jsr CLIP.Line.EncodeP2
bra .1
2020-10-06 06:27:35 +00:00
.7 bit #CLIP.Line.RIGHT
2020-09-05 13:38:04 +00:00
beq .8
2020-10-06 06:27:35 +00:00
* X2 is after S.CB.X2....
2020-10-06 06:27:35 +00:00
jsr CLIP.Line.EncodeP2
bra .1
2020-10-06 06:27:35 +00:00
2019-10-03 06:25:27 +00:00
* X2 is before S.CB.X1....
2020-10-06 06:27:35 +00:00
.8 jsr CLIP.Line.EncodeP2
bra .1
2020-10-06 06:27:35 +00:00
.88 clc
rts
.99 sec
rts
*--------------------------------------
CLIP.Line.EncodeP1
ldy #0
lda CB.Cache+S.CB.X1
ldx CB.Cache+S.CB.X1+1
jsr CLIP.Line.EncodeX.AX
tay
lda CB.Cache+S.CB.Y1
ldx CB.Cache+S.CB.Y1+1
jsr CLIP.Line.EncodeY.AX
sta CLIP.Line.P1
rts
*--------------------------------------
CLIP.Line.EncodeP2
ldy #0
lda CB.Cache+S.CB.X2
ldx CB.Cache+S.CB.X2+1
jsr CLIP.Line.EncodeX.AX
tay
lda CB.Cache+S.CB.Y2
ldx CB.Cache+S.CB.Y2+1
jsr CLIP.Line.EncodeY.AX
sta CLIP.Line.P2
rts
*--------------------------------------
CLIP.Line.EncodeX.AX
pha
2019-01-10 16:26:58 +00:00
>SCMPAX OBJ.Cache+S.OBJ.X1
2020-10-26 06:38:50 +00:00
bpl .1
2020-10-06 06:27:35 +00:00
tya
ora #CLIP.Line.LEFT
plx
rts
2020-10-06 06:27:35 +00:00
.1 pla
2020-10-06 06:27:35 +00:00
>SCMPAX OBJ.Cache+S.OBJ.X2
2020-10-26 06:38:50 +00:00
bmi .8
2020-10-06 06:27:35 +00:00
tya
ora #CLIP.Line.RIGHT
2021-06-03 17:43:28 +00:00
rts
2020-10-06 06:27:35 +00:00
2020-10-26 06:38:50 +00:00
.8 tya
rts
*--------------------------------------
2020-09-05 13:38:04 +00:00
CLIP.Line.EncodeY.AX
pha
2019-01-10 16:26:58 +00:00
>SCMPAX OBJ.Cache+S.OBJ.Y1
2020-10-26 06:38:50 +00:00
bpl .1
2020-10-06 06:27:35 +00:00
tya
ora #CLIP.Line.TOP
plx
rts
2020-10-06 06:27:35 +00:00
.1 pla
2020-10-06 06:27:35 +00:00
>SCMPAX OBJ.Cache+S.OBJ.Y2
2020-10-26 06:38:50 +00:00
bmi .8
2020-10-06 06:27:35 +00:00
tya
ora #CLIP.Line.BOTTOM
2021-06-03 17:43:28 +00:00
rts
2020-10-06 06:27:35 +00:00
2020-10-26 06:38:50 +00:00
.8 tya
rts
*--------------------------------------
2020-09-04 15:21:15 +00:00
CB.Cache.SetX2Y2
lda CB.Cache+S.CB.SrcW
clc
adc CB.Cache+S.CB.X1
pha
lda CB.Cache+S.CB.SrcW+1
adc CB.Cache+S.CB.X1+1
tax
pla
bne .2
dex
2020-09-05 13:38:04 +00:00
.2 dec
2020-09-04 15:21:15 +00:00
sta CB.Cache+S.CB.X2
stx CB.Cache+S.CB.X2+1
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
lda CB.Cache+S.CB.SrcH
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
clc
adc CB.Cache+S.CB.Y1
pha
lda CB.Cache+S.CB.SrcH+1
adc CB.Cache+S.CB.Y1+1
tax
pla
bne .3
dex
2020-09-05 13:38:04 +00:00
.3 dec
2020-09-04 15:21:15 +00:00
sta CB.Cache+S.CB.Y2
stx CB.Cache+S.CB.Y2+1
rts
*--------------------------------------
CB.Cache.Overlap
>LDYA CB.Cache+S.CB.X1
>SCMPYA OBJ.Cache+S.OBJ.X2
bpl .9
>LDYA CB.Cache+S.CB.X2
>SCMPYA OBJ.Cache+S.OBJ.X1
bmi .9
>LDYA CB.Cache+S.CB.Y1
>SCMPYA OBJ.Cache+S.OBJ.Y2
bpl .9
>LDYA CB.Cache+S.CB.Y2
>SCMPYA OBJ.Cache+S.OBJ.Y1
bmi .9
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
clc
rts
2020-09-05 13:38:04 +00:00
2020-09-04 15:21:15 +00:00
.9 sec
rts
*--------------------------------------
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s.clip
LOAD usr/src/lib/libgui.s
ASM