mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-30 23:49:37 +00:00
106 lines
1.7 KiB
Plaintext
106 lines
1.7 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*/--------------------------------------
|
||
* # tuiInit
|
||
* Initialize screen & create a new context
|
||
* ## C
|
||
* `short int hCTX tuiInit();`
|
||
* ## ASM
|
||
* `>LIBCALL hLIBTUI,LIBTUI.Init`
|
||
* ## RETURN VALUE
|
||
* CC = success, A = hCTX
|
||
*\--------------------------------------
|
||
CTX.Init >LDYA L.SEQ.INIT
|
||
jsr IO.fputs
|
||
bcs .99
|
||
|
||
>LDYAI S.CTX
|
||
>SYSCALL2 GetMem
|
||
bcs .99
|
||
|
||
>STYA ZPCtxPtr
|
||
txa
|
||
>PUSHA hCTX
|
||
|
||
lda #0
|
||
>PUSHA Init Counter
|
||
|
||
ldy #S.CTX-1
|
||
|
||
.10 sta (ZPCtxPtr),y
|
||
dey
|
||
bpl .10
|
||
|
||
jsr IO.GetC.Reset
|
||
|
||
.1 jsr IO.GetC
|
||
bcs .98
|
||
|
||
.2 ldy #S.CTX.W
|
||
lda (ZPCtxPtr),y
|
||
bne .8
|
||
|
||
.3 lda (pStack)
|
||
|
||
dec
|
||
sta (pStack)
|
||
bne .1
|
||
|
||
lda #80
|
||
ldy #S.CTX.W
|
||
sta (ZPCtxPtr),y
|
||
|
||
lda #24
|
||
iny S.CTX.H
|
||
sta (ZPCtxPtr),y
|
||
|
||
.8 inc pStack Discard counter
|
||
|
||
>PULLA hCTX
|
||
clc
|
||
.99 rts
|
||
|
||
.98 pha
|
||
inc pStack Discard counter
|
||
>PULLA hCTX
|
||
>SYSCALL2 FreeMem
|
||
pla
|
||
sec
|
||
|
||
rts
|
||
*/--------------------------------------
|
||
* # tuiClose
|
||
* destroy context
|
||
* ## C
|
||
* `void fastcall tuiClose(short int hCTX);`
|
||
* ## ASM
|
||
* `lda hCTX`
|
||
* `>LIBCALL hLIBTUI,LIBTUI.Close`
|
||
* ## RETURN VALUE
|
||
* CC = success
|
||
*\--------------------------------------
|
||
CTX.Close pha
|
||
|
||
>SYSCALL2 GetMemPtr
|
||
>STYA ZPCtxPtr
|
||
|
||
lda (ZPCtxPtr) S.CTX.hSCRN
|
||
beq .1
|
||
|
||
jsr LIB.Destroy
|
||
|
||
.1 pla
|
||
>SYSCALL2 FreeMem
|
||
|
||
>LDYA L.SEQ.CLOSE
|
||
jsr IO.fputs
|
||
|
||
clc
|
||
CTX.Close.RTS rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/lib/libtui.s.ctx
|
||
LOAD usr/src/lib/libtui.s
|
||
ASM
|