A2osX/LIB/LIBTUI.S.TLINE.txt

321 lines
4.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* TLINE.New hParent,X1,Y1,W,pBuf,MaxLen 8
*--------------------------------------
TLINE.New lda #S.OBJ.T.TLINE
jsr OBJ.Create
bcs .9
jsr OBJ.PullBuf
ldy #S.OBJ.F
lda #S.OBJ.F.bHScroll+S.OBJ.F.bCursor
sta (ZPObjPtr),y
>PULLA
ldy #S.OBJ.W
sta (ZPObjPtr),y
iny S.OBJ.H
lda #1
sta (ZPObjPtr),y
ldy #S.OBJ.CurX
sta (ZPObjPtr),y
jsr OBJ.PullY1X1hParent
jsr OBJ.Insert
bcs .99
lda hObj
* clc
rts
.9 >POP 7
.99 rts
*--------------------------------------
TLINE.Destroy clc
rts
*--------------------------------------
TLINE.Run ldy #S.OBJ.S
lda (ZPObjPtr),y
bpl .9 S.OBJ.S.bActive
jsr OBJ.GetBuf
lda (pStack) Event
cmp #C.DEL
beq TLINE.RUN.DEL
cmp #C.SPACE
bcs .2
cmp #C.BS
beq TLINE.RUN.BS
cmp #C.FS
beq TLINE.RUN.FS
.9 lda #0
sec
rts
*--------------------------------------
.2 ldy #S.OBJ.BufSize
lda (ZPObjPtr),y
ldy #S.TLINE.Len
cmp (ZPObjPtr),y
beq .8
lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
pha
ldy #S.TLINE.Ptr
lda (ZPObjPtr),y
sta TempW
inc
sta (ZPObjPtr),y
ply
.1 dey
lda (ZPPtr1),y
iny
sta (ZPPtr1),y
dey
cpy TempW
bne .1
lda (pStack)
ldy TempW
sta (ZPPtr1),y
jmp TLINE.SetViewPort
.8 lda #0
clc
rts
*--------------------------------------
TLINE.RUN.BS ldy #S.TLINE.Ptr
lda (ZPObjPtr),y
beq .8
dec
sta (ZPObjPtr),y
jmp TLINE.SetViewPort
.8 clc
rts
*--------------------------------------
TLINE.RUN.FS ldy #S.TLINE.Len
lda (ZPObjPtr),y
ldy #S.TLINE.Ptr
eor (ZPObjPtr),y
beq .8
lda (ZPObjPtr),y
inc
sta (ZPObjPtr),y
jmp TLINE.SetViewPort
.8 clc
rts
*--------------------------------------
TLINE.RUN.DEL ldy #S.TLINE.Ptr
lda (ZPObjPtr),y
beq .8
tay
.1 lda (ZPPtr1),y
dey
sta (ZPPtr1),y
tax
beq .2
iny
iny
bra .1
.2 ldy #S.TLINE.Len
lda (ZPObjPtr),y
dec
sta (ZPObjPtr),y
jmp TLINE.RUN.BS
.8 clc
rts
*--------------------------------------
TLINE.Draw jsr OBJ.GetBuf
ldx #C.SPACE
ldy #S.OBJ.S
lda (ZPObjPtr),y S.OBJ.S.bActive
bpl .1
ldx #'['
.1 txa
jsr LB.COut
ldy #S.TLINE.HScroll
lda (ZPObjPtr),y
beq .12
tax
.11 jsr TLINE.GetLineChar
beq .12
dex
bne .11
.12 ldy #S.OBJ.InnerW
lda (ZPObjPtr),y
tax
dex
dex
.2 jsr TLINE.GetLineChar
beq .3
jsr LB.COut
dex
bne .2
.3 txa
beq .5
lda #C.SPACE
.4 jsr LB.COut
dex
bne .4
.5 ldx #C.SPACE
ldy #S.OBJ.S
lda (ZPObjPtr),y S.OBJ.S.bActive
bpl .6
ldx #']'
.6 txa
jsr LB.COut
.8 clc
rts
*--------------------------------------
TLINE.Activate
TLINE.Deactivate
jmp OBJ.Draw.Body
*--------------------------------------
TLINE.GetLineChar
lda (ZPPtr1)
beq .8
inc ZPPtr1
bne .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
TLINE.SetViewPort
ldy #S.TLINE.Ptr
lda (ZPObjPtr),y
ldy #S.TLINE.HScroll
sec
sbc (ZPObjPtr),y
ldy #S.OBJ.CurX set CurX = Ptr - HScroll
inc +1
sta (ZPObjPtr),y
bcs .10 yes..
ldy #S.TLINE.Ptr no, set HScroll = Ptr
lda (ZPObjPtr),y
ldy #S.TLINE.HScroll
sta (ZPObjPtr),y
lda #0 set CurX = 0+1
bra .20
*--------------------------------------
.10 ldy #S.TLINE.HScroll
lda (ZPObjPtr),y
ldy #S.OBJ.InnerW
clc
adc (ZPObjPtr),y
dec
dec
ldy #S.TLINE.Ptr (HScroll + InnerW-2) > (Ptr + 1) ?
clc Ptr+1
sbc (ZPObjPtr),y
bcs .8 no...
ldy #S.OBJ.InnerW yes, set HScroll = Ptr - (InnerW - 1)
lda (ZPObjPtr),y
dec
dec
dec
sta TempW (InnerW - 1)
ldy #S.TLINE.Ptr
lda (ZPObjPtr),y
sec
sbc TempW
bcc .12 Ptr - (InnerW - 1) < 0
ldy #S.TLINE.HScroll
sta (ZPObjPtr),y
lda TempW set CurX = (InnerW - 1)
bra .20
.12 lda #0
ldy #S.TLINE.HScroll
sta (ZPObjPtr),y
.20 inc
ldy #S.OBJ.CurX
sta (ZPObjPtr),y
sec
ror bRepaintAll
.8 ldy #1 hObj
lda (pStack),y
>PUSHA
jsr OBJ.Draw.Body
inc pStack
bcs .9
lda #0
* clc
.9 rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.tline
LOAD usr/src/lib/libtui.s
ASM