A2osX/LIB/LIBTUI.S.OBJ.txt

913 lines
13 KiB
Plaintext
Raw Normal View History

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.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 IO.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 clc
rts
*--------------------------------------
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
OBJ.Draw.Top.I 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 IO.LBWrite
*--------------------------------------
OBJ.Draw.Body lda (pStack)
jsr LIB.GetOBJ
OBJ.Draw.Body.I ldy #S.OBJ.InnerY
lda (ZPObjPtr),y
>PUSHA Start
ldy #S.OBJ.InnerH
lda (ZPObjPtr),y
>PUSHA Count
>PUSHBI 0 Relative Y
OBJ.Draw.Lines jsr OBJ.CurOff
.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 IO.LBWrite
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
OBJ.Draw.Bottom.I
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 IO.LBWrite
*--------------------------------------
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 cpy #S.OBJ.pTitle
bne .1
jsr OBJ.Draw.Top.I
ldy #0
rts
.1 cpy #S.OBJ.pStatus
bne .8
jsr OBJ.Draw.Bottom.I
ldy #0
rts
.8 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.CurUpdPos ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bEdit
* beq .8
ldy #S.OBJ.S
lda (ZPObjPtr),y S.OBJ.S.bActive
bpl .8
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
jsr IO.LBWrite
.8 clc
rts
*--------------------------------------
OBJ.CurOn ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bEdit
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 IO.LBWrite
.8 lda #0
clc
rts
*--------------------------------------
OBJ.CurOff ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.OBJ.F.bEdit
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 IO.LBWrite
.8 lda #0
clc
rts
*--------------------------------------
OBJ.ZeroWordAtY lda #0
sta (ZPObjPtr),y
iny
sta (ZPObjPtr),y
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