A2osX/LIB/LIBGUI.S.CLIP.txt

449 lines
7.5 KiB
Plaintext
Raw Permalink Normal View History

NEW
2019-07-30 08:57:25 +00:00
AUTO 3,1
*--------------------------------------
CLIP.GetRect >STYA .1+1
ldy #S.OBJ.Y2+1
ldx #7
.1 lda $ffff,y
sta CLIP.Rect,x
dey
dex
bpl .1
rts
*--------------------------------------
* CLIPPING Functions:
2020-09-05 13:38:04 +00:00
* In:
2022-11-03 06:59:03 +00:00
* Target Clipping Region in CLIP.Rect
* YA = Control Block
* Out:
* CC : CLIP.Cache clipped & visible
* CS : CLIP.Cache invisible
*--------------------------------------
CLIP.CB.Cache ldx #S.CB
.1 lda CB.Cache-1,x
sta CLIP.Cache-1,x
dex
bne .1
* lda CB.Cache+S.CB.CMD
2020-10-01 15:30:25 +00:00
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
*--------------------------------------
CLIP.HLine >LDYA CLIP.Cache+S.CB.Y1
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.Y2
2020-09-10 15:28:59 +00:00
bpl .9
>LDYA CLIP.Cache+S.CB.Y1
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.Y1
2020-09-10 15:28:59 +00:00
bmi .9
2022-11-03 06:59:03 +00:00
>LDYA CLIP.Rect+S.RECT.X1
>STYAIFGTR CLIP.Cache+S.CB.X1
2022-11-03 06:59:03 +00:00
>LDYA CLIP.Rect+S.RECT.X2
>STYAIFLWR CLIP.Cache+S.CB.X2
2020-09-10 15:28:59 +00:00
clc
rts
2020-09-10 15:28:59 +00:00
.9 sec
rts
*--------------------------------------
CLIP.VLine >LDYA CLIP.Cache+S.CB.X1
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.X2
2020-09-10 15:28:59 +00:00
bpl .9
>LDYA CLIP.Cache+S.CB.X1
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.X1
2020-09-10 15:28:59 +00:00
bpl CLIP.Y1Y2
* bmi .9
2020-09-10 15:28:59 +00:00
* >LDYA CLIP.Rect+S.RECT.Y1
* >STYAIFGTR CLIP.Cache+S.CB.Y1
2020-09-10 15:28:59 +00:00
* >LDYA CLIP.Rect+S.RECT.Y2
* >STYAIFLWR CLIP.Cache+S.CB.Y2
* 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-03 06:59:03 +00:00
CLIP.Rectangle jsr CLIP.Rect.Overlap
bcs CLIP.Text.RTS
2020-09-02 15:47:23 +00:00
2022-11-03 06:59:03 +00:00
>LDYA CLIP.Rect+S.RECT.X1
>STYAIFGTR CLIP.Cache+S.CB.X1
2017-12-04 16:42:08 +00:00
2022-11-03 06:59:03 +00:00
>LDYA CLIP.Rect+S.RECT.X2
>STYAIFLWR CLIP.Cache+S.CB.X2
2017-12-04 07:18:24 +00:00
CLIP.Y1Y2 >LDYA CLIP.Rect+S.RECT.Y1
>STYAIFGTR CLIP.Cache+S.CB.Y1
2020-09-03 15:19:25 +00:00
2022-11-03 06:59:03 +00:00
>LDYA CLIP.Rect+S.RECT.Y2
>STYAIFLWR CLIP.Cache+S.CB.Y2
2020-09-03 15:19:25 +00:00
* clc
* rts
2020-09-04 15:21:15 +00:00
*--------------------------------------
CLIP.Text 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 CLIP.SetX2Y2
2022-11-03 06:59:03 +00:00
jsr CLIP.Rect.Overlap
2020-09-04 15:21:15 +00:00
bcs CLIP.Text.RTS
2017-12-04 16:42:08 +00:00
ldx #S.RECT select CLIP.Rect
CLIP.BitBltX lda CLIP.Screen+S.RECT.X1,x
2017-12-04 07:18:24 +00:00
sec
sbc CLIP.Cache+S.CB.X1
sta TmpW
2020-09-05 13:38:04 +00:00
lda CLIP.Screen+S.RECT.X1+1,x
sbc CLIP.Cache+S.CB.X1+1
sta TmpW+1
2020-09-04 15:21:15 +00:00
bvc .1
2020-09-04 15:21:15 +00:00
eor #$80
2020-09-04 15:21:15 +00:00
.1 bmi .2
2020-09-05 13:38:04 +00:00
ldy #S.CB.X1
jsr CLIP.AddTmpW2ClipCacheY
2020-09-04 15:21:15 +00:00
ldy #S.CB.SrcX
jsr CLIP.AddTmpW2ClipCacheY
2020-09-05 13:38:04 +00:00
ldy #S.CB.SrcW
jsr CLIP.SubTmpW2ClipCacheY
2020-09-05 13:38:04 +00:00
bcc CLIP.Text.9
*--------------------------------------
.2 lda CLIP.Cache+S.CB.X2
2017-12-05 07:09:16 +00:00
sec
sbc CLIP.Screen+S.RECT.X2,x
sta TmpW
2020-09-05 13:38:04 +00:00
lda CLIP.Cache+S.CB.X2+1
sbc CLIP.Screen+S.RECT.X2+1,x
sta TmpW+1
2020-09-04 15:21:15 +00:00
bvc .3
2020-09-04 15:21:15 +00:00
eor #$80
2020-09-04 15:21:15 +00:00
.3 bmi .4
2020-09-05 13:38:04 +00:00
ldy #S.CB.SrcW
jsr CLIP.SubTmpW2ClipCacheY
2020-09-05 13:38:04 +00:00
bcc .9
*--------------------------------------
.4 lda CLIP.Screen+S.RECT.Y1,x
2020-09-05 13:38:04 +00:00
sec
sbc CLIP.Cache+S.CB.Y1
sta TmpW
2020-09-05 13:38:04 +00:00
lda CLIP.Screen+S.RECT.Y1+1,x
sbc CLIP.Cache+S.CB.Y1+1
sta TmpW+1
2020-09-05 13:38:04 +00:00
bvc .5
2020-09-05 13:38:04 +00:00
eor #$80
2020-09-05 13:38:04 +00:00
.5 bmi .6
ldy #S.CB.Y1
jsr CLIP.AddTmpW2ClipCacheY
ldy #S.CB.SrcY
jsr CLIP.AddTmpW2ClipCacheY
ldy #S.CB.SrcH
jsr CLIP.SubTmpW2ClipCacheY
2020-09-05 13:38:04 +00:00
bcc .9
*--------------------------------------
.6 lda CLIP.Cache+S.CB.Y2
2020-09-05 13:38:04 +00:00
sec
sbc CLIP.Screen+S.RECT.Y2,x
sta TmpW
2020-09-05 13:38:04 +00:00
lda CLIP.Cache+S.CB.Y2+1
sbc CLIP.Screen+S.RECT.Y2+1,x
sta TmpW+1
2020-09-05 13:38:04 +00:00
bvc .7
2020-09-05 13:38:04 +00:00
eor #$80
2020-09-05 13:38:04 +00:00
.7 bmi .8
ldy #S.CB.SrcH
jsr CLIP.SubTmpW2ClipCacheY
2020-09-05 13:38:04 +00:00
bcc .9
2020-09-03 15:19:25 +00:00
2020-09-05 13:38:04 +00:00
.8 clc
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 CLIP.Cache+S.CB.X1
ldx CLIP.Cache+S.CB.X1+1
jsr CLIP.Line.EncodeX.AX
2022-11-02 06:54:30 +00:00
lda CLIP.Cache+S.CB.Y1
ldx CLIP.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 CLIP.Cache+S.CB.X2
ldx CLIP.Cache+S.CB.X2+1
jsr CLIP.Line.EncodeX.AX
2022-11-02 06:54:30 +00:00
lda CLIP.Cache+S.CB.Y2
ldx CLIP.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-03 06:59:03 +00:00
>SCMPAX CLIP.Rect+S.RECT.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-03 06:59:03 +00:00
>SCMPAX CLIP.Rect+S.RECT.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-03 06:59:03 +00:00
>SCMPAX CLIP.Rect+S.RECT.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-03 06:59:03 +00:00
>SCMPAX CLIP.Rect+S.RECT.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
*--------------------------------------
CLIP.SetX2Y2 ldx CLIP.Cache+S.CB.SrcW+1
lda CLIP.Cache+S.CB.SrcW
bne .3
dex
.3 dec
clc
adc CLIP.Cache+S.CB.X1
sta CLIP.Cache+S.CB.X2
txa
adc CLIP.Cache+S.CB.X1+1
sta CLIP.Cache+S.CB.X2+1
ldx CLIP.Cache+S.CB.SrcH+1
lda CLIP.Cache+S.CB.SrcH
bne .4
dex
.4 dec
clc
adc CLIP.Cache+S.CB.Y1
sta CLIP.Cache+S.CB.Y2
txa
adc CLIP.Cache+S.CB.Y1+1
sta CLIP.Cache+S.CB.Y2+1
rts
*--------------------------------------
2022-11-03 06:59:03 +00:00
CLIP.Rect.Overlap
>LDYA CLIP.Cache+S.CB.X1
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.X2
2020-09-04 15:21:15 +00:00
bpl .9
>LDYA CLIP.Cache+S.CB.X2
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.X1
2020-09-04 15:21:15 +00:00
bmi .9
>LDYA CLIP.Cache+S.CB.Y1
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.Y2
2020-09-04 15:21:15 +00:00
bpl .9
>LDYA CLIP.Cache+S.CB.Y2
2022-11-03 06:59:03 +00:00
>SCMPYA CLIP.Rect+S.RECT.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
*--------------------------------------
CLIP.AddTmpW2ClipCacheY
clc
lda CLIP.Cache,y
adc TmpW
sta CLIP.Cache,y
lda CLIP.Cache+1,y
adc TmpW+1
sta CLIP.Cache+1,y
rts
*--------------------------------------
CLIP.SubTmpW2ClipCacheY
sec
lda CLIP.Cache,y
sbc TmpW
sta CLIP.Cache,y
lda CLIP.Cache+1,y
sbc TmpW+1
sta CLIP.Cache+1,y
rts
*--------------------------------------
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s.clip
LOAD usr/src/lib/libgui.s
ASM