mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel 0.9.2
This commit is contained in:
parent
3abdf9cc9b
commit
04510ec5bf
@ -217,6 +217,33 @@ CS: A = EC
|
||||
CC: Y,A = bytes written
|
||||
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
|
||||
Get socket table
|
||||
|
||||
@ -225,6 +252,6 @@ Get socket table
|
||||
|
||||
## ASM
|
||||
**In:**
|
||||
`>LIBCALL hLIBTCPIP,LIBTCPIP.skt.GetTable`
|
||||
`>LIBCALL hLIBTCPIP,LIBTCPIP.GetTable`
|
||||
|
||||
## RETURN VALUE
|
||||
|
Binary file not shown.
Binary file not shown.
@ -38,6 +38,7 @@ CS.START cld
|
||||
L.LIBTCPIP .DA LIBTCPIP
|
||||
L.SSCANF.IP .DA SSCANF.IP
|
||||
L.SSCANF.MAC .DA SSCANF.MAC
|
||||
L.MSG.Usage .DA MSG.Usage
|
||||
L.MSG0 .DA MSG0
|
||||
L.MSG1 .DA MSG1
|
||||
L.MSG2 .DA MSG2
|
||||
@ -50,32 +51,48 @@ CS.INIT >LDYA L.LIBTCPIP
|
||||
|
||||
.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
|
||||
cmp #2
|
||||
bcs .1
|
||||
bcs .2
|
||||
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+1
|
||||
>PUSHEA.G DST.IP
|
||||
|
||||
>PUSHBI 8 4 Ptrs
|
||||
|
||||
>PUSHW L.SSCANF.IP
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
|
||||
>SYSCALL sscanf
|
||||
bcs .9
|
||||
bcs CS.RUN.ERR
|
||||
|
||||
ldy #S.PS.ARGC
|
||||
lda (pPs),y
|
||||
cmp #1
|
||||
cmp #2
|
||||
beq CS.RUN.QUERY
|
||||
|
||||
cmp #2
|
||||
beq CS.RUN.ADD
|
||||
cmp #3
|
||||
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
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -87,13 +104,13 @@ CS.RUN.QUERY jsr Init.Timeout
|
||||
bcc .2 success, print & exit
|
||||
|
||||
jsr Wait.TimeOut
|
||||
bcs .9
|
||||
bcs .8
|
||||
|
||||
>SLEEP
|
||||
>SYSCALL GetChar
|
||||
bcs .1
|
||||
cmp #3
|
||||
beq .8
|
||||
beq .9
|
||||
bra .1
|
||||
|
||||
.2 ldy #5
|
||||
@ -123,6 +140,9 @@ CS.RUN.ADD >PUSHEA.G DST.MAC+5
|
||||
>PUSHEA.G DST.MAC+2
|
||||
>PUSHEA.G DST.MAC+1
|
||||
>PUSHEA.G DST.MAC
|
||||
|
||||
>PUSHBI 12 6 Ptrs
|
||||
|
||||
>PUSHW L.SSCANF.MAC
|
||||
lda #2
|
||||
>SYSCALL ArgV
|
||||
@ -133,13 +153,10 @@ CS.RUN.ADD >PUSHEA.G DST.MAC+5
|
||||
>PUSHEA.G DST.MAC
|
||||
>PUSHEA.G DST.IP
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.ADD
|
||||
bcc CS.RUN.DUMP
|
||||
clc
|
||||
.8 rts
|
||||
|
||||
rts
|
||||
|
||||
.9 lda #E.SYN
|
||||
.99 sec
|
||||
rts
|
||||
.9 jmp CS.RUN.ERR
|
||||
*--------------------------------------
|
||||
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
|
||||
>STYA ZPPTR1
|
||||
@ -222,6 +239,9 @@ CS.END
|
||||
LIBTCPIP .AZ "libtcpip"
|
||||
SSCANF.IP .AZ "%d.%d.%d.%d"
|
||||
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"
|
||||
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"
|
||||
|
@ -61,7 +61,7 @@ CS.INIT >LDYA L.LIBTCPIP
|
||||
>SYSCALL LoadLib
|
||||
bcs .9
|
||||
sta hLIBTCPIP
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN >PUSHBI 0
|
||||
|
@ -92,10 +92,10 @@ S.IPCFG.DOMAIN .EQ 48 79+\0 C String
|
||||
*
|
||||
S.IPCFG .EQ 128
|
||||
*--------------------------------------
|
||||
S.ARPCACHE.STATUS .EQ 0
|
||||
S.ARPCACHE.STATUS.PENDING .EQ 1
|
||||
S.ARPCACHE.STATUS.STATIC .EQ 2
|
||||
S.ARPCACHE.STATUS.RESOLVED .EQ 128
|
||||
S.ARPCACHE.S .EQ 0
|
||||
S.ARPCACHE.S.PENDING .EQ 1
|
||||
S.ARPCACHE.S.STATIC .EQ 2
|
||||
S.ARPCACHE.S.RESOLVED .EQ 128
|
||||
S.ARPCACHE.TTL .EQ 2
|
||||
S.ARPCACHE.IP .EQ 6
|
||||
S.ARPCACHE.MAC .EQ 10
|
||||
|
@ -69,7 +69,7 @@ ARP.Add >PULLW ZPPtrIP IP
|
||||
dey
|
||||
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
|
||||
|
||||
@ -123,7 +123,7 @@ ARP.AddFromFrameInPtr
|
||||
lda /K.ARP.TTL
|
||||
sta ARP.TmpCache+S.ARPCACHE.TTL+1
|
||||
|
||||
lda #S.ARPCACHE.STATUS.RESOLVED
|
||||
lda #S.ARPCACHE.S.RESOLVED
|
||||
jmp ARP.ADD.I
|
||||
*--------------------------------------
|
||||
ARP.IN ldy #S.ARP.TPA+3
|
||||
@ -200,7 +200,7 @@ ARP.IN.REP lda #K.ARP.TTL
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
lda #S.ARPCACHE.STATUS.RESOLVED
|
||||
lda #S.ARPCACHE.S.RESOLVED
|
||||
|
||||
jsr ARP.ADD.I
|
||||
jmp ARP.IN.EXIT
|
||||
@ -246,7 +246,7 @@ ARP.QUERY.I jsr ARP.FIND.BY.IP
|
||||
sta ARP.TmpCache+S.ARPCACHE.TTL
|
||||
stz ARP.TmpCache+S.ARPCACHE.TTL+1
|
||||
|
||||
lda #S.ARPCACHE.STATUS.PENDING
|
||||
lda #S.ARPCACHE.S.PENDING
|
||||
jsr ARP.ADD.I
|
||||
|
||||
.9 lda #ERR.ARP.PENDING
|
||||
@ -343,6 +343,8 @@ ARP.EXPIRE >LDYA L.ARP.CACHE
|
||||
|
||||
.1 lda (ZPCachePtr)
|
||||
beq .2
|
||||
and #S.ARPCACHE.S.STATIC
|
||||
bne .2
|
||||
|
||||
ldy #S.ARPCACHE.TTL
|
||||
sec
|
||||
|
@ -123,14 +123,39 @@ SKT.bind >SYSCALL GetMemPtr
|
||||
sta SKT.LOC.ADDR+S.SOCKADDR.PORT
|
||||
stx SKT.LOC.ADDR+S.SOCKADDR.PORT+1
|
||||
|
||||
.1 jsr SKT.FindMatchingLoc
|
||||
bcc .9
|
||||
.1 ldx #0
|
||||
|
||||
.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
|
||||
|
||||
.9 lda #ERR.SKT.BUSY
|
||||
sec
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # Connect
|
||||
* Initiate a connection on a socket
|
||||
@ -359,10 +384,7 @@ SKT.shutdown.STREAM
|
||||
* CC: Y,A = bytes read
|
||||
* CS: A = EC
|
||||
*\--------------------------------------
|
||||
SKT.Read >SYSCALL GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
>PULLW ZPDataInPtr !!!DataOut trashed when sending ACK in TCP.OUT
|
||||
>PULLW ZPDataInLen !!!use DataInPtr/Len
|
||||
SKT.Read jsr SKT.PullhFDDataInPtrLen
|
||||
|
||||
ldy #S.SOCKET.T
|
||||
lda (ZPPtrSKT),y
|
||||
@ -409,10 +431,7 @@ SKT.Read >SYSCALL GetMemPtr
|
||||
* CC: Y,A = bytes written
|
||||
* CS: A = EC
|
||||
*\--------------------------------------
|
||||
SKT.Write >SYSCALL GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
>PULLW ZPDataInPtr
|
||||
>PULLW ZPDataInLen
|
||||
SKT.Write jsr SKT.PullhFDDataInPtrLen
|
||||
|
||||
ldy #S.SOCKET.T
|
||||
lda (ZPPtrSKT),y
|
||||
@ -575,11 +594,8 @@ SKT.SendTo sec
|
||||
.HS 90 BCC
|
||||
SKT.Send clc
|
||||
php
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
jsr SKT.PullhFDDataInPtrLen
|
||||
plp
|
||||
>PULLW ZPDataInPtr
|
||||
>PULLW ZPDataInLen
|
||||
bcc .1
|
||||
jsr SKT.PullRemAddr
|
||||
jsr SKT.SetRemAddr
|
||||
@ -663,6 +679,13 @@ SKT.GetTable >LDYA L.SKT.Table
|
||||
clc
|
||||
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
|
||||
ldy #S.SOCKADDR-1
|
||||
.1 lda (ZPTmpPtr1),y
|
||||
@ -696,7 +719,9 @@ SKT.SetRemAddr ldy #S.SOCKET.REM.PORT+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.FindMatchingLocRem
|
||||
.DO IPDEBUG=1
|
||||
jsr FRM.Dump
|
||||
.FIN
|
||||
ldx #0
|
||||
|
||||
.1 lda SKT.TABLE,x
|
||||
@ -705,7 +730,9 @@ SKT.FindMatchingLocRem
|
||||
phx
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
.DO IPDEBUG=1
|
||||
jsr SKT.Dump
|
||||
.FIN
|
||||
plx
|
||||
|
||||
ldy #S.SOCKET.AF
|
||||
@ -748,22 +775,20 @@ SKT.FindMatchingLocRem
|
||||
and #S.SOCKET.O.BROADCAST
|
||||
beq .9 this socket does not accept broadcast
|
||||
|
||||
ldy #S.SOCKET.REM.PORT Boradcast, check port only
|
||||
bra .5
|
||||
bra .43
|
||||
|
||||
.41 ldy #S.SOCKET.REM.ADDR
|
||||
|
||||
.5 lda (ZPPtrSKT),y
|
||||
|
||||
cmp #$ff accept 255.255.255.255 ?
|
||||
bne .43
|
||||
bne .42
|
||||
|
||||
ldy #S.SOCKET.REM.PORT Boradcast, check port only
|
||||
bra .43
|
||||
.43 ldy #S.SOCKET.REM.PORT Boradcast, check port only
|
||||
|
||||
.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....
|
||||
iny
|
||||
cpy #S.SOCKET.REM.PORT+2
|
||||
@ -780,42 +805,6 @@ SKT.FindMatchingLocRem
|
||||
.9 sec
|
||||
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
|
||||
ldy #S.SOCKET.HQ.HEAD
|
||||
lda (ZPPtrSKT),y
|
||||
@ -925,23 +914,8 @@ SKT.AddDataToSktIn
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.Cache+S.SOCKET.TCP.INFREE
|
||||
sec
|
||||
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
|
||||
.8 >SBC16 SKT.Cache+S.SOCKET.TCP.INFREE,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.INUSED,ZPDataInLen
|
||||
|
||||
clc
|
||||
|
||||
@ -1058,21 +1032,8 @@ SKT.GetDataFromSktIn
|
||||
ora ZPTmpPtr3+1
|
||||
beq .9
|
||||
|
||||
lda SKT.Cache+S.SOCKET.TCP.INFREE
|
||||
clc
|
||||
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
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.INFREE,ZPTmpPtr3
|
||||
>SBC16 SKT.Cache+S.SOCKET.TCP.INUSED,ZPTmpPtr3
|
||||
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3
|
||||
clc
|
||||
@ -1175,29 +1136,9 @@ SKT.AddDataToSktOut
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.Cache+S.SOCKET.TCP.OUTFREE
|
||||
sec
|
||||
sbc 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
|
||||
.8 >SBC16 SKT.Cache+S.SOCKET.TCP.OUTFREE,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.OUTUSED,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.OUTTOSEND,ZPDataInLen
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From TCP.OUT
|
||||
@ -1262,13 +1203,7 @@ SKT.GetDataFromSktOut
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.8 lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND
|
||||
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
|
||||
.8 >SBC16 SKT.Cache+S.SOCKET.TCP.OUTTOSEND,ZPDataOutLen
|
||||
|
||||
clc
|
||||
rts
|
||||
@ -1307,6 +1242,7 @@ SKT.AckDataToSktOut
|
||||
adc SKT.Cache+S.SOCKET.TCP.OUTTAIL+1
|
||||
and /K.TCP.WSIZE-1
|
||||
sta SKT.Cache+S.SOCKET.TCP.OUTTAIL+1
|
||||
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTFREE
|
||||
clc
|
||||
adc TmpDWord+3
|
||||
|
@ -21,96 +21,6 @@ UDP.IN jsr FRM.GetTargetSKT.TCPUDP
|
||||
>SYSCALL FreeMem
|
||||
.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
|
||||
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.UDP
|
||||
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
||||
|
@ -5,6 +5,28 @@ AUTO 4,1
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.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/A2OSX.I
|
||||
@ -150,8 +172,10 @@ J.SKT.send .DA SKT.send.RAW
|
||||
.DA SKT.send.DGRAM
|
||||
.DA SKT.send.SEQPACKET
|
||||
.DA SKT.send.STREAM
|
||||
.DO IPDEBUG=1
|
||||
L.MSG.FRM.Dump .DA MSG.FRM.Dump
|
||||
L.MSG.SKT.Dump .DA MSG.SKT.Dump
|
||||
.FIN
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
LIB.LOAD ldx RefCount
|
||||
@ -258,6 +282,98 @@ GetDynPort inc DYNPORT.LAST
|
||||
ldx DYNPORT.LAST+1
|
||||
clc
|
||||
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.CFG
|
||||
@ -404,8 +520,10 @@ hFrameOut .BS 1
|
||||
HST.SScanF .AZ "%d.%d.%d.%d"
|
||||
IP.ID .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.SKT.Dump .AZ "SKT:LOC=%d.%d.%d.%d:%D REM=%d.%d.%d.%d:%D\r\n"
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S
|
||||
|
@ -585,10 +585,10 @@ Cmd.INT.READ ldx #1
|
||||
clc
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
Cmd.INT.SLEEP lda (ZPCMDBuf)
|
||||
beq .9
|
||||
Cmd.INT.SLEEP ldx #1
|
||||
jsr Cmd.GetArgX
|
||||
bcs .9
|
||||
|
||||
>LDYA ZPCMDBuf
|
||||
>SYSCALL AToL
|
||||
bcs .9
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user