A2osX/LIB/LIBTUI.S.txt

307 lines
7.1 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
.OP 65C02
.OR $2000
.TF lib/libtui
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/net.telnet.i
.INB inc/libtui.i
*--------------------------------------
.DUMMY
.OR ZPLIB
ZPCtxPtr .BS 2
ZPObjPtr .BS 2
ZPLineBufPtr .BS 2
ZPLineBufCnt .BS 2
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPPtr3 .BS 2
TempW .BS 2
TempC .BS 2
TempI .BS 2
bRepaintAll .BS 1
hObj .BS 1
.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
.DA CTX.Init
.DA CTX.Close
*--------------------------------------
.DA OBJ.New
.DA OBJ.Exec
.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 DLG.New
.DA LABEL.New
.DA TLINE.New
.DA TBOX.New
.DA LBOX.New
.DA CBOX.New
.DA BUT.New
.DA RADIO.New
*--------------------------------------
J.ObjDestroy .DA SCRN.Destroy
.DA DLG.Destroy
.DA LABEL.Destroy
.DA TLINE.Destroy
.DA TBOX.Destroy
.DA LBOX.Destroy
.DA CBOX.Destroy
.DA BUT.Destroy
.DA RADIO.Destroy
*--------------------------------------
J.ObjRun .DA SCRN.Run
.DA DLG.Run
.DA LABEL.Run
.DA TLINE.Run
.DA TBOX.Run
.DA LBOX.Run
.DA CBOX.Run
.DA BUT.Run
.DA RADIO.Run
*--------------------------------------
J.ObjDraw .DA SCRN.Draw
.DA DLG.Draw
.DA LABEL.Draw
.DA TLINE.Draw
.DA TBOX.Draw
.DA LBOX.Draw
.DA CBOX.Draw
.DA BUT.Draw
.DA RADIO.Draw
*--------------------------------------
J.ObjActivate .DA SCRN.Activate
.DA DLG.Activate
.DA LABEL.Activate
.DA TLINE.Activate
.DA TBOX.Activate
.DA LBOX.Activate
.DA CBOX.Activate
.DA BUT.Activate
.DA RADIO.Activate
*--------------------------------------
J.ObjDeactivate .DA SCRN.Deactivate
.DA DLG.Deactivate
.DA LABEL.Deactivate
.DA TLINE.Deactivate
.DA TBOX.Deactivate
.DA LBOX.Deactivate
.DA CBOX.Deactivate
.DA BUT.Deactivate
.DA RADIO.Deactivate
*--------------------------------------
J.TBOX.RUN .DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.SelBegin Ctrl-B
.DA TBOX.RUN.Ignore Ctrl-C
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.SelEnd Ctrl-E
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.SOL Ctrl-G
.DA TBOX.RUN.BS
.DA TBOX.RUN.Ignore TAB
.DA TBOX.RUN.LF
.DA TBOX.RUN.VT
.DA TBOX.RUN.EOL Ctrl-L
.DA TBOX.RUN.CR
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.PGUP Ctrl-O
.DA TBOX.RUN.PGDN Ctrl-P
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Home Ctrl-T
.DA TBOX.RUN.FS
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.EraseCL Ctrl-W
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.EOF Ctrl-Y
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
.DA TBOX.RUN.Ignore
*--------------------------------------
L.SEQ.INIT .DA SEQ.INIT
L.SEQ.GOTOXY .DA SEQ.GOTOXY
L.SEQ.COLOR .DA SEQ.COLOR
L.SEQ.CLOSE .DA SEQ.CLOSE
L.FMT.ESCCSI.R .DA FMT.ESCCSI.R
.DA 0
*--------------------------------------
LIB.LOAD lda LibCnt
bne .8
>LDYAI 512
>SYSCALL2 GetMem
bcs .9
>STYA LineBuf
stx hLineBuf
.8 inc LibCnt
clc
.9 rts
*--------------------------------------
LIB.UNLOAD dec LibCnt
bne .8
lda hLineBuf
>SYSCALL2 FreeMem
.8 clc
rts
*--------------------------------------
LIB.GetCTX >SYSCALL2 GetMemPtr
>STYA ZPCtxPtr
rts
*--------------------------------------
LIB.GetOBJ >SYSCALL2 GetMemPtr
>STYA ZPObjPtr
rts
*--------------------------------------
.INB usr/src/lib/libtui.s.lb
.INB usr/src/lib/libtui.s.ctx
.INB usr/src/lib/libtui.s.cont
.INB usr/src/lib/libtui.s.obj
.INB usr/src/lib/libtui.s.scrn
.INB usr/src/lib/libtui.s.dlg
.INB usr/src/lib/libtui.s.label
.INB usr/src/lib/libtui.s.tline
.INB usr/src/lib/libtui.s.tbox
.INB usr/src/lib/libtui.s.lbox
.INB usr/src/lib/libtui.s.cbox
.INB usr/src/lib/libtui.s.but
.INB usr/src/lib/libtui.s.radio
*--------------------------------------
CS.END
*--------------------------------------
LibCnt .BS 1
hLineBuf .BS 1
LineBuf .BS 2
*--------------------------------------
ESC.In .AS "DBAC"
ESC.Out .DA #C.BS,#C.LF,#C.VT,#C.FS
*--------------------------------------
FMT.ESCCSI.R .AZ "%d;%d"
*--------------------------------------
OBJ.SIZES .DA S.SCRN,S.DLG,S.LABEL,S.TLINE,S.TBOX,S.LBOX,S.CBOX,S.BUT,S.RADIO
*--------------------------------------
OBJ.COLORS .DA #93,#44 SCRN
.DA #93,#46 DLG
.DA #93,#0 LABEL
.DA #93,#104 TLINE
.DA #93,#104 TBOX
.DA #93,#104 LBOX
.DA #93,#0 CBOX
.DA #92,#100 BUT
.DA #93,#0 RADIO
*--------------------------------------
SEQ.INIT .DA #C.ESC
.AS "c" FF
.DA #C.ESC
.AS "[999;999H" Set Cursor Pos to 999,999
.DA #C.ESC
.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
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s
ASM