Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-10-08 17:41:00 +02:00
parent 505259be4a
commit 231e530537
15 changed files with 207 additions and 309 deletions

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@ INSDRV UTHERNET.DRV 00:0E:3A:12:34:56
#INSDRV LANCEGS.DRV
#INSDRV UTHER2.AI.DRV 00:08:DC:12:34:56
#INSDRV UTHERNET2.DRV 00:08:DC:12:34:56
#STARTPROC TCPIP
#STARTPROC TCPIPD
#STARTPROC DHCPCLNT
#STARTPROC TELNETD
#STARTPROC HTTPD

View File

@ -430,14 +430,23 @@ S.FD.DEV .EQ 16
*--------------------------------------
* S.FD.LNK
*--------------------------------------
S.FD.SOCK.HSKT .EQ 2
S.FD.SOCK.OPEN .EQ 3
S.FD.SOCK.CLOSE .EQ 4
S.FD.SOCK.READ .EQ 5
S.FD.SOCK.WRITE .EQ 6
S.FD.SOCK.STATUS .EQ 7
S.FD.DSOCK.HSKT .EQ 2
S.FD.DSOCK.OPEN .EQ 3
S.FD.DSOCK.CLOSE .EQ 4
S.FD.DSOCK.READ .EQ 5
S.FD.DSOCK.WRITE .EQ 6
S.FD.DSOCK.STATUS .EQ 7
*
S.FD.SOCK .EQ 8
S.FD.DSOCK .EQ 8
*--------------------------------------
S.FD.SSOCK.HSKT .EQ 2
S.FD.SSOCK.OPEN .EQ 3
S.FD.SSOCK.CLOSE .EQ 4
S.FD.SSOCK.READ .EQ 5
S.FD.SSOCK.WRITE .EQ 6
S.FD.SSOCK.STATUS .EQ 7
*
S.FD.SSOCK .EQ 8
*--------------------------------------
S.FD.PIPE.S .EQ 2
S.FD.PIPE.S.ROpened .EQ %00000001

View File

@ -183,7 +183,7 @@ S.SOCKET.TCP.OUTFREE .EQ S.SOCKET+16
S.SOCKET.TCP.OUTTOSEND .EQ S.SOCKET+18
S.SOCKET.TCP.OUTUSED .EQ S.SOCKET+20
*
S.SOCKET.TCP.INLASTSEQNUM .EQ S.SOCKET+22 Rcvd:Last SEQ received from remote
S.SOCKET.TCP.INLASTSEQNUM .EQ S.SOCKET+22 Recv:Last SEQ received from remote
S.SOCKET.TCP.OUTSEQNUM .EQ S.SOCKET+26 Send:SEQ sent not yet ACKed (retransmit)
S.SOCKET.TCP.OUTNEXTSEQ .EQ S.SOCKET+30 Send:Next SEQ to send

View File

@ -490,18 +490,13 @@ SET.IPCFG.I >LDYA L.DCB.NIC
>SYSCALL IOCTL
bcs .9
.2 lda hDNSSocket1
.2 lda hDNSSocket
beq .3
jsr SKT.Close
stz hDNSSocket1
stz hDNSSocket
.3 lda hDNSSocket2
beq .4
jsr SKT.Close
stz hDNSSocket2
.4 lda IPCFG+S.IPCFG.DNS1
beq .6
.3 lda IPCFG+S.IPCFG.DNS1
beq .8
ldx #3
@ -512,31 +507,13 @@ SET.IPCFG.I >LDYA L.DCB.NIC
stz DNS.SOCKET.SP
stz DNS.SOCKET.SP+1
>DEBUG
>PUSHW L.DNS.SOCKET
jsr SKT.New
lda #S.SOCKET.T.DGRAM
jsr SKT.Socket
bcs .9
sta hDNSSocket1
.6 lda IPCFG+S.IPCFG.DNS2
beq .8
ldx #3
.7 lda IPCFG+S.IPCFG.DNS2,x
sta DNS.SOCKET.DA,x
dex
bpl .7
stz DNS.SOCKET.SP
stz DNS.SOCKET.SP+1
>PUSHW L.DNS.SOCKET
jsr SKT.New
bcs .9
sta hDNSSocket2
sta hDNSSocket
.8 clc
.9 rts

View File

@ -53,7 +53,7 @@ DNS.Query.I jsr DNS.FIND.BY.NAME
sec
rts
*--------------------------------------
DNS.REQUEST lda hDNSSocket1
DNS.REQUEST lda hDNSSocket
beq .99
jsr DNS.CSTR2DNS Y=DNS string len+0
@ -94,30 +94,25 @@ DNS.REQUEST lda hDNSSocket1
jsr DNS.ADD.I
bcs .9
lda hDNSSocket1
jsr DNS.REQUEST.SEND
bcs .99
lda hDNSSocket2
beq .8
jsr DNS.REQUEST.SEND
bcc .8
lda #ERR.DNS.PENDING
sec
rts
.99 lda #ERR.DNS.ERROR
.9 sec
rts
.8 lda #ERR.DNS.PENDING
sec
rts
*--------------------------------------
DNS.REQUEST.SEND
pha
* TODO : >PUSHW L.SOCKADDR.DNS1....DNS2
>PUSHW DNS.MSG.LEN
>PUSHW L.DNS.MSG
pla
jmp SKT.Send
lda hDNSSocket
jmp SKT.SendTo
*--------------------------------------
DNS.CSTR2DNS lda (ZPPtrDNS)
beq .9
@ -406,20 +401,13 @@ DNS.FREE ldy #S.DNSCACHE.hNAME
sta (ZPCachePtr)
rts
*--------------------------------------
DNS.POLL lda hDNSSocket1
DNS.POLL lda hDNSSocket
beq .8
jsr SKT.Rcvd
bcs .1
jsr DNS.DecodeMsg
.1 lda hDNSSocket2
beq .8
jsr SKT.Rcvd
jsr SKT.Recv
bcs .8
jsr DNS.DecodeMsg
.8 clc
rts
*--------------------------------------

View File

@ -3,7 +3,7 @@ PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
FRM.GetTargetSKT
FRM.GetTargetSKT.TCPUDP
ldy #S.TCPUDP.SRCPORT
lda (ZPFrameInPtr),y
sta SKT.REM.ADDR+S.SOCKADDR.PORT+1
@ -18,8 +18,10 @@ FRM.GetTargetSKT
lda (ZPFrameInPtr),y
sta SKT.LOC.ADDR+S.SOCKADDR.PORT
FRM.GetTargetSKT.RAW
ldy #S.IP.SRC+3
ldx #3
.1 lda (ZPFrameInPtr),y
sta SKT.REM.ADDR+S.SOCKADDR.ADDR,x
dey
@ -28,11 +30,13 @@ FRM.GetTargetSKT
ldy #S.IP.DST+3
ldx #3
.2 lda (ZPFrameInPtr),y
sta SKT.LOC.ADDR+S.SOCKADDR.ADDR,x
dey
dex
bpl .2
rts
*--------------------------------------
* FRM.NewIP

View File

@ -51,62 +51,34 @@ ICMP.IN.EXIT lda hFrameIn
stz hFrameIn
.8 rts
*--------------------------------------
ICMP.IN.ECHOREP jsr IP.FillSKT.TemplateSrcDstIP
lda #S.IP.PROTOCOL.ICMP
sta SKT.Template+S.SOCKET.RAW.PROTO
ICMP.IN.ECHOREP jsr FRM.GetTargetSKT.RAW
ldy #S.ICMP.IDENTIFIER
lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.REM.PORT+1
sta SKT.LOC.ADDR+S.SOCKADDR.PORT+1
iny
lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.REM.PORT
sta SKT.LOC.ADDR+S.SOCKADDR.PORT
lda hSocketTable
>SYSCALL GetMemPtr
jsr SKT.FindMatchingLocRem
bcs .9
>STYA ZPPtrSKT
ldx #0
.3 lda (ZPPtrSKT)
beq .7
cmp #S.SOCKET.T.RAW
bne .7
ldy #S.SOCKET.LOC.ADDR
.4 lda (ZPPtrSKT),y
cmp SKT.Template,y
bne .7
iny
cpy #S.SOCKET.LOC.PORT
bne .5
iny
iny
.5 cpy #S.SOCKET.REM.PORT Compare SRC.ADDR,DST.ADDR,DST.PORT
bne .4
ldy #S.SOCKET.PROTO
lda (ZPPtrSKT),y
ldy #S.SOCKET.PROTO
lda (ZPPtrSKT),y
cmp #S.IP.PROTOCOL.ICMP
bne .9
lda hFrameIn
jsr SKT.AddToQueueA
bcs ICMP.IN.EXIT Q full, discard...
rts DO NOT Discard this queued frame
.7 lda ZPPtrSKT
clc
adc #S.SOCKET
sta ZPPtrSKT
bcc .8
inc ZPPtrSKT+1
.8 inx
cpx #K.SKTTABLE.SIZE
bne .3
bra ICMP.IN.EXIT
.9 lda hFrameIn Q full, discard...
>SYSCALL FreeMem
.8 rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.ICMP

View File

@ -186,39 +186,6 @@ IP.AddSrcDstIPToChecksum
rts
*--------------------------------------
IP.FillSKT.TemplateSrcDstIPP
ldy #S.TCPUDP.SRCPORT
lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.REM.PORT+1
iny
lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.REM.PORT
iny #S.TCPUDP.DSTPORT
lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.LOC.PORT+1
iny
lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.LOC.PORT
*--------------------------------------
IP.FillSKT.TemplateSrcDstIP
ldy #S.IP.SRC+3
ldx #3
.1 lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.REM.ADDR,x
dey
dex
bpl .1
ldy #S.IP.DST+3
ldx #3
.2 lda (ZPFrameInPtr),y
sta SKT.Template+S.SOCKET.LOC.ADDR,x
dey
dex
bpl .2
rts
*--------------------------------------
IP.SetDestMAC ldy #S.IP.DST
lda (ZPFrameOutPtr),y
iny

View File

@ -37,7 +37,7 @@ SKT.Socket.DSOCK
sta FD.DSOCK+S.SOCKET.PROTO ICMP,UDP,TCP
lda #0 Y = socket.size
>SYSCALL GetMem0
bcs .99
bcs .9
>STYA ZPTmpPtr1
stx FD.DSOCK+S.FD.DSOCK.HSKT
@ -63,7 +63,7 @@ SKT.Socket.STREAM
sta FD.SSOCK+S.SOCKET.PROTO ICMP,UDP,TCP
lda #0 Y = socket.size
>SYSCALL GetMem0
bcs .99
bcs .9
>STYA ZPTmpPtr1
stx FD.SSOCK+S.FD.SSOCK.HSKT
@ -498,8 +498,9 @@ SKT.Write >SYSCALL GetMemPtr
*/--------------------------------------
* # SKT.Recv (RAW,DGRAM,SEQPACKET)
* # SKT.RecvFrom (RAW,DGRAM,SEQPACKET)
* hMem recv(hFD fd);
* hMem recvfrom(hFD fd, struct sockaddr *addr);
* ## C
* `hMem recv(hFD fd);`
* `hMem recvfrom(hFD fd, struct sockaddr *addr);`
* ## ASM
* **In:**
* `>PUSHW addr` (RecvFrom)
@ -602,7 +603,7 @@ SKT.Send clc
tax
jmp (J.SKT.send,x)
*--------------------------------------
SKT.Send.RAW ldy #S.SOCKET.RAW.PROTO
SKT.Send.RAW ldy #S.SOCKET.PROTO
lda (ZPPtrSKT),y
tax
@ -629,7 +630,7 @@ SKT.Send.DGRAM.8
*--------------------------------------
SKT.Send.STREAM lda #ERR.SKT.BAD
sec
rts
SKT.Send.9 rts
*--------------------------------------
SKT.Send.SEQPACKET
bra *
@ -816,9 +817,9 @@ SKT.AddToQueueA sta .2+1
* Dst : hInMem/INHEAD
*--------------------------------------
SKT.AddDataToSktIn
ldx SKT.TCBCache+S.SOCKET.TCP.INFREE
ldx SKT.TmpCache+S.SOCKET.TCP.INFREE
cpx ZPDataInLen
lda SKT.TCBCache+S.SOCKET.TCP.INFREE+1
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
sbc ZPDataInLen+1
bcc .9 Not enough room in Q
@ -826,7 +827,7 @@ SKT.AddDataToSktIn
ldx #3
.10 lda (ZPFrameInPtr),y
eor SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM,x
eor SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM,x
bne .9
dey
dex
@ -839,11 +840,11 @@ SKT.AddDataToSktIn
lda ZPTmpPtr1
clc
adc SKT.TCBCache+S.SOCKET.TCP.INHEAD
adc SKT.TmpCache+S.SOCKET.TCP.INHEAD
sta ZPTmpPtr2
lda ZPTmpPtr1+1
adc SKT.TCBCache+S.SOCKET.TCP.INHEAD+1
adc SKT.TmpCache+S.SOCKET.TCP.INHEAD+1
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
lda ZPDataInLen
@ -874,13 +875,13 @@ SKT.AddDataToSktIn
bne .4
inc ZPTmpPtr2+1
.4 inc SKT.TCBCache+S.SOCKET.TCP.INHEAD
.4 inc SKT.TmpCache+S.SOCKET.TCP.INHEAD
bne .1
inc SKT.TCBCache+S.SOCKET.TCP.INHEAD+1
lda SKT.TCBCache+S.SOCKET.TCP.INHEAD+1
inc SKT.TmpCache+S.SOCKET.TCP.INHEAD+1
lda SKT.TmpCache+S.SOCKET.TCP.INHEAD+1
cmp /K.TCP.WSIZE
bne .1
stz SKT.TCBCache+S.SOCKET.TCP.INHEAD+1
stz SKT.TmpCache+S.SOCKET.TCP.INHEAD+1
lda ZPTmpPtr1 Dst Ptr=Buffer Base
sta ZPTmpPtr2
@ -891,37 +892,37 @@ SKT.AddDataToSktIn
.9 sec
rts
.8 lda SKT.TCBCache+S.SOCKET.TCP.INFREE
.8 lda SKT.TmpCache+S.SOCKET.TCP.INFREE
sec
sbc ZPDataInLen
sta SKT.TCBCache+S.SOCKET.TCP.INFREE
sta SKT.TmpCache+S.SOCKET.TCP.INFREE
lda SKT.TCBCache+S.SOCKET.TCP.INFREE+1
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
sbc ZPDataInLen+1
sta SKT.TCBCache+S.SOCKET.TCP.INFREE+1
sta SKT.TmpCache+S.SOCKET.TCP.INFREE+1
lda SKT.TCBCache+S.SOCKET.TCP.INUSED
lda SKT.TmpCache+S.SOCKET.TCP.INUSED
clc
adc ZPDataInLen
sta SKT.TCBCache+S.SOCKET.TCP.INUSED
sta SKT.TmpCache+S.SOCKET.TCP.INUSED
lda SKT.TCBCache+S.SOCKET.TCP.INUSED+1
lda SKT.TmpCache+S.SOCKET.TCP.INUSED+1
adc ZPDataInLen+1
sta SKT.TCBCache+S.SOCKET.TCP.INUSED+1
sta SKT.TmpCache+S.SOCKET.TCP.INUSED+1
clc
lda SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM+3
lda SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM+3
adc ZPDataInLen
sta SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM+3
sta SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM+3
lda SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM+2
lda SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM+2
adc ZPDataInLen+1
sta SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM+2
sta SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM+2
bcc .80
inc SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM+1
inc SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM+1
bne .80
inc SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM
inc SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM
.80 clc
rts
@ -935,8 +936,8 @@ SKT.AddDataToSktIn
*--------------------------------------
SKT.GetDataFromSktIn
jsr SKT.GetTCB
lda SKT.TCBCache+S.SOCKET.TCP.INUSED
ora SKT.TCBCache+S.SOCKET.TCP.INUSED+1
lda SKT.TmpCache+S.SOCKET.TCP.INUSED
ora SKT.TmpCache+S.SOCKET.TCP.INUSED+1
bne .10
sec
rts A=0,NO DATA
@ -948,11 +949,11 @@ SKT.GetDataFromSktIn
lda ZPTmpPtr1
clc
adc SKT.TCBCache+S.SOCKET.TCP.INTAIL
adc SKT.TmpCache+S.SOCKET.TCP.INTAIL
sta ZPTmpPtr2
lda ZPTmpPtr1+1
adc SKT.TCBCache+S.SOCKET.TCP.INTAIL+1
adc SKT.TmpCache+S.SOCKET.TCP.INTAIL+1
sta ZPTmpPtr2+1
lda ZPDataInLen
@ -976,25 +977,25 @@ SKT.GetDataFromSktIn
pha
.2 lda SKT.TCBCache+S.SOCKET.TCP.INTAIL
eor SKT.TCBCache+S.SOCKET.TCP.INHEAD
.2 lda SKT.TmpCache+S.SOCKET.TCP.INTAIL
eor SKT.TmpCache+S.SOCKET.TCP.INHEAD
bne .3
lda SKT.TCBCache+S.SOCKET.TCP.INTAIL+1
eor SKT.TCBCache+S.SOCKET.TCP.INHEAD+1
lda SKT.TmpCache+S.SOCKET.TCP.INTAIL+1
eor SKT.TmpCache+S.SOCKET.TCP.INHEAD+1
beq .7 no more data....
.3 lda (ZPTmpPtr2)
pha
inc SKT.TCBCache+S.SOCKET.TCP.INTAIL
inc SKT.TmpCache+S.SOCKET.TCP.INTAIL
bne .4
inc SKT.TCBCache+S.SOCKET.TCP.INTAIL+1
lda SKT.TCBCache+S.SOCKET.TCP.INTAIL+1
inc SKT.TmpCache+S.SOCKET.TCP.INTAIL+1
lda SKT.TmpCache+S.SOCKET.TCP.INTAIL+1
cmp /K.TCP.WSIZE
bne .4
stz SKT.TCBCache+S.SOCKET.TCP.INTAIL+1
stz SKT.TmpCache+S.SOCKET.TCP.INTAIL+1
lda ZPTmpPtr1
sta ZPTmpPtr2
lda ZPTmpPtr1+1
@ -1024,37 +1025,37 @@ SKT.GetDataFromSktIn
ora ZPTmpPtr3+1
beq .9
lda SKT.TCBCache+S.SOCKET.TCP.INFREE
lda SKT.TmpCache+S.SOCKET.TCP.INFREE
clc
adc ZPTmpPtr3
sta SKT.TCBCache+S.SOCKET.TCP.INFREE
sta SKT.TmpCache+S.SOCKET.TCP.INFREE
lda SKT.TCBCache+S.SOCKET.TCP.INFREE+1
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
adc ZPTmpPtr3+1
sta SKT.TCBCache+S.SOCKET.TCP.INFREE+1
sta SKT.TmpCache+S.SOCKET.TCP.INFREE+1
lda SKT.TCBCache+S.SOCKET.TCP.INUSED
lda SKT.TmpCache+S.SOCKET.TCP.INUSED
sec
sbc ZPTmpPtr3
sta SKT.TCBCache+S.SOCKET.TCP.INUSED
sta SKT.TmpCache+S.SOCKET.TCP.INUSED
lda SKT.TCBCache+S.SOCKET.TCP.INUSED+1
lda SKT.TmpCache+S.SOCKET.TCP.INUSED+1
sbc ZPTmpPtr3+1
sta SKT.TCBCache+S.SOCKET.TCP.INUSED+1
sta SKT.TmpCache+S.SOCKET.TCP.INUSED+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM+3
lda SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM+3
clc
adc ZPTmpPtr3
sta SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM+3
sta SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM+3
lda SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM+2
lda SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM+2
adc ZPTmpPtr3+1
sta SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM+2
sta SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM+2
bcc .80
inc SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM+1
inc SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM+1
bne .80
inc SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM
inc SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM
.80 jsr SKT.StoreTCB
@ -1080,9 +1081,9 @@ SKT.GetDataFromSktIn
*--------------------------------------
SKT.AddDataToSktOut
jsr SKT.GetTCB
ldx SKT.TCBCache+S.SOCKET.TCP.OUTFREE
ldx SKT.TmpCache+S.SOCKET.TCP.OUTFREE
cpx ZPDataInLen
lda SKT.TCBCache+S.SOCKET.TCP.OUTFREE+1
lda SKT.TmpCache+S.SOCKET.TCP.OUTFREE+1
sbc ZPDataInLen+1
bcc .9 Not enough room in Q
@ -1093,11 +1094,11 @@ SKT.AddDataToSktOut
lda ZPTmpPtr1
clc
adc SKT.TCBCache+S.SOCKET.TCP.OUTHEAD
adc SKT.TmpCache+S.SOCKET.TCP.OUTHEAD
sta ZPTmpPtr2
lda ZPTmpPtr1+1
adc SKT.TCBCache+S.SOCKET.TCP.OUTHEAD+1
adc SKT.TmpCache+S.SOCKET.TCP.OUTHEAD+1
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
lda ZPDataInLen
@ -1128,13 +1129,13 @@ SKT.AddDataToSktOut
bne .4
inc ZPTmpPtr2+1
.4 inc SKT.TCBCache+S.SOCKET.TCP.OUTHEAD
.4 inc SKT.TmpCache+S.SOCKET.TCP.OUTHEAD
bne .1
inc SKT.TCBCache+S.SOCKET.TCP.OUTHEAD+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTHEAD+1
inc SKT.TmpCache+S.SOCKET.TCP.OUTHEAD+1
lda SKT.TmpCache+S.SOCKET.TCP.OUTHEAD+1
cmp /K.TCP.WSIZE
bne .1
stz SKT.TCBCache+S.SOCKET.TCP.OUTHEAD+1
stz SKT.TmpCache+S.SOCKET.TCP.OUTHEAD+1
lda ZPTmpPtr1 Dst Ptr=Buffer Base
sta ZPTmpPtr2
@ -1145,29 +1146,29 @@ SKT.AddDataToSktOut
.9 sec
rts
.8 lda SKT.TCBCache+S.SOCKET.TCP.OUTFREE
.8 lda SKT.TmpCache+S.SOCKET.TCP.OUTFREE
sec
sbc ZPDataInLen
sta SKT.TCBCache+S.SOCKET.TCP.OUTFREE
lda SKT.TCBCache+S.SOCKET.TCP.OUTFREE+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTFREE
lda SKT.TmpCache+S.SOCKET.TCP.OUTFREE+1
sbc ZPDataInLen+1
sta SKT.TCBCache+S.SOCKET.TCP.OUTFREE+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTFREE+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTUSED
lda SKT.TmpCache+S.SOCKET.TCP.OUTUSED
clc
adc ZPDataInLen
sta SKT.TCBCache+S.SOCKET.TCP.OUTUSED
lda SKT.TCBCache+S.SOCKET.TCP.OUTUSED+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTUSED
lda SKT.TmpCache+S.SOCKET.TCP.OUTUSED+1
adc ZPDataInLen+1
sta SKT.TCBCache+S.SOCKET.TCP.OUTUSED+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTUSED+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND
lda SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND
clc
adc ZPDataInLen
sta SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND
lda SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND
lda SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND+1
adc ZPDataInLen+1
sta SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND+1
jsr SKT.StoreTCB
rts
*--------------------------------------
@ -1184,11 +1185,11 @@ SKT.GetDataFromSktOut
lda ZPTmpPtr1
clc
adc SKT.TCBCache+S.SOCKET.TCP.OUTTAILNEXT
adc SKT.TmpCache+S.SOCKET.TCP.OUTTAILNEXT
sta ZPTmpPtr2 Make ZPTmpPtr2=base+nexttail
lda ZPTmpPtr1+1
adc SKT.TCBCache+S.SOCKET.TCP.OUTTAILNEXT+1
adc SKT.TmpCache+S.SOCKET.TCP.OUTTAILNEXT+1
sta ZPTmpPtr2+1
lda ZPDataOutLen
@ -1219,13 +1220,13 @@ SKT.GetDataFromSktOut
bne .4
inc ZPTmpPtr2+1
.4 inc SKT.TCBCache+S.SOCKET.TCP.OUTTAILNEXT
.4 inc SKT.TmpCache+S.SOCKET.TCP.OUTTAILNEXT
bne .1
inc SKT.TCBCache+S.SOCKET.TCP.OUTTAILNEXT+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTTAILNEXT+1
inc SKT.TmpCache+S.SOCKET.TCP.OUTTAILNEXT+1
lda SKT.TmpCache+S.SOCKET.TCP.OUTTAILNEXT+1
cmp /K.TCP.WSIZE
bne .1
stz SKT.TCBCache+S.SOCKET.TCP.OUTTAILNEXT+1
stz SKT.TmpCache+S.SOCKET.TCP.OUTTAILNEXT+1
lda ZPTmpPtr1 Dst Ptr=Buffer Base
sta ZPTmpPtr2
@ -1233,13 +1234,13 @@ SKT.GetDataFromSktOut
sta ZPTmpPtr2+1
bra .1
.8 lda SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND
.8 lda SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND
sec
sbc ZPDataOutLen
sta SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND
lda SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND
lda SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND+1
sbc ZPDataOutLen+1
sta SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND+1
clc
rts
@ -1256,10 +1257,10 @@ SKT.AckDataToSktOut
.1 lda (ZPFrameInPtr),y
pha
sbc SKT.TCBCache+S.SOCKET.TCP.OUTSEQNUM,x
sbc SKT.TmpCache+S.SOCKET.TCP.OUTSEQNUM,x
sta TmpDWord,x
pla ....and Set SEQ = new SEQ
sta SKT.TCBCache+S.SOCKET.TCP.OUTSEQNUM,x
sta SKT.TmpCache+S.SOCKET.TCP.OUTSEQNUM,x
dey
dex
bpl .1
@ -1271,65 +1272,50 @@ SKT.AckDataToSktOut
beq .8
.2 clc
adc SKT.TCBCache+S.SOCKET.TCP.OUTTAIL
sta SKT.TCBCache+S.SOCKET.TCP.OUTTAIL
adc SKT.TmpCache+S.SOCKET.TCP.OUTTAIL
sta SKT.TmpCache+S.SOCKET.TCP.OUTTAIL
txa
adc SKT.TCBCache+S.SOCKET.TCP.OUTTAIL+1
adc SKT.TmpCache+S.SOCKET.TCP.OUTTAIL+1
and /K.TCP.WSIZE-1
sta SKT.TCBCache+S.SOCKET.TCP.OUTTAIL+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTTAIL+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTFREE
lda SKT.TmpCache+S.SOCKET.TCP.OUTFREE
clc
adc TmpDWord+3
sta SKT.TCBCache+S.SOCKET.TCP.OUTFREE
lda SKT.TCBCache+S.SOCKET.TCP.OUTFREE+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTFREE
lda SKT.TmpCache+S.SOCKET.TCP.OUTFREE+1
adc TmpDWord+2
sta SKT.TCBCache+S.SOCKET.TCP.OUTFREE+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTFREE+1
lda SKT.TCBCache+S.SOCKET.TCP.OUTUSED
lda SKT.TmpCache+S.SOCKET.TCP.OUTUSED
sec
sbc TmpDWord+3
sta SKT.TCBCache+S.SOCKET.TCP.OUTUSED
lda SKT.TCBCache+S.SOCKET.TCP.OUTUSED+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTUSED
lda SKT.TmpCache+S.SOCKET.TCP.OUTUSED+1
sbc TmpDWord+2
sta SKT.TCBCache+S.SOCKET.TCP.OUTUSED+1
sta SKT.TmpCache+S.SOCKET.TCP.OUTUSED+1
.8 rts
*--------------------------------------
SKT.NewTCB
SKT.GetTCB ldy #S.SOCKET.TCP-S.SOCKET
clc
.9 rts
*--------------------------------------
SKT.GetTCB ldy #S.SOCKET.SQ.hTCB
.1 dey
lda (ZPPtrSKT),y
>SYSCALL GetMemPtr
bcs *
>STYA .1+1
sta SKT.TmpCache,y
cpy #S.SOCKET
bne .1
ldx #S.TCB-1
.1 lda $ffff,x
sta SKT.TCBCache,x
dex
bpl .1
rts
*--------------------------------------
SKT.StoreTCB ldy #S.SOCKET.SQ.hTCB
lda (ZPPtrSKT),y
>SYSCALL GetMemPtr
bcs *
>STYA .2+1
SKT.StoreTCB ldy #S.SOCKET.TCP-S.SOCKET
.1 dey
lda SKT.TmpCache,y
sta (ZPPtrSKT),y
cpy #S.SOCKET
bne .1
ldx #S.TCB-1
.1 lda SKT.TCBCache,x
.2 sta $ffff,x
dex
bpl .1
rts
*--------------------------------------
SKT.Destroy ldy #S.SOCKET.SQ.hOutMem
@ -1342,12 +1328,7 @@ SKT.Destroy ldy #S.SOCKET.SQ.hOutMem
beq .2
>SYSCALL FreeMem
.2 ldy #S.SOCKET.SQ.hTCB
lda (ZPPtrSKT),y
beq .3
>SYSCALL FreeMem
.3 lda #0
.2 lda #0
sta (ZPPtrSKT)
clc
rts

View File

@ -3,7 +3,7 @@ PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
TCP.IN jsr FRM.GetTargetSKT
TCP.IN jsr FRM.GetTargetSKT.TCPUDP
jsr SKT.FindMatchingLocRem
bcs TCP.IN.JMP.CLOSED no socket, go discard
@ -12,7 +12,7 @@ TCP.IN jsr FRM.GetTargetSKT
ldy #S.SOCKET.PROTO
lda (ZPPtrSKT),y
cmp #S.SOCKET.T.TCP
cmp #S.IP.PROTOCOL.TCP
bne TCP.IN.JMP.CLOSED wrong protocol, go discard
ldy #S.TCP.OPTIONS
@ -93,9 +93,9 @@ TCP.IN.JMP.SYNSENT
sec Check if ACK=OUTNEXTSEQ+1
.1 lda SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ,x
.1 lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x
adc #0
sta SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ,x
sta SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x
eor (ZPFrameInPtr),y
bne .9
dey
@ -132,10 +132,10 @@ TCP.IN.JMP.SYNRCVD
sec
.1 lda SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ,x Check if ACK=OUTNEXTSEQ+1
.1 lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x Check if ACK=OUTNEXTSEQ+1
adc #0
sta SKT.TCBCache+S.SOCKET.TCP.OUTSEQNUM,x setup SEQNUM
sta SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ,x ...and update NEXTSEQ
sta SKT.TmpCache+S.SOCKET.TCP.OUTSEQNUM,x setup SEQNUM
sta SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x ...and update NEXTSEQ
eor (ZPFrameInPtr),y
bne .8
dey
@ -253,8 +253,8 @@ TCP.IN.ACKTheSYN
.3 lda (ZPFrameInPtr),y Set OUTACK=SEQ+1 for new socket...
adc #0
sta SKT.TCBCache+S.SOCKET.TCP.INLASTSEQNUM,x
sta SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM,x
sta SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM,x
sta SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
dey
dex
bpl .3
@ -273,9 +273,9 @@ TCP.IN.ACKTheFIN
sec
.3 lda SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM,x
.3 lda SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
adc #0
sta SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM,x
sta SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
dey
dex
bpl .3
@ -331,8 +331,8 @@ TCP.IN.SetDataInPtrAndLen
*--------------------------------------
TCP.OUT jsr SKT.GetTCB
TCP.OUT.I lda SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND+1
ldy SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND
TCP.OUT.I lda SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND+1
ldy SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND
bne .1
@ -367,18 +367,18 @@ TCP.OUT.I lda SKT.TCBCache+S.SOCKET.TCP.OUTTOSEND+1
bcs TCP.OUT.9
lda SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ+3
lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+3
clc
adc ZPDataOutLen
sta SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ+3
sta SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+3
lda SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ+2
lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+2
adc ZPDataOutLen+1
sta SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ+2
sta SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+2
bcc .80
inc SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ+1
inc SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+1
bne .80
inc SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ
inc SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ
.80 jmp SKT.StoreTCB exits with CC
TCP.OUT.9 rts
@ -400,7 +400,7 @@ TCP.OUT.SendOptA.1
ldx #3
ldy #S.TCP.ACKNUM+3
.1 lda SKT.TCBCache+S.SOCKET.TCP.OUTACKNUM,x
.1 lda SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
sta (ZPFrameOutPtr),y
dey
dex
@ -409,17 +409,17 @@ TCP.OUT.SendOptA.1
.10 ldx #3
ldy #S.TCP.SEQNUM+3
.2 lda SKT.TCBCache+S.SOCKET.TCP.OUTNEXTSEQ,x
.2 lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x
sta (ZPFrameOutPtr),y
dey
dex
bpl .2
ldy #S.TCP.WINDOW
lda SKT.TCBCache+S.SOCKET.TCP.INFREE+1
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
sta (ZPFrameOutPtr),y
iny
lda SKT.TCBCache+S.SOCKET.TCP.INFREE
lda SKT.TmpCache+S.SOCKET.TCP.INFREE
sta (ZPFrameOutPtr),y
jsr FRM.SendIP
@ -445,10 +445,10 @@ TCP.NewFrame ldx #S.IP.PROTOCOL.TCP
sta (ZPFrameOutPtr),y
ldy #S.TCP.WINDOW
lda SKT.TCBCache+S.SOCKET.TCP.INFREE+1
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
sta (ZPFrameOutPtr),y
iny
lda SKT.TCBCache+S.SOCKET.TCP.INFREE
lda SKT.TmpCache+S.SOCKET.TCP.INFREE
sta (ZPFrameOutPtr),y
clc

View File

@ -3,7 +3,7 @@ PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
UDP.IN jsr FRM.GetTargetSKT
UDP.IN jsr FRM.GetTargetSKT.TCPUDP
jsr SKT.FindMatchingLocRem
bcs .9

View File

@ -8,6 +8,7 @@ AUTO 4,1
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/MLI.I
.INB INC/MLI.E.I
.INB INC/NIC.I
.INB INC/ETH.I
@ -81,10 +82,10 @@ CS.START cld
.DA SKT.Read
.DA SKT.Write
.DA SKT.Rcvd
.DA SKT.Recv
.DA SKT.Send
.DA SKT.RcvdFrom
.DA SKT.RecvFrom
.DA SKT.SendTo
.DA SKT.GetTable
@ -376,13 +377,12 @@ FRM.QUEUE.LenH .BS K.FRMQUEUE.SIZE
*--------------------------------------
RefCount .DA #0
DYNPORT.LAST .DA K.DYNPORT.START
hDNSSocket1 .BS 1
hDNSSocket2 .BS 1
hDNSSocket .BS 1
DNS.TmpCache .BS S.DNSCACHE
ARP.TmpCache .BS S.ARP
SKT.Template .BS S.SOCKET
SKT.LOC.ADDR .BS S.SOCKADDR
SKT.REM.ADDR .BS S.SOCKADDR
SKT.TmpCache .BS S.SOCKET.TCP
TmpDWord .BS 4
TmpOffset .BS 2
hFrameIn .BS 1

View File

@ -320,10 +320,10 @@ IO.WRITE.CDEV ldx #IOCTL.WRITE
>LDYA K.S.IOCTL+S.IOCTL.BYTECNT
.9 rts
*--------------------------------------
IO.WRITE.SSOCK ldy #S.FD.SOCK.WRITE
IO.WRITE.SSOCK ldy #S.FD.SSOCK.WRITE
.HS 2C BIT ABS
*--------------------------------------
IO.READ.SSOCK ldy #S.FD.SOCK.READ
IO.READ.SSOCK ldy #S.FD.SSOCK.READ
lda (pFD),y
tax Function Offset in LIB
@ -333,7 +333,7 @@ IO.READ.SSOCK ldy #S.FD.SOCK.READ
jsr K.GetMemPtr
>STYA .1
ldy #S.FD.SOCK.HSKT
ldy #S.FD.SSOCK.HSKT
lda (pFD),y
.1 jmp $ffff