mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
155 lines
2.7 KiB
Plaintext
155 lines
2.7 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
ClipLine.LEFT .EQ 1
|
||
ClipLine.RIGHT .EQ 2
|
||
ClipLine.BOTTOM .EQ 4
|
||
ClipLine.TOP .EQ 8
|
||
*--------------------------------------
|
||
* In:
|
||
* Control Block in CB.Cache
|
||
* Graphic Context in GC.Cache
|
||
*--------------------------------------
|
||
ClipLine jsr ClipLine.EncodeP1
|
||
jsr ClipLine.EncodeP2
|
||
|
||
.1 lda ClipLine.P1
|
||
ora ClipLine.P2
|
||
beq .88
|
||
|
||
lda ClipLine.P1
|
||
and ClipLine.P2
|
||
bne .99
|
||
|
||
lda ClipLine.P1
|
||
beq .5
|
||
|
||
bit #ClipLine.TOP
|
||
beq .2
|
||
* Y1 is above S.CB.Y1....
|
||
* DY=Y2-Y1;
|
||
|
||
jsr ClipLine.EncodeP1
|
||
bra .1
|
||
|
||
.2 bit #ClipLine.BOTTOM
|
||
beq .3
|
||
* Y1 is below S.CB.Y2....
|
||
|
||
jsr ClipLine.EncodeP1
|
||
bra .1
|
||
|
||
.3 bit #ClipLine.RIGHT
|
||
beq .4
|
||
* X1 is after S.CB.X2....
|
||
jsr ClipLine.EncodeP1
|
||
bra .1
|
||
* X1 is before S.CB.X1....
|
||
.4
|
||
jsr ClipLine.EncodeP1
|
||
bra .1
|
||
* P2
|
||
.5 lda ClipLine.P2
|
||
|
||
bit #ClipLine.TOP
|
||
beq .6
|
||
* Y2 is above S.CB.Y1....
|
||
jsr ClipLine.EncodeP2
|
||
bra .1
|
||
|
||
.6 bit #ClipLine.BOTTOM
|
||
beq .7
|
||
* Y2 is below S.CB.Y2....
|
||
jsr ClipLine.EncodeP2
|
||
bra .1
|
||
|
||
.7 bit #ClipLine.RIGHT
|
||
beq .8
|
||
* X2 is after S.CB.X2....
|
||
jsr ClipLine.EncodeP2
|
||
bra .1
|
||
* X2 is before S.CB.X1....
|
||
.8
|
||
jsr ClipLine.EncodeP2
|
||
bra .1
|
||
|
||
.88 clc
|
||
rts
|
||
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
ClipLine.EncodeP1
|
||
ldy #0
|
||
|
||
lda CB.Cache+S.CB.X1
|
||
ldx CB.Cache+S.CB.X1+1
|
||
jsr ClipLine.EncodeX.AX
|
||
|
||
tay
|
||
|
||
lda CB.Cache+S.CB.Y1
|
||
ldx CB.Cache+S.CB.Y1+1
|
||
jsr ClipLine.EncodeY.AX
|
||
|
||
sta ClipLine.P1
|
||
rts
|
||
*--------------------------------------
|
||
ClipLine.EncodeP2
|
||
ldy #0
|
||
|
||
lda CB.Cache+S.CB.X2
|
||
ldx CB.Cache+S.CB.X2+1
|
||
jsr ClipLine.EncodeX.AX
|
||
|
||
tay
|
||
|
||
lda CB.Cache+S.CB.Y2
|
||
ldx CB.Cache+S.CB.Y2+1
|
||
jsr ClipLine.EncodeY.AX
|
||
|
||
sta ClipLine.P2
|
||
rts
|
||
*--------------------------------------
|
||
ClipLine.EncodeX.AX
|
||
pha
|
||
>SCMPAX GC.Cache+S.GC.X1
|
||
bmi .1
|
||
tya
|
||
ora #ClipLine.LEFT
|
||
plx
|
||
rts
|
||
|
||
.1 pla
|
||
>SCMPAX GC.Cache+S.GC.X1
|
||
bpl .8
|
||
tya
|
||
ora #ClipLine.RIGHT
|
||
.8 rts
|
||
*--------------------------------------
|
||
ClipLine.EncodeY.AX
|
||
pha
|
||
>SCMPAX GC.Cache+S.GC.Y1
|
||
bmi .1
|
||
tya
|
||
ora #ClipLine.TOP
|
||
plx
|
||
rts
|
||
|
||
.1 pla
|
||
>SCMPAX GC.Cache+S.GC.Y1
|
||
bpl .8
|
||
tya
|
||
ora #ClipLine.BOTTOM
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/LIB/LIBGUI.S.CLIP
|
||
LOAD /A2OSX.SRC/LIB/LIBGUI.S
|
||
ASM
|