A2osX/BIN/EDIT.S.SCRN.txt

610 lines
9.5 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-05-29 15:21:14 +00:00
SCRN.Init >LDYAI 510+5+5+4+1 potentially 255*\\ NORM,INV,CEOL & \0
2019-05-27 15:37:31 +00:00
>SYSCALL Getmem
bcs .9
>STYA LineBufPtr
txa
>STA.G hLineBuffer
>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
2018-08-23 20:38:32 +00:00
2016-01-04 07:25:43 +00:00
lda #0
ldy #FileX
sta (pData),y
ldy #FileY
sta (pData),y
iny
sta (pData),y
ldy #ScreenX
sta (pData),y
ldy #ScreenY
sta (pData),y
iny
sta (pData),y
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
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateTopBar
lda #1
jsr SCRN.InvLineA
bcs .9
2018-08-23 20:38:32 +00:00
>LDA.G hFileName
2016-01-04 07:25:43 +00:00
beq .1
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-01-04 07:25:43 +00:00
bra .2
.1 >LDYA L.MSG.NEWFILE
.2 >PUSHYA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
2016-01-04 07:25:43 +00:00
>LDYA L.MSG.TOPBAR
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2016-01-04 07:25:43 +00:00
.9 rts
*--------------------------------------
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
.1 lda TmpIndex
ldx TmpIndex+1
2018-08-23 20:38:32 +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
2016-01-04 07:25:43 +00:00
.3 inc TmpByte
inc TmpIndex
2016-01-04 07:25:43 +00:00
bne .4
inc TmpIndex+1
.4 dec TmpCount
2016-01-04 07:25:43 +00:00
bne .1
2016-01-21 07:05:23 +00:00
jmp SCRN.GotoCurXCurY
2016-01-04 07:25:43 +00:00
.5 ldx #0
ldy TmpByte
2016-01-04 07:25:43 +00:00
jsr GotoXY
2019-05-28 16:00:53 +00:00
bcs SCRN.UpdateMain.9
2018-08-23 20:38:32 +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
2016-01-04 07:25:43 +00:00
inc TmpByte
dec TmpCount
2016-01-04 07:25:43 +00:00
bne .5
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
inx
.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
2019-05-28 16:00:53 +00:00
2016-01-04 07:25:43 +00:00
ldx #0
tay
jsr GotoXY
2019-08-26 06:29:18 +00:00
bcs SCRN.UpdateMain.9
2016-01-04 07:25:43 +00:00
2019-05-28 16:00:53 +00:00
>LDYA LineBufPtr
>STYA ZPPTR1
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
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
tya
* clc
adc BufPtr
sta BufPtr
bcc .1
2016-01-04 07:25:43 +00:00
2019-05-28 16:00:53 +00:00
inc BufPtr+1
.1 lda (BufPtr)
beq .8
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
2016-01-04 07:25:43 +00:00
2019-05-29 05:58:28 +00:00
jsr SCRN.ToggleSel
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-05-28 16:00:53 +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
.51 jsr SCRN.ToLineBuf
2019-05-29 15:21:14 +00:00
2019-08-26 06:29:18 +00:00
inc BufPtr
2019-05-28 16:00:53 +00:00
bne .6
inc BufPtr+1
.6 inc BUF.COffset
bne .7
inc BUF.COffset+1
2016-01-04 07:25:43 +00:00
2019-05-28 16:00:53 +00:00
.7 dex
2016-01-04 07:25:43 +00:00
bne .1
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-05-29 15:21:14 +00:00
.80 ldy #0
.81 lda SEQ.CEOL,y
beq .82
jsr SCRN.ToLineBuf
iny
bra .81
.82 sta (ZPPTR1)
2019-05-28 16:00:53 +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
2016-01-04 07:25:43 +00:00
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
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-05-28 16:00:53 +00:00
.8 rts
*--------------------------------------
SCRN.ToLineBuf sta (ZPPTR1)
inc ZPPTR1
bne .8
inc ZPPTR1+1
.8 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateStatusBar
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
bcs .9
2018-08-23 20:38:32 +00:00
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.SEQ.INV
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
2018-08-23 20:38:32 +00:00
>LDA.G PromptMode
2016-01-04 07:25:43 +00:00
bne .2
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
2018-08-23 20:38:32 +00:00
inc
.1 >PUSHA
txa
>PUSHA
2016-01-04 07:25:43 +00:00
2018-08-23 20:38:32 +00:00
>LDA.G FileX
2016-01-04 07:25:43 +00:00
inc
>PUSHA
2019-05-27 15:37:31 +00:00
>PUSHW BufLen
2018-08-23 20:38:32 +00:00
>PUSHBI 5
2016-01-04 07:25:43 +00:00
>LDYA L.MSG.STATUSBAR
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
lda #58
jsr SCRN.ClearEOLA
bcs .9
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.SEQ.NORM
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
2016-01-21 07:05:23 +00:00
jmp SCRN.GotoCurXCurY
2019-05-29 15:21:14 +00:00
.9 rts
*--------------------------------------
2018-08-22 15:23:27 +00:00
.2 eor #PromptModeHelp
beq .3
>PUSHW pData
2018-08-22 15:23:27 +00:00
lda #2
2018-08-22 15:23:27 +00:00
.3 >PUSHA
2018-08-23 20:38:32 +00:00
>LDA.G ScreenH
jsr SCRN.InvLineA
bcs .9
ldy #PromptMode
lda (pData),y
tax
2016-01-04 07:25:43 +00:00
>LDYA L.MSG.STATUSBAR,x
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2016-01-22 16:29:11 +00:00
bcs .9
rts
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateStatusBarErrA
2018-08-23 20:38:32 +00:00
pha
2016-01-09 22:33:47 +00:00
ldy #ScreenH
lda (pData),y
dec
jsr SCRN.InvLineA
2018-08-23 20:38:32 +00:00
pla
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 1
>LDYA L.MSG.STATUSBAR.E
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2019-05-29 15:21:14 +00:00
rts
*--------------------------------------
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
*--------------------------------------
SCRN.ClearEOLA pha
.1 pla
ldy #ScreenW
cmp (pData),y
bcs .8
inc
pha
lda #' '
2018-07-18 15:30:42 +00:00
>SYSCALL PutChar
bcc .1
plx
rts
.8 clc
.9 rts
*--------------------------------------
SCRN.InvLineA sta .2+1
lda #1
>PUSHA
lda .2+1
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>LDYA L.MSG.GOTOXY
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.SEQ.INV
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
ldy #ScreenW
lda (pData),y
.1 pha
lda #' '
2018-07-18 15:30:42 +00:00
>SYSCALL PutChar
pla
bcs .9
dec
bne .1
lda #1
>PUSHA
.2 lda #$ff
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>LDYA L.MSG.GOTOXY
2018-06-21 15:12:10 +00:00
>SYSCALL printf
.9 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
GotoXY txa
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-05-29 15:21:14 +00:00
GotoXY.RTS rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2016-01-21 07:05:23 +00:00
SCRN.UpdateViewPort
lda #$ff
2016-01-04 07:25:43 +00:00
sta bNotRepaint
.1 ldy #FileX
lda (pData),y
ldy #ScreenX
cmp (pData),y
bcs .2 out of left border ?
ldy #ScreenX yes
2016-01-04 07:25:43 +00:00
lda (pData),y
dec
sta (pData),y
stz bNotRepaint
bra .1
.2 clc
ldy #ScreenX
2016-01-04 07:25:43 +00:00
lda (pData),y
ldy #ScreenW
adc (pData),y
dec
2016-01-04 07:25:43 +00:00
ldy #FileX
cmp (pData),y
bcs .3 out of right border ?
ldy #ScreenX
lda (pData),y
inc
sta (pData),y
stz bNotRepaint
bra .2
.3 ldy #FileY+1
2016-01-04 07:25:43 +00:00
lda (pData),y
tax
dey
lda (pData),y A,X = FileY
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 ?
ldy #ScreenY move viewport up one line....
2016-01-04 07:25:43 +00:00
lda (pData),y
sbc #0 CC from BCS
2016-01-04 07:25:43 +00:00
sta (pData),y
iny
lda (pData),y
sbc #0
sta (pData),y
2016-01-04 07:25:43 +00:00
bit bNotRepaint
bpl .3
jsr SCRN.scrollDn ...and move content one line down
2019-05-29 15:21:14 +00:00
bcs GotoXY.RTS
2016-01-04 07:25:43 +00:00
.4 ldy #ScreenY+1
2016-01-04 07:25:43 +00:00
lda (pData),y
tax
dey
lda (pData),y
ldy #ViewPortHm1
clc
adc (pData),y
bcc .41
inx
.41 ldy #FileY A,X = screen bottom
cmp (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
bcs .5 CS : fileY>= screen bottom
2016-01-04 07:25:43 +00:00
* clc from BCS
ldy #ScreenY move viewport down one line....
2016-01-04 07:25:43 +00:00
lda (pData),y
adc #1
sta (pData),y
iny
lda (pData),y
adc #0
sta (pData),y
2018-11-15 15:04:14 +00:00
bit bNotRepaint
2016-01-04 07:25:43 +00:00
bpl .4
jsr SCRN.scrollUp ...and move content one line up
2016-01-22 16:29:11 +00:00
bcs .9
bra .4
2016-01-04 07:25:43 +00:00
.5 sec
ldy #FileX
lda (pData),y
ldy #ScreenX
sbc (pData),y
ldy #CurX
sta (pData),y
sec
ldy #FileY
lda (pData),y
ldy #ScreenY
sbc (pData),y
ldy #CurY
sta (pData),y
bit bNotRepaint
bmi .6
2016-01-21 07:05:23 +00:00
jsr SCRN.UpdateMain
2016-01-04 07:25:43 +00:00
bcs .9
2016-01-21 07:05:23 +00:00
.6 jsr SCRN.UpdateStatusBar
2016-01-04 07:25:43 +00:00
bcs .9
2019-05-29 15:21:14 +00:00
jmp SCRN.GotoCurXCurY
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
SCRN.scrollUp ldy #CurX
lda (pData),y
inc
>PUSHA
ldy #CurY
lda (pData),y
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
ldy #ScreenY+1
lda (pData),y
tax
dey
lda (pData),y
clc
ldy #ViewPortHm1
adc (pData),y
2016-01-04 07:25:43 +00:00
bcc .1
inx
.1 jsr BUF.GetLineAX
bcs .9
ldy #ViewPortHm1
lda (pData),y
2019-05-29 15:21:14 +00:00
jmp SCRN.UpdateLineAtALenY
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
SCRN.scrollDn ldy #CurX
lda (pData),y
inc
>PUSHA
2016-01-04 07:25:43 +00:00
ldy #CurY
lda (pData),y
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
jsr BUF.GetLineAX
2016-01-04 07:25:43 +00:00
bcs .9
lda #0
2019-05-29 15:21:14 +00:00
jmp SCRN.UpdateLineAtALenY
.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