A2osX/LIB/LIBGUI.S.CB.txt
2023-07-10 06:57:04 +02:00

333 lines
6.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
CB.GetWndYCacheX
lda (ZPWNDPtr),y
sta CB.Cache,x
iny
lda (ZPWNDPtr),y
sta CB.Cache+1,x
rts
*--------------------------------------
CB.SwapX1X2 ldx CB.Cache+S.CB.X1
ldy CB.Cache+S.CB.X1+1
lda CB.Cache+S.CB.X2
sta CB.Cache+S.CB.X1
lda CB.Cache+S.CB.X2+1
sta CB.Cache+S.CB.X1+1
stx CB.Cache+S.CB.X2
sty CB.Cache+S.CB.X2+1
rts
*--------------------------------------
CB.SwapY1Y2 ldx CB.Cache+S.CB.Y1
ldy CB.Cache+S.CB.Y1+1
lda CB.Cache+S.CB.Y2
sta CB.Cache+S.CB.Y1
lda CB.Cache+S.CB.Y2+1
sta CB.Cache+S.CB.Y1+1
stx CB.Cache+S.CB.Y2
sty CB.Cache+S.CB.Y2+1
rts
*--------------------------------------
CB.BorderLineH lda #S.CB.CMD.HLINE
sta CB.Cache+S.CB.CMD
lda #S.CB.OP.SET
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
lda PREFS.BorderColor
sta CB.Cache+S.CB.COLOR
rts
*--------------------------------------
CB.FillRectMonoA
sta CB.Cache+S.CB.COLOR
lda #S.CB.CMD.FILLRECT
sta CB.Cache+S.CB.CMD
lda #S.CB.OP.SET
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
rts
*--------------------------------------
CB.PullY2X2Y1X1 ldx #7
bra CB.PullX
CB.PullY1X1 ldx #3
CB.PullX >PULLA
sta CB.Cache+S.CB.X1-1,x
>PULLA
sta CB.Cache+S.CB.X1,x
dex
dex
bpl CB.PullX
rts
**--------------------------------------
CB.X2ToX1 ldy CB.Cache+S.CB.X2
lda CB.Cache+S.CB.X2+1
sty CB.Cache+S.CB.X1
sta CB.Cache+S.CB.X1+1
rts
*--------------------------------------
CB.AddA2X1 clc
adc CB.Cache+S.CB.X1
sta CB.Cache+S.CB.X1
bcc .1
inc CB.Cache+S.CB.X1+1
.1 rts
*--------------------------------------
CB.IncY1 inc CB.Cache+S.CB.Y1
bne .1
inc CB.Cache+S.CB.Y1+1
.1 rts
*--------------------------------------
CB.DecY2 lda CB.Cache+S.CB.Y2
bne .1
dec CB.Cache+S.CB.Y2+1
.1 dec CB.Cache+S.CB.Y2
rts
*--------------------------------------
CB.GetObjX1Y1 ldy #S.OBJ.X1+3
ldx #3
bra CB.GetObjXY
*--------------------------------------
CB.GetObjX1Y1X2Y2
ldy #S.OBJ.X1+7
ldx #7
CB.GetObjXY lda (ZPObjPtr),y
sta CB.Cache+S.CB.X1,x
dey
dex
bpl CB.GetObjXY
rts
*--------------------------------------
CB.GetObjSrcWH ldy #S.OBJ.W+3 W,H
ldx #3
.1 lda (ZPObjPtr),y
sta CB.Cache+S.CB.SrcW,x
dey
dex
bpl .1
rts
*--------------------------------------
CB.ResetSrcXY ldx #4
.1 stz CB.Cache+S.CB.SrcX-1,x
dex
bne .1
rts
*--------------------------------------
CB.SrcWCenterH ldy #S.OBJ.W
lda (ZPObjPtr),y
sec
sbc CB.Cache+S.CB.SrcW
pha
iny
lda (ZPObjPtr),y
sbc CB.Cache+S.CB.SrcW+1
lsr
tax
pla
ror
*--------------------------------------
CB.AddAX2X1 clc
adc CB.Cache+S.CB.X1
sta CB.Cache+S.CB.X1
txa
adc CB.Cache+S.CB.X1+1
sta CB.Cache+S.CB.X1+1
rts
*--------------------------------------
CB.GetBuf clc
ldx hCBBuf
bne .9
>LDYAI 1024
>SYSCALL2 GetMem
bcs .9
stx hCBBuf
>STYA ZPCBBufPtr
.9 rts
*--------------------------------------
CB.Cache2CBBufG jsr CB.ToGlobal
*--------------------------------------
CB.Cache2CBBuf lda CB.Cache
lsr
tax
ldy CB.CmdLen-1,x
.1 lda CB.Cache,y
sta (ZPCBBufPtr),y
dey
bpl .1
*--------------------------------------
CB.BufNext lda (ZPCBBufPtr) Get Cmd
lsr
tax
lda CB.CmdLen-1,x
sec +1
adc ZPCBBufPtr
sta ZPCBBufPtr
bcc .1
inc ZPCBBufPtr+1
.1 rts
*--------------------------------------
* CLIP.Rect = Target Object
*--------------------------------------
CB.Write jsr PTR.Disable
jsr CB.GFXWriteClip
.8 jmp PTR.Enable
*--------------------------------------
* Y,A = Target Object
*--------------------------------------
CB.FlushBufToYA jsr CLIP.GetRect
CB.FlushBuf ldx hCBBuf
beq .8
jsr PTR.Disable
lda #0
sta (ZPCBBufPtr)
lda hCBBuf
>SYSCALL2 GetMemPtr
>STYA ZPCBBufPtr
*--------------------------------------
.1 lda (ZPCBBufPtr) Get Cmd
beq .7
lsr
tax
ldy CB.CmdLen-1,x
.2 lda (ZPCBBufPtr),y
sta CB.Cache,y
dey
bpl .2
* lda (ZPCBBufPtr) A = CB.CMD
cmp #S.CB.CMD.DRAWTEXT2
bne .4
lda #S.CB.CMD.DRAWTEXT+S.CB.CMD.OSD
sta CB.Cache+S.CB.CMD
ldx #0 Select CB.Cache
jsr CB.GFXWriteX Direct Write (no clip)
bcs .9
jsr CB.GFXWriteClip
lda CB.Cache+S.CB.SrcPtr
>SYSCALL2 FreeStkObj
bra .5
*--------------------------------------
.4 jsr CB.GFXWriteClip
.5 jsr CB.BufNext
bra .1
.7 lda hCBBuf
stz hCBBuf
>SYSCALL2 FreeMem
jmp PTR.Enable
.8 clc
.9 rts
*--------------------------------------
CB.ToGlobal lda ZPWNDPtr
ldx ZPWNDPtr+1
.1 sta ZPPtr1
stx ZPPtr1+1
ldy #S.WND.InnerX1
ldx #S.CB.X1
jsr CB.AddPtr1YtoCBX
ldy #S.WND.InnerY1
ldx #S.CB.Y1
jsr CB.AddPtr1YtoCBX
ldy #S.WND.InnerX1
ldx #S.CB.X2
jsr CB.AddPtr1YtoCBX
ldy #S.WND.InnerY1
ldx #S.CB.Y2
jsr CB.AddPtr1YtoCBX
ldy #S.OBJ.hPARENT+1
lda (ZPPtr1),y
beq .8 00xx = hDev
tax
dey
lda (ZPPtr1),y
bra .1
.8 clc
rts
*--------------------------------------
CB.AddPtr1YtoCBX
lda (ZPPtr1),y
clc
adc CB.Cache,x
sta CB.Cache,x
iny
lda (ZPPtr1),y
adc CB.Cache+1,x
sta CB.Cache+1,x
rts
*--------------------------------------
* CB.Cache -> CLIP.Cache
*--------------------------------------
CB.GFXWriteClip jsr CLIP.CB.Cache
bcs CB.GFXWrite.9
CB.GFXWrite ldx #2 Select CLIP.Cache
*--------------------------------------
* X=0:CB.Cache, X=2:CLIP.Cache
*--------------------------------------
CB.GFXWriteX >PUSHB WND.Screen+S.OBJ.hPARENT
>PUSHBI IOCTL.WRITE
>PUSHW L.CB.Cache,x
>SYSCALL2 IOCTL
CB.GFXWrite.9 rts
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.cb
LOAD usr/src/lib/libgui.s
ASM