A2osX/BIN/EDIT.S.SCRN.txt

631 lines
10 KiB
Plaintext
Raw Normal View History

2016-01-04 07:25:43 +00:00
NEW
2019-05-27 06:01:59 +00:00
AUTO 3,1
2016-01-04 07:25:43 +00:00
.LIST OFF
*--------------------------------------
2019-11-06 16:25:00 +00:00
SCRN.Init >LDA.G ScreenH
2016-01-04 07:25:43 +00:00
dec
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 1
2016-01-04 07:25:43 +00:00
>LDYA L.SEQ.INIT
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2016-01-04 07:25:43 +00:00
bcs .9
2019-11-04 07:21:40 +00:00
2019-12-17 12:28:49 +00:00
jsr SCRN.Home
2019-12-18 07:57:47 +00:00
jsr SCRN.UpdateMainAndStatus
bcs .9
jmp SCRN.UpdateTopBar
2016-01-04 07:25:43 +00:00
.9 rts
*--------------------------------------
2019-11-04 13:41:58 +00:00
SCRN.Home lda #0
2019-11-17 14:39:55 +00:00
ldy #FileX Zero FileXY,ScreenXY & CurXY
2019-11-04 13:41:58 +00:00
.1 sta (pData),y
iny
2019-11-13 16:33:29 +00:00
cpy #CurY+1
2019-11-04 13:41:58 +00:00
bne .1
rts
*--------------------------------------
2019-11-18 16:40:32 +00:00
SCRN.ResetScrollRgn
>LDA.G ScreenH
dec
>PUSHA
>PUSHBI 1
>LDYA L.SEQ.SCROLLRGN
>SYSCALL printf
rts
*--------------------------------------
2019-12-17 12:28:49 +00:00
SCRN.UnSaved >LDA.G bUnSaved
2019-12-16 13:14:11 +00:00
bne .8
dec
sta (pData),y
bra SCRN.UpdateTopBar
.8 clc
rts
*--------------------------------------
2019-11-04 07:21:40 +00:00
SCRN.UpdateTopBar
2019-12-18 07:57:47 +00:00
lda #$ff
>STA.G bUpdateTop
clc
rts
*--------------------------------------
SCRN.UpdateTopBarAsync
>LDA.G bUpdateTop
bpl .8
lda #0
sta (pData),y
2019-12-09 07:12:14 +00:00
jsr SCRN.LineBufInitBar
2019-12-18 07:57:47 +00:00
ldx #SEQ.CURSAVE-SEQS
jsr SCRN.SEQS.ToLineBuf
ldy #1
jsr SCRN.LineBufGotoLineY
bcs .9
2019-12-09 07:12:14 +00:00
>LDA.G ScreenW
tax
lda #C.SPACE
.1 jsr SCRN.ToLineBuf
dex
bne .1
lda #C.CR
jsr SCRN.ToLineBuf
2019-11-18 16:40:32 +00:00
2019-11-12 16:39:22 +00:00
>LDA.G FileType
tax
>PUSHW L.MSG.FILETYPES,x
2019-11-04 07:21:40 +00:00
2018-08-23 20:38:32 +00:00
>LDA.G hFileName
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2019-11-27 16:47:13 +00:00
>PUSHYA
2019-11-12 16:39:22 +00:00
>PUSHBI 4
2019-11-04 07:21:40 +00:00
>PUSHW L.MSG.TOPBAR
2019-12-09 07:12:14 +00:00
jsr SCRN.LineBufSprintf
2019-11-04 07:21:40 +00:00
bcs .9
2019-12-16 13:14:11 +00:00
>LDA.G bUnSaved
2019-12-18 07:57:47 +00:00
beq .2
2019-11-04 07:21:40 +00:00
2019-12-16 13:14:11 +00:00
lda #'*'
2019-12-09 07:12:14 +00:00
jsr SCRN.ToLineBuf
2019-11-04 07:21:40 +00:00
2019-12-18 07:57:47 +00:00
.2 ldx #SEQ.CURRESTORE-SEQS
jsr SCRN.SEQS.ToLineBuf
jmp SCRN.LineBufOut
.8 clc
2019-11-04 07:21:40 +00:00
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
SCRN.UpdateViewPort
stz bRepaint
.1 >LDA.G FileX
>CMP.G ScreenX
bcs .2 out of left border ?
>DEC.G ScreenX yes
sec
ror bRepaint
bra .1
.2 bit bRepaint
bmi .30
.21 >LDA.G ScreenX
clc
>ADC.G ScreenW
dec
>CMP.G FileX
bcs .3 out of right border ?
>INC.G ScreenX
sec
ror bRepaint
bra .21
.3 bit bRepaint
.30 bmi .6
.31 >LDA.G FileY+1
tax
dey
lda (pData),y A,X = FileY
>CMP.G ScreenY
iny
txa
sbc (pData),y
bcs .4 out of top border ?
>DECW.G ScreenY move viewport up one line....
bit bRepaint
bmi .31 skip scroll, will be repainted later
jsr SCRN.scrollDn ...and move content one line down
bcc .31
rts
.4 bit bRepaint
bmi .6
.41 >LDA.G ScreenY+1
tax
dey
lda (pData),y
clc
>ADC.G ViewPortHm1
bcc .5
inx
.5 >CMP.G FileY A,X = screen bottom
txa
iny FileY > screen bottom ?
sbc (pData),y
bcs .6 CS : fileY>= screen bottom
>INCW.G ScreenY move viewport down one line....
bit bRepaint
bmi .41
jsr SCRN.scrollUp ...and move content one line up
bcc .41
.9 rts
.6 >LDA.G FileX
sec
>SBC.G ScreenX
>STA.G CurX
>LDA.G FileY
sec
>SBC.G ScreenY
>STA.G CurY
2019-12-17 12:28:49 +00:00
jsr BUF.ComputeCOffset
jsr SCRN.GotoCurXCurY
bit bRepaint
2019-12-17 12:28:49 +00:00
bmi SCRN.UpdateMain
2019-12-17 12:28:49 +00:00
jmp SCRN.UpdateStatusBar
*--------------------------------------
SCRN.UpdateMainAndStatus
jsr SCRN.UpdateStatusBar
*--------------------------------------
2018-08-23 20:38:32 +00:00
SCRN.UpdateMain >LDA.G ScreenY
2016-01-04 07:25:43 +00:00
sta TmpIndex
iny
lda (pData),y
sta TmpIndex+1
2019-11-18 16:40:32 +00:00
stz TmpByte
2018-08-23 20:38:32 +00:00
>LDA.G ViewPortH
2019-11-18 16:40:32 +00:00
bra SCRN.UpdateMain.1
SCRN.UpdateLast >LDA.G ViewPortHm1
sta TmpByte
clc
>ADC.G ScreenY
sta (pData),y
iny
lda (pData),y
adc #0
sta (pData),y
lda #1
SCRN.UpdateMain.1
2016-01-04 07:25:43 +00:00
sta TmpCount
2019-11-18 16:40:32 +00:00
.1 lda TmpIndex
ldx TmpIndex+1
2019-11-17 14:39:55 +00:00
2016-01-04 07:25:43 +00:00
jsr BUF.GetLineAX Y = line length
bcs .5
lda TmpByte
2016-01-21 07:05:23 +00:00
jsr SCRN.UpdateLineAtALenY
2019-05-28 16:00:53 +00:00
bcs SCRN.UpdateMain.9
2019-11-04 07:21:40 +00:00
.3 inc TmpByte
inc TmpIndex
2016-01-04 07:25:43 +00:00
bne .4
2019-11-04 07:21:40 +00:00
2016-01-04 07:25:43 +00:00
inc TmpIndex+1
.4 dec TmpCount
2016-01-04 07:25:43 +00:00
bne .1
2019-11-04 07:21:40 +00:00
2019-11-13 16:33:29 +00:00
bra .8
2019-11-04 07:21:40 +00:00
2016-01-04 07:25:43 +00:00
.5 ldx #0
ldy TmpByte
2019-11-04 07:21:40 +00:00
jsr SCRN.GotoXY
2019-05-28 16:00:53 +00:00
bcs SCRN.UpdateMain.9
2019-11-04 07:21:40 +00:00
2018-08-22 15:23:27 +00:00
>PUSHBI 0
2016-01-04 07:25:43 +00:00
>LDYA L.SEQ.CEOL
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2019-05-28 16:00:53 +00:00
bcs SCRN.UpdateMain.9
2019-11-04 07:21:40 +00:00
inc TmpByte
dec TmpCount
2016-01-04 07:25:43 +00:00
bne .5
2019-11-04 07:21:40 +00:00
2019-12-16 13:14:11 +00:00
.8 jsr BUF.ComputeCOffset
jmp SCRN.GotoCurXCurY
2019-05-28 16:00:53 +00:00
SCRN.UpdateMain.9
rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-12-18 07:57:47 +00:00
SCRN.UpdateCurrentEOL
jsr SCRN.LineBufInitEdit
bra SCRN.UpdateLineAtBufPtr
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateCurrentLine
2018-08-23 20:38:32 +00:00
>LDA.G ScreenY+1
2016-01-04 07:25:43 +00:00
tax
dey
lda (pData),y
clc
2018-08-23 20:38:32 +00:00
>ADC.G CurY
2016-01-04 07:25:43 +00:00
bcc .1
2019-11-04 13:41:58 +00:00
2016-01-04 07:25:43 +00:00
inx
2019-11-04 13:41:58 +00:00
2016-01-04 07:25:43 +00:00
.1 jsr BUF.GetLineAX
2019-05-28 16:00:53 +00:00
bcs SCRN.UpdateMain.9
2016-01-04 07:25:43 +00:00
phy
2018-08-23 20:38:32 +00:00
>LDA.G CurY
2016-01-04 07:25:43 +00:00
ply
2019-05-28 16:00:53 +00:00
*--------------------------------------
* A = Target Screen Y position
* BufPtr = Text line start, Y = len
2016-01-04 07:25:43 +00:00
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateLineAtALenY
2016-01-04 07:25:43 +00:00
sty TmpLen
2019-12-18 07:57:47 +00:00
inc
inc
sta TmpLen+1
2019-11-13 16:33:29 +00:00
2019-12-18 21:52:43 +00:00
jsr SCRN.LineBufInitEdit
ldy TmpLen+1
jsr SCRN.LineBufGotoLineY
2018-08-23 20:38:32 +00:00
>LDA.G ScreenX
2019-05-28 16:00:53 +00:00
cmp TmpLen
2019-12-18 21:52:43 +00:00
bcs SCRN.UpdateLineAtBufPtr.END
2019-12-18 07:57:47 +00:00
2019-12-18 21:52:43 +00:00
tay
2019-05-28 16:00:53 +00:00
clc
adc BUF.LOffset
sta BUF.COffset
lda #0
adc BUF.LOffset+1
sta BUF.COffset+1
2019-11-04 07:21:40 +00:00
2019-05-28 16:00:53 +00:00
tya
* clc
adc BufPtr
sta BufPtr
2019-12-18 07:57:47 +00:00
bcc .2
2019-05-28 16:00:53 +00:00
inc BufPtr+1
2019-12-18 21:52:43 +00:00
.2
2019-12-18 07:57:47 +00:00
SCRN.UpdateLineAtBufPtr
>LDA.G ScreenW
tax
stz bSelected
.2 lda (BufPtr)
2019-05-28 16:00:53 +00:00
beq .8
2019-11-04 07:21:40 +00:00
2018-11-15 15:04:14 +00:00
cmp #C.CR
2019-05-28 16:00:53 +00:00
beq .8
2018-11-15 15:04:14 +00:00
2016-01-04 07:25:43 +00:00
jsr BUF.CheckSelected
2019-05-28 16:00:53 +00:00
eor bSelected
bpl .5
2019-11-04 07:21:40 +00:00
2019-05-29 05:58:28 +00:00
jsr SCRN.ToggleSel
2019-11-04 07:21:40 +00:00
2019-05-28 16:00:53 +00:00
.5 lda (BufPtr)
2019-05-29 15:21:14 +00:00
cmp #'\'
2019-08-26 06:29:18 +00:00
beq .50
cmp #'%'
2019-05-29 15:21:14 +00:00
bne .51
2019-11-04 07:21:40 +00:00
2019-08-26 06:29:18 +00:00
.50 pha
lda #'\'
2019-05-29 15:21:14 +00:00
jsr SCRN.ToLineBuf
2019-08-26 06:29:18 +00:00
pla
2019-11-04 07:21:40 +00:00
2019-08-26 06:29:18 +00:00
.51 jsr SCRN.ToLineBuf
inc BufPtr
2019-05-28 16:00:53 +00:00
bne .6
inc BufPtr+1
2019-11-04 07:21:40 +00:00
2019-05-28 16:00:53 +00:00
.6 inc BUF.COffset
bne .7
inc BUF.COffset+1
.7 dex
2019-12-18 07:57:47 +00:00
bne .2
2019-11-04 07:21:40 +00:00
2019-05-28 16:00:53 +00:00
.8 bit bSelected
2019-12-18 21:52:43 +00:00
bpl SCRN.UpdateLineAtBufPtr.END
2019-05-28 16:00:53 +00:00
jsr SCRN.ToggleSel
2018-08-23 20:38:32 +00:00
2019-12-18 21:52:43 +00:00
SCRN.UpdateLineAtBufPtr.END
ldx #SEQ.CEOL-SEQS
jsr SCRN.SEQS.ToLineBuf
jmp SCRN.LineBufOut
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-12-11 13:14:56 +00:00
SCRN.ToggleSel ldy #SEQ.NORM-SEQS
2019-05-28 16:00:53 +00:00
lda bSelected
2019-05-29 15:21:14 +00:00
eor #$ff
sta bSelected
2019-05-28 16:00:53 +00:00
bpl .1
2019-11-04 07:21:40 +00:00
2019-12-11 13:14:56 +00:00
ldy #SEQ.INV-SEQS
2019-05-28 16:00:53 +00:00
2019-12-11 13:14:56 +00:00
.1 lda SEQS,y
2019-05-28 16:00:53 +00:00
beq .8
2019-12-11 13:14:56 +00:00
2019-05-28 16:00:53 +00:00
jsr SCRN.ToLineBuf
iny
2019-05-29 15:21:14 +00:00
bra .1
2016-01-04 07:25:43 +00:00
2019-11-04 07:21:40 +00:00
.8
SCRN.ToggleSel.RTS
rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
SCRN.UpdateStatusBar
2019-12-17 12:28:49 +00:00
lda #$ff
>STA.G bUpdateStatus
clc
rts
*--------------------------------------
SCRN.UpdateStatusBarAsync
>LDA.G bUpdateStatus
bpl .8
lda #0
sta (pData),y
jsr SCRN.ResetStatusBar
2019-11-04 07:21:40 +00:00
2018-08-23 20:38:32 +00:00
>LDA.G FileY
2016-01-04 07:25:43 +00:00
tax
iny
2016-01-04 07:25:43 +00:00
lda (pData),y
inx
2019-12-09 07:12:14 +00:00
bne .2
2019-11-04 07:21:40 +00:00
inc
2019-11-04 07:21:40 +00:00
2019-12-09 07:12:14 +00:00
.2 >PUSHA
txa
>PUSHA
2018-08-23 20:38:32 +00:00
>LDA.G FileX
2016-01-04 07:25:43 +00:00
inc
>PUSHA
2019-11-04 07:21:40 +00:00
>PUSHW BUF.COffset
2019-11-06 13:14:42 +00:00
>PUSHW FileLen
2019-05-27 15:37:31 +00:00
2019-11-04 07:21:40 +00:00
>PUSHBI 7
2019-12-09 07:12:14 +00:00
>PUSHW L.MSG.STATUSBAR
jsr SCRN.LineBufSprintf
bcs .9
ldx #SEQ.CURRESTORE-SEQS
jsr SCRN.SEQS.ToLineBuf
2019-12-09 07:12:14 +00:00
jmp SCRN.LineBufOut
2019-12-16 13:14:11 +00:00
2019-12-17 12:28:49 +00:00
.8 clc
2019-12-09 07:12:14 +00:00
.9 rts
2019-05-29 15:21:14 +00:00
*--------------------------------------
SCRN.ResetStatusBar
jsr SCRN.LineBufInitBar
2019-12-17 12:28:49 +00:00
ldx #SEQ.CURSAVE-SEQS
jsr SCRN.SEQS.ToLineBuf
2019-12-18 07:57:47 +00:00
>LDA.G ScreenH
tay
jsr SCRN.LineBufGotoLineY
2019-11-04 07:21:40 +00:00
>LDA.G ScreenW
tax
lda #C.SPACE
2019-11-04 07:21:40 +00:00
.1 jsr SCRN.ToLineBuf
2019-11-04 07:21:40 +00:00
dex
bne .1
2019-11-04 07:21:40 +00:00
lda #C.CR
2019-12-17 12:28:49 +00:00
jmp SCRN.ToLineBuf
2019-05-29 15:21:14 +00:00
*--------------------------------------
SCRN.CursorAdjust
.1 jsr BUF.ComputeCOffset
bcc .8
>DECW.G FileY
>STZ.G FileX
bra .1
.8 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.GotoCurXCurY
ldy #CurX
2016-01-04 07:25:43 +00:00
lda (pData),y
tax
ldy #CurY
lda (pData),y
tay
2019-11-04 07:21:40 +00:00
SCRN.GotoXY txa
2016-01-04 07:25:43 +00:00
inc
>PUSHA
tya
inc
inc
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
2016-01-04 07:25:43 +00:00
>LDYA L.MSG.GOTOXY
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2019-11-04 16:14:25 +00:00
rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-11-13 16:33:29 +00:00
SCRN.scrollUp >PUSHBI 0
>LDYA L.SEQ.SCROLLUP
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2016-01-04 07:25:43 +00:00
bcs .9
2019-11-04 13:41:58 +00:00
2019-11-12 16:39:22 +00:00
>LDA.G ScreenY+1
2016-01-04 07:25:43 +00:00
tax
dey
lda (pData),y
2019-11-04 13:41:58 +00:00
2019-11-13 16:33:29 +00:00
* clc
2019-11-04 16:14:25 +00:00
>ADC.G ViewPortHm1
2016-01-04 07:25:43 +00:00
bcc .1
2019-11-04 13:41:58 +00:00
2016-01-04 07:25:43 +00:00
inx
2019-11-04 13:41:58 +00:00
2016-01-04 07:25:43 +00:00
.1 jsr BUF.GetLineAX
bcs .9
2019-11-04 13:41:58 +00:00
2019-12-18 07:57:47 +00:00
phy
2019-11-04 13:41:58 +00:00
>LDA.G ViewPortHm1
2019-12-18 07:57:47 +00:00
ply
2019-05-29 15:21:14 +00:00
jmp SCRN.UpdateLineAtALenY
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-11-13 16:33:29 +00:00
SCRN.scrollDn >PUSHBI 0
>LDYA L.SEQ.SCROLLDN
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
2019-11-12 16:39:22 +00:00
>LDA.G ScreenY+1
tax
dey
lda (pData),y
2019-11-04 13:41:58 +00:00
jsr BUF.GetLineAX
2016-01-04 07:25:43 +00:00
bcs .9
2019-12-18 07:57:47 +00:00
* >DEBUG
2016-01-04 07:25:43 +00:00
lda #0
2019-12-18 07:57:47 +00:00
jsr SCRN.UpdateLineAtALenY
* >DEBUG
2019-05-29 15:21:14 +00:00
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-12-09 07:12:14 +00:00
SCRN.LineBufInitBar
phx
ldx #SEQ.BAR-SEQS
bra SCRN.LineBufInit
SCRN.LineBufInitDlg
phx
ldx #SEQ.DLG-SEQS
bra SCRN.LineBufInit
2019-12-12 07:09:44 +00:00
SCRN.LineBufInitLBL
phx
ldx #SEQ.DLG.LBL-SEQS
bra SCRN.LineBufInit
2019-12-11 16:54:41 +00:00
SCRN.LineBufInitTB
phx
ldx #SEQ.DLG.TB-SEQS
bra SCRN.LineBufInit
2019-12-09 07:12:14 +00:00
SCRN.LineBufInitBut
phx
ldx #SEQ.DLG.BUT-SEQS
bra SCRN.LineBufInit
SCRN.LineBufInitEdit
phx
ldx #SEQ.EDIT-SEQS
bra SCRN.LineBufInit
2019-11-18 16:40:32 +00:00
SCRN.LineBufInitNorm
2019-12-09 07:12:14 +00:00
phx
ldx #SEQ.NORM-SEQS
bra SCRN.LineBufInit
2019-11-18 16:40:32 +00:00
SCRN.LineBufInitInv
2019-12-09 07:12:14 +00:00
phx
ldx #SEQ.INV-SEQS
SCRN.LineBufInit
2019-11-18 16:40:32 +00:00
>LDYA.G LineBufBase
>STYA LineBufPtr
jsr SCRN.SEQS.ToLineBuf
plx
rts
*--------------------------------------
SCRN.SEQS.ToLineBuf
lda SEQS,x
2019-11-18 16:40:32 +00:00
.1 jsr SCRN.ToLineBuf
2019-12-09 07:12:14 +00:00
inx
lda SEQS,x
bne .1
2019-11-18 16:40:32 +00:00
rts
*--------------------------------------
2019-12-18 07:57:47 +00:00
SCRN.LineBufGotoLineY
>PUSHBI 1
tya
>PUSHA
>PUSHBI 2
>PUSHW L.MSG.GOTOXY
*--------------------------------------
2019-12-09 07:12:14 +00:00
SCRN.LineBufSprintf
>LDYA LineBufPtr
>SYSCALL sprintf
bcs .9
tya
clc
adc LineBufPtr
sta LineBufPtr
bcc .9
inc LineBufPtr+1
clc
.9 rts
*--------------------------------------
SCRN.ToLineBuf sta (LineBufPtr)
inc LineBufPtr
bne .8
inc LineBufPtr+1
.8 rts
*--------------------------------------
2019-11-18 16:40:32 +00:00
SCRN.LineBufOut lda #0
2019-12-13 16:06:23 +00:00
sta (LineBufPtr)
2019-11-18 16:40:32 +00:00
>PUSHBI 0
>LDYA.G LineBufBase
>SYSCALL printf
rts
*--------------------------------------
2016-01-04 07:25:43 +00:00
MAN
2019-02-01 16:32:29 +00:00
SAVE USR/SRC/BIN/EDIT.S.SCRN
LOAD USR/SRC/BIN/EDIT.S
2016-01-04 07:25:43 +00:00
ASM