A2osX/LIB/LIBTUI.S.txt
2021-04-29 13:56:34 +02:00

142 lines
2.7 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/libtui.i
*--------------------------------------
.DUMMY
.OR ZPLIB
hCtx .BS 1
.BS 1
ZPCtxPtr .BS 2
ZPObjPtr .BS 2
ZPPtr1 .BS 2
.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 LIBTUI.Init
.DA LIBTUI.Close
*--------------------------------------
L.SEQ.INIT .DA SEQ.INIT
.DA 0
*--------------------------------------
LIB.LOAD clc
rts
*--------------------------------------
LIB.UNLOAD clc
rts
*--------------------------------------
LIBTUI.Init >LDYAI 256
>SYSCALL GetMem
bcs .9
txa
* clc
.9 rts
*--------------------------------------
LIBTUI.Close clc
rts
*--------------------------------------
LIBTUI.LBOXNew >PULLB hCtx
>SYSCALL GetMemPtr
>STYA ZPCtxPtr
>PULLW ZPPtr1
>LDYAI S.LBOX
>SYSCALL GetMem
bcs .9
>STYA ZPObjPtr
lda #S.OBJ.T.LBOX
sta (ZPObjPtr)
ldy #S.OBJ.P
lda hCtx
sta (ZPObjPtr),y
iny #S.OBJ.F
.1 lda (ZPPtr1),y
sta (ZPObjPtr),y
cpy #S.OBJ.H+1
bne .1
.8 txa
clc
.9 rts
*--------------------------------------
LIBTUI.LBOXLoad >SYSCALL GetMemPtr
>STYA ZPObjPtr
rts
*--------------------------------------
LIBTUI.LBOXFocus
*--------------------------------------
LIBTUI.LBOXRun
*--------------------------------------
LIBTUI.LBOXClose
clc
rts
*--------------------------------------
LIBGUI.SetupX2Y2
ldy #S.OBJ.X1
jsr .1
ldy #S.OBJ.Y1
.1 clc
lda (ZPObjPtr),y
iny
iny S.OBJ.W/H
adc (ZPObjPtr),y
iny
iny S.OBJ.X2/Y2
sta (ZPObjPtr),y
rts
*--------------------------------------
LIBTUI.DrawFrame
*--------------------------------------
CS.END
*--------------------------------------
SEQ.INIT .AS "\ec\e(B\e)0"
SEQ.SCROLLRGN .AZ "\e[?7l\e[2;%dr"
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 .AZ "\ec"
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s
ASM