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.COut			sta (ZPLineBufPtr)
				inc ZPLineBufPtr
				bne .1

				inc ZPLineBufPtr+1

.1				inc ZPLineBufCnt
				bne .8
	
				inc ZPLineBufCnt+1
				
.8				rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.lb
LOAD usr/src/lib/libtui.s
ASM
