A2osX/LIB/LIBTUI.S.TLINE.txt

329 lines
4.9 KiB
Plaintext
Raw Permalink Normal View History

NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* TLINE.New hParent,X1,Y1,W,pBuf,MaxLen,F 8
*--------------------------------------
TLINE.New lda #S.OBJ.T.TLINE
jsr OBJ.Create
bcs .9
>PULLA
ldy #S.OBJ.F
ora #S.OBJ.F.bHScroll+S.OBJ.F.bEdit
sta (ZPObjPtr),y
jsr OBJ.PullBuf
>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 CONT.Insert
bcs .99
lda hObj
* clc
rts
.9 >POP 8
.99 rts
*--------------------------------------
TLINE.Run ldy #S.OBJ.S
lda (ZPObjPtr),y
bpl .9 S.OBJ.S.bActive
2024-01-25 18:44:59 +00:00
jsr OBJ.GetpBufPtr1
ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
tya
ldy #S.TLINE.Len
sta (ZPObjPtr),y
lda (pStack) Event
cmp #C.DEL
beq TLINE.RUN.DEL
cmp #C.SPACE
bcs .2
cmp #C.BS
beq TLINE.RUN.BS
cmp #21 Forward Space
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
.3 dey
lda (ZPPtr1),y
iny
sta (ZPPtr1),y
dey
cpy TempW
bne .3
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
*--------------------------------------
2024-01-25 18:44:59 +00:00
TLINE.Draw jsr OBJ.GetpBufPtr1
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