Kernel version 0.9 : Bug Fix in UDP preventing even DHCP to work properly!!!!

This commit is contained in:
Rémy GIBERT 2017-01-30 22:03:12 +01:00
parent 8c891ccf04
commit 2aa2b79f72
8 changed files with 61 additions and 57 deletions

Binary file not shown.

Binary file not shown.

View File

@ -69,7 +69,7 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
lda #SYSMGR.ERRSYN lda #SYSMGR.ERRSYN
sec sec
rts rts
*--------------------------------------
CS.RUN.IPOK >SYSCALL GetArgC CS.RUN.IPOK >SYSCALL GetArgC
cmp #1 cmp #1
beq .9 beq .9
@ -97,7 +97,7 @@ CS.RUN.IPOK >SYSCALL GetArgC
lda #SYSMGR.ERRSYN lda #SYSMGR.ERRSYN
sec sec
rts rts
*--------------------------------------
CS.RUN.HOSTOK lda #1 CS.RUN.HOSTOK lda #1
>SYSCALL GetArgA >SYSCALL GetArgA
>PUSHYA >PUSHYA
@ -114,8 +114,9 @@ CS.RUN.HOSTOK lda #1
>LDYA L.MSG.HOSTOK >LDYA L.MSG.HOSTOK
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
CS.RUN.ECHO ldx #3 CS.RUN.OPENSKT ldx #3
ldy #S.IPCFG.IP+3 ldy #S.IPCFG.IP+3
.1 lda (ZPIPCfgPtr),y .1 lda (ZPIPCfgPtr),y
sta Socket.Src.Addr,x sta Socket.Src.Addr,x
dey dey
@ -147,7 +148,6 @@ CS.RUN.ECHO ldx #3
ldy #hSocket ldy #hSocket
sta (pData),y sta (pData),y
ldy #Identifier ldy #Identifier
lda (pData),y lda (pData),y
tax tax
@ -190,22 +190,19 @@ CS.RUN.ECHO ldx #3
dex dex
bpl .21 bpl .21
CS.RUN.SEND.ECHO
jsr Init.Timeout jsr Init.Timeout
.3 ldy #hFrame .3 ldy #hSocket
lda (pData),y >PUSHB (pData),y
>SYSCALL GetMemPtrA >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.SEND
>PUSHYA
>LIBCALL hLIBTCPIP,LIBTCPIP.SEND.ICMP.FRAME
bcc .4 bcc .4
>SYSCALL Sleep >SYSCALL Sleep
jsr Wait.Timeout jsr Wait.Timeout
bcc .3 bcc .3
.4 ldy #hFrame
lda (pData),y
>SYSCALL FreeMemA
ldy #bReply ldy #bReply
lda #0 lda #0
@ -213,41 +210,43 @@ CS.RUN.ECHO ldx #3
jsr Init.Timeout jsr Init.Timeout
CS.RUN.WAIT >SYSCALL Sleep CS.RUN.WAIT.REPLY
ldy #bReply >SYSCALL Sleep
>SYSCALL GetA
bcs .1
cmp #3 Ctrl-C
beq .9
.1 ldy #hSocket
lda (pData),y lda (pData),y
bne .1 >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.RCVDA
bcs .2
ldy #bCTRLC ldy #hFrame
lda (pData),y sta (pData),y
bne CS.RUN.ERROR >SYSCALL GetMemPtrA
>STYA ZPFrameBase
jsr CS.Print.REPLY
bra CS.RUN.SEND.ECHO
jsr Wait.Timeout .2 jsr Wait.Timeout
bcc CS.RUN.WAIT bcc CS.RUN.WAIT.REPLY
ldy #3 ldy #DST.IP+3
>PUSHB (pData),y DST.IP+3 >PUSHB (pData),y DST.IP+3
dey dey
>PUSHB (pData),y DST.IP+2 >PUSHB (pData),y DST.IP+2
dey dey
>PUSHB (pData),y DST.IP+1 >PUSHB (pData),y DST.IP+1
>PUSHB (pData) DST.IP dey
>LDYA L.MSG2 >PUSHB (pData),y DST.IP
>LDYA L.MSG.UNREACH
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
.1 ldy #bCTRLC jmp CS.RUN.SEND.ECHO
lda (pData),y
bne CS.RUN.ERROR
ldy #TimeOut
lda (pData),y
beq .2
>SYSCALL Sleep .9 lda #0
bra .1 sec
.2 jmp CS.RUN.ECHO
CS.RUN.ERROR sec
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT lda (pEvent) CS.DOEVENT lda (pEvent)
@ -263,6 +262,8 @@ CS.DOEVENT lda (pEvent)
.9 sec do not discard TIMER event .9 sec do not discard TIMER event
rts rts
*-------------------------------------- *--------------------------------------
*--------------------------------------
CS.Print.REPLY lda #TIMEOUT.MAX CS.Print.REPLY lda #TIMEOUT.MAX
sec sec
ldy #TimeOut ldy #TimeOut
@ -301,7 +302,7 @@ CS.Print.REPLY lda #TIMEOUT.MAX
dey dey
>PUSHB (ZPFrameBase),y >PUSHB (ZPFrameBase),y
>LDYA L.MSG3 >LDYA L.MSG.REPLY
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
ldy #bReply ldy #bReply
@ -334,8 +335,8 @@ MSG.IPKO >CSTR "TCP/IP Not Loaded/Configured.\n"
MSG.USAGE >CSTR "Usage : PING <ip|host>\n" MSG.USAGE >CSTR "Usage : PING <ip|host>\n"
MSG.UNKNOWN >CSTR "%S: Unknown host\n" MSG.UNKNOWN >CSTR "%S: Unknown host\n"
MSG.HOSTOK >CSTR "PING %d.%d.%d.%d (%S)\n" MSG.HOSTOK >CSTR "PING %d.%d.%d.%d (%S)\n"
MSG2 >CSTR "%d.%d.%d.%d: TimeOut/Host unreachable\n" MSG.UNREACH >CSTR "%d.%d.%d.%d: TimeOut/Host unreachable\n"
MSG3 >CSTR "32 bytes from %d.%d.%d.%d, icmp_seq=%D, ttl=%d, time=%D ms\n" MSG.REPLY >CSTR "32 bytes from %d.%d.%d.%d, icmp_seq=%D, ttl=%d, time=%D ms\n"
hLIBTCPIP .BS 1 hLIBTCPIP .BS 1
TimeOut.ms .BS 2 TimeOut.ms .BS 2
Socket .DA #S.SOCKET.SOCK.RAW Socket .DA #S.SOCKET.SOCK.RAW

View File

@ -1,6 +1,6 @@
PR#3 PR#3
PREFIX /A2OSX.SRC PREFIX /A2OSX.SRC
NEW LOMEM $A00
INC 1 INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF
@ -12,7 +12,7 @@ AUTO 6
* Y,A = Frame PTR * Y,A = Frame PTR
* X = hMem * X = hMem
*\-------------------------------------- *\--------------------------------------
FRM.NewA sta .1+2 FRM.NewA sta .1+1
>PUSHWI K.ETH.FRAME.LEN >PUSHWI K.ETH.FRAME.LEN
>PUSHBI S.MEM.F.INIT0 >PUSHBI S.MEM.F.INIT0
>SYSCALL GetMem >SYSCALL GetMem

View File

@ -27,14 +27,16 @@ SKT.NEW >PULLW ZPTmpPtr1
.1 >LDYA L.SKT.TABLE .1 >LDYA L.SKT.TABLE
>STYA ZPTmpPtr2 >STYA ZPTmpPtr2
stz TmpOffset to keep track of any free slot lda #$ff
sta TmpOffset to keep track of any free slot
ldx #0 ldx #0
.2 lda (ZPTmpPtr2) .2 lda (ZPTmpPtr2)
beq .4 beq .4 empty!!!
cmp (ZPTmpPtr1) cmp (ZPTmpPtr1)
bne .5 bne .5 not same SKT type...try next
ldy #S.SOCKET.SRC.ADDR ldy #S.SOCKET.SRC.ADDR
@ -45,14 +47,15 @@ SKT.NEW >PULLW ZPTmpPtr1
cpy #S.SOCKET.DST.PORT+2 cpy #S.SOCKET.DST.PORT+2
bne .3 bne .3
lda #ERR.SKT.BUSY lda #ERR.SKT.BUSY same one!!!!! busy...
sec sec
rts rts
.4 bit TmpOffset .4 lda TmpOffset
bmi .5 Already found an empty slot bpl .5 already found an empty slot....
>LDYA ZPTmpPtr2
>STYA ZPTmpPtr3 >LDYA ZPTmpPtr2 found one...
>STYA ZPTmpPtr3 save it!
stx TmpOffset stx TmpOffset
.5 lda ZPTmpPtr2 .5 lda ZPTmpPtr2
@ -65,8 +68,8 @@ SKT.NEW >PULLW ZPTmpPtr1
cpx #K.SKTTABLE.SIZE cpx #K.SKTTABLE.SIZE
bne .2 bne .2
bit TmpOffset Did we found an empty slot ? lda TmpOffset Did we found an empty slot ?
bpl .9 bmi .9
ldy #S.SOCKET-1 ldy #S.SOCKET-1
.7 lda (ZPTmpPtr1),y .7 lda (ZPTmpPtr1),y

View File

@ -160,8 +160,8 @@ POLL ldx #DEVMGR.READBLOCK
* Expire = every sec * Expire = every sec
* Retry = every 100 msec * Retry = every 100 msec
*-------------------------------------- *--------------------------------------
PULSEA asl PULSEA and #S.EVT.F.T1SEC
bpl .1 beq .1
jsr ARP.EXPIRE jsr ARP.EXPIRE
jsr DNS.EXPIRE jsr DNS.EXPIRE

View File

@ -103,6 +103,7 @@ CS.INIT >LDYA L.LIBTCPIP
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN >PUSHW L.Socket CS.RUN >PUSHW L.Socket
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.NEW >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.NEW
bcc .1 bcc .1

View File

@ -153,9 +153,8 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.POLL
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT lda (pEvent) CS.DOEVENT lda (pEvent)
bpl .9
bit #S.EVT.F.T10TH
beq .9 S.EVT.F.T1SEC
>LIBCALL hLIBTCPIP,LIBTCPIP.PULSEA >LIBCALL hLIBTCPIP,LIBTCPIP.PULSEA
.9 sec never discard TIME event .9 sec never discard TIME event