Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-09-01 12:47:39 +02:00
parent eb9443dce4
commit b8e761fdbb
6 changed files with 119 additions and 55 deletions

Binary file not shown.

View File

@ -21,17 +21,20 @@ ZS.START
ZPIPCfgPtr .BS 2
ZPHostPtr .BS 2
ZPPtr .BS 2
ZPReqBufPtr .BS 2
hReqBuf .BS 1
ZPReqBufPtr .BS 2
ZPReqBufLen .BS 2
hEncodedBuf .BS 1
ZPEncodedBufPtr .BS 2
ZPEncodedBufLen .BS 2
ZPRespBufPtr .BS 2
ZPRespBufLen .BS 2
ArgIndex .BS 1
hSocket .BS 1
hReqBuf .BS 1
hEncodedBuf .BS 1
hSendBuf .BS 1
ZPSendBufPtr .BS 2
@ -136,13 +139,13 @@ CS.RUN.IPOK ldy #S.IPCFG.IP+3
CS.RUN.ESYN lda #E.SYN
sec
CS.RUN.RTS rts
*--------------------------------------
CS.RUN.HOSTOK inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcc .10
jmp CS.RUN.PORTOK
.8 jmp CS.RUN.ARGSOK
.10 >STYA ZPPtr
lda (ZPPtr)
@ -154,6 +157,7 @@ CS.RUN.HOSTOK inc ArgIndex
bcs CS.RUN.RTS
>STYA SA.REMOTE+S.SOCKADDR.PORT
inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
@ -176,6 +180,9 @@ CS.RUN.HOSTOK inc ArgIndex
.11 cmp #'U'
bne .2
bit bURI
bmi CS.RUN.ESYN
inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
@ -185,11 +192,16 @@ CS.RUN.HOSTOK inc ArgIndex
>STYA ZPReqBufPtr
>SYSCALL StrLen
>STYA ZPReqBufLen
.8 bra CS.RUN.PORTOK
sec
ror bURI
bra CS.RUN.HOSTOK
.2 cmp #'F'
bne .3
bit bURI
bmi CS.RUN.ESYN
inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
@ -209,7 +221,7 @@ CS.RUN.HOSTOK inc ArgIndex
sec
ror bURI
bra CS.RUN.PORTOK
jmp CS.RUN.HOSTOK
.3 cmp #'O'
bcs .9
@ -220,8 +232,9 @@ CS.RUN.HOSTOK inc ArgIndex
bcs .9
>STYA ZPFileName
CS.RUN.PORTOK >PUSHW L.MSG.CONNECT
jmp CS.RUN.HOSTOK
*--------------------------------------
CS.RUN.ARGSOK >PUSHW L.MSG.CONNECT
ldx #0
.1 >PUSHB SA.REMOTE+S.SOCKADDR.ADDR,x
@ -459,9 +472,6 @@ CS.RUN.RESPONSE jsr Init.TimeOut
.1 >SLEEP
lda #'?'
>SYSCALL putchar
lda hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcc .2
@ -474,25 +484,74 @@ CS.RUN.RESPONSE jsr Init.TimeOut
bra .80
.2 lda #'!'
>SYSCALL putchar
>SYSCALL GetMemPtr
.2 >SYSCALL GetMemPtr
>STYA ZPRespBufPtr
ldy #S.IP.TOTAL.LENGTH+1
lda (ZPRespBufPtr),y
sec
sbc #S.TCP-S.IP
sta ZPRespBufLen
dey
lda (ZPRespBufPtr),y
sbc /S.TCP-S.IP
sta ZPRespBufLen+1
lda ZPRespBufPtr
clc
adc #S.TCP
sta ZPRespBufPtr
bcc .3
inc ZPRespBufPtr+1
.3 bit bResponse
bmi .6
.30 ldx #0
.4 dex
lda (ZPRespBufPtr)
inc ZPRespBufPtr
bne .5
inc ZPRespBufPtr+1
.5 cmp #C.LF
bne .4
txa
* sec
adc ZPRespBufLen
sta ZPRespBufLen
lda ZPRespBufLen+1
adc #$ff
sta ZPRespBufLen+1
inx
inx
bne .30
sec
ror bResponse
.6 >PUSHW ZPRespBufLen
>PUSHW ZPRespBufPtr
lda hFile
bne .3
bne .7
ldy #S.PS.hStdOut
lda (pPS),y
.3 >SYSCALL FWrite
.7 >SYSCALL FWrite
bcs .9
sec
ror bResponse
bra CS.RUN.RESPONSE
jmp CS.RUN.RESPONSE
.8 cmp #MLI.E.IO SKT Close ?
bne .9
@ -504,8 +563,8 @@ CS.RUN.RESPONSE jsr Init.TimeOut
rts
.99 lda #MLI.E.IO
.9 sec
rts
sec
.9 rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9 is it a TIMER event?

View File

@ -36,29 +36,26 @@ DHCP.RUN >PUSHBI 0 no protocol
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
bcc .1
.9 jmp DHCP.RUN.KO
.1 >STA.G hSocket
.1 sta hSocket
pha
>PUSHW L.SA.LOCAL
pla
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
bcs .9
>PUSHWI S.SOCKET.O.BROADCAST
>LDA.G hSocket
lda hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.setsockopt
>PUSHW L.SA.REMOTE
>LDA.G hSocket
lda hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
bcs .9
>LDYA L.MSG.DHCP.CFG1
>SYSCALL PutS
lda #TIMEOUT.MAX
sta TimeOut
DHCP.RUN.SDISC >PUSHW L.SA.DEST
>PUSHWI DHCP.DISC.LEN
>PUSHW L.DHCP.DISC
>LDA.G hSocket
lda hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.SendTo
bcc .1
@ -67,15 +64,12 @@ DHCP.RUN.SDISC >PUSHW L.SA.DEST
.1 lda #S.IPCFG.STATUS.SDISC
sta IPCFG
DHCP.RUN.ROFFER >SLEEP
jsr DHCP.RUN.SKT.RCVD
DHCP.RUN.ROFFER jsr DHCP.RUN.SKT.RECV
bcc .1
lda TimeOut
bne DHCP.RUN.ROFFER
lda #1
jmp DHCP.RUN.KO
.1 jsr CheckDHCPOffer
bcs DHCP.RUN.ROFFER
lda #S.IPCFG.STATUS.ROFFER
@ -94,20 +88,16 @@ DHCP.RUN.SREQ >PUSHW L.MSG.DHCP.CFG2
>PUSHW L.SA.DEST
>PUSHWI DHCP.REQ.LEN
>PUSHW L.DHCP.REQ
>LDA.G hSocket
lda hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.SendTo
bcs DHCP.RUN.KO
lda #S.IPCFG.STATUS.SREQ
sta IPCFG
DHCP.RUN.RACK >SLEEP
jsr DHCP.RUN.SKT.RCVD
DHCP.RUN.RACK jsr DHCP.RUN.SKT.RECV
bcc .1
lda TimeOut
bne DHCP.RUN.RACK
lda #2
bra DHCP.RUN.KO
@ -153,17 +143,32 @@ DHCP.RUN.KO pha
sec
rts
*--------------------------------------
DHCP.RUN.SKT.RCVD
>LDA.G hSocket
DHCP.RUN.SKT.RECV
lda #TIMEOUT.MAX
sta TimeOut
.1 >SLEEP
lda hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcs .9
>STA.G hFrame
bcc .8
cmp #E.NODATA
bne .9
lda TimeOut
bne .1
.9 sec
rts
.8 sta hFrame
>SYSCALL GetMemPtr
>STYA ZPFrameBase
.9 rts
rts
*--------------------------------------
DHCP.QUIT >LDA.G hSocket
DHCP.QUIT lda hSocket
beq .1
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
@ -317,7 +322,7 @@ CheckDHCPAck jsr CheckDHCPXID
sec
rts
*--------------------------------------
CS.RUN.DISCARD >LDA.G hFrame
CS.RUN.DISCARD sta hFrame
>SYSCALL FreeMem
rts
*--------------------------------------

View File

@ -1,6 +1,5 @@
NEW
AUTO 3,1
.LIST OFF
*/--------------------------------------
* # Socket
* Create a new socket
@ -948,7 +947,7 @@ SKT.Recv clc
sec
rts
.90 lda #0 no data
.90 lda #E.NODATA
plp
sec
rts

View File

@ -220,7 +220,7 @@ CS.RUN.Negotiate
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcc .3
tay
cmp #E.NODATA
beq .2
bra .99
@ -273,7 +273,7 @@ CS.RUN.SessSetup
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcc .3
tay
cmp #E.NODATA
beq .2
bra .99
@ -338,7 +338,7 @@ CS.RUN.TreeConn lda #TIMEOUT.MAX
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcc .3
tay
cmp #E.NODATA
beq .2
bra .99
@ -419,7 +419,7 @@ CIFS.OpenDir lda #TIMEOUT.MAX
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcc .3
tay
cmp #E.NODATA
beq .2
bra .99

View File

@ -371,8 +371,9 @@ CS.RUN.CLIENT >LDYAI 1024
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
bcc .2
tay
cmp #E.NODATA
beq .1
jmp .99
.2 jsr CS.RUN.REQ.GetReq