Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-09-09 10:11:42 +02:00
parent a57ee2791e
commit f3857cd815
10 changed files with 273 additions and 118 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -44,6 +44,8 @@ L.MSG.HOSTOK .DA MSG.HOSTOK
L.MSG.SKTKO .DA MSG.SKTKO
L.MSG.SKTOK .DA MSG.SKTOK
L.MSG.SKTERR .DA MSG.SKTERR
L.MSG.IOERR .DA MSG.IOERR
L.MSG.USER .DA MSG.USER
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBTCPIP
@ -175,14 +177,16 @@ CS.RUN.LOOP >SLEEP
tay
beq .2 no char
rts
jmp CS.RUN.SKTERR
.1 >PUSHYA len
* lda #'@'
* >SYSCALL putchar
>PUSHW ZPBufPtr
ldy #S.PS.hStdOut
lda (pPs),y
>SYSCALL write
bcs CS.RUN.ERR
bcs .11
.2 >PUSHWI BUFSIZE
>PUSHW ZPBufPtr
@ -191,31 +195,50 @@ CS.RUN.LOOP >SLEEP
>SYSCALL read
bcc .3
tay
beq CS.RUN.LOOP
beq CS.RUN.LOOP no char from STDIN
>PUSHA
>PUSHBI 1
>LDYA L.MSG.SKTERR
>SYSCALL printf
rts
.11 jmp CS.RUN.IOERR
.3 >STYA ZPBufLen
lda (ZPBufPtr)
cmp #3 Ctrl-C
beq .9
beq CS.RUN.USER
>PUSHB.G hSocket
>PUSHW ZPBufPtr
>PUSHW ZPBufLen
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Write
bcs CS.RUN.ERR
bcs CS.RUN.SKTERR
jmp CS.RUN.LOOP
.9 lda #0
sec
CS.RUN.ERR rts
rts
*--------------------------------------
CS.RUN.SKTERR pha
>PUSHA
>PUSHBI 1
>LDYA L.MSG.SKTERR
>SYSCALL printf
pla
sec
rts
*--------------------------------------
CS.RUN.IOERR pha
>PUSHA
>PUSHBI 1
>LDYA L.MSG.IOERR
>SYSCALL printf
pla
sec
rts
*--------------------------------------
CS.RUN.USER >LDYA L.MSG.USER
>SYSCALL puts
lda #3
sec
rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9 is it a TIMER event?
@ -268,6 +291,8 @@ MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s) ...\r\n"
MSG.SKTKO .AZ "Failed to Open Socket."
MSG.SKTOK .AZ "Connected."
MSG.SKTERR .AZ "Socket Error : $%h\r\n"
MSG.IOERR .AZ "I/O Error : $%h\r\n"
MSG.USER .AZ "User interrupt."
*--------------------------------------
Socket .DA #S.SOCKET.SOCK.STREAM
.BS 1

View File

@ -62,14 +62,16 @@ FD.DEV .DA #S.FD.T.CDEV
*--------------------------------------
CURSOR.BLINK.SPEED .EQ 2
ESCSEQ.MAXLEN .EQ 16
OUTBUF.MAXLEN .EQ 32
IACBUF.MAXLEN .EQ 32
*--------------------------------------
ZPBaseL1 .EQ ZPDRV
ZPBaseL2 .EQ ZPDRV+2
ZPTmpWord .EQ ZPDRV+4
ZPTmpBool .EQ ZPDRV+6
ZPBufPtr .EQ ZPDRV+8
ZPCount .EQ ZPDRV+10
ZPIOCTL .EQ ZPDRV+12
ZPIOCTL .EQ ZPDRV+8
ZPBufPtr .EQ ZPDRV+10
ZPCount .EQ ZPDRV+12
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
@ -102,6 +104,12 @@ J.EscSequences .DA Esc.DispAttr m
.DA Esc.Scroll r
.DA Esc.Erase K
.DA Esc.Home H
*--------------------------------------
J.COUT.IAC.CMDS .DA COUT.IAC.SB
.DA COUT.IAC.WILL
.DA COUT.IAC.WONT
.DA COUT.IAC.DO
.DA COUT.IAC.DONT
.DA 0 end of relocation
*--------------------------------------
STATUS >STYA ZPIOCTL
@ -178,12 +186,9 @@ CLOSE lda #S.DIB.S.OPENED
*--------------------------------------
READ >STYA ZPIOCTL
jsr Char.Out.Get
bcc .8 IF cs,no char in output buffer...
lda A2osX.ASCREEN
cmp #1 is CON active?
bne .9 no....exit
bne .6 no....go check flush...
lda A2osX.TIMER16
and #CURSOR.BLINK.SPEED
@ -192,10 +197,10 @@ READ >STYA ZPIOCTL
jsr CURBLNK
.1 lda OPENAPPLE
bmi .9 Open apple key, not for us...
bmi .6 Open apple key, not for us...
lda KBD
bpl .9
bpl .6
sta KBDSTROBE
and #$7F
@ -205,37 +210,43 @@ READ >STYA ZPIOCTL
beq .3
dex
bne .2
bra .8
jsr Char.Out.Put no remap....send char....
bra .7 and flush
.3 lda KeyRemappedIdx,x
tay
.4 lda KeyRemappedTbl,y
beq .6
beq .7 end of remap....flush
jsr Char.Out.Put
iny
bra .4
.6 jsr Char.Out.Get
.6 lda OutCnt
beq .9 no char in output buffer...
.8 pha
.7 stz .8+1
jsr GetPtrsAndCnt
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
.70 inc ZPCount
bne .71
inc ZPCount+1
beq .8
sta ZPBufPtr
.71 jsr Char.Out.Get
bcs .8
ldy .8+1
sta (ZPBufPtr),y
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
sty .8+1
bra .70
pla
sta (ZPBufPtr)
lda #1
.8 lda #$ff SELF MODIFIED
ldy #S.IOCTL.BYTECNT
sta (ZPIOCTL),y
iny
dec
lda #0
sta (ZPIOCTL),y
clc
@ -247,29 +258,12 @@ READ >STYA ZPIOCTL
*--------------------------------------
WRITE >STYA ZPIOCTL
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
ldy #S.IOCTL.BYTECNT
lda (ZPIOCTL),y
eor #$ff
sta ZPCount
iny
lda (ZPIOCTL),y
eor #$ff
sta ZPCount+1
jsr GetPtrsAndCnt
.2 inc ZPCount
bne .3
inc ZPCount+1
bne .3
clc
rts
beq .8
.3 lda (ZPBufPtr)
inc ZPBufPtr
@ -278,14 +272,17 @@ WRITE >STYA ZPIOCTL
.4 jsr WRITE.COUT
.5 bra .2
bra .2
.8 clc
rts
*--------------------------------------
WRITE.COUT bit bEscMode
bmi COUT.EscMode
bit bIACMode
bpl .10
jmp COUT.IACMode
jmp COUT.IAC
.10 cmp #IAC
bne .1
@ -460,27 +457,48 @@ COUT.ExecEscSeq stz EscSeqParamCnt
.5 jmp (J.EscSequences,x)
*--------------------------------------
COUT.IACMode inc IACBuf
COUT.IAC inc IACBuf
ldx IACBuf
cpx #IACBUF.MAXLEN
beq *
sta IACBuf,x
cpx #1 VERB ?
cpx #1 CMD ?
beq .8 yes, wait for additional bytes
ldy IACBuf+1 get back VERB
ldy IACBuf+1 get back CMD
cpy #SB
bne .2 not a SB/SE....
bne .1 not a SB/SE....stop with CMD/SUBCMD
cmp #SE
bne .8 wait for ending SE....keep bIACMode
lda IACBuf+2 Get OPT
cmp #TELOPT.TTYPE
bne .7
.1 cpy #IAC
beq .9
tya
sec
sbc #SB
bcc .9
asl
tax
lda IACBuf+2 Get SUBCMD in A
cpx #10
bcs *
jmp (J.COUT.IAC.CMDS,x)
.9 stz bIACMode
.8 clc
rts
*--------------------------------------
COUT.IAC.SB cmp #TELOPT.TTYPE
bne .9
lda IACBuf+3
cmp #SB.SEND
bne .7
bne .9
ldy #0
@ -489,26 +507,87 @@ COUT.IACMode inc IACBuf
iny
cpy #SB.IS.TTYPE.LEN
bne .1
bra .7
.2 cpy #DO
bne .6
.9 stz bIACMode
cmp #TELOPT.TTYPE
bne .7
clc
rts
*--------------------------------------
COUT.IAC.WILL ldx #WILLDO.CNT-1
.1 cmp WILLDO,x
beq .7
dex
bpl .1
ldx #WILLDONT.CNT-1
.2 cmp WILLDONT,x
beq .8
dex
bpl .2
bra .9
.7 ldx #DO
.HS 2C BIT ABS
.8 ldx #DONT
bra COUT.IAC.SendAX
.9 stz bIACMode
clc
rts
*--------------------------------------
COUT.IAC.WONT
.9 stz bIACMode
clc
rts
*--------------------------------------
COUT.IAC.DO ldx #DOWILL.CNT-1
.1 cmp DOWILL,x
beq .7
dex
bpl .1
ldx #DOWONT.CNT-1
.2 cmp DOWONT,x
beq .8
dex
bpl .2
bra COUT.IAC.SendAX.9
.7 ldx #WILL
.HS 2C BIT ABS
.8 ldx #WONT
*--------------------------------------
COUT.IAC.SendAX
pha push CMD
phx
lda #IAC
jsr Char.Out.Put
lda #WILL
pla
jsr Char.Out.Put
lda #TELOPT.TTYPE
pla
jsr Char.Out.Put
bra .7
.6
COUT.IAC.SendAX.9
stz bIACMode
.7 stz bIACMode
clc
rts
*--------------------------------------
COUT.IAC.DONT
.9 stz bIACMode
.8 clc
clc
rts
*--------------------------------------
RESET jsr CLRSCR
@ -937,7 +1016,7 @@ Char.Out.Put pha
lda OutPtr
clc
adc OutCnt
and #$0f
and #OUTBUF.MAXLEN-1
tax
pla
sta OutBuffer,x
@ -953,12 +1032,31 @@ Char.Out.Get sec
pha
txa
inc
and #$0f
and #OUTBUF.MAXLEN-1
sta OutPtr
pla
clc
.9 rts
*--------------------------------------
GetPtrsAndCnt ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
* ldy #S.IOCTL.BYTECNT
iny
lda (ZPIOCTL),y
eor #$ff
sta ZPCount
iny
lda (ZPIOCTL),y
eor #$ff
sta ZPCount+1
rts
*--------------------------------------
DRV.CS.END
EscCodes >PSTR "MDc"
EscSeqCmds >PSTR "mnrKH"
@ -970,17 +1068,6 @@ SB.IS.TTYPE.LEN .EQ *-SB.IS.TTYPE
BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
*--------------------------------------
CH .BS 1
CV .BS 1
INVFLG .BS 1
SCROLLTOP .BS 1
SCROLLBOT .BS 1
CURON .BS 1
CURCHAR .BS 1
OutBuffer .BS 16
OutPtr .BS 1
OutCnt .BS 1
*--------------------------------------
KeyRemapped .HS 05080A0B0D15 L,D,U,CR,R
KeyRemappedIdx .HS 050004080C0F
KeyRemappedTbl .EQ *
@ -992,10 +1079,30 @@ KeyRemappedRGHT .HS 1B5B4300 esc[C
TelnetOpt .DA #IAC,#DO,#TELOPT.ECHO
.DA #0
*--------------------------------------
CtrlChars.Cnt .EQ 7
WILLDO .DA #TELOPT.BINARY,#TELOPT.SGA,#TELOPT.NAWS
WILLDO.CNT .EQ *-WILLDO
WILLDONT .DA #TELOPT.TSPEED,#TELOPT.LINEMODE
WILLDONT.CNT .EQ *-WILLDONT
DOWILL .DA #TELOPT.BINARY,#TELOPT.SGA,#TELOPT.NAWS
DOWILL.CNT .EQ *-DOWILL
DOWONT .DA #TELOPT.NEWENVIRON
DOWONT.CNT .EQ *-DOWONT
*--------------------------------------
CtrlChars .HS 05080A0C0D151B
CtrlChars.Cnt .EQ *-CtrlChars
*--------------------------------------
CH .BS 1
CV .BS 1
INVFLG .BS 1
SCROLLTOP .BS 1
SCROLLBOT .BS 1
CURON .BS 1
CURCHAR .BS 1
OutBuffer .BS OUTBUF.MAXLEN
OutPtr .BS 1
OutCnt .BS 1
bIACMode .BS 1
IACBuf .BS 33
IACBuf .BS OUTBUF.MAXLEN+1
bEscMode .BS 1
bEscModeCSI .BS 1
bEscSeqInNum .BS 1

View File

@ -8,6 +8,8 @@ TCP.PORT.TELNET .EQ 23
*--------------------------------------
SE .EQ 240 $F0
SB .EQ 250 $FA
SB.IS .EQ 0
SB.SEND .EQ 1
WILL .EQ 251 $FB
WONT .EQ 252 $FC
DO .EQ 253 $FD
@ -56,8 +58,5 @@ TELOPT.ENCRYPT .EQ 38 Encryption option
TELOPT.NEWENVIRON .EQ 39 New - Environment variables
TELOPT.EXOPL .EQ 255 extended-options-list
*--------------------------------------
SB.IS .EQ 0
SB.SEND .EQ 1
*--------------------------------------
MAN
SAVE /A2OSX.BUILD/INC/NET.TELNET.I

View File

@ -258,6 +258,20 @@ TCP.IN.JMP.ESTBLSH
ora #S.TCP.OPTIONS.ACK ACK the FIN....
sta (ZPPtrSKT),y
jsr SKT.GetTCB
ldx #3
ldy #S.TCP.ACKNUM+3
sec
.3 lda SKT.TCBCache+S.TCB.OUTACKNUM,x
adc #0
sta SKT.TCBCache+S.TCB.OUTACKNUM,x
dey
dex
bpl .3
jsr TCP.OUT.I SKT.GetTCB called, try to ACK the FIN
bcs .9
@ -275,8 +289,8 @@ TCP.IN.JMP.CLWAIT
TCP.IN.JMP.LASTACK
ldy #S.TCP.OPTIONS only accept ACK packet
lda (ZPFrameInPtr),y
cmp #S.TCP.OPTIONS.ACK
bne .8
bit #S.TCP.OPTIONS.ACK
beq .8
jmp SKT.Destroy
@ -318,8 +332,8 @@ TCP.IN.JMP.FINWT2.1
TCP.IN.JMP.CLOSING
ldy #S.TCP.OPTIONS only accept ACK packet
lda (ZPFrameInPtr),y
cmp #S.TCP.OPTIONS.ACK
bne .1
bit #S.TCP.OPTIONS.ACK
beq .1
ldy #S.SOCKET.TCP.STATUS
lda #S.SOCKET.TCP.STATUS.TIMEWT
@ -331,8 +345,7 @@ TCP.IN.JMP.CLOSING
TCP.IN.JMP.TIMEWT
*--------------------------------------
TCP.IN.JMP.CLOSED
clc
rts
jmp SKT.Destroy
*--------------------------------------
TCP.IN.SetDataInPtrAndLen
ldy #S.IP.TOTAL.LENGTH+1

View File

@ -60,13 +60,12 @@ CL.CHARIN tax
.9 clc
rts
*--------------------------------------
CL.CHARIN.CTRL cpx #13 CR
CL.CHARIN.CTRL cpx #C.CR
bne .10
txa
>SYSCALL PutChar
lda #10
>SYSCALL PutChar
>PUSHBI 0
>LDYA L.MSG.ECHOCRLF
>SYSCALL printf
>LDA.G CmdBufPtr
tay
@ -80,7 +79,7 @@ CL.CHARIN.CTRL cpx #13 CR
clc
rts
.10 cpx #$1B esc
.10 cpx #C.ESC
bne .11
lda #$ff
@ -165,7 +164,7 @@ CL.BS >LDA.G CmdBufPtr
dec
sta (pData),y
lda #8
lda #C.BS
>SYSCALL PutChar
.9 rts
*--------------------------------------
@ -176,7 +175,7 @@ CL.NAK >LDA.G CmdBufPtr
inc
>STA.G CmdBufPtr
lda #21
lda #C.FS
>SYSCALL PutChar
.9 rts
*--------------------------------------
@ -196,7 +195,7 @@ CL.DEL >LDA.G CmdBuflen
>LDA.G CmdBufPtr
beq CL.PrintEOL.8
lda #8
lda #C.BS
>SYSCALL PutChar
>DEC.G CmdBufPtr
@ -242,13 +241,13 @@ CL.PrintEOL >LDA.G CmdBufPtr
pha
lda #8
lda #C.BS
>SYSCALL PutChar
pla
inc
bra .3
.4 lda #8
.4 lda #C.BS
>SYSCALL PutChar
CL.PrintEOL.8 clc

View File

@ -46,6 +46,7 @@ CS.START cld
L.MSG.GREETINGS .DA MSG.GREETINGS
L.MSG.PROMPT .DA MSG.PROMPT
L.MSG.ECHO .DA MSG.ECHO
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
L.MSG.ERROR .DA MSG.ERROR
L.MSG.PRINTENV .DA MSG.PRINTENV
L.MSG.CSHERR .DA MSG.CSHERR
@ -358,7 +359,8 @@ INTCMDS .AZ "CD"
*--------------------------------------
MSG.GREETINGS .AZ "\r\nA2osX-Shell %d.%d\r\n\r\n"
MSG.PROMPT .AZ "$ "
MSG.ECHO .AZ ">%s\r\n"
MSG.ECHO .AS ">%s"
MSG.ECHOCRLF .AZ "\r\n"
MSG.ERROR .AZ "[$%h]:%S.\r\n"
MSG.PRINTENV .AZ "%s=%s\r\n"
MSG.CSHERR .AZ "^\r\nLine #%D:"

View File

@ -429,8 +429,18 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
.1 lda (ZPPtr1),y Start Relocate JMP table
tax LO in X
iny
ora (ZPPtr1),y ORA with HI
beq .2 $0000 = end of table
lda (ZPPtr1),y HI in A
beq .2 $00xx = end of table
cpx BIN.R.CS.Start
sbc BIN.R.CS.Start+1
bcc .11 addr < BIN.R.CS.Start, out of range
txa Get back LO
cpx BIN.R.End
lda (ZPPtr1),y Get HI
sbc BIN.R.End+1
bcs .11 addr > BIN.R.End, out of range
dey
txa get back LO
@ -443,7 +453,7 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
adc BIN.R.Offset+1
sta (ZPPtr1),y
iny
.11 iny
bra .1
*--------------------------------------