2021-04-15 20:52:08 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF lib/libtui
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.INB inc/net.telnet.i
|
2021-04-15 20:52:08 +00:00
|
|
|
|
.INB inc/libtui.i
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPLIB
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
ZPScrnPtr .BS 2
|
2021-04-15 20:52:08 +00:00
|
|
|
|
ZPObjPtr .BS 2
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
ZPLineBufPtr .BS 2
|
|
|
|
|
ZPLineBufCnt .BS 2
|
|
|
|
|
|
2021-04-15 20:52:08 +00:00
|
|
|
|
ZPPtr1 .BS 2
|
2021-09-07 12:32:31 +00:00
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
TempW .BS 2
|
|
|
|
|
TempC .BS 2
|
|
|
|
|
TempI .BS 2
|
|
|
|
|
bResize .BS 1
|
|
|
|
|
|
2021-04-15 20:52:08 +00:00
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA LIB.LOAD
|
|
|
|
|
.DA LIB.UNLOAD
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.DA LIB.Init
|
|
|
|
|
.DA LIB.GetEvent
|
|
|
|
|
.DA LIB.Dispatch
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.DA LIB.Close
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.DA OBJ.New
|
|
|
|
|
.DA OBJ.Destroy
|
|
|
|
|
.DA OBJ.Run
|
|
|
|
|
.DA OBJ.Draw
|
|
|
|
|
.DA OBJ.GetProp
|
|
|
|
|
.DA OBJ.SetProp
|
|
|
|
|
.DA OBJ.Activate
|
|
|
|
|
.DA OBJ.Deactivate
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
J.ObjNew .DA SCRN.New
|
|
|
|
|
.DA TBOX.New
|
|
|
|
|
.DA LBOX.New
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
J.ObjDestroy .DA SCRN.Destroy
|
|
|
|
|
.DA TBOX.Destroy
|
|
|
|
|
.DA LBOX.Destroy
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
J.ObjRun .DA SCRN.Run
|
|
|
|
|
.DA TBOX.Run
|
|
|
|
|
.DA LBOX.Run
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
J.ObjDraw .DA SCRN.Draw
|
|
|
|
|
.DA TBOX.Draw
|
|
|
|
|
.DA LBOX.Draw
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
J.ObjActivate .DA SCRN.Activate
|
|
|
|
|
.DA TBOX.Activate
|
|
|
|
|
.DA LBOX.Activate
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
J.ObjDeactivate .DA SCRN.Deactivate
|
|
|
|
|
.DA TBOX.Deactivate
|
|
|
|
|
.DA LBOX.Deactivate
|
2021-04-29 11:56:34 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
L.SEQ.INIT .DA SEQ.INIT
|
2021-09-07 12:32:31 +00:00
|
|
|
|
L.SEQ.GOTOXY .DA SEQ.GOTOXY
|
|
|
|
|
L.SEQ.COLOR .DA SEQ.COLOR
|
|
|
|
|
L.SEQ.CLOSE .DA SEQ.CLOSE
|
2021-08-13 18:34:20 +00:00
|
|
|
|
L.FMT.ESCCSI.R .DA FMT.ESCCSI.R
|
2021-04-15 20:52:08 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2021-08-13 18:34:20 +00:00
|
|
|
|
LIB.LOAD lda LibCnt
|
|
|
|
|
bne .8
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>LDYAI 512
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>SYSCALL2 GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>STYA LineBuf
|
2021-08-13 18:34:20 +00:00
|
|
|
|
stx hLineBuf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.8 inc LibCnt
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-08-13 18:34:20 +00:00
|
|
|
|
LIB.UNLOAD dec LibCnt
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
lda hLineBuf
|
|
|
|
|
>SYSCALL2 FreeMem
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2021-04-15 20:52:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.Init sta TempW F
|
|
|
|
|
|
|
|
|
|
>LDYAI S.SCRN
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>SYSCALL2 GetMem
|
|
|
|
|
bcs .99
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>STYA ZPScrnPtr
|
|
|
|
|
txa
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>PUSHA hScrn
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda #0
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>PUSHA Init Counter
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
ldy #S.SCRN-1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.10 sta (ZPScrnPtr),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .10
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
lda TempW
|
|
|
|
|
ldy #S.OBJ.F
|
|
|
|
|
sta (ZPScrnPtr),y
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
jsr LIB.GetC.Reset
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>LDYA L.SEQ.INIT
|
|
|
|
|
jsr LIB.YAOut
|
|
|
|
|
bcs .98
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
|
|
|
|
.1 >SLEEP
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
ldy #1 hScrn
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda (pStack),y
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
jsr LIB.GetC
|
|
|
|
|
bcs .98
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
ldy #1 hScrn
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
jsr LIB.GetScrn
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.2 ldy #S.OBJ.W
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
bne .8
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda (pStack)
|
|
|
|
|
dec
|
|
|
|
|
sta (pStack)
|
|
|
|
|
bne .1
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda #80
|
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.W
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
|
|
|
|
|
lda #24
|
|
|
|
|
iny S.OBJ.H
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.8 >LDYA ZPScrnPtr
|
2021-08-13 18:34:20 +00:00
|
|
|
|
jsr LIB.SetObjX2Y2
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.S
|
|
|
|
|
lda #S.OBJ.S.bACTIVE
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
|
|
|
|
|
inc pStack Discard counter
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>PULLA hScrn
|
|
|
|
|
clc
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.99 rts
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
|
|
|
|
.98 pha
|
2021-09-07 12:32:31 +00:00
|
|
|
|
inc pStack Discard counter
|
|
|
|
|
>PULLA hScrn
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>SYSCALL2 FreeMem
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
rts
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetEvent stz bResize
|
|
|
|
|
|
|
|
|
|
>PUSHA hScrn
|
|
|
|
|
|
|
|
|
|
jsr LIB.GetC
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
bit bResize
|
|
|
|
|
bpl .8
|
|
|
|
|
|
|
|
|
|
lda (pStack)
|
|
|
|
|
jsr LIB.GetScrn
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
ldy #S.OBJ.fRESIZE
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
jsr .10
|
|
|
|
|
|
|
|
|
|
stz bResize
|
|
|
|
|
|
|
|
|
|
lda #0
|
2021-08-13 18:34:20 +00:00
|
|
|
|
clc
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.8
|
|
|
|
|
.9 inc pStack
|
|
|
|
|
|
2021-04-15 20:52:08 +00:00
|
|
|
|
rts
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
.10 jmp (ZPPtr1)
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.Dispatch jsr OBJ.Run
|
|
|
|
|
bcc .8
|
2021-04-15 20:52:08 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
lda (pStack)
|
|
|
|
|
cmp #3 Ctrl-C
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.8
|
|
|
|
|
|
|
|
|
|
.9 inc pStack Destroy Event
|
|
|
|
|
inc pStack on Stack
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.Close jsr OBJ.Destroy
|
|
|
|
|
|
|
|
|
|
>LDYA L.SEQ.CLOSE
|
|
|
|
|
jsr LIB.YAOut
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.FindActive ldx ZPObjPtr
|
|
|
|
|
phx
|
|
|
|
|
ldx ZPObjPtr+1
|
|
|
|
|
phx
|
|
|
|
|
|
|
|
|
|
jsr LIB.GetObj
|
|
|
|
|
|
|
|
|
|
* ldy #S.OBJ.P
|
|
|
|
|
* lda (ZPObjPtr),y
|
|
|
|
|
* sec
|
|
|
|
|
* beq .80
|
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.Childs
|
2021-04-15 20:52:08 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.1 phy
|
|
|
|
|
lda (ZPObjPtr),y
|
|
|
|
|
beq .7
|
2021-04-15 20:52:08 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
pha
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
>SYSCALL2 GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
ldy #S.OBJ.S
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
and #S.OBJ.S.bACTIVE
|
|
|
|
|
bne .8
|
2021-04-15 20:52:08 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.7 ply
|
2021-08-13 18:34:20 +00:00
|
|
|
|
iny
|
2021-09-07 12:32:31 +00:00
|
|
|
|
cpy #S.OBJ
|
2021-04-15 20:52:08 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
* sec
|
|
|
|
|
bra .80
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.8 pla
|
|
|
|
|
ply
|
2021-04-15 20:52:08 +00:00
|
|
|
|
clc
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
.80 plx
|
|
|
|
|
stx ZPObjPtr+1
|
|
|
|
|
plx
|
|
|
|
|
stx ZPObjPtr
|
|
|
|
|
|
|
|
|
|
rts
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GotoXY >PUSHW ZPLineBufPtr
|
|
|
|
|
>PUSHW L.SEQ.GOTOXY
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
tya
|
|
|
|
|
inc
|
|
|
|
|
>PUSHA
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
txa
|
|
|
|
|
inc
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
jmp LIB.LineBufPrintF
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.SetColor tax
|
|
|
|
|
>PUSHW ZPLineBufPtr
|
|
|
|
|
>PUSHW L.SEQ.COLOR
|
|
|
|
|
|
|
|
|
|
>PUSHB OBJ.COLORS,x
|
|
|
|
|
>PUSHB OBJ.COLORS+1,x
|
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
jmp LIB.LineBufPrintF
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetScrn >SYSCALL2 GetMemPtr
|
|
|
|
|
>STYA ZPScrnPtr
|
|
|
|
|
rts
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetObj >SYSCALL2 GetMemPtr
|
|
|
|
|
>STYA ZPObjPtr
|
2021-04-15 20:52:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.SetObjX2Y2 >STYA ZPPtr1
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-04-15 20:52:08 +00:00
|
|
|
|
ldy #S.OBJ.X1
|
2021-09-07 12:32:31 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
2021-04-15 20:52:08 +00:00
|
|
|
|
ldy #S.OBJ.Y1
|
2021-09-07 12:32:31 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.F
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
and #S.OBJ.F.bHBorder
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.InnerX
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
inc
|
|
|
|
|
sta (ZPPtr1),y
|
2021-04-15 20:52:08 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
iny
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPPtr1),y S.OBJ.InnerW
|
|
|
|
|
dec
|
|
|
|
|
dec
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
.1 ldx #0
|
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.F
|
|
|
|
|
lda (ZPPtr1),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 (ZPPtr1),y
|
|
|
|
|
inc
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
adc (ZPPtr1),y S.OBJ.InnerH
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
.4 ldy #S.OBJ.F
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bit #S.OBJ.F.bMENU
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
ldy #S.OBJ.InnerY
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
inc
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1),y S.OBJ.InnerH
|
|
|
|
|
dec
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
.5 rts
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.7 lda (ZPPtr1),y S.OBJ.X1/Y1
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
iny S.OBJ.W/H
|
|
|
|
|
phy
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
clc
|
2021-09-07 12:32:31 +00:00
|
|
|
|
adc (ZPPtr1),y
|
|
|
|
|
dec
|
|
|
|
|
iny
|
|
|
|
|
iny S.OBJ.X2/Y2
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPPtr1),y S.OBJ.InnerX/Y
|
|
|
|
|
|
|
|
|
|
ply S.OBJ.W/H
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPPtr1),y S.OBJ.InnerW/H
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetC >PUSHA hScrn
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdIn
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL2 FEOF
|
|
|
|
|
bcs .9
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
tay
|
2021-09-07 12:32:31 +00:00
|
|
|
|
beq .10
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
inc pStack
|
|
|
|
|
bra .18
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.10 >SYSCALL2 GetChar
|
|
|
|
|
bcc .11
|
|
|
|
|
|
|
|
|
|
.9 inc pStack
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.11 pha
|
|
|
|
|
|
|
|
|
|
>PULLA
|
|
|
|
|
jsr LIB.GetScrn
|
|
|
|
|
|
|
|
|
|
plx
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.SCRN.bEscMode
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
beq .20
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
bmi .40 IAC mode
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
iny S.SCRN.InBufPtr
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
|
|
|
|
|
cpx #'[' CSI ?
|
2021-09-07 12:32:31 +00:00
|
|
|
|
bne .12
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
cmp #S.SCRN.InBufPtr
|
|
|
|
|
bne .49 buffer not empty...bad SEQ
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.12 jsr LIB.GetC.ToBuf
|
2021-08-13 18:34:20 +00:00
|
|
|
|
bcs .49 Buffer Full
|
|
|
|
|
|
|
|
|
|
cpx #'['
|
|
|
|
|
beq .18
|
|
|
|
|
|
|
|
|
|
cpx #64
|
2021-09-07 12:32:31 +00:00
|
|
|
|
bcs LIB.GetC.ESCSEQ if CC, not a letter...SEQ is incomplete
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
|
|
|
|
.18 lda #0
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.20 cpx #C.ESC
|
|
|
|
|
bne .30
|
|
|
|
|
|
|
|
|
|
inc A = $01
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
bra .31
|
2021-08-13 18:34:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.30 cpx #IAC
|
|
|
|
|
bne .38
|
|
|
|
|
|
|
|
|
|
dec A = $FF
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.31 jsr LIB.GetC.SetMode
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
lda #0
|
2021-08-13 18:34:20 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.38 txa
|
|
|
|
|
clc
|
|
|
|
|
.39 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.40 jsr LIB.GetC.ToBuf
|
2021-08-13 18:34:20 +00:00
|
|
|
|
bcs .49 Buffer Full
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
cpy #S.SCRN.InBuf First char...
|
|
|
|
|
beq .48
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
ldy #S.SCRN.InBuf
|
|
|
|
|
lda (ZPScrnPtr),y
|
2021-09-07 12:32:31 +00:00
|
|
|
|
cmp #SB First char is SB ?
|
|
|
|
|
bne LIB.GetC.IACSEQ no ...
|
|
|
|
|
|
|
|
|
|
cpx #SE is SE after SB ..... ?
|
2021-08-13 18:34:20 +00:00
|
|
|
|
bne .48
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
bra LIB.GetC.IACSEQ yes, we have IAC SB .....SE
|
|
|
|
|
|
|
|
|
|
.49 jsr LIB.GetC.Reset
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
|
|
|
|
.48 lda #0
|
|
|
|
|
clc
|
2021-09-07 12:32:31 +00:00
|
|
|
|
rts
|
2021-08-13 18:34:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetC.ESCSEQ cmp #S.SCRN.InBuf+2
|
2021-08-13 18:34:20 +00:00
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
ldy #ESC.Out-ESC.In-1
|
|
|
|
|
txa
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.1 cmp ESC.In,y
|
|
|
|
|
beq .7
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
bra .6
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* \e[xxx;yyyR
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.2 cpx #'R' Response to cursor position query?
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
lda #S.SCRN.InBuf+1 skip ESC [
|
2021-09-07 12:32:31 +00:00
|
|
|
|
jsr LIB.GetC.GetScrnOfs
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
>PUSHW L.FMT.ESCCSI.R
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda #S.OBJ.H
|
2021-09-07 12:32:31 +00:00
|
|
|
|
jsr LIB.GetC.GetScrnOfs
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
lda #S.OBJ.W
|
2021-09-07 12:32:31 +00:00
|
|
|
|
jsr LIB.GetC.GetScrnOfs
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>PUSHYA
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
>PUSHBI 4 2 pointers
|
|
|
|
|
>SYSCALL2 sscanf
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.6 ldx #0
|
|
|
|
|
bra .8
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.7 ldx ESC.Out,y
|
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.8 jsr LIB.GetC.Reset
|
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
txa
|
|
|
|
|
clc
|
2021-09-07 12:32:31 +00:00
|
|
|
|
rts
|
2021-08-13 18:34:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
* IAC SB TN.O.NAWS ww ww hh hh IAC SE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.GetC.IACSEQ ldy #S.SCRN.InBuf
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
cmp #SB
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
cmp #TN.O.NAWS
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
cmp #80
|
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
lda #80
|
|
|
|
|
|
|
|
|
|
.1 tax
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPScrnPtr),y
|
|
|
|
|
cmp #24
|
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
lda #24
|
|
|
|
|
|
|
|
|
|
.2 ldy #S.OBJ.H
|
|
|
|
|
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
|
|
|
|
|
dey S.OBJ.W
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
|
|
|
|
|
>LDYA ZPScrnPtr
|
|
|
|
|
jsr LIB.SetObjX2Y2
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
ror bResize
|
|
|
|
|
|
|
|
|
|
.8 jsr LIB.GetC.Reset
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetC.Reset lda #0
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetC.SetMode
|
|
|
|
|
ldy #S.SCRN.bEscMode
|
2021-08-13 18:34:20 +00:00
|
|
|
|
sta (ZPScrnPtr),y
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
iny Y = S.SCRN.InBufPtr
|
|
|
|
|
tya
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.GetC.GetScrnOfs
|
|
|
|
|
clc
|
|
|
|
|
adc ZPScrnPtr
|
|
|
|
|
tay
|
|
|
|
|
lda ZPScrnPtr+1
|
|
|
|
|
adc #0
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.GetC.ToBuf ldy #S.SCRN.InBufPtr
|
2021-08-13 18:34:20 +00:00
|
|
|
|
lda (ZPScrnPtr),y
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
2021-08-13 18:34:20 +00:00
|
|
|
|
cmp #S.SCRN.EndBuf buffer full
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
inc
|
|
|
|
|
tay
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPScrnPtr),y
|
|
|
|
|
tya
|
|
|
|
|
ply
|
|
|
|
|
sta (ZPScrnPtr),y
|
2021-09-07 12:32:31 +00:00
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufInit >LDYA LineBuf
|
|
|
|
|
>STYA ZPLineBufPtr
|
|
|
|
|
stz ZPLineBufCnt
|
|
|
|
|
stz ZPLineBufCnt+1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufSeqOut
|
|
|
|
|
.1 lda SEQS,x
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
jsr LIB.LineBufCOut
|
|
|
|
|
inx
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufYAOut
|
|
|
|
|
ldx #0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufYAOutX
|
|
|
|
|
>STYA ZPPtr1 X = MaxLen
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
jsr LIB.LineBufCOut
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufPrintF
|
|
|
|
|
>SYSCALL2 SPrintF
|
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
adc ZPLineBufPtr
|
|
|
|
|
sta ZPLineBufPtr
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
inc ZPLineBufPtr+1
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.1 tya
|
|
|
|
|
adc ZPLineBufCnt
|
|
|
|
|
sta ZPLineBufCnt
|
|
|
|
|
bcc .8
|
2021-08-13 18:34:20 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
inc ZPLineBufCnt+1
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufHOut pha
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
jsr .1
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
and #$0F
|
|
|
|
|
|
|
|
|
|
.1 ora #$30
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcc LIB.LineBufCOut
|
|
|
|
|
|
|
|
|
|
adc #6
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LineBufCOut sta (ZPLineBufPtr)
|
|
|
|
|
inc ZPLineBufPtr
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
inc ZPLineBufPtr+1
|
|
|
|
|
|
|
|
|
|
.1 inc ZPLineBufCnt
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
inc ZPLineBufCnt+1
|
2021-04-15 20:52:08 +00:00
|
|
|
|
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.8 rts
|
2021-08-13 18:34:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.LineBufOut ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHW LineBuf
|
|
|
|
|
>PUSHW ZPLineBufCnt
|
|
|
|
|
>SYSCALL fwrite
|
2021-08-13 18:34:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LIB.YAOut dec pStack
|
|
|
|
|
>PUSHYA
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
ldy #2
|
|
|
|
|
sta (pStack),y
|
|
|
|
|
>SYSCALL fputs
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB usr/src/lib/libtui.s.obj
|
|
|
|
|
.INB usr/src/lib/libtui.s.lbox
|
|
|
|
|
.INB usr/src/lib/libtui.s.scrn
|
|
|
|
|
.INB usr/src/lib/libtui.s.tbox
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2021-08-13 18:34:20 +00:00
|
|
|
|
LibCnt .BS 1
|
|
|
|
|
hLineBuf .BS 1
|
2021-09-07 12:32:31 +00:00
|
|
|
|
LineBuf .BS 2
|
2021-08-13 18:34:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ESC.In .AS "DBAC"
|
2021-09-07 12:32:31 +00:00
|
|
|
|
ESC.Out .DA #C.BS,#C.LF,#C.VT,#C.FS
|
2021-08-13 18:34:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
FMT.ESCCSI.R .AZ "%d;%d"
|
|
|
|
|
*--------------------------------------
|
2021-09-07 12:32:31 +00:00
|
|
|
|
OBJ.SIZES .DA S.SCRN,S.TBOX,S.LBOX
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
OBJ.COLORS .DA #93,#44 SCRN
|
|
|
|
|
.DA #93,#104 TBOX
|
|
|
|
|
.DA #93,#104 LBOX
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.INIT .DA #C.ESC
|
|
|
|
|
.AS "c" FF
|
|
|
|
|
.DA #C.ESC
|
2021-08-13 18:34:20 +00:00
|
|
|
|
.AS "[999;999H" Set Cursor Pos to 999,999
|
|
|
|
|
.DA #C.ESC
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.AS "[6n" then query Cursor Pos
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AS "(B" font select
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AS ")0" font select
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AS "[?7l" Disable Line Wrap
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AS "[?25l" Hide Cursor
|
|
|
|
|
.DA #0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.GOTOXY .AZ "\e[%d;%dH"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.COLOR .AZ "\e[%d;%dm"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQS .EQ *
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.CURON .DA #C.ESC
|
|
|
|
|
.AS "[?25h" Show Cursor
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.CUROFF .DA #C.ESC
|
|
|
|
|
.AS "[?25l" Hide Cursor
|
|
|
|
|
.DA #0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.BAR .DA #C.ESC
|
|
|
|
|
.AS "[1m" BOLD
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AS "[7m" INVERSE
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AS "[37;40m"
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.BAREND .DA #C.ESC
|
|
|
|
|
.AS "[0m"
|
|
|
|
|
.DA #0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.BORDERTL .DA #C.SO,#'l'
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.BORDERTR .DA #C.SO,#'k',#C.SI
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.BORDERBL .DA #C.SO,#'m'
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.BORDERBR .DA #C.SO,#'j',#C.SI
|
|
|
|
|
.DA #0
|
|
|
|
|
*SEQ.BORDERH .DA #C.SO,#'q',#C.SI
|
|
|
|
|
* .DA #0
|
|
|
|
|
SEQ.BORDERV .DA #C.SO,#'x',#C.SI
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.INVERSE .DA #C.ESC
|
|
|
|
|
.AS "[7m"
|
|
|
|
|
.DA #0
|
|
|
|
|
SEQ.NORMAL .DA #C.ESC
|
|
|
|
|
.AS "[0m"
|
|
|
|
|
.DA #0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
*SEQ.SCROLLCURUP .AS "\e[?7l\e[%d;%dr"
|
|
|
|
|
*SEQ.SCROLLUP .AZ "\eD"
|
|
|
|
|
*SEQ.SCROLLCURDN .AS "\e[?7l\e[%d;%dr"
|
|
|
|
|
*SEQ.SCROLLDN .AZ "\eM"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SEQ.CLOSE .DA #C.ESC
|
|
|
|
|
.AS "c"
|
|
|
|
|
.DA #C.ESC
|
|
|
|
|
.AZ "[?7h" Enable Line Wrap
|
2021-04-15 20:52:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/lib/libtui.s
|
|
|
|
|
ASM
|