EDIT : bug fix (still some remaining when using from PuTTY)

This commit is contained in:
burniouf 2023-03-27 22:52:33 +02:00
parent 39e1b23f86
commit 82f1cb8630
5 changed files with 190 additions and 183 deletions

Binary file not shown.

View File

@ -89,7 +89,7 @@ Ctrl.A >STZ.G bUpdateStatus
jsr SCRN.LineBufOut
bcs .9
.8 jsr GetCh
.8 jsr IO.GetCh
bcs .9
beq .8
@ -460,7 +460,7 @@ Ctrl.Q >LDA.G bUnSaved
jsr SCRN.LineBufOut
bcs .9
.1 jsr GetCh
.1 jsr IO.GetCh
bcs .9
cmp #'a

View File

@ -88,7 +88,7 @@ DLG.Open >STYA ZPPTR2
.9 rts
*--------------------------------------
DLG.Run jsr GetCh
DLG.Run jsr IO.GetCh
bcs .9
cmp #3

184
BIN/EDIT.S.IO.txt Normal file
View File

@ -0,0 +1,184 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
IO.GetCh >SYSCALL GetChar
bcs .9
cmp #C.CR
bne IO.GetCh.1
ldy #S.PS.hStdIn Check for any extra LF
lda (pPS),y
>SYSCALL FEOF
bcs .9
tay
bne .8
>SYSCALL GetChar
bcs .9
.8 lda #C.CR
* clc
.9 rts
*--------------------------------------
IO.GetCh.1 tax
>LDA.G bEscMode
bmi .1
cpx #C.ESC
bne .8
lda #$ff
>STA.G bEscMode
inc
clc
rts
.1 >LDA.G bCSIMode
bmi .11
cpx #'[' \e[ ?
bne IO.GetCh.Esc
lda #$ff
>STA.G bCSIMode
inc
sta (pData) #EscBufferPtr
clc
rts
*--------------------------------------
.11 lda (pData) #EscBufferPtr
cmp #15
bcc .10
.19 >STZ.G bEscMode
>STA.G bCSIMode
clc
rts
.10 inc
sta (pData)
tay
txa
sta (pData),y
cmp #64
bcs IO.GetCh.CSI
ldx #0
.8 txa
clc
rts
*--------------------------------------
IO.GetCh.Esc >STZ.G bEscMode
IO.GetCh.Esc1 txa
ldx #EscChars.Cnt-1
.1 cmp EscChars,x
beq .2
dex
bpl .1
lda #0
clc
rts
.2 lda EscAscii,x
clc
rts
*--------------------------------------
* \e[A UP
* \e[B DOWN
* \e[C FOWARD
* \e[D BACK
* \e[xxx;yyyR DSR ("\e[I6n" reply)
*--------------------------------------
IO.GetCh.CSI >STZ.G bEscMode
>STA.G bCSIMode
cpx #'R' Response to cursor position query?
beq .3
bra IO.GetCh.Esc1
.3 stz TmpByte
ldy #0
.4 iny
lda (pData),y
cmp #';'
beq .5
jsr IO.GetCh.TmpByte10pA
bra .4
.5 phy
lda TmpByte
>STA.G ScreenH
dec Remove 2 (top & status bar) for viewportH
dec
>STA.G ViewPortH
dec
>STA.G ViewPortHm1 Remove 1 more to store offsert to last line of viewport
ply
stz TmpByte
.6 iny
lda (pData),y
cmp #'R'
beq .7
jsr IO.GetCh.TmpByte10pA
bra .6
.7 lda TmpByte
>STA.G ScreenW
.8 lda #0
clc
rts
*--------------------------------------
IO.GetCh.TmpByte10pA
and #$0f
pha
lda TmpByte
asl
asl
clc
adc TmpByte
asl
sta TmpByte
pla
clc
adc TmpByte
sta TmpByte
rts
*--------------------------------------
MAN
SAVE usr/src/bin/edit.s.io
LOAD usr/src/bin/edit.s
ASM

View File

@ -150,7 +150,7 @@ CS.RUN >PUSHW L.MSG.TERMCAP
>SYSCALL PrintF Send Query for term W & H
bcs CS.INIT.RTS
.1 jsr GetCh
.1 jsr IO.GetCh
bcs CS.INIT.RTS
* beq .11
@ -197,7 +197,7 @@ CS.RUN >PUSHW L.MSG.TERMCAP
>STA.G hReplace
*--------------------------------------
CS.RUN.LOOP jsr GetCh
CS.RUN.LOOP jsr IO.GetCh
bcs CS.RUN.RTS I/O error
beq .8
@ -293,189 +293,12 @@ CS.QUIT ldy #hLineBuf
.8 clc
rts
*--------------------------------------
GetCh >SYSCALL GetChar
bcs .9
cmp #C.CR
bne GetCh.1
ldy #S.PS.hStdIn Check for any extra LF
lda (pPS),y
>SYSCALL FEOF
bcs .9
tay
bne .8
>SYSCALL GetChar
bcs .9
.8 lda #C.CR
* clc
.9 rts
*--------------------------------------
GetCh.1 tax
>LDA.G bEscMode
bmi .1
cpx #C.ESC
bne .8
lda #$ff
>STA.G bEscMode
inc
clc
rts
.1 >LDA.G bCSIMode
bmi .11
cpx #'[' \e[ ?
bne GetCh.Esc
lda #$ff
>STA.G bCSIMode
inc
sta (pData) #EscBufferPtr
clc
rts
*--------------------------------------
.11 lda (pData) #EscBufferPtr
cmp #15
bcc .10
.19 >STZ.G bEscMode
>STA.G bCSIMode
clc
rts
.10 inc
sta (pData)
tay
txa
sta (pData),y
cmp #64
bcs GetCh.CSI
ldx #0
.8 txa
clc
rts
*--------------------------------------
GetCh.Esc >STZ.G bEscMode
GetCh.Esc1 txa
ldx #EscChars.Cnt-1
.1 cmp EscChars,x
beq .2
dex
bpl .1
lda #0
clc
rts
.2 lda EscAscii,x
clc
rts
*--------------------------------------
* \e[A UP
* \e[B DOWN
* \e[C FOWARD
* \e[D BACK
* \e[xxx;yyyR DSR ("\e[I6n" reply)
*--------------------------------------
GetCh.CSI >STZ.G bEscMode
>STA.G bCSIMode
cpx #'R' Response to cursor position query?
beq .3
>DEBUG
bra GetCh.Esc1
.3 stz TmpByte
ldy #0
.4 iny
lda (pData),y
cmp #';'
beq .5
jsr GetCh.TmpByte10pA
bra .4
.5 phy
lda TmpByte
>STA.G ScreenH
dec Remove 2 (top & status bar) for viewportH
dec
>STA.G ViewPortH
dec
>STA.G ViewPortHm1 Remove 1 more to store offsert to last line of viewport
ply
stz TmpByte
.6 iny
lda (pData),y
cmp #'R'
beq .7
jsr GetCh.TmpByte10pA
bra .6
.7 lda TmpByte
>STA.G ScreenW
.8 lda #0
clc
rts
*--------------------------------------
GetCh.TmpByte10pA
and #$0f
pha
lda TmpByte
asl
asl
clc
adc TmpByte
asl
sta TmpByte
pla
clc
adc TmpByte
sta TmpByte
rts
*--------------------------------------
.INB usr/src/bin/edit.s.buf
.INB usr/src/bin/edit.s.ctrl
.INB usr/src/bin/edit.s.dlg
.INB usr/src/bin/edit.s.file
.INB usr/src/bin/edit.s.io
.INB usr/src/bin/edit.s.scrn
*--------------------------------------
CS.END