Kernel version 0.9 : More ANSI/Telnet support

This commit is contained in:
Rémy GIBERT 2017-02-03 17:58:13 +01:00
parent b0fd171a06
commit eeaf77a48a
5 changed files with 126 additions and 33 deletions

Binary file not shown.

Binary file not shown.

View File

@ -68,7 +68,8 @@ DRV.CS.START cld
.DA WRITE
L.STAT .DA STAT
*--------------------------------------
J.CtrlChars .DA BS 8
J.CtrlChars .DA ENQ 5
.DA BS 8
.DA LF 10
.DA HOME 12
.DA CROUT 13
@ -327,6 +328,17 @@ ESC lda #$80
clc
rts
*--------------------------------------
ENQ ldy #0
.1 lda ENQ.String,y
beq .8
jsr Char.Out.Put
iny
bne .1
.8 clc
rts
*--------------------------------------
BS ldx CH
beq .1
dec CH
@ -786,7 +798,7 @@ KeyRemappedUP .HS 1B5B4100 esc[A
KeyRemappedCR .HS 0D0A00 crlf
KeyRemappedRGHT .HS 1B5B4300 esc[C
*--------------------------------------
CtrlChars .HS 05080A0C0D1B
CtrlChars .HS 0605080A0C0D1B
bEscMode .BS 1
bEscModeCSI .BS 1
bEscSeqInNum .BS 1
@ -801,6 +813,7 @@ STAT .DA #S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA #S.DEVSTAT.TYPE.CHAR
.DA #0
.DA $0900
ENQ.String >CSTR "A2osXTERM"
*--------------------------------------
MAN
SAVE DRV/CONSOLE.DRV.S

View File

@ -12,8 +12,8 @@ AUTO 6
.INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/PRODOS.I
*--------------------------------------
BUF.SIZE .EQ $20
BUF.MASK .EQ $1F
BUF.SIZE .EQ $40
BUF.MASK .EQ $3F
*--------------------------------------
ZPTmpPtr1 .EQ ZPDRV
*--------------------------------------
@ -168,7 +168,7 @@ READ php
beq .9
lda INBUF,x
jsr READ.DEBUG
inx
cpx #BUF.SIZE
bne .1
@ -186,20 +186,66 @@ READ php
sec
rts
*--------------------------------------
READ.DEBUG phx
phy
pha
lda #2
>SYSCALL GetDevByIDA
>STYA ZPTmpPtr1
lda (ZPTmpPtr1)
sta READ.DEBUG.JMP+1
ldy #1
lda (ZPTmpPtr1),y
sta READ.DEBUG.JMP+2
pla
pha
lsr
lsr
lsr
lsr
tax
lda READ.DEBUG.CHAR,x
ldx #DEVMGR.WRITE
jsr READ.DEBUG.JMP
pla
pha
and #$0F
tax
lda READ.DEBUG.CHAR,x
ldx #DEVMGR.WRITE
jsr READ.DEBUG.JMP
lda #'/'
ldx #DEVMGR.WRITE
jsr READ.DEBUG.JMP
pla
ply
plx
rts
READ.DEBUG.JMP jmp $ffff
READ.DEBUG.CHAR .AS "0123456789ABCDEF"
*--------------------------------------
WRITE php
sei
tay save char in Y
* ldx DEVSLOTn0
ldx DEVSLOTn0
* lda SSC.STATUS,x
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR true when 0
* bne .9
ldx OUTBUF.HEAD
cpx OUTBUF.TAIL Buffer Empty?
lda OUTBUF.HEAD
cmp OUTBUF.TAIL Buffer Empty?
bne .11 not empty, queue char
ldx DEVSLOTn0
lda SSC.STATUS,x
and #SSC.STATUS.TDRE Register Empty ?
@ -212,17 +258,15 @@ WRITE php
clc
rts
.10 ldx OUTBUF.HEAD
.10 lda OUTBUF.HEAD
.11 inx
cpx #BUF.SIZE
bne .12
ldx #0
.12 cpx OUTBUF.TAIL
.11 tax
inc
and #BUF.MASK
cmp OUTBUF.TAIL
beq .9 Buffer Full!!
stx OUTBUF.TAIL
sta OUTBUF.TAIL
tya
sta OUTBUF,x
@ -245,6 +289,7 @@ IRQ stz .8+1
.1 ldx DEVSLOTn0
lda SSC.STATUS,x
* bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
bit #SSC.STATUS.RDRF incoming char?
@ -257,11 +302,8 @@ IRQ stz .8+1
ldx INBUF.HEAD
txa
inc
cmp #BUF.SIZE
bne .2
lda #0
.2 cmp INBUF.TAIL
and #BUF.MASK
cmp INBUF.TAIL
beq .8 buffer full, discard and exit
sta INBUF.HEAD

View File

@ -32,7 +32,9 @@ CS.START cld
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.TELNETOPT .DA MSG.TELNETOPT
L.MSG.GREETINGS .DA MSG.GREETINGS
L.TERM .DA TERM
.DA 0 End Of Reloc Table
*--------------------------------------
CS.INIT >SYSCALL GetArgC
@ -73,20 +75,37 @@ CS.INIT >SYSCALL GetArgC
clc
.9 rts
*--------------------------------------
CS.RUN lda #255 IAC
>SYSCALL PutCA
CS.RUN >LDYA L.MSG.TELNETOPT
>SYSCALL CPrintFYA
bcs .8
* lda #254 DONT
* >SYSCALL PutCA
lda #251 WILL
lda #5 Ctrl-E
>SYSCALL PutCA
bcs .8
lda #1 ECHO
>SYSCALL PutCA
.1 >SYSCALL Sleep
>SYSCALL GetC
bcs .1
cmp #13
beq .2
tax
lda (pData)
cmp #63
beq .1
inc
sta (pData)
tay
txa
sta (pData),y
bra .1
.2 >DEBUG
>PUSHYA
* >PUSHW pdata
* >PUSHW L.TERM
* >SYSCALL SetEnv
>LDYA L.MSG.GREETINGS
>SYSCALL CPrintFYA
@ -115,13 +134,32 @@ CS.QUIT ldy #hBinName
clc
rts
*--------------------------------------
* 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
WILL .EQ 251
WONT .EQ 252
DO .EQ 253
DONT .EQ 254
IAC .EQ 255
TELOPT.ECHO .EQ 1
TELOPT.SGA .EQ 3
TELOPT.NAWS .EQ 31
TELOPT.LINEMODE .EQ 34
*--------------------------------------
CS.END
MSG.USAGE >CSTR "GETTY <DEV> <PROGRAM>"
MSG.GREETINGS >CSTR "\e[12h\nA2osX-GeTTY\n"
MSG.TELNETOPT .DA #IAC,#WILL,#TELOPT.ECHO
.DA #IAC,#WILL,#TELOPT.SGA
.DA #IAC,#DONT,#TELOPT.LINEMODE
.DA #IAC,#DO,#TELOPT.NAWS
.DA #0
MSG.GREETINGS >CSTR "\nA2osX-GeTTY\n"
TERM >PSTR "TERM"
* \e[12h
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.START
InBuf .BS 64
hBinName .BS 1
DS.END .ED
MAN