A2osX/BIN/EDIT.S.CTRL.txt
2019-11-06 14:14:42 +01:00

563 lines
9.1 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
*--------------------------------------
* ^A = Help
* ^B = Begin Block
* ^C = Copy Block
* ^D = Delete Block
* ^E = End Block
* ^F = Find...
* ^G = Go To SOL
******** ^H = BS
******** ^I = TAB
******** ^J = LF
******** ^K = VT
* ^L = Go To EOL
******** ^M = CR
* ^N = Find Next
* ^O = Page Up
* ^P = Page Down
* ^Q = Quit
* ^R = Replace...
* ^S = Save
* ^T = Go To Top of file
******** ^U = FS
* ^V = Paste Block
* ^W = Erase line
* ^X = Cut Block
* ^Y = End Of File
*--------------------------------------
Prompt.Editor cmp #C.DEL
beq Ctrl.DEL
cmp #C.SPACE
bcc .3
jsr BUF.InsertA
bcs .9
jsr SCRN.UpdateCurrentLine
bcs .9
jmp Ctrl.FS
.9 rts
.3 asl
tax
jmp (J.CTRL,x)
*--------------------------------------
Ctrl.DEL jsr BUF.ComputeCOffset
lda BUF.COffset
ora BUF.COffset+1 No Backspace possible
beq .8
jsr Ctrl.BS
bcs .9
jmp Ctrl.Z
.8 clc
.9 rts
*--------------------------------------
Ctrl.Invalid
clc
Ctrl.Invalid.RTS
rts
*--------------------------------------
Ctrl.A lda #PromptModeHelp
>STA.G PromptMode
>LDYA L.MSG.HELP
>STYA ZPPTR1
stz .1+1
.1 ldy #0
ldx #0
jsr SCRN.GotoXY
lda (ZPPTR1)
beq .8
>PUSHW ZPPTR1
>PUSHBI 2
>LDYA L.MSG.HELPLINE
>SYSCALL printf
bcs Ctrl.Invalid.RTS
inc .1+1
lda (ZPPTR1)
sec
adc ZPPTR1
sta ZPPTR1
bcc .1
inc ZPPTR1+1
bra .1
.8 jmp SCRN.UpdateStatusBar
*--------------------------------------
Ctrl.B jsr BUF.ComputeCOffset
lda BUF.COffset
ldy #SelStart
sta (pData),y
lda BUF.COffset+1
iny
sta (pData),y
jmp SCRN.UpdateMain
*--------------------------------------
Ctrl.C jmp BUF.SelToClipboard
*--------------------------------------
Ctrl.E jsr BUF.ComputeCOffset
lda BUF.COffset
ldy #SelEnd
sta (pData),y
lda BUF.COffset+1
iny
sta (pData),y
jmp SCRN.UpdateMain
*--------------------------------------
Ctrl.F lda #PromptModeFind
>STA.G PromptMode
jmp SCRN.UpdateStatusBar
*--------------------------------------
Ctrl.G >LDA.G FileX
beq .8
lda #0
sta (pData),y
jmp SCRN.UpdateViewPort
.8 clc
rts
*--------------------------------------
Ctrl.BS >LDA.G FileX
beq .1 already at beginning of line
dec
sta (pData),y
bra .3
.1 >LDA.G FileY+1
tax
dey
ora (pData),y
beq .8
lda (pData),y
bne .2
dex
.2 dec
jsr BUF.GetLineAX
bcs .8
tya
>STA.G FileX
>DECW.G FileY
.3 jmp SCRN.UpdateViewPort
.8 clc
rts
*--------------------------------------
Ctrl.TAB jsr BUF.InsertTAB
bcs .9
>LDA.G FileX
clc
adc #TABLEN
sta (pData),y
>LDA.G CurX
clc
adc #TABLEN
sta (pData),y
>SBC.G ScreenX
>SBC.G ScreenW
bcs .8
jsr SCRN.UpdateCurrentLine
bcs .9
jmp SCRN.UpdateStatusBar
.8 >ADC.G ScreenX
inc
sta (pData),y
jmp SCRN.UpdateViewPort
.9 rts
*--------------------------------------
Ctrl.LF jsr BUF.GetNextLine
bcs .8
tya Y = line length
>CMP.G FileX
bcs .2
sta (pData),y
.2 >INCW.G FileY
jmp SCRN.UpdateViewPort
.8 clc
rts
*--------------------------------------
Ctrl.VT >LDA.G FileY+1
tax
dey
ora (pData),y
beq .8
lda (pData),y
bne .1
dex
.1 dec
jsr BUF.GetLineAX
bcs .8
tya Y = line length
>CMP.G FileX
bcs .2
sta (pData),y
.2 >DECW.G FileY
jmp SCRN.UpdateViewPort
.8
Ctrl.VT.8 clc
rts
*--------------------------------------
Ctrl.L jsr BUF.GetLine
bcs Ctrl.VT.8
tya Y = line length
>STA.G FileX
jmp SCRN.UpdateViewPort
*--------------------------------------
Ctrl.CR lda #C.CR
jsr BUF.InsertA
bcs .9
>STZ.G FileX
jmp SCRN.UpdateMain
.9 rts
*--------------------------------------
Ctrl.N
clc
rts
*--------------------------------------
Ctrl.O ldy #FileY+1
lda (pData),y
tax
dey
lda (pData),y
ldy #ViewPortH
sec
sbc (pData),y
pha
txa
sbc #0
bcc .8
ldy #FileY+1
sta (pData),y
dey
pla
sta (pData),y
>STZ.G FileX
jmp SCRN.UpdateViewPort
.8 pla
*--------------------------------------
Ctrl.T jsr SCRN.Home
jmp SCRN.UpdateViewPort
*--------------------------------------
Ctrl.P ldy #FileY+1
lda (pData),y
tax
dey
lda (pData),y
ldy #ViewPortH
clc
adc (pData),y
bcc .1
inx
.1 pha
phx
jsr BUF.GetLineAX A,X = FileY+PAGE
bcs .8
tya Y = line length
>STA.G FileX
ldy #FileY+1
pla
sta (pData),y
dey
pla
sta (pData),y
jmp SCRN.UpdateViewPort
.8 pla
pla
*--------------------------------------
Ctrl.Y jsr BUF.GetNextLine
bcs .1
>INCW.G FileY
bra Ctrl.Y
.1 jsr BUF.GetLine
tya Y = line length
>STA.G FileX
jmp SCRN.UpdateViewPort
*--------------------------------------
Ctrl.R lda #PromptModeReplace
>STA.G PromptMode
jmp SCRN.UpdateStatusBar
*--------------------------------------
Ctrl.Q lda #$FF
>STA.G bExit
>LDA.G bSaved
beq Ctrl.S
clc
rts
*--------------------------------------
Ctrl.S lda #PromptModeSave
>STA.G PromptMode
>LDA.G hFileName
beq .2
>SYSCALL GetMemPtr
>STYA ZPPTR1
ldy #$ff
.1 iny
lda (ZPPTR1),y
sta (pData),y
bne .1
tya
.2 >STA.G PromptBufPtr
jmp SCRN.UpdateStatusBar
*--------------------------------------
Ctrl.FS jsr BUF.GetLine
bcs .8
tya Y = line length
>CMP.G FileX
beq .1 already at end of line
lda (pData),y
inc
sta (pData),y
bra .3
.1 jsr BUF.GetNextLine
bcs .8
>INCW.G FileY
>STZ.G FileX
.3 jmp SCRN.UpdateViewPort
.8 clc
.9 rts
*--------------------------------------
Ctrl.V jsr BUF.InsertClipboard
bcs .9
jsr SCRN.UpdateMain
bcs .9
jmp SCRN.UpdateStatusBar
.9 rts
*--------------------------------------
Ctrl.W jsr BUF.ComputeCOffset Y=line len
phy
lda BUF.LOffset
ldy #SelStart
sta (pData),y
lda BUF.LOffset+1
iny
sta (pData),y
ply Get back line len
clc
lda (BufPtr),y
beq .1 last line \0 ending
sec delete CR
.1 tya
adc BUF.LOffset
ldy #SelEnd
sta (pData),y
lda BUF.LOffset+1
adc #0
iny
sta (pData),y
bra Ctrl.D
.8
Ctrl.W.RTS rts
*--------------------------------------
Ctrl.X jsr BUF.SelToClipboard
bcs Ctrl.W.RTS
Ctrl.D jsr BUF.DelSel
bcs Ctrl.W.RTS
jsr SCRN.CursorAdjust
jsr SCRN.UpdateMain
bcs Ctrl.W.RTS
jmp SCRN.UpdateStatusBar
*--------------------------------------
Ctrl.Z jsr BUF.ComputeCOffset
lda BUF.COffset
eor FileLen
bne .1
lda BUF.COffset+1
eor FileLen+1
bne .1
clc
rts
.1 jsr BUF.DelCharAtCursor
bcs Ctrl.W.RTS
cmp #C.CR did we DEL a CR ?
beq Prompt.Help.Upd yes repaint whole screen
jsr SCRN.UpdateCurrentLine
bcs Ctrl.W.RTS
jmp SCRN.UpdateStatusBar
*--------------------------------------
Prompt.Help >STZ.G PromptMode
Prompt.Help.Upd jsr SCRN.UpdateStatusBar
bcs Prompt.Find.RTS
jmp SCRN.UpdateMain
*--------------------------------------
Prompt.Find cmp #3
bne .1
>STZ.G PromptMode
jmp SCRN.UpdateStatusBar
.1 cmp #C.CR
bne .2
.2
clc
.9
Prompt.Find.RTS rts
*--------------------------------------
Prompt.Replace cmp #3
bne .1
>STZ.G PromptMode
jsr SCRN.UpdateStatusBar
bcs .9
rts
.1 cmp #C.CR
bne .2
.2
clc
.9 rts
*--------------------------------------
Prompt.Save cmp #3 Ctrl-C
bne .1
>STZ.G PromptMode
bra .80
.1 cmp #C.CR
bne .2
>LDA.G PromptBufPtr
beq .8
>LDYA pData
>SYSCALL RealPath
bcs .12
phx
>LDA.G hFileName
beq .11
>SYSCALL FreeMem
.11 pla
>STA.G hFileName
>STZ.G PromptMode
jsr SaveFile
bcc .81
.12 jsr SCRN.LineBufInit
jmp SCRN.UpdateStatusBarErrA
.2 cmp #C.DEL
bne .3
>LDA.G PromptBufPtr
beq .8
dec
sta (pData),y
tay
lda #0
sta (pData),y
bra .80
.3 cmp #C.SPACE
bcc .8
pha
>LDA.G PromptBufPtr
tay
pla
cpy #PROMPTBUFMAX
beq .8
sta (pData),y
iny
lda #0
sta (pData),y
tya
>STA.G PromptBufPtr
bra .80
.8 clc
rts
.81 jsr SCRN.UpdateTopBar
bcs .9
.80 jmp SCRN.UpdateStatusBar
.9 rts
*--------------------------------------
MAN
SAVE USR/SRC/BIN/EDIT.S.CTRL
LOAD USR/SRC/BIN/EDIT.S
ASM