A2osX/LIB/LIBGUI.S.CLIP.txt

423 lines
7.0 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:
2022-11-02 16:00:52 +00:00
* Graphic Context in CLIP.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
2022-11-02 16:00:52 +00:00
>SCMPYA CLIP.Cache+S.OBJ.Y2
2020-09-10 15:28:59 +00:00
bpl .9
2022-11-02 16:00:52 +00:00
>LDYA CB.Cache+S.CB.Y1
>SCMPYA CLIP.Cache+S.OBJ.Y1
2020-09-10 15:28:59 +00:00
bmi .9
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.X1
2020-09-10 15:28:59 +00:00
>STYAIFGTR CB.Cache+S.CB.X1
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.X2
2020-09-10 15:28:59 +00:00
>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
2022-11-02 16:00:52 +00:00
>SCMPYA CLIP.Cache+S.OBJ.X2
2020-09-10 15:28:59 +00:00
bpl .9
2022-11-02 16:00:52 +00:00
>LDYA CB.Cache+S.CB.X1
>SCMPYA CLIP.Cache+S.OBJ.X1
2020-09-10 15:28:59 +00:00
bmi .9
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.Y1
2020-09-10 15:28:59 +00:00
>STYAIFGTR CB.Cache+S.CB.Y1
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.Y2
2020-09-10 15:28:59 +00:00
>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
*--------------------------------------
2022-11-02 16:00:52 +00:00
CLIP.Rect jsr CLIP.Cache.Overlap
2020-09-04 15:21:15 +00:00
bcs .9
2020-09-02 15:47:23 +00:00
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.X1
2020-09-04 15:21:15 +00:00
>STYAIFGTR CB.Cache+S.CB.X1
2017-12-04 16:42:08 +00:00
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.X2
2020-09-04 15:21:15 +00:00
>STYAIFLWR CB.Cache+S.CB.X2
2017-12-04 07:18:24 +00:00
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.Y1
2020-09-04 15:21:15 +00:00
>STYAIFGTR CB.Cache+S.CB.Y1
2020-09-03 15:19:25 +00:00
2022-11-02 16:00:52 +00:00
>LDYA CLIP.Cache+S.OBJ.Y2
2020-09-04 15:21:15 +00:00
>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
*--------------------------------------
2022-11-02 16:00:52 +00:00
CLIP.BitBlt jsr CB.SetX2Y2 set X2=X1+W-1 Y2=X1+H-1
2017-12-04 07:18:24 +00:00
2022-11-02 16:00:52 +00:00
jsr CLIP.Cache.Overlap
2020-09-04 15:21:15 +00:00
bcs CLIP.Text.RTS
2017-12-04 16:42:08 +00:00
2022-11-02 16:00:52 +00:00
lda CLIP.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
2022-11-02 16:00:52 +00:00
lda CLIP.Cache+S.OBJ.X1+1
2020-09-04 15:21:15 +00:00
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
2022-11-02 16:00:52 +00:00
sbc CLIP.Cache+S.OBJ.X2
2020-09-04 15:21:15 +00:00
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
2022-11-02 16:00:52 +00:00
sbc CLIP.Cache+S.OBJ.X2+1
2020-09-04 15:21:15 +00:00
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
2022-11-02 16:00:52 +00:00
.4 lda CLIP.Cache+S.OBJ.Y1
2020-09-05 13:38:04 +00:00
sec
sbc CB.Cache+S.CB.Y1
sta DX
2022-11-02 16:00:52 +00:00
lda CLIP.Cache+S.OBJ.Y1+1
2020-09-05 13:38:04 +00:00
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
2022-11-02 16:00:52 +00:00
sbc CLIP.Cache+S.OBJ.Y2
2020-09-05 13:38:04 +00:00
sta DX
lda CB.Cache+S.CB.Y2+1
2022-11-02 16:00:52 +00:00
sbc CLIP.Cache+S.OBJ.Y2+1
2020-09-05 13:38:04 +00:00
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
2022-11-02 06:54:30 +00:00
>DEBUG
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
2022-11-02 06:54:30 +00:00
lda CB.Cache+S.CB.Y1
ldx CB.Cache+S.CB.Y1+1
jsr CLIP.Line.EncodeY.AX
2022-11-02 06:54:30 +00:00
sty 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
2022-11-02 06:54:30 +00:00
lda CB.Cache+S.CB.Y2
ldx CB.Cache+S.CB.Y2+1
jsr CLIP.Line.EncodeY.AX
2022-11-02 06:54:30 +00:00
sty CLIP.Line.P2
rts
*--------------------------------------
CLIP.Line.EncodeX.AX
pha
2022-11-02 16:00:52 +00:00
>SCMPAX CLIP.Cache+S.OBJ.X1
2020-10-26 06:38:50 +00:00
bpl .1
2020-10-06 06:27:35 +00:00
2022-11-02 06:54:30 +00:00
pla
tya
ora #CLIP.Line.LEFT
2022-11-02 06:54:30 +00:00
tay
rts
2020-10-06 06:27:35 +00:00
.1 pla
2022-11-02 16:00:52 +00:00
>SCMPAX CLIP.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
2022-11-02 06:54:30 +00:00
tay
2020-10-06 06:27:35 +00:00
2022-11-02 06:54:30 +00:00
.8 rts
*--------------------------------------
2020-09-05 13:38:04 +00:00
CLIP.Line.EncodeY.AX
pha
2022-11-02 16:00:52 +00:00
>SCMPAX CLIP.Cache+S.OBJ.Y1
2020-10-26 06:38:50 +00:00
bpl .1
2020-10-06 06:27:35 +00:00
2022-11-02 06:54:30 +00:00
pla
tya
ora #CLIP.Line.TOP
2022-11-02 06:54:30 +00:00
tya
rts
2020-10-06 06:27:35 +00:00
.1 pla
2022-11-02 16:00:52 +00:00
>SCMPAX CLIP.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
2022-11-02 06:54:30 +00:00
tay
2020-10-06 06:27:35 +00:00
2022-11-02 06:54:30 +00:00
.8 rts
*--------------------------------------
2022-11-02 16:00:52 +00:00
CLIP.Cache.Overlap
2020-09-04 15:21:15 +00:00
>LDYA CB.Cache+S.CB.X1
2022-11-02 16:00:52 +00:00
>SCMPYA CLIP.Cache+S.OBJ.X2
2020-09-04 15:21:15 +00:00
bpl .9
>LDYA CB.Cache+S.CB.X2
2022-11-02 16:00:52 +00:00
>SCMPYA CLIP.Cache+S.OBJ.X1
2020-09-04 15:21:15 +00:00
bmi .9
>LDYA CB.Cache+S.CB.Y1
2022-11-02 16:00:52 +00:00
>SCMPYA CLIP.Cache+S.OBJ.Y2
2020-09-04 15:21:15 +00:00
bpl .9
>LDYA CB.Cache+S.CB.Y2
2022-11-02 16:00:52 +00:00
>SCMPYA CLIP.Cache+S.OBJ.Y1
2020-09-04 15:21:15 +00:00
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
*--------------------------------------
2022-11-02 16:00:52 +00:00
CLIP.GetInCache >STYA .1+1
ldx #S.OBJ-1
.1 lda $ffff,x SELF MODIFIED
sta CLIP.Cache,x
dex
bpl .1
rts
*--------------------------------------
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s.clip
LOAD usr/src/lib/libgui.s
ASM