Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-11-09 14:29:23 +01:00
parent 3abdf9cc9b
commit 04510ec5bf
11 changed files with 255 additions and 242 deletions

View File

@ -217,6 +217,33 @@ CS: A = EC
CC: Y,A = bytes written CC: Y,A = bytes written
CS: A = EC CS: A = EC
# GetSockOpt
Set Socket Options
## C
`int getsockopt(hFD fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.GetSockOpt`
## RETURN VALUE
# SetSockOpt
Set Socket Options
## C
`int setsockopt(hFD fd, short int opts);`
## ASM
**In:**
`>PUSHWI opts`
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.SetSockOpt`
## RETURN VALUE
# GetTable # GetTable
Get socket table Get socket table
@ -225,6 +252,6 @@ Get socket table
## ASM ## ASM
**In:** **In:**
`>LIBCALL hLIBTCPIP,LIBTCPIP.skt.GetTable` `>LIBCALL hLIBTCPIP,LIBTCPIP.GetTable`
## RETURN VALUE ## RETURN VALUE

Binary file not shown.

Binary file not shown.

View File

@ -38,6 +38,7 @@ CS.START cld
L.LIBTCPIP .DA LIBTCPIP L.LIBTCPIP .DA LIBTCPIP
L.SSCANF.IP .DA SSCANF.IP L.SSCANF.IP .DA SSCANF.IP
L.SSCANF.MAC .DA SSCANF.MAC L.SSCANF.MAC .DA SSCANF.MAC
L.MSG.Usage .DA MSG.Usage
L.MSG0 .DA MSG0 L.MSG0 .DA MSG0
L.MSG1 .DA MSG1 L.MSG1 .DA MSG1
L.MSG2 .DA MSG2 L.MSG2 .DA MSG2
@ -50,32 +51,48 @@ CS.INIT >LDYA L.LIBTCPIP
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN ldy #S.PS.ARGC CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
>STYA ZPPTR1
ldy #S.IPCFG.STATUS
lda (ZPPTR1),y
bmi .1
jmp CS.RUN.ERR
.1 ldy #S.PS.ARGC
lda (pPs),y lda (pPs),y
cmp #2 cmp #2
bcs .1 bcs .2
jmp CS.RUN.DUMP jmp CS.RUN.DUMP
.1 >PUSHEA.G DST.IP+3 .2 >PUSHEA.G DST.IP+3
>PUSHEA.G DST.IP+2 >PUSHEA.G DST.IP+2
>PUSHEA.G DST.IP+1 >PUSHEA.G DST.IP+1
>PUSHEA.G DST.IP >PUSHEA.G DST.IP
>PUSHBI 8 4 Ptrs
>PUSHW L.SSCANF.IP >PUSHW L.SSCANF.IP
lda #1 lda #1
>SYSCALL ArgV >SYSCALL ArgV
>SYSCALL sscanf >SYSCALL sscanf
bcs .9 bcs CS.RUN.ERR
ldy #S.PS.ARGC ldy #S.PS.ARGC
lda (pPs),y lda (pPs),y
cmp #1 cmp #2
beq CS.RUN.QUERY beq CS.RUN.QUERY
cmp #2 cmp #3
beq CS.RUN.ADD bne CS.RUN.ERR
jmp CS.RUN.ADD
.9 lda #E.SYN CS.RUN.ERR >PUSHBI 0
>LDYA L.MSG.Usage
>SYSCALL printf
lda #E.SYN
sec sec
rts rts
*-------------------------------------- *--------------------------------------
@ -87,13 +104,13 @@ CS.RUN.QUERY jsr Init.Timeout
bcc .2 success, print & exit bcc .2 success, print & exit
jsr Wait.TimeOut jsr Wait.TimeOut
bcs .9 bcs .8
>SLEEP >SLEEP
>SYSCALL GetChar >SYSCALL GetChar
bcs .1 bcs .1
cmp #3 cmp #3
beq .8 beq .9
bra .1 bra .1
.2 ldy #5 .2 ldy #5
@ -123,6 +140,9 @@ CS.RUN.ADD >PUSHEA.G DST.MAC+5
>PUSHEA.G DST.MAC+2 >PUSHEA.G DST.MAC+2
>PUSHEA.G DST.MAC+1 >PUSHEA.G DST.MAC+1
>PUSHEA.G DST.MAC >PUSHEA.G DST.MAC
>PUSHBI 12 6 Ptrs
>PUSHW L.SSCANF.MAC >PUSHW L.SSCANF.MAC
lda #2 lda #2
>SYSCALL ArgV >SYSCALL ArgV
@ -133,13 +153,10 @@ CS.RUN.ADD >PUSHEA.G DST.MAC+5
>PUSHEA.G DST.MAC >PUSHEA.G DST.MAC
>PUSHEA.G DST.IP >PUSHEA.G DST.IP
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.ADD >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.ADD
bcc CS.RUN.DUMP clc
.8 rts
rts .9 jmp CS.RUN.ERR
.9 lda #E.SYN
.99 sec
rts
*-------------------------------------- *--------------------------------------
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
>STYA ZPPTR1 >STYA ZPPTR1
@ -222,6 +239,9 @@ CS.END
LIBTCPIP .AZ "libtcpip" LIBTCPIP .AZ "libtcpip"
SSCANF.IP .AZ "%d.%d.%d.%d" SSCANF.IP .AZ "%d.%d.%d.%d"
SSCANF.MAC .AZ "%h:%h:%h:%h:%h:%h" SSCANF.MAC .AZ "%h:%h:%h:%h:%h:%h"
MSG.Usage .AS "Usage : ARP, display ARP cache\r\n"
.AS " ARP ip.ip.ip.ip query cache or network\r\n"
.AZ " ARP ip.ip.ip.ip HH:HH:HH:HH:HH:HH add a static ARP record in Cache\r\n"
MSG0 .AZ "STS TTL MAC Address IP Address" MSG0 .AZ "STS TTL MAC Address IP Address"
MSG1 .AZ "$%h %5D %h:%h:%h:%h:%h:%h %d.%d.%d.%d\r\n" MSG1 .AZ "$%h %5D %h:%h:%h:%h:%h:%h %d.%d.%d.%d\r\n"
MSG2 .AZ "%d.%d.%d.%d is at %h:%h:%h:%h:%h:%h\r\n" MSG2 .AZ "%d.%d.%d.%d is at %h:%h:%h:%h:%h:%h\r\n"

View File

@ -61,7 +61,7 @@ CS.INIT >LDYA L.LIBTCPIP
>SYSCALL LoadLib >SYSCALL LoadLib
bcs .9 bcs .9
sta hLIBTCPIP sta hLIBTCPIP
clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN >PUSHBI 0 CS.RUN >PUSHBI 0

View File

@ -92,10 +92,10 @@ S.IPCFG.DOMAIN .EQ 48 79+\0 C String
* *
S.IPCFG .EQ 128 S.IPCFG .EQ 128
*-------------------------------------- *--------------------------------------
S.ARPCACHE.STATUS .EQ 0 S.ARPCACHE.S .EQ 0
S.ARPCACHE.STATUS.PENDING .EQ 1 S.ARPCACHE.S.PENDING .EQ 1
S.ARPCACHE.STATUS.STATIC .EQ 2 S.ARPCACHE.S.STATIC .EQ 2
S.ARPCACHE.STATUS.RESOLVED .EQ 128 S.ARPCACHE.S.RESOLVED .EQ 128
S.ARPCACHE.TTL .EQ 2 S.ARPCACHE.TTL .EQ 2
S.ARPCACHE.IP .EQ 6 S.ARPCACHE.IP .EQ 6
S.ARPCACHE.MAC .EQ 10 S.ARPCACHE.MAC .EQ 10

View File

@ -69,7 +69,7 @@ ARP.Add >PULLW ZPPtrIP IP
dey dey
bpl .2 bpl .2
lda #S.ARPCACHE.STATUS.RESOLVED+S.ARPCACHE.STATUS.STATIC lda #S.ARPCACHE.S.RESOLVED+S.ARPCACHE.S.STATIC
ARP.ADD.I sta ARP.TmpCache ARP.ADD.I sta ARP.TmpCache
@ -123,7 +123,7 @@ ARP.AddFromFrameInPtr
lda /K.ARP.TTL lda /K.ARP.TTL
sta ARP.TmpCache+S.ARPCACHE.TTL+1 sta ARP.TmpCache+S.ARPCACHE.TTL+1
lda #S.ARPCACHE.STATUS.RESOLVED lda #S.ARPCACHE.S.RESOLVED
jmp ARP.ADD.I jmp ARP.ADD.I
*-------------------------------------- *--------------------------------------
ARP.IN ldy #S.ARP.TPA+3 ARP.IN ldy #S.ARP.TPA+3
@ -200,7 +200,7 @@ ARP.IN.REP lda #K.ARP.TTL
dex dex
bpl .2 bpl .2
lda #S.ARPCACHE.STATUS.RESOLVED lda #S.ARPCACHE.S.RESOLVED
jsr ARP.ADD.I jsr ARP.ADD.I
jmp ARP.IN.EXIT jmp ARP.IN.EXIT
@ -246,7 +246,7 @@ ARP.QUERY.I jsr ARP.FIND.BY.IP
sta ARP.TmpCache+S.ARPCACHE.TTL sta ARP.TmpCache+S.ARPCACHE.TTL
stz ARP.TmpCache+S.ARPCACHE.TTL+1 stz ARP.TmpCache+S.ARPCACHE.TTL+1
lda #S.ARPCACHE.STATUS.PENDING lda #S.ARPCACHE.S.PENDING
jsr ARP.ADD.I jsr ARP.ADD.I
.9 lda #ERR.ARP.PENDING .9 lda #ERR.ARP.PENDING
@ -343,6 +343,8 @@ ARP.EXPIRE >LDYA L.ARP.CACHE
.1 lda (ZPCachePtr) .1 lda (ZPCachePtr)
beq .2 beq .2
and #S.ARPCACHE.S.STATIC
bne .2
ldy #S.ARPCACHE.TTL ldy #S.ARPCACHE.TTL
sec sec

View File

@ -123,14 +123,39 @@ SKT.bind >SYSCALL GetMemPtr
sta SKT.LOC.ADDR+S.SOCKADDR.PORT sta SKT.LOC.ADDR+S.SOCKADDR.PORT
stx SKT.LOC.ADDR+S.SOCKADDR.PORT+1 stx SKT.LOC.ADDR+S.SOCKADDR.PORT+1
.1 jsr SKT.FindMatchingLoc .1 ldx #0
bcc .9
.2 lda SKT.TABLE,x
beq .7
phx
>SYSCALL GetMemPtr
>STYA ZPTmpPtr1
plx
ldy #S.SOCKET.AF
lda (ZPTmpPtr1),y
cmp #AF.INET
bne .7
ldy #S.SOCKET.LOC.ADDR
.3 lda (ZPTmpPtr1),y
cmp SKT.LOC.ADDR+S.SOCKADDR.ADDR-S.SOCKET.LOC.ADDR,y
bne .7
iny
cpy #S.SOCKET.LOC.PORT+2
bne .3
lda #ERR.SKT.BUSY
* sec
rts
.7 inx
cpx #K.SKTTABLE.SIZE
bne .2
jmp SKT.SetLocAddr jmp SKT.SetLocAddr
.9 lda #ERR.SKT.BUSY
sec
rts
*/-------------------------------------- */--------------------------------------
* # Connect * # Connect
* Initiate a connection on a socket * Initiate a connection on a socket
@ -359,10 +384,7 @@ SKT.shutdown.STREAM
* CC: Y,A = bytes read * CC: Y,A = bytes read
* CS: A = EC * CS: A = EC
*\-------------------------------------- *\--------------------------------------
SKT.Read >SYSCALL GetMemPtr SKT.Read jsr SKT.PullhFDDataInPtrLen
>STYA ZPPtrSKT
>PULLW ZPDataInPtr !!!DataOut trashed when sending ACK in TCP.OUT
>PULLW ZPDataInLen !!!use DataInPtr/Len
ldy #S.SOCKET.T ldy #S.SOCKET.T
lda (ZPPtrSKT),y lda (ZPPtrSKT),y
@ -409,10 +431,7 @@ SKT.Read >SYSCALL GetMemPtr
* CC: Y,A = bytes written * CC: Y,A = bytes written
* CS: A = EC * CS: A = EC
*\-------------------------------------- *\--------------------------------------
SKT.Write >SYSCALL GetMemPtr SKT.Write jsr SKT.PullhFDDataInPtrLen
>STYA ZPPtrSKT
>PULLW ZPDataInPtr
>PULLW ZPDataInLen
ldy #S.SOCKET.T ldy #S.SOCKET.T
lda (ZPPtrSKT),y lda (ZPPtrSKT),y
@ -575,11 +594,8 @@ SKT.SendTo sec
.HS 90 BCC .HS 90 BCC
SKT.Send clc SKT.Send clc
php php
>SYSCALL GetMemPtr jsr SKT.PullhFDDataInPtrLen
>STYA ZPPtrSKT
plp plp
>PULLW ZPDataInPtr
>PULLW ZPDataInLen
bcc .1 bcc .1
jsr SKT.PullRemAddr jsr SKT.PullRemAddr
jsr SKT.SetRemAddr jsr SKT.SetRemAddr
@ -663,6 +679,13 @@ SKT.GetTable >LDYA L.SKT.Table
clc clc
rts rts
*-------------------------------------- *--------------------------------------
SKT.PullhFDDataInPtrLen
>SYSCALL GetMemPtr
>STYA ZPPtrSKT
>PULLW ZPDataInPtr !!!DataOut trashed when sending ACK in TCP.OUT
>PULLW ZPDataInLen !!!use DataInPtr/Len
rts
*--------------------------------------
SKT.PullLocAddr >PULLW ZPTmpPtr1 SKT.PullLocAddr >PULLW ZPTmpPtr1
ldy #S.SOCKADDR-1 ldy #S.SOCKADDR-1
.1 lda (ZPTmpPtr1),y .1 lda (ZPTmpPtr1),y
@ -696,7 +719,9 @@ SKT.SetRemAddr ldy #S.SOCKET.REM.PORT+1
rts rts
*-------------------------------------- *--------------------------------------
SKT.FindMatchingLocRem SKT.FindMatchingLocRem
.DO IPDEBUG=1
jsr FRM.Dump jsr FRM.Dump
.FIN
ldx #0 ldx #0
.1 lda SKT.TABLE,x .1 lda SKT.TABLE,x
@ -705,7 +730,9 @@ SKT.FindMatchingLocRem
phx phx
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
>STYA ZPPtrSKT >STYA ZPPtrSKT
.DO IPDEBUG=1
jsr SKT.Dump jsr SKT.Dump
.FIN
plx plx
ldy #S.SOCKET.AF ldy #S.SOCKET.AF
@ -748,22 +775,20 @@ SKT.FindMatchingLocRem
and #S.SOCKET.O.BROADCAST and #S.SOCKET.O.BROADCAST
beq .9 this socket does not accept broadcast beq .9 this socket does not accept broadcast
ldy #S.SOCKET.REM.PORT Boradcast, check port only bra .43
bra .5
.41 ldy #S.SOCKET.REM.ADDR .41 ldy #S.SOCKET.REM.ADDR
.5 lda (ZPPtrSKT),y .5 lda (ZPPtrSKT),y
cmp #$ff accept 255.255.255.255 ? cmp #$ff accept 255.255.255.255 ?
bne .43 bne .42
ldy #S.SOCKET.REM.PORT Boradcast, check port only .43 ldy #S.SOCKET.REM.PORT Boradcast, check port only
bra .43
.42 lda (ZPPtrSKT),y .42 lda (ZPPtrSKT),y
.43 cmp SKT.REM.ADDR+S.SOCKADDR.ADDR-S.SOCKET.REM.ADDR,y cmp SKT.REM.ADDR+S.SOCKADDR.ADDR-S.SOCKET.REM.ADDR,y
bne .8 wrong remote host, exit.... bne .8 wrong remote host, exit....
iny iny
cpy #S.SOCKET.REM.PORT+2 cpy #S.SOCKET.REM.PORT+2
@ -780,42 +805,6 @@ SKT.FindMatchingLocRem
.9 sec .9 sec
rts rts
*-------------------------------------- *--------------------------------------
SKT.FindMatchingLoc
ldx #0
.1 lda SKT.TABLE,x
beq .7
phx
>SYSCALL GetMemPtr
>STYA ZPTmpPtr1
plx
ldy #S.SOCKET.AF
lda (ZPTmpPtr1),y
cmp #AF.INET
bne .7
ldy #S.SOCKET.LOC.ADDR
.2 lda (ZPTmpPtr1),y
cmp SKT.LOC.ADDR+S.SOCKADDR.ADDR-S.SOCKET.LOC.ADDR,y
bne .7
iny
cpy #S.SOCKET.LOC.PORT+2
bne .2
>LDYA ZPTmpPtr1 x = SKT.TABLE index
clc
rts
.7 inx
cpx #K.SKTTABLE.SIZE
bne .1
* sec
.9 rts
*--------------------------------------
SKT.AddToQueueA pha SKT.AddToQueueA pha
ldy #S.SOCKET.HQ.HEAD ldy #S.SOCKET.HQ.HEAD
lda (ZPPtrSKT),y lda (ZPPtrSKT),y
@ -925,23 +914,8 @@ SKT.AddDataToSktIn
.9 sec .9 sec
rts rts
.8 lda SKT.Cache+S.SOCKET.TCP.INFREE .8 >SBC16 SKT.Cache+S.SOCKET.TCP.INFREE,ZPDataInLen
sec >ADC16 SKT.Cache+S.SOCKET.TCP.INUSED,ZPDataInLen
sbc ZPDataInLen
sta SKT.Cache+S.SOCKET.TCP.INFREE
lda SKT.Cache+S.SOCKET.TCP.INFREE+1
sbc ZPDataInLen+1
sta SKT.Cache+S.SOCKET.TCP.INFREE+1
lda SKT.Cache+S.SOCKET.TCP.INUSED
clc
adc ZPDataInLen
sta SKT.Cache+S.SOCKET.TCP.INUSED
lda SKT.Cache+S.SOCKET.TCP.INUSED+1
adc ZPDataInLen+1
sta SKT.Cache+S.SOCKET.TCP.INUSED+1
clc clc
@ -1058,21 +1032,8 @@ SKT.GetDataFromSktIn
ora ZPTmpPtr3+1 ora ZPTmpPtr3+1
beq .9 beq .9
lda SKT.Cache+S.SOCKET.TCP.INFREE >ADC16 SKT.Cache+S.SOCKET.TCP.INFREE,ZPTmpPtr3
clc >SBC16 SKT.Cache+S.SOCKET.TCP.INUSED,ZPTmpPtr3
adc ZPTmpPtr3
sta SKT.Cache+S.SOCKET.TCP.INFREE
lda SKT.Cache+S.SOCKET.TCP.INFREE+1
adc ZPTmpPtr3+1
sta SKT.Cache+S.SOCKET.TCP.INFREE+1
lda SKT.Cache+S.SOCKET.TCP.INUSED
sec
sbc ZPTmpPtr3
sta SKT.Cache+S.SOCKET.TCP.INUSED
lda SKT.Cache+S.SOCKET.TCP.INUSED+1
sbc ZPTmpPtr3+1
sta SKT.Cache+S.SOCKET.TCP.INUSED+1
lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3 lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3
clc clc
@ -1175,29 +1136,9 @@ SKT.AddDataToSktOut
.9 sec .9 sec
rts rts
.8 lda SKT.Cache+S.SOCKET.TCP.OUTFREE .8 >SBC16 SKT.Cache+S.SOCKET.TCP.OUTFREE,ZPDataInLen
sec >ADC16 SKT.Cache+S.SOCKET.TCP.OUTUSED,ZPDataInLen
sbc ZPDataInLen >ADC16 SKT.Cache+S.SOCKET.TCP.OUTTOSEND,ZPDataInLen
sta SKT.Cache+S.SOCKET.TCP.OUTFREE
lda SKT.Cache+S.SOCKET.TCP.OUTFREE+1
sbc ZPDataInLen+1
sta SKT.Cache+S.SOCKET.TCP.OUTFREE+1
lda SKT.Cache+S.SOCKET.TCP.OUTUSED
clc
adc ZPDataInLen
sta SKT.Cache+S.SOCKET.TCP.OUTUSED
lda SKT.Cache+S.SOCKET.TCP.OUTUSED+1
adc ZPDataInLen+1
sta SKT.Cache+S.SOCKET.TCP.OUTUSED+1
lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND
clc
adc ZPDataInLen
sta SKT.Cache+S.SOCKET.TCP.OUTTOSEND
lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
adc ZPDataInLen+1
sta SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
jmp SKT.StoreTCB jmp SKT.StoreTCB
*-------------------------------------- *--------------------------------------
* From TCP.OUT * From TCP.OUT
@ -1262,13 +1203,7 @@ SKT.GetDataFromSktOut
sta ZPTmpPtr2+1 sta ZPTmpPtr2+1
bra .1 bra .1
.8 lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND .8 >SBC16 SKT.Cache+S.SOCKET.TCP.OUTTOSEND,ZPDataOutLen
sec
sbc ZPDataOutLen
sta SKT.Cache+S.SOCKET.TCP.OUTTOSEND
lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
sbc ZPDataOutLen+1
sta SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
clc clc
rts rts
@ -1307,6 +1242,7 @@ SKT.AckDataToSktOut
adc SKT.Cache+S.SOCKET.TCP.OUTTAIL+1 adc SKT.Cache+S.SOCKET.TCP.OUTTAIL+1
and /K.TCP.WSIZE-1 and /K.TCP.WSIZE-1
sta SKT.Cache+S.SOCKET.TCP.OUTTAIL+1 sta SKT.Cache+S.SOCKET.TCP.OUTTAIL+1
lda SKT.Cache+S.SOCKET.TCP.OUTFREE lda SKT.Cache+S.SOCKET.TCP.OUTFREE
clc clc
adc TmpDWord+3 adc TmpDWord+3

View File

@ -21,96 +21,6 @@ UDP.IN jsr FRM.GetTargetSKT.TCPUDP
>SYSCALL FreeMem >SYSCALL FreeMem
.8 rts .8 rts
*-------------------------------------- *--------------------------------------
FRM.Dump ldy #S.TCPUDP.DSTPORT
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.IP.DST+3
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.TCPUDP.SRCPORT
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.IP.SRC+3
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
>PUSHBI 12
>LDYA L.MSG.FRM.Dump
>SYSCALL Printf
rts
*--------------------------------------
SKT.Dump ldy #S.SOCKET.REM.PORT+1
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.REM.ADDR+3
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.LOC.PORT+1
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.LOC.ADDR+3
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
>PUSHBI 12
>LDYA L.MSG.SKT.Dump
>SYSCALL Printf
rts
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.UDP SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.UDP
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S LOAD /A2OSX.SRC/LIB/LIBTCPIP.S

View File

@ -5,6 +5,28 @@ AUTO 4,1
.OP 65C02 .OP 65C02
.OR $2000 .OR $2000
.TF LIB/LIBTCPIP .TF LIB/LIBTCPIP
*--------------------------------------
IPDEBUG .EQ 0
*--------------------------------------
.MA ADC16
clc
lda ]1
adc ]2
sta ]1
lda ]1+1
adc ]2+1
sta ]1+1
.EM
*--------------------------------------
.MA SBC16
sec
lda ]1
sbc ]2
sta ]1
lda ]1+1
sbc ]2+1
sta ]1+1
.EM
*-------------------------------------- *--------------------------------------
.INB INC/MACROS.I .INB INC/MACROS.I
.INB INC/A2OSX.I .INB INC/A2OSX.I
@ -150,8 +172,10 @@ J.SKT.send .DA SKT.send.RAW
.DA SKT.send.DGRAM .DA SKT.send.DGRAM
.DA SKT.send.SEQPACKET .DA SKT.send.SEQPACKET
.DA SKT.send.STREAM .DA SKT.send.STREAM
.DO IPDEBUG=1
L.MSG.FRM.Dump .DA MSG.FRM.Dump L.MSG.FRM.Dump .DA MSG.FRM.Dump
L.MSG.SKT.Dump .DA MSG.SKT.Dump L.MSG.SKT.Dump .DA MSG.SKT.Dump
.FIN
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
LIB.LOAD ldx RefCount LIB.LOAD ldx RefCount
@ -258,6 +282,98 @@ GetDynPort inc DYNPORT.LAST
ldx DYNPORT.LAST+1 ldx DYNPORT.LAST+1
clc clc
rts rts
*--------------------------------------
.DO IPDEBUG=1
FRM.Dump ldy #S.TCPUDP.DSTPORT
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.IP.DST+3
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.TCPUDP.SRCPORT
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.IP.SRC+3
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
>PUSHBI 12
>LDYA L.MSG.FRM.Dump
>SYSCALL Printf
rts
*--------------------------------------
SKT.Dump ldy #S.SOCKET.REM.PORT+1
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.REM.ADDR+3
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.LOC.PORT+1
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.LOC.ADDR+3
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
>PUSHBI 12
>LDYA L.MSG.SKT.Dump
>SYSCALL Printf
rts
.FIN
*-------------------------------------- *--------------------------------------
.INB /A2OSX.SRC/LIB/LIBTCPIP.S.ARP .INB /A2OSX.SRC/LIB/LIBTCPIP.S.ARP
.INB /A2OSX.SRC/LIB/LIBTCPIP.S.CFG .INB /A2OSX.SRC/LIB/LIBTCPIP.S.CFG
@ -404,8 +520,10 @@ hFrameOut .BS 1
HST.SScanF .AZ "%d.%d.%d.%d" HST.SScanF .AZ "%d.%d.%d.%d"
IP.ID .BS 2 IP.ID .BS 2
IP.CHECKSUM .BS 2 IP.CHECKSUM .BS 2
.DO IPDEBUG=1
MSG.FRM.Dump .AZ "FRM:SRC=%d.%d.%d.%d:%D DST=%d.%d.%d.%d:%D\r\n" MSG.FRM.Dump .AZ "FRM:SRC=%d.%d.%d.%d:%D DST=%d.%d.%d.%d:%D\r\n"
MSG.SKT.Dump .AZ "SKT:LOC=%d.%d.%d.%d:%D REM=%d.%d.%d.%d:%D\r\n" MSG.SKT.Dump .AZ "SKT:LOC=%d.%d.%d.%d:%D REM=%d.%d.%d.%d:%D\r\n"
.FIN
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S SAVE /A2OSX.SRC/LIB/LIBTCPIP.S

View File

@ -585,10 +585,10 @@ Cmd.INT.READ ldx #1
clc clc
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
Cmd.INT.SLEEP lda (ZPCMDBuf) Cmd.INT.SLEEP ldx #1
beq .9 jsr Cmd.GetArgX
bcs .9
>LDYA ZPCMDBuf
>SYSCALL AToL >SYSCALL AToL
bcs .9 bcs .9