A2osX/LIB/LIBTUI.S.LB.txt

155 lines
2.3 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
LB.Init >LDYA LineBuf
>STYA ZPLineBufPtr
stz ZPLineBufCnt
stz ZPLineBufCnt+1
rts
*--------------------------------------
LB.SeqOut lda SEQS,x
beq .8
jsr LB.COut
inx
bra LB.SeqOut
.8 rts
*--------------------------------------
LB.GotoXY >PUSHW ZPLineBufPtr
>PUSHW L.SEQ.GOTOXY
tya
inc
>PUSHA
txa
inc
>PUSHA
>PUSHBI 2
jmp LB.PrintF
*--------------------------------------
LB.SetColor >PUSHW ZPLineBufPtr
>PUSHW L.SEQ.COLOR
lda (ZPObjPtr)
tax
>PUSHB OBJ.COLORS,x
lda OBJ.COLORS+1,x
bne .7
ldy #S.OBJ.hParent
lda (ZPObjPtr),y
beq .7
>SYSCALL2 GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
tax
lda OBJ.COLORS+1,x
.7 >PUSHA
>PUSHBI 2
jmp LB.PrintF
*--------------------------------------
LB.Ptr1OutEscMaxX
ldy #0
.1 lda (ZPPtr1),y
beq .8
cmp #C.CR
beq .8
jsr LB.COut
iny
dex
bne .1
.8 rts
*--------------------------------------
LB.PrintF >SYSCALL2 SPrintF
tya
clc
adc ZPLineBufPtr
sta ZPLineBufPtr
bcc .1
inc ZPLineBufPtr+1
clc
.1 tya
adc ZPLineBufCnt
sta ZPLineBufCnt
bcc .8
inc ZPLineBufCnt+1
clc
.8 rts
*--------------------------------------
LB.HexOut pha
lsr
lsr
lsr
lsr
jsr .1
pla
and #$0F
.1 ora #$30
cmp #'9'+1
bcc LB.COut
adc #6
*--------------------------------------
LB.COut sta (ZPLineBufPtr)
inc ZPLineBufPtr
bne .1
inc ZPLineBufPtr+1
.1 inc ZPLineBufCnt
bne .8
inc ZPLineBufCnt+1
.8 rts
*--------------------------------------
LB.Out ldx ZPCtxPtr
phx
ldx ZPCtxPtr+1
phx
ldx ZPObjPtr
phx
ldx ZPObjPtr+1
phx
ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHW LineBuf
>PUSHW ZPLineBufCnt
>SYSCALL fwrite
plx
stx ZPObjPtr+1
plx
stx ZPObjPtr
plx
stx ZPCtxPtr+1
plx
stx ZPCtxPtr
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.lb
LOAD usr/src/lib/libtui.s
ASM