Kernel version 0.9 : Telnet ECHO mode and other IAC stuff

This commit is contained in:
Rémy GIBERT 2017-03-03 17:37:15 +01:00
parent 11234acaee
commit 878d0d5268
8 changed files with 163 additions and 48 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -144,8 +144,6 @@ CS.RUN >LDYA L.SEQ.DETECT
lda (pData),y for W & H lda (pData),y for W & H
beq .1 beq .1
>DEBUG
jsr SCRN.Init jsr SCRN.Init
bcs .9 bcs .9
@ -196,7 +194,7 @@ CS.QUIT ldy #hBuffer
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CharIn tax CharIn tax
>DEBUG
ldy #bEscMode ldy #bEscMode
lda (pData),y lda (pData),y
asl asl
@ -251,6 +249,7 @@ CharIn.Esc ldy #bEscMode
beq .2 beq .2
dex dex
bne .1 bne .1
cmp #'R' Response to cursor position query? cmp #'R' Response to cursor position query?
beq .3 beq .3

View File

@ -12,6 +12,7 @@ AUTO 6
.INB /A2OSX.DEV/INC/A2OSX.I .INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/IO.I .INB /A2OSX.DEV/INC/IO.I
.INB /A2OSX.DEV/INC/MLI.ERR.I .INB /A2OSX.DEV/INC/MLI.ERR.I
.INB /A2OSX.DEV/INC/NET.TELNET.I
*-------------------------------------- *--------------------------------------
CURSOR.BLINK.SPEED .EQ 8 CURSOR.BLINK.SPEED .EQ 8
ESCSEQ.MAXLEN .EQ 16 ESCSEQ.MAXLEN .EQ 16
@ -106,6 +107,14 @@ OPEN stz CURON
jsr RESET jsr RESET
jsr HOME jsr HOME
ldy #0
.1 lda TelnetOpt,y
beq CONTROL
jsr Char.Out.Put
iny
bne .1
*-------------------------------------- *--------------------------------------
CONTROL sta SETTEXT CONTROL sta SETTEXT
sta SETALTCHAR sta SETALTCHAR
@ -810,6 +819,8 @@ KeyRemappedDOWN .HS 1B5B4200 esc[B
KeyRemappedUP .HS 1B5B4100 esc[A KeyRemappedUP .HS 1B5B4100 esc[A
KeyRemappedCR .HS 0D0A00 crlf KeyRemappedCR .HS 0D0A00 crlf
KeyRemappedRGHT .HS 1B5B4300 esc[C KeyRemappedRGHT .HS 1B5B4300 esc[C
TelnetOpt .DA #IAC,#DO,#TELOPT.ECHO
.DA #13,#10,#0
*-------------------------------------- *--------------------------------------
CtrlChars.Cnt .EQ 6 CtrlChars.Cnt .EQ 6
CtrlChars .HS 05080A0C0D1B CtrlChars .HS 05080A0C0D1B

View File

@ -199,6 +199,10 @@ READ.DEBUG phx
lda (ZPTmpPtr1),y lda (ZPTmpPtr1),y
sta READ.DEBUG.JMP+2 sta READ.DEBUG.JMP+2
lda #'('
ldx #DEVMGR.WRITE
jsr READ.DEBUG.JMP
pla pla
pha pha
lsr lsr
@ -220,7 +224,7 @@ READ.DEBUG phx
ldx #DEVMGR.WRITE ldx #DEVMGR.WRITE
jsr READ.DEBUG.JMP jsr READ.DEBUG.JMP
lda #'/' lda #')'
ldx #DEVMGR.WRITE ldx #DEVMGR.WRITE
jsr READ.DEBUG.JMP jsr READ.DEBUG.JMP

View File

@ -7,6 +7,8 @@ AUTO 6
* https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/jb-dev/sysroot/usr/include/arpa/telnet.h * https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/jb-dev/sysroot/usr/include/arpa/telnet.h
SE .EQ 240 SE .EQ 240
SB .EQ 250 SB .EQ 250
SB.IS .EQ 0
SB.SEND .EQ 1
WILL .EQ 251 $FB WILL .EQ 251 $FB
WONT .EQ 252 $FC WONT .EQ 252 $FC
DO .EQ 253 $FD DO .EQ 253 $FD

View File

@ -12,6 +12,8 @@ AUTO 6
.INB /A2OSX.DEV/INC/A2OSX.I .INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/NET.TELNET.I .INB /A2OSX.DEV/INC/NET.TELNET.I
*-------------------------------------- *--------------------------------------
TIMEOUT.MAX .EQ 10 1 sec.
*--------------------------------------
ZPTmp1 .EQ ZPBIN ZPTmp1 .EQ ZPBIN
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
@ -33,7 +35,7 @@ CS.START cld
.DA CS.DOEVENT .DA CS.DOEVENT
.DA CS.QUIT .DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE L.MSG.USAGE .DA MSG.USAGE
L.MSG.TELNETOPT .DA MSG.TELNETOPT L.MSG.TELNET.OPT .DA MSG.TELNET.OPT
L.MSG.GREETINGS .DA MSG.GREETINGS L.MSG.GREETINGS .DA MSG.GREETINGS
L.TERM .DA TERM L.TERM .DA TERM
.DA 0 End Of Reloc Table .DA 0 End Of Reloc Table
@ -72,55 +74,124 @@ CS.INIT >SYSCALL GetArgC
ldy #hBinName ldy #hBinName
sta (pData),y sta (pData),y
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN CS.RUN jsr Init.Timeout
>LDYA L.MSG.TELNETOPT
>SYSCALL CPrintFYA .66 >SYSCALL Sleep
bcs *
lda #$83
jsr PRINT.DEBUG
.1 >SYSCALL Sleep
>SYSCALL GetC >SYSCALL GetC
bcs .2 bcc .1
bcs .66
jsr PRINT.DEBUG * jsr Wait.Timeout
bra .1 * bcc .66
* jmp .2
.2 lda #5 Ctrl-E .10 >SYSCALL Sleep
>SYSCALL PutCA
bcs *
lda #$84
jsr PRINT.DEBUG
.3 >SYSCALL Sleep
>SYSCALL GetC >SYSCALL GetC
bcs .4 bcs .1
jsr PRINT.DEBUG
tax .1 cmp #IAC
lda (pData) beq .11
cmp #63
beq .4 jmp .2
inc
sta (pData) .11 >SYSCALL Sleep
tay >SYSCALL GetC
txa bcs .11
ldy #IAC.VERB
sta (pData),y sta (pData),y
bra .3
.4 lda (pData) * jsr PRINT.DEBUG
.12 >SYSCALL Sleep
>SYSCALL GetC
bcs .12
ldy #IAC.OPT
sta (pData),y
* jsr PRINT.DEBUG
ldy #IAC.VERB
lda (pData),y
cmp #SB
bne .10
ldy #IAC.OPT
lda (pData),y
cmp #TELOPT.TTYPE
bne .15 only interested in Term Type, go get IAC,SE
.13 >SYSCALL Sleep
>SYSCALL GetC
bcs .13
cmp #SB.IS not a valid reply, go get IAC,SE
bne .15
lda #0
sta (pData) reset IAC.TERM
.14 >SYSCALL Sleep
>SYSCALL GetC
bcs .14
cmp #IAC
beq .16 end of DATA, go wait SE
pha
lda (pData)
inc
tay
sta (pData)
pla
sta (pData),y
bra .14
.15 >SYSCALL Sleep
>SYSCALL GetC
bcs .15
cmp #IAC
bne .15
.16 >SYSCALL Sleep
>SYSCALL GetC
bcs .16
cmp #SE
bne .16
jmp .10
.2
lda (pData)
beq .5 beq .5
>PUSHW pdata >PUSHW pData
>PUSHW L.TERM >PUSHW L.TERM
>SYSCALL SetEnv >SYSCALL SetEnv
.5 >LDYA L.MSG.GREETINGS .5
>LDYA L.MSG.TELNET.OPT
>SYSCALL CPrintFYA
bcs *
>LDYA L.MSG.GREETINGS
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
bcs .8 unable to send greetings...loop.. bcs .8 unable to send greetings...loop..
@ -134,8 +205,18 @@ CS.RUN
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT sec CS.DOEVENT lda (pEvent)
rts bpl .9 is it a TIMER event?
ldy #TimeOut
lda (pData),y
beq .9
dec
sta (pData),y
.9 sec do not discard TIMER event
rts
*-------------------------------------- *--------------------------------------
CS.QUIT ldy #hBinName CS.QUIT ldy #hBinName
lda (pData),y lda (pData),y
@ -198,18 +279,33 @@ PRINT.DEBUG phx
rts rts
PRINT.DEBUG.JMP jmp $ffff PRINT.DEBUG.JMP jmp $ffff
*-------------------------------------- *--------------------------------------
Init.Timeout ldy #TimeOut
lda #TIMEOUT.MAX
sta (pData),y
rts
*--------------------------------------
Wait.TimeOut sec
ldy #TimeOut
lda (pData),y
beq .9
clc
.9 rts
*--------------------------------------
CS.END CS.END
PRINT.DEBUG.CHAR .AS "0123456789ABCDEF" PRINT.DEBUG.CHAR .AS "0123456789ABCDEF"
MSG.USAGE >CSTR "GETTY <DEV> <PROGRAM>\r\n" MSG.USAGE >CSTR "GETTY <DEV> <PROGRAM>\r\n"
MSG.TELNETOPT MSG.TELNET.OPT
* .DA #IAC,#WILL,#TELOPT.BINARY
* .DA #IAC,#DO,#TELOPT.LINEMODE * .DA #IAC,#DO,#TELOPT.LINEMODE
* .DA #IAC,#SB,#TELOPT.LINEMODE,#1,#0,#IAC,#SE * .DA #IAC,#SB,#TELOPT.LINEMODE,#1,#0,#IAC,#SE
.DA #IAC,#WILL,#TELOPT.BINARY .DA #IAC,#DONT,#TELOPT.ECHO
.DA #IAC,#WILL,#TELOPT.ECHO .DA #IAC,#WILL,#TELOPT.ECHO
* .DA #IAC,#WILL,#TELOPT.SGA .DA #IAC,#WILL,#TELOPT.SGA
.DA #IAC,#DO,#TELOPT.SGA
* .DA #IAC,#DO,#TELOPT.NAWS * .DA #IAC,#DO,#TELOPT.NAWS
.DA #IAC,#DO,TELOPT.TTYPE .DA #IAC,#DO,#TELOPT.TTYPE
.DA #13,#10,#0 .DA #IAC,#SB,#TELOPT.TTYPE,#SB.SEND,#IAC,#SE
.DA #0
MSG.GREETINGS >CSTR "\r\nA2osX-GeTTY\r\n" MSG.GREETINGS >CSTR "\r\nA2osX-GeTTY\r\n"
TERM >PSTR "TERM" TERM >PSTR "TERM"
* \e[12h * \e[12h
@ -217,8 +313,11 @@ TERM >PSTR "TERM"
.DUMMY .DUMMY
.OR 0 .OR 0
DS.START DS.START
InBuf .BS 64 IAC.TERM .BS 64
hBinName .BS 1 hBinName .BS 1
TimeOut .BS 1
IAC.VERB .BS 1
IAC.OPT .BS 1
DS.END .ED DS.END .ED
MAN MAN
SAVE SBIN/GETTY.S SAVE SBIN/GETTY.S