A2osX/BIN/EDIT.S.SCRN.txt

541 lines
8.3 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-11-04 13:41:58 +00:00
jsr SCRN.Home
2016-01-04 07:25:43 +00:00
2016-01-21 07:05:23 +00:00
jsr SCRN.UpdateTopBar
2016-01-04 07:25:43 +00:00
bcs .9
2016-01-21 07:05:23 +00:00
jsr SCRN.UpdateViewPort
2016-01-04 07:25:43 +00:00
bcs .9
2016-01-21 07:05:23 +00:00
jsr SCRN.UpdateMain
2016-01-04 07:25:43 +00:00
.9 rts
*--------------------------------------
2019-11-04 13:41:58 +00:00
SCRN.Home lda #0
ldy #FileX
.1 sta (pData),y
iny
cpy #CurX
bne .1
inc
sta (pData),y CurX
iny
sta (pData),y CurY
rts
*--------------------------------------
2019-11-04 07:21:40 +00:00
SCRN.UpdateTopBar
jsr SCRN.LineBufInit
>PUSHBI 1
>PUSHBI 1
>PUSHBI 2
>LDYA L.MSG.GOTOXY
>SYSCALL printf
bcs .9
2019-11-04 07:21:40 +00:00
2018-08-23 20:38:32 +00:00
>LDA.G hFileName
2016-01-04 07:25:43 +00:00
beq .1
2019-11-04 07:21:40 +00:00
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-01-04 07:25:43 +00:00
bra .2
2019-11-04 07:21:40 +00:00
2016-01-04 07:25:43 +00:00
.1 >LDYA L.MSG.NEWFILE
.2 >PUSHYA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
2019-11-04 07:21:40 +00:00
>PUSHW L.MSG.TOPBAR
>LDYA ZPPTR1
>SYSCALL sprintf
bcs .9
>LDA.G bSaved
bne .8
ldy #255
.3 iny
lda (ZPPTR1),y
bne .3
2019-11-04 13:41:58 +00:00
lda #'!'
2019-11-04 07:21:40 +00:00
sta (ZPPTR1),y
iny
lda #0
sta (ZPPTR1),y
.8 jmp SCRN.LineBufOutBar
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
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
lda #0
sta TmpByte
2018-08-23 20:38:32 +00:00
>LDA.G ViewPortH
2016-01-04 07:25:43 +00:00
sta TmpCount
2019-11-04 07:21:40 +00:00
.1 lda TmpIndex
ldx TmpIndex+1
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
2016-01-21 07:05:23 +00:00
jmp SCRN.GotoCurXCurY
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
2016-01-21 07:05:23 +00:00
jmp SCRN.GotoCurXCurY
2016-01-04 07:25:43 +00:00
2019-05-28 16:00:53 +00:00
SCRN.UpdateMain.9
rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
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
stz bSelected
sty TmpLen
ldx #0
tay
2019-11-04 07:21:40 +00:00
jsr SCRN.GotoXY
2019-08-26 06:29:18 +00:00
bcs SCRN.UpdateMain.9
2019-11-04 07:21:40 +00:00
jsr SCRN.LineBufInit
ldy #$ff
.10 iny
lda SEQ.EDIT,y
beq .11
jsr SCRN.ToLineBuf
bra .10
.11 ldy #0
2018-08-23 20:38:32 +00:00
>LDA.G ScreenW
2016-01-04 07:25:43 +00:00
tax
2018-08-23 20:38:32 +00:00
>LDA.G ScreenX
2019-05-28 16:00:53 +00:00
cmp TmpLen
bcs .8
2019-11-04 07:21:40 +00:00
2016-01-04 07:25: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
bcc .1
inc BufPtr+1
.1 lda (BufPtr)
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
2016-01-04 07:25:43 +00:00
bne .1
2019-11-04 07:21:40 +00:00
2019-05-28 16:00:53 +00:00
.8 bit bSelected
bpl .80
jsr SCRN.ToggleSel
2018-08-23 20:38:32 +00:00
2019-11-04 07:21:40 +00:00
.80 lda #0
2019-05-29 15:21:14 +00:00
jsr SCRN.ToLineBuf
2019-11-04 07:21:40 +00:00
2018-08-22 15:23:27 +00:00
>PUSHBI 0
2019-05-28 16:00:53 +00:00
>LDYA LineBufPtr
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2019-05-29 15:21:14 +00:00
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-05-29 05:58:28 +00:00
SCRN.ToggleSel ldy #0
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-05-28 16:00:53 +00:00
ldy #6
2019-05-29 15:21:14 +00:00
.1 lda SEQ.NORM,y
2019-05-28 16:00:53 +00:00
beq .8
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
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateStatusBar
2019-11-04 07:21:40 +00:00
jsr SCRN.LineBufInit
2018-08-23 20:38:32 +00:00
>PUSHBI 1
>PUSHB.G ScreenH
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>LDYA L.MSG.GOTOXY
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2019-11-04 07:21:40 +00:00
bcs SCRN.ToggleSel.RTS
2018-08-23 20:38:32 +00:00
>LDA.G PromptMode
2016-01-04 07:25:43 +00:00
bne .2
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
bne .1
2019-11-04 07:21:40 +00:00
inc
2019-11-04 07:21:40 +00:00
.1 >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
bra SCRN.UpdateStatusBarOut
2019-05-29 15:21:14 +00:00
*--------------------------------------
2018-08-22 15:23:27 +00:00
.2 eor #PromptModeHelp
beq .3
2019-11-04 07:21:40 +00:00
>PUSHW pData
2018-08-22 15:23:27 +00:00
lda #2
.3 >PUSHA
2019-11-04 07:21:40 +00:00
bra SCRN.UpdateStatusBarOut
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateStatusBarErrA
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 1
2019-11-04 07:21:40 +00:00
ldx #10
bra SCRN.UpdateStatusBarOutErr
SCRN.UpdateStatusBarOut
ldy #PromptMode
lda (pData),y
tax
SCRN.UpdateStatusBarOutErr
>PUSHW L.MSG.STATUSBAR,x
>LDYA ZPPTR1
>SYSCALL sprintf
SCRN.LineBufOutBar
>LDA.G ScreenW
tax
ldy #0
.1 lda (ZPPTR1),y
beq .2
iny
dex
bne .1
bra .4
.2 lda #C.SPACE
.3 sta (ZPPTR1),y
iny
dex
bne .3
lda #0
sta (ZPPTR1),y
.4 >PUSHW LineBufPtr
>PUSHBI 2
>LDYA L.SEQ.BAR
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2019-11-04 07:21:40 +00:00
bcs .9
jmp SCRN.GotoCurXCurY
.9 rts
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
*--------------------------------------
2019-11-04 07:21:40 +00:00
SCRN.LineBufInit
>LDYA LineBufPtr
>STYA ZPPTR1
rts
*--------------------------------------
2019-11-04 07:21:40 +00:00
SCRN.ToLineBuf sta (ZPPTR1)
inc ZPPTR1
bne .8
inc ZPPTR1+1
.8 rts
*--------------------------------------
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
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateViewPort
2019-11-04 16:14:25 +00:00
stz bRepaint
2019-11-04 07:21:40 +00:00
2019-11-04 13:41:58 +00:00
.1 >LDA.G FileX
>CMP.G ScreenX
2016-01-04 07:25:43 +00:00
bcs .2 out of left border ?
2019-11-04 07:21:40 +00:00
2019-11-04 13:41:58 +00:00
>DEC.G ScreenX yes
2019-11-04 16:14:25 +00:00
sec
ror bRepaint
2016-01-04 07:25:43 +00:00
bra .1
2019-11-04 07:21:40 +00:00
2019-11-04 16:14:25 +00:00
.2 >LDA.G ScreenX
>ADC.G ScreenW
dec
2019-11-04 16:14:25 +00:00
>CMP.G FileX
2016-01-04 07:25:43 +00:00
bcs .3 out of right border ?
2019-11-04 07:21:40 +00:00
2019-11-04 13:41:58 +00:00
>INC.G ScreenX
2019-11-04 16:14:25 +00:00
sec
ror bRepaint
2016-01-04 07:25:43 +00:00
bra .2
2019-11-04 07:21:40 +00:00
.3 ldy #FileY+1
2016-01-04 07:25:43 +00:00
lda (pData),y
tax
dey
lda (pData),y A,X = FileY
2019-11-04 13:41:58 +00:00
2016-01-04 07:25:43 +00:00
ldy #ScreenY
cmp (pData),y
iny
txa
2016-01-04 07:25:43 +00:00
sbc (pData),y
bcs .4 out of top border ?
2019-11-04 07:21:40 +00:00
2019-11-04 13:41:58 +00:00
>DECW.G ScreenY move viewport up one line....
2019-11-04 16:14:25 +00:00
bit bRepaint
bmi .3 skip scroll, will be repainted later
2019-11-04 07:21:40 +00:00
jsr SCRN.scrollDn ...and move content one line down
2019-11-04 16:14:25 +00:00
bcc .3
rts
2019-11-04 07:21:40 +00:00
.4 ldy #ScreenY+1
2016-01-04 07:25:43 +00:00
lda (pData),y
tax
dey
lda (pData),y
2019-11-04 13:41:58 +00:00
>ADC.G ViewPortHm1
2019-11-04 16:14:25 +00:00
bcc .5
2019-11-04 07:21:40 +00:00
inx
2019-11-04 07:21:40 +00:00
2019-11-04 16:14:25 +00:00
.5 ldy #FileY A,X = screen bottom
clc
sbc (pData),y
2016-01-04 07:25:43 +00:00
txa
iny FileY > screen bottom ?
2016-01-04 07:25:43 +00:00
sbc (pData),y
2019-11-04 16:14:25 +00:00
bcs .6 CS : fileY>= screen bottom
2019-11-04 07:21:40 +00:00
2019-11-04 13:41:58 +00:00
>INCW.G ScreenY move viewport down one line....
2019-11-04 16:14:25 +00:00
bit bRepaint
bmi .4
2019-11-04 07:21:40 +00:00
jsr SCRN.scrollUp ...and move content one line up
2019-11-04 16:14:25 +00:00
bcc .4
.9 rts
2019-11-04 07:21:40 +00:00
2019-11-04 16:14:25 +00:00
.6 >LDA.G FileX
2019-11-04 13:41:58 +00:00
>SBC.G ScreenX
>STA.G CurX
>LDA.G FileY
>SBC.G ScreenY
>STA.G CurY
2019-11-04 16:14:25 +00:00
bit bRepaint
bpl .7
2019-11-04 07:21:40 +00:00
2016-01-21 07:05:23 +00:00
jsr SCRN.UpdateMain
2016-01-04 07:25:43 +00:00
bcs .9
2019-11-04 07:21:40 +00:00
2019-11-04 16:14:25 +00:00
.7 jsr BUF.ComputeCOffset
jsr SCRN.UpdateStatusBar
2016-01-04 07:25:43 +00:00
bcs .9
2019-11-04 07:21:40 +00:00
2019-05-29 15:21:14 +00:00
jmp SCRN.GotoCurXCurY
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-11-04 13:41:58 +00:00
SCRN.scrollUp >LDA.G CurX
inc
>PUSHA
2019-11-04 13:41:58 +00:00
>LDA.G CurY
inc
inc
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>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
2016-01-04 07:25:43 +00:00
ldy #ScreenY+1
lda (pData),y
tax
dey
lda (pData),y
2019-11-04 13:41:58 +00:00
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
>LDA.G ViewPortHm1
2019-05-29 15:21:14 +00:00
jmp SCRN.UpdateLineAtALenY
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-11-04 13:41:58 +00:00
SCRN.scrollDn >LDA.G CurX
inc
>PUSHA
2019-11-04 13:41:58 +00:00
>LDA.G CurY
inc
inc
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>LDYA L.SEQ.SCROLLDN
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
ldy #ScreenY+1
lda (pData),y
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-11-04 13:41:58 +00:00
2016-01-04 07:25:43 +00:00
lda #0
2019-05-29 15:21:14 +00:00
jmp SCRN.UpdateLineAtALenY
2019-11-04 13:41:58 +00:00
2019-05-29 15:21:14 +00:00
.9 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