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

View File

@ -12,8 +12,8 @@ AUTO 6
.INB /A2OSX.DEV/INC/A2OSX.I .INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/PRODOS.I .INB /A2OSX.DEV/INC/PRODOS.I
*-------------------------------------- *--------------------------------------
BUF.SIZE .EQ $20 BUF.SIZE .EQ $40
BUF.MASK .EQ $1F BUF.MASK .EQ $3F
*-------------------------------------- *--------------------------------------
ZPTmpPtr1 .EQ ZPDRV ZPTmpPtr1 .EQ ZPDRV
*-------------------------------------- *--------------------------------------
@ -168,7 +168,7 @@ READ php
beq .9 beq .9
lda INBUF,x lda INBUF,x
jsr READ.DEBUG
inx inx
cpx #BUF.SIZE cpx #BUF.SIZE
bne .1 bne .1
@ -186,20 +186,66 @@ READ php
sec sec
rts 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 WRITE php
sei sei
tay save char in Y tay save char in Y
* ldx DEVSLOTn0 ldx DEVSLOTn0
* lda SSC.STATUS,x * lda SSC.STATUS,x
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR true when 0 * bit #SSC.STATUS.DCD+SSC.STATUS.DSR true when 0
* bne .9 * bne .9
ldx OUTBUF.HEAD lda OUTBUF.HEAD
cpx OUTBUF.TAIL Buffer Empty? cmp OUTBUF.TAIL Buffer Empty?
bne .11 not empty, queue char bne .11 not empty, queue char
ldx DEVSLOTn0
lda SSC.STATUS,x lda SSC.STATUS,x
and #SSC.STATUS.TDRE Register Empty ? and #SSC.STATUS.TDRE Register Empty ?
@ -212,17 +258,15 @@ WRITE php
clc clc
rts rts
.10 ldx OUTBUF.HEAD .10 lda OUTBUF.HEAD
.11 inx .11 tax
cpx #BUF.SIZE inc
bne .12 and #BUF.MASK
ldx #0 cmp OUTBUF.TAIL
.12 cpx OUTBUF.TAIL
beq .9 Buffer Full!! beq .9 Buffer Full!!
stx OUTBUF.TAIL sta OUTBUF.TAIL
tya tya
sta OUTBUF,x sta OUTBUF,x
@ -245,6 +289,7 @@ IRQ stz .8+1
.1 ldx DEVSLOTn0 .1 ldx DEVSLOTn0
lda SSC.STATUS,x lda SSC.STATUS,x
* bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!! * bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
bit #SSC.STATUS.RDRF incoming char? bit #SSC.STATUS.RDRF incoming char?
@ -257,11 +302,8 @@ IRQ stz .8+1
ldx INBUF.HEAD ldx INBUF.HEAD
txa txa
inc inc
cmp #BUF.SIZE and #BUF.MASK
bne .2 cmp INBUF.TAIL
lda #0
.2 cmp INBUF.TAIL
beq .8 buffer full, discard and exit beq .8 buffer full, discard and exit
sta INBUF.HEAD sta INBUF.HEAD

View File

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