NEW
  AUTO 3,1
				.LIST OFF
*--------------------------------------
LBOX.New		
				clc
				rts
*--------------------------------------
LBOX.Destroy
				clc
				rts
*--------------------------------------
LBOX.Run		lda (pStack)			Event
				cmp #C.LF
				bne .5

				
				clc
				rts
				
.5				cmp #C.VT
				bne .9


				clc
				rts

.9				sec
				rts
*--------------------------------------
LBOX.Draw		ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				clc
				adc (pStack)			Relative Y

				tax
				jsr LBOX.GetLineX
				bcs .5
				
				txa
				ldy #S.LBOX.Idx
				cmp (ZPObjPtr),y
				bne .1
	
				ldx #SEQ.INVERSE-SEQS
				jsr LIB.LineBufSeqOut
	
.1				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y
				tax

				ldy #0

.2				lda (ZPPtr1),y
				beq .3

				jsr LIB.LineBufCOut
				iny
				dex
				bne .2

.3				txa
				beq .8

				bra .6

.5				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y

				tax
				
.6				lda #C.SPACE

.7				jsr LIB.LineBufCOut
				dex
				bne .7
				
.8				clc
				rts
*--------------------------------------
LBOX.GetLineX	stz TempI
				
				ldy #S.LBOX.pL
				lda (ZPObjPtr),y
				sta ZPPtr1
				iny
				lda (ZPObjPtr),y
				sta ZPPtr1+1
				
.1				cpx TempI
				beq .8

.2				inc TempI

				ldy #$ff

.4				iny
				lda (ZPPtr1),y
				bne .4

				tya
				beq .9

				sec
				adc ZPPtr1
				sta ZPPtr1
				bcc .1
				
				inc ZPPtr1+1
				bra .1

.8				clc
				rts
				
.9				sec
				rts
*--------------------------------------
LBOX.Activate
				clc
				rts
*--------------------------------------
LBOX.Deactivate
				clc
				rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.lbox
LOAD usr/src/lib/libtui.s
ASM
