A2osX/LIB/LIBTUI.S.OBJ.txt

957 lines
14 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
.LIST OFF
*--------------------------------------
OBJ.Create pha Type
tax
ldy OBJ.SIZES,x
lda #0
>SYSCALL2 GetMem
bcs .9
>STYA ZPObjPtr
stx hObj
pla
sta (ZPObjPtr)
tax
ldy OBJ.SIZES,x
lda #0
dey
.1 sta (ZPObjPtr),y
dey
bne .1
* clc
rts
.9 plx
rts
*--------------------------------------
OBJ.PullBuf ldy #S.OBJ.BufSize
jsr OBJ.PullWordY
ldy #S.OBJ.pBuf
*--------------------------------------
OBJ.PullWordY >PULLA
sta (ZPObjPtr),y
tax
iny
>PULLA
sta (ZPObjPtr),y
rts
*--------------------------------------
OBJ.PullHW ldy #S.OBJ.H
>PULLA
sta (ZPObjPtr),y
dey
>PULLA
sta (ZPObjPtr),y
rts
*--------------------------------------
OBJ.PullY1X1hParent
>PULLA
ldy #S.OBJ.Y1
sta (ZPObjPtr),y
dey S.OBJ.X1
>PULLA
sta (ZPObjPtr),y
dey S.OBJ.hParent
>PULLA
sta (ZPObjPtr),y
rts
*--------------------------------------
OBJ.Insert >SYSCALL2 GetMemPtr A = hParent
>STYA ZPPtr2
ldy #S.OBJ.Childs
.1 lda (ZPPtr2),y
beq .2
iny
cpy #S.OBJ
bcc .1
lda #E.OOH
* sec
rts
.2 lda hObj
sta (ZPPtr2),y
ldy #S.OBJ.S
lda (ZPPtr2),y
ora #S.OBJ.S.bHasChilds
sta (ZPPtr2),y
ldy #S.OBJ.InnerX
lda (ZPPtr2),y
ldy #S.OBJ.X1
clc
adc (ZPObjPtr),y
sta (ZPObjPtr),y
ldy #S.OBJ.InnerY
lda (ZPPtr2),y
ldy #S.OBJ.Y1
clc
adc (ZPObjPtr),y
sta (ZPObjPtr),y
*--------------------------------------
OBJ.SetX2Y2 ldy #S.OBJ.X1
jsr .7
ldy #S.OBJ.Y1
jsr .7
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bHBorder
beq .1
ldy #S.OBJ.InnerX
lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
iny
iny
lda (ZPObjPtr),y S.OBJ.InnerW
dec
dec
sta (ZPObjPtr),y
.1 ldx #0
ldy #S.OBJ.F
lda (ZPObjPtr),y
bit #S.OBJ.F.bVBorder+S.OBJ.F.bTITLE
beq .2
dex
.2 bit #S.OBJ.F.bVBorder+S.OBJ.F.bSTATUS
beq .3
dex
.3 txa
beq .4
ldy #S.OBJ.InnerY
lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
txa
iny
iny
clc
adc (ZPObjPtr),y S.OBJ.InnerH
sta (ZPObjPtr),y
.4 ldy #S.OBJ.F
lda (ZPObjPtr),y
bit #S.OBJ.F.bMENU
beq .8
ldy #S.OBJ.InnerY
lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
iny
iny
lda (ZPObjPtr),y S.OBJ.InnerH
dec
sta (ZPObjPtr),y
.8 clc
rts
*--------------------------------------
.7 lda (ZPObjPtr),y S.OBJ.X1/Y1
tax
iny
iny S.OBJ.W/H
phy
clc
adc (ZPObjPtr),y
dec
iny
iny S.OBJ.X2/Y2
sta (ZPObjPtr),y
iny
iny
txa
sta (ZPObjPtr),y S.OBJ.InnerX/Y
ply S.OBJ.W/H
lda (ZPObjPtr),y
iny
iny
iny
iny
iny
iny
sta (ZPObjPtr),y S.OBJ.InnerW/H
rts
*--------------------------------------
OBJ.Exec >PUSHA hOBJ
jsr LIB.GetOBJ
jsr LIB.GetCTX
.1 jsr CTX.GetC
bcs .9
cmp #EV.RESIZE
clc
beq .99
tay
beq .1
>PUSHA
jsr OBJ.Run
inc pStack
tay
beq .1 no event, no error
.9 inc pStack
.99 rts
*--------------------------------------
OBJ.Destroy ldx ZPObjPtr
phx
ldx ZPObjPtr+1
phx
pha
jsr LIB.GetOBJ
ldy #S.OBJ.Childs
.1 lda (ZPObjPtr),y
beq .2
phy
jsr OBJ.Destroy
ply
.2 iny
cpy #S.OBJ
bcc .1
pla
pha
jsr LIB.GetOBJ
jsr .7
pla
>SYSCALL2 FreeMem
plx
stx ZPObjPtr+1
plx
stx ZPObjPtr
rts
.7 lda (ZPObjPtr) S.OBJ.T
tax
jmp (J.ObjDestroy,x)
*--------------------------------------
OBJ.Run ldx ZPObjPtr
phx
ldx ZPObjPtr+1
phx
ldy #1
lda (pStack),y
jsr LIB.GetOBJ
ldy #S.OBJ.S
lda (ZPObjPtr),y
and #S.OBJ.S.bDisabled
bne .9
ldy #1
lda (pStack),y hOBJ
>PUSHA
lda (pStack),y Event
>PUSHA
jsr .80
inc pStack
inc pStack
tax
bne .8 error / event
bcc .8
ldy #S.OBJ.Childs
.1 lda (ZPObjPtr),y
beq .5
phy
>PUSHA hChild
ldy #1
lda (pStack),y Event
>PUSHA
jsr OBJ.Run
ply
inc pStack
inc pStack
bcc .8
tax
bne .8
.5 iny
cpy #S.OBJ
bne .1
.9 sec
lda #0
.8 plx
stx ZPObjPtr+1
plx
stx ZPObjPtr
rts
.80 lda (ZPObjPtr) S.OBJ.T
tax
jmp (J.ObjRun,x)
*--------------------------------------
OBJ.Draw >PUSHA hObj
jsr OBJ.Draw.Top
bcs .99
jsr OBJ.Draw.Body
bcs .99
jsr OBJ.Draw.Bottom
bcs .99
ldy #S.OBJ.S
lda (ZPObjPtr),y
and #S.OBJ.S.bHasChilds
* clc
beq .99
lda #S.OBJ.Childs
>PUSHA
.6 ldy #1
lda (pStack),y
jsr LIB.GetOBJ
lda (pStack)
tay
lda (ZPObjPtr),y
beq .7
jsr OBJ.Draw
bcs .98
.7 lda (pStack)
inc
sta (pStack)
cmp #S.OBJ
bne .6
clc
.98 inc pStack
.99 inc pStack
OBJ.Draw.RTS rts
*--------------------------------------
OBJ.Draw.Top lda (pStack)
jsr LIB.GetOBJ
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bTITLE+S.OBJ.F.bHBorder
* clc
beq OBJ.Draw.RTS
jsr LB.Init
ldy #S.OBJ.X1
lda (ZPObjPtr),y
tax
ldy #S.OBJ.Y1
lda (ZPObjPtr),y
tay
jsr LB.GotoXY
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bVBorder
beq .1
jsr LB.SetColor
ldx #SEQ.BORDERTL-SEQS
jsr LB.SeqOut
.1 ldy #S.OBJ.F
lda (ZPObjPtr),y
bpl .4 S.OBJ.F.bTITLE
ldx #SEQ.BAR-SEQS
jsr LB.SeqOut
ldy #S.OBJ.InnerW
lda (ZPObjPtr),y
tax
ldy #S.OBJ.pTitle
lda (ZPObjPtr),y
sta ZPPtr1
iny
lda (ZPObjPtr),y
sta ZPPtr1+1
beq .3
lda #C.SI
jsr LB.COut
ldy #0
.2 lda (ZPPtr1),y
beq .3
jsr LB.COut
iny
dex
bne .2
.3 txa
beq .31
lda #C.SPACE
.30 jsr LB.COut
dex
bne .30
.31 ldx #SEQ.BAREND-SEQS
jsr LB.SeqOut
bra .6
.4 ldy #S.OBJ.InnerW
lda (ZPObjPtr),y
tax
lda #'q'
.5 jsr LB.COut
dex
bne .5
.6 ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bVBorder
beq .7
jsr LB.SetColor
ldx #SEQ.BORDERTR-SEQS
jsr LB.SeqOut
.7 jmp LB.Out
*--------------------------------------
OBJ.Draw.Body lda (pStack)
jsr LIB.GetOBJ
jsr OBJ.CurOff
ldy #S.OBJ.InnerY
lda (ZPObjPtr),y
>PUSHA Start
ldy #S.OBJ.InnerH
lda (ZPObjPtr),y
>PUSHA Count
>PUSHBI 0 Relative Y
.1 jsr LB.Init
ldy #S.OBJ.X1
lda (ZPObjPtr),y
tax
ldy #2 InnerY
lda (pStack),y
tay
jsr LB.GotoXY
jsr LB.SetColor
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bVBorder
php
beq .2
ldx #SEQ.BORDERV-SEQS
jsr LB.SeqOut
.2 jsr OBJ.Draw.Body.JMP
ldx #SEQ.NORMAL-SEQS
jsr LB.SeqOut
plp
beq .4
ldy #S.OBJ.X2
lda (ZPObjPtr),y
tax
ldy #2 InnerY
lda (pStack),y
tay
jsr LB.GotoXY
jsr LB.SetColor
ldx #SEQ.BORDERV-SEQS
jsr LB.SeqOut
.4 jsr LB.Out
bcs .9
lda (pStack) Relative Y
inc
sta (pStack)
ldy #2 InnerY
lda (pStack),y
inc
sta (pStack),y
dey
lda (pStack),y Count
dec
sta (pStack),y
bne .1
jsr OBJ.CurOn
.9 >POP 3
OBJ.Draw.Body.RTS
rts
*--------------------------------------
OBJ.Draw.Body.JMP
lda (ZPObjPtr)
tax
jmp (J.ObjDraw,x)
*--------------------------------------
OBJ.Draw.Bottom lda (pStack)
jsr LIB.GetOBJ
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bSTATUS+S.OBJ.F.bHBorder
* clc
beq OBJ.Draw.Body.RTS
jsr LB.Init
ldy #S.OBJ.X1
lda (ZPObjPtr),y
tax
ldy #S.OBJ.Y2
lda (ZPObjPtr),y
tay
jsr LB.GotoXY
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bVBorder
beq .1
jsr LB.SetColor
ldx #SEQ.BORDERBL-SEQS
jsr LB.SeqOut
.1 ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bSTATUS
beq .4
ldx #SEQ.BAR-SEQS
jsr LB.SeqOut
ldy #S.OBJ.InnerW
lda (ZPObjPtr),y
tax
ldy #S.OBJ.pSTATUS
lda (ZPObjPtr),y
sta ZPPtr1
iny
lda (ZPObjPtr),y
sta ZPPtr1+1
beq .3
lda #C.SI
jsr LB.COut
ldy #0
.2 lda (ZPPtr1),y
beq .3
jsr LB.COut
iny
dex
bne .2
.3 txa
beq .31
lda #C.SPACE
.30 jsr LB.COut
dex
bne .30
.31 ldx #SEQ.BAREND-SEQS
jsr LB.SeqOut
bra .6
.4 ldy #S.OBJ.InnerW
lda (ZPObjPtr),y
tax
lda #'q'
.5 jsr LB.COut
dex
bne .5
.6 ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bVBorder
beq .7
jsr LB.SetColor
ldx #SEQ.BORDERBR-SEQS
jsr LB.SeqOut
.7 jmp LB.Out
*--------------------------------------
OBJ.GetProp ldy #1 hObj
lda (pStack),y
jsr LIB.GetOBJ
>PULLA
tay prop
lda (ZPObjPtr),y
pha
iny
lda (ZPObjPtr),y
ply
inc pStack
* clc
rts
*--------------------------------------
OBJ.SetProp ldy #3 hObj
lda (pStack),y
jsr LIB.GetOBJ
ldy #2
lda (pStack),y
tay prop
>PULLA
sta (ZPObjPtr),y
iny
>PULLA
sta (ZPObjPtr),y
inc pStack
inc pStack
* clc
rts
*--------------------------------------
OBJ.Activate >PUSHA hObj
jsr OBJ.FindActive
bcs .1
>PUSHA hObj
jsr OBJ.Deactivate
inc pStack
.1 lda (pStack)
jsr OBJ.Activate2
inc pStack
clc
rts
*--------------------------------------
OBJ.Activate2 jsr LIB.GetOBJ
ldy #S.OBJ.S
lda (ZPObjPtr),y
ora #S.OBJ.S.bActive
sta (ZPObjPtr),y
jsr .1
jmp OBJ.CurOn
.1 lda (ZPObjPtr)
tax
jmp (J.ObjActivate,x)
*--------------------------------------
OBJ.Deactivate jsr LIB.GetOBJ
jsr OBJ.CurOff
ldy #S.OBJ.S
lda (ZPObjPtr),y
and #S.OBJ.S.bActive^$ff
sta (ZPObjPtr),y
lda (ZPObjPtr)
tax
jmp (J.ObjDeactivate,x)
*--------------------------------------
OBJ.FindActive ldx ZPObjPtr
phx
ldx ZPObjPtr+1
phx
jsr LIB.GetOBJ
ldy #S.OBJ.Childs
.1 phy
lda (ZPObjPtr),y
beq .7
pha
>SYSCALL2 GetMemPtr
>STYA ZPPtr1
ldy #S.OBJ.S
lda (ZPPtr1),y S.OBJ.S.bActive
bmi .8
pla
.7 ply
iny
cpy #S.OBJ
bne .1
* sec
bra .80
.8 pla
ply
clc
.80 plx
stx ZPObjPtr+1
plx
stx ZPObjPtr
rts
*--------------------------------------
OBJ.CurOn ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bCursor
beq .8
ldy #S.OBJ.S
lda (ZPObjPtr),y S.OBJ.S.bActive
bpl .8
bit #S.OBJ.S.bCurOn
bne .8
ora #S.OBJ.S.bCurOn
sta (ZPObjPtr),y
jsr LB.Init
ldy #S.OBJ.InnerX
lda (ZPObjPtr),y
clc
ldy #S.OBJ.CurX
adc (ZPObjPtr),y
tax
ldy #S.OBJ.InnerY
lda (ZPObjPtr),y
clc
ldy #S.OBJ.CurY
adc (ZPObjPtr),y
tay
jsr LB.GotoXY
ldx #SEQ.CURON-SEQS
jsr LB.SeqOut
jsr LB.Out
.8 lda #0
clc
rts
*--------------------------------------
OBJ.CurOff ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bCursor
beq .8
ldy #S.OBJ.S
lda (ZPObjPtr),y S.OBJ.S.bActive
bpl .8
bit #S.OBJ.S.bCurOn
beq .8
eor #S.OBJ.S.bCurOn
sta (ZPObjPtr),y
jsr LB.Init
ldx #SEQ.CUROFF-SEQS
jsr LB.SeqOut
jmp LB.Out
.8 lda #0
clc
rts
*--------------------------------------
OBJ.IncWordAtY lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
bne .8
iny
lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
.8 rts
*--------------------------------------
OBJ.DecWordAtY clc
lda (ZPObjPtr),y
sbc #0
sta (ZPObjPtr),y
iny
lda (ZPObjPtr),y
sbc #0
sta (ZPObjPtr),y
rts
*--------------------------------------
OBJ.GetBuf ldy #S.OBJ.pBuf
lda (ZPObjPtr),y
sta ZPPtr1
iny
lda (ZPObjPtr),y
sta ZPPtr1+1
rts
*--------------------------------------
OBJ.GetLineXAtY lda (ZPObjPtr),y
sta ZPPtr1
iny
lda (ZPObjPtr),y
sta ZPPtr1+1
stz TempI
.1 lda (ZPPtr1)
beq .9
cpx TempI
beq .8
.2 inc TempI
ldy #$ff
.4 iny
lda (ZPPtr1),y
clc
beq .5
cmp #C.CR
bne .4
* sec
.5 tya
adc ZPPtr1
sta ZPPtr1
bcc .1
inc ZPPtr1+1
bra .1
.8 clc
rts
.9 sec
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.obj
LOAD usr/src/lib/libtui.s
ASM