2021-12-02 21:28:26 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
2022-09-04 20:12:49 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # tuiInit
|
|
|
|
|
* Initialize screen & create a new context
|
|
|
|
|
* ## C
|
|
|
|
|
* `short int hCTX tuiInit();`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>LIBCALL hLIBTUI,LIBTUI.Init`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC = success, A = hCTX
|
|
|
|
|
*\--------------------------------------
|
2021-12-02 21:28:26 +00:00
|
|
|
|
CTX.Init >LDYA L.SEQ.INIT
|
2023-03-26 17:42:38 +00:00
|
|
|
|
jsr IO.fputs
|
2021-12-02 21:28:26 +00:00
|
|
|
|
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
|
|
|
|
|
|
2023-03-26 17:42:38 +00:00
|
|
|
|
jsr IO.GetC.Reset
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-04-22 18:58:37 +00:00
|
|
|
|
.1 jsr IO.GetC
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
.2 ldy #S.CTX.W
|
|
|
|
|
lda (ZPCtxPtr),y
|
|
|
|
|
bne .8
|
|
|
|
|
|
2023-03-26 17:42:38 +00:00
|
|
|
|
.3 lda (pStack)
|
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
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
|
2023-03-26 17:42:38 +00:00
|
|
|
|
|
2021-12-02 21:28:26 +00:00
|
|
|
|
>PULLA hCTX
|
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.98 pha
|
|
|
|
|
inc pStack Discard counter
|
|
|
|
|
>PULLA hCTX
|
|
|
|
|
>SYSCALL2 FreeMem
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
rts
|
2022-09-04 20:12:49 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # tuiClose
|
|
|
|
|
* destroy context
|
|
|
|
|
* ## C
|
|
|
|
|
* `void fastcall tuiClose(short int hCTX);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `lda hCTX`
|
|
|
|
|
* `>LIBCALL hLIBTUI,LIBTUI.Close`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC = success
|
|
|
|
|
*\--------------------------------------
|
2023-02-10 18:19:29 +00:00
|
|
|
|
CTX.Close pha
|
|
|
|
|
|
|
|
|
|
>SYSCALL2 GetMemPtr
|
|
|
|
|
>STYA ZPCtxPtr
|
2023-03-26 17:42:38 +00:00
|
|
|
|
|
2023-02-10 18:19:29 +00:00
|
|
|
|
lda (ZPCtxPtr) S.CTX.hSCRN
|
|
|
|
|
beq .1
|
2023-03-26 17:42:38 +00:00
|
|
|
|
|
2023-02-10 18:19:29 +00:00
|
|
|
|
jsr LIB.Destroy
|
|
|
|
|
|
|
|
|
|
.1 pla
|
|
|
|
|
>SYSCALL2 FreeMem
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.SEQ.CLOSE
|
2023-03-26 17:42:38 +00:00
|
|
|
|
jsr IO.fputs
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
CTX.Close.RTS rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/lib/libtui.s.ctx
|
|
|
|
|
LOAD usr/src/lib/libtui.s
|
|
|
|
|
ASM
|