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

View File

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

View File

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

View File

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

View File

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

View File

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