2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2016-01-16 22:04:22 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2018-09-17 15:42:38 +00:00
|
|
|
|
TCP.IN jsr IP.FillSKT.TemplateSrcDstIPP
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-02-10 07:29:58 +00:00
|
|
|
|
lda hSocketTable
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2016-03-13 22:09:00 +00:00
|
|
|
|
>STYA ZPPtrSKT
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.3 lda (ZPPtrSKT)
|
|
|
|
|
beq .7
|
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
|
|
|
|
bne .7
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SRC.ADDR
|
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
.4 lda SKT.Template,y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
bne .7 Not for this socket...
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #S.SOCKET.SRC.PORT+2
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
and #S.SOCKET.SO.ACCEPTCONN Listening socket?
|
2017-02-16 16:26:11 +00:00
|
|
|
|
beq .5 no, go check if Dst Match
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS yes, only accept SYN packet
|
2017-02-15 21:46:21 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
|
|
|
|
|
2017-03-13 15:34:56 +00:00
|
|
|
|
cmp #S.TCP.OPTIONS.SYN SYN only, if SYN.ACK, pass to regular socket
|
|
|
|
|
beq TCP.IN.JMP.LISTEN
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
|
|
|
|
.5 ldy #S.SOCKET.DST.ADDR
|
|
|
|
|
|
2017-03-13 07:07:07 +00:00
|
|
|
|
.6 lda SKT.Template,y regular socket, check remote ADDR/PORT
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
bne .7
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.SOCKET.DST.PORT+2
|
|
|
|
|
bne .6
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS
|
|
|
|
|
lda (ZPFrameInPtr),y
|
|
|
|
|
and #S.TCP.OPTIONS.RST RST ? go Kill this socket.
|
|
|
|
|
bne TCP.IN.RST
|
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda (ZPPtrSKT),y
|
2018-09-07 19:51:46 +00:00
|
|
|
|
cmp #S.SOCKET.TCP.STATUS.TIMEWT+1
|
2017-03-09 07:11:44 +00:00
|
|
|
|
bcs *
|
2017-02-16 16:26:11 +00:00
|
|
|
|
asl
|
|
|
|
|
tax
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
jmp (L.TCP.IN.JMP,x)
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
|
|
|
|
.7 lda ZPPtrSKT
|
|
|
|
|
clc
|
|
|
|
|
adc #S.SOCKET
|
|
|
|
|
sta ZPPtrSKT
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPPtrSKT+1
|
|
|
|
|
|
|
|
|
|
.8 inx
|
|
|
|
|
cpx #K.SKTTABLE.SIZE
|
|
|
|
|
bne .3
|
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
.9 clc Discard frame
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-22 16:39:01 +00:00
|
|
|
|
TCP.IN.RST jmp SKT.Destroy
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-16 16:26:11 +00:00
|
|
|
|
TCP.IN.JMP.LISTEN
|
2016-03-13 22:09:00 +00:00
|
|
|
|
lda #S.SOCKET.SOCK.STREAM
|
2017-02-16 16:26:11 +00:00
|
|
|
|
sta SKT.Template+S.SOCKET.SOCK
|
|
|
|
|
stz SKT.Template+S.SOCKET.SO
|
2017-03-13 07:07:07 +00:00
|
|
|
|
stz SKT.Template+S.SOCKET.TCP.STATUS
|
|
|
|
|
|
2018-09-18 06:28:51 +00:00
|
|
|
|
>PUSHW L.SKT.Template
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2018-08-28 15:28:34 +00:00
|
|
|
|
jsr SKT.New Assign OUTNEXTSEQ
|
2017-03-13 07:07:07 +00:00
|
|
|
|
bcs .99
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-13 07:07:07 +00:00
|
|
|
|
sty .1+1
|
|
|
|
|
sta .2+1
|
2016-04-09 09:15:11 +00:00
|
|
|
|
txa
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
jsr SKT.AddToQueueA
|
2016-04-09 09:15:11 +00:00
|
|
|
|
|
2017-03-13 07:07:07 +00:00
|
|
|
|
bcs .99 Queued successfully ?
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-13 07:07:07 +00:00
|
|
|
|
.1 lda #$ff
|
|
|
|
|
sta ZPPtrSKT
|
|
|
|
|
.2 lda #$ff
|
|
|
|
|
sta ZPPtrSKT+1
|
2017-02-17 07:20:57 +00:00
|
|
|
|
|
2018-09-21 15:28:46 +00:00
|
|
|
|
jsr TCP.IN.ACKTheSYN
|
2017-02-17 07:20:57 +00:00
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
jsr SKT.StoreTCB
|
2017-02-16 16:26:11 +00:00
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
jsr ARP.AddFromFrameInPtr
|
|
|
|
|
|
2017-03-23 16:41:36 +00:00
|
|
|
|
lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
2018-09-21 15:28:46 +00:00
|
|
|
|
jsr TCP.OUT.SendOptA SYN received, Send SYN.ACK
|
2017-02-16 16:26:11 +00:00
|
|
|
|
bcs .9
|
2017-03-14 07:32:31 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
2017-03-10 16:35:54 +00:00
|
|
|
|
lda #S.SOCKET.TCP.STATUS.SYNRCVD
|
2017-02-16 16:26:11 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
|
|
|
|
.9 lda #0 error
|
|
|
|
|
sta (ZPPtrSKT) clear this socket
|
|
|
|
|
lda #ERR.SKT.OOS
|
|
|
|
|
.99 rts
|
2017-01-28 22:05:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.SYNSENT
|
2017-03-14 16:46:29 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS SYN Send, only accept SYN.ACK packet, then Send ACK
|
2017-03-10 16:35:54 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2018-09-12 15:27:00 +00:00
|
|
|
|
and #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
|
|
|
|
cmp #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
|
|
|
|
bne .9
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-03-13 15:34:56 +00:00
|
|
|
|
jsr SKT.GetTCB
|
|
|
|
|
|
|
|
|
|
ldx #3
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.TCP.ACKNUM+3
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sec Check if ACK=OUTNEXTSEQ+1
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
.1 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
|
2017-03-13 15:34:56 +00:00
|
|
|
|
adc #0
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
|
2017-03-13 15:34:56 +00:00
|
|
|
|
eor (ZPFrameInPtr),y
|
2018-09-12 15:27:00 +00:00
|
|
|
|
bne .9
|
2017-03-13 15:34:56 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2018-09-21 15:28:46 +00:00
|
|
|
|
jsr TCP.IN.ACKTheSYN
|
2018-09-03 06:01:07 +00:00
|
|
|
|
|
2017-03-13 15:34:56 +00:00
|
|
|
|
lda #S.TCP.OPTIONS.ACK
|
2017-04-10 06:07:14 +00:00
|
|
|
|
jsr TCP.OUT.SendOptA SYN.ACK recieved, Send, ACK
|
2017-03-13 15:34:56 +00:00
|
|
|
|
bcs .9
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.ESTBLSH
|
2018-09-03 06:01:07 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
2018-09-04 15:29:15 +00:00
|
|
|
|
jmp SKT.StoreTCB
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2018-09-12 15:27:00 +00:00
|
|
|
|
.9 lda #S.TCP.OPTIONS.RST
|
|
|
|
|
jsr TCP.OUT.SendOptA
|
|
|
|
|
|
|
|
|
|
jmp SKT.Destroy
|
2017-03-10 16:35:54 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.SYNRCVD
|
2018-09-21 15:28:46 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS SYN Received, SYN.ACK Sent, only accept ACK packet
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp #S.TCP.OPTIONS.ACK
|
|
|
|
|
bne .8
|
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
jsr SKT.GetTCB
|
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ldx #3
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.TCP.ACKNUM+3
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-03-29 06:33:26 +00:00
|
|
|
|
sec
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
.1 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x Check if ACK=OUTNEXTSEQ+1
|
2017-03-29 06:33:26 +00:00
|
|
|
|
adc #0
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTSEQNUM,x setup SEQNUM
|
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x ...and update NEXTSEQ
|
2017-03-10 16:35:54 +00:00
|
|
|
|
eor (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .8
|
2017-03-13 07:07:07 +00:00
|
|
|
|
dey
|
2016-03-13 22:09:00 +00:00
|
|
|
|
dex
|
2017-03-10 16:35:54 +00:00
|
|
|
|
bpl .1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.ESTBLSH
|
2017-03-10 16:35:54 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
2018-09-04 15:29:15 +00:00
|
|
|
|
jmp SKT.StoreTCB
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.8 clc
|
2017-03-24 16:27:44 +00:00
|
|
|
|
.9 rts
|
2017-01-28 22:05:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.ESTBLSH
|
2017-03-10 16:35:54 +00:00
|
|
|
|
jsr SKT.GetTCB
|
|
|
|
|
|
2017-01-28 22:05:20 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-03-27 06:28:25 +00:00
|
|
|
|
and #S.TCP.OPTIONS.ACK Remote side ACKed data ?
|
2017-03-10 16:35:54 +00:00
|
|
|
|
beq .1
|
2017-02-17 16:39:38 +00:00
|
|
|
|
|
2017-03-27 06:28:25 +00:00
|
|
|
|
jsr SKT.AckDataToSktOut Yes, Discard sent data
|
|
|
|
|
jsr SKT.StoreTCB and update SKT
|
2017-02-17 16:39:38 +00:00
|
|
|
|
|
2017-03-13 15:34:56 +00:00
|
|
|
|
.1 jsr TCP.IN.SetDataInPtrAndLen
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
2017-03-14 16:46:29 +00:00
|
|
|
|
lda ZPDataInLen Incoming Data in this frame ?
|
2017-03-10 16:35:54 +00:00
|
|
|
|
ora ZPDataInLen+1
|
2017-03-14 16:46:29 +00:00
|
|
|
|
beq .2 No data, ...
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-14 16:46:29 +00:00
|
|
|
|
jsr SKT.AddDataToSktIn yes, queue data if there is room for....
|
2017-04-10 06:07:14 +00:00
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
jsr SKT.StoreTCB success, update socket
|
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
.2 ldy #S.TCP.OPTIONS
|
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-03-27 06:28:25 +00:00
|
|
|
|
and #S.TCP.OPTIONS.FIN
|
2017-03-13 07:07:07 +00:00
|
|
|
|
beq .8
|
2018-09-09 08:11:42 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
jsr TCP.IN.ACKTheFIN
|
2018-09-09 08:11:42 +00:00
|
|
|
|
|
2017-03-27 06:28:25 +00:00
|
|
|
|
bcs .9
|
2017-03-24 16:27:44 +00:00
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.CLWAIT
|
2017-02-17 16:39:38 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
2017-03-21 21:54:59 +00:00
|
|
|
|
|
2017-03-27 06:28:25 +00:00
|
|
|
|
.8 clc
|
2017-03-10 16:35:54 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.CLWAIT
|
2017-03-24 16:27:44 +00:00
|
|
|
|
clc Wait for SKT.CloseA from Daemon
|
2017-03-10 16:35:54 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.LASTACK
|
2017-03-13 15:34:56 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS only accept ACK packet
|
2017-03-10 16:35:54 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2018-09-09 08:11:42 +00:00
|
|
|
|
bit #S.TCP.OPTIONS.ACK
|
|
|
|
|
beq .8
|
2017-02-17 16:39:38 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
jmp SKT.Destroy
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2017-02-17 16:39:38 +00:00
|
|
|
|
.8 clc
|
2017-02-01 16:49:44 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.FINWT1
|
2017-03-24 16:27:44 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS only accept ACK packet
|
|
|
|
|
lda (ZPFrameInPtr),y
|
2018-09-05 11:31:49 +00:00
|
|
|
|
bit #S.TCP.OPTIONS.ACK
|
|
|
|
|
beq TCP.IN.JMP.FINWT2.1
|
2017-03-24 16:27:44 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.FINWT2
|
|
|
|
|
sta (ZPPtrSKT),y
|
2017-03-10 16:35:54 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-01 16:49:44 +00:00
|
|
|
|
TCP.IN.JMP.FINWT2
|
2017-03-24 16:27:44 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS only accept FIN packet
|
|
|
|
|
lda (ZPFrameInPtr),y
|
2018-09-05 11:31:49 +00:00
|
|
|
|
TCP.IN.JMP.FINWT2.1
|
|
|
|
|
bit #S.TCP.OPTIONS.FIN
|
2017-03-24 16:27:44 +00:00
|
|
|
|
bne .8
|
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
jsr TCP.IN.ACKTheFIN
|
2017-03-24 16:27:44 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.TIMEWT
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
2017-03-10 16:35:54 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-01 16:49:44 +00:00
|
|
|
|
TCP.IN.JMP.CLOSING
|
2017-03-24 16:27:44 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS only accept ACK packet
|
|
|
|
|
lda (ZPFrameInPtr),y
|
2018-09-09 08:11:42 +00:00
|
|
|
|
bit #S.TCP.OPTIONS.ACK
|
|
|
|
|
beq .1
|
2017-03-24 16:27:44 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.TIMEWT
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
.1 clc
|
|
|
|
|
rts
|
2017-03-10 16:35:54 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-01 16:49:44 +00:00
|
|
|
|
TCP.IN.JMP.TIMEWT
|
2017-03-13 15:34:56 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.CLOSED
|
2018-09-09 08:11:42 +00:00
|
|
|
|
jmp SKT.Destroy
|
2017-02-01 16:49:44 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-21 15:28:46 +00:00
|
|
|
|
TCP.IN.ACKTheSYN
|
|
|
|
|
ldy #S.TCP.SEQNUM+3 Get Remote SEQ
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.3 lda (ZPFrameInPtr),y Set OUTACK=SEQ+1 for new socket...
|
|
|
|
|
adc #0
|
|
|
|
|
sta SKT.TCBCache+S.TCB.INLASTSEQNUM,x
|
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTACKNUM,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-09-13 15:29:02 +00:00
|
|
|
|
TCP.IN.ACKTheFIN
|
|
|
|
|
ldy #S.SOCKET.TCP.OPTIONS
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ora #S.TCP.OPTIONS.ACK
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
jsr SKT.GetTCB
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.TCP.ACKNUM+3
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.3 lda SKT.TCBCache+S.TCB.OUTACKNUM,x
|
|
|
|
|
adc #0
|
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTACKNUM,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
2018-09-13 18:43:39 +00:00
|
|
|
|
jmp TCP.OUT.I ACK the FIN
|
2018-09-13 15:29:02 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-13 15:34:56 +00:00
|
|
|
|
TCP.IN.SetDataInPtrAndLen
|
2017-03-19 21:47:54 +00:00
|
|
|
|
ldy #S.IP.TOTAL.LENGTH+1
|
|
|
|
|
lda (ZPFrameInPtr),y
|
|
|
|
|
sec
|
|
|
|
|
sbc #S.IP-S.ETH
|
|
|
|
|
sta ZPDataInLen
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPFrameInPtr),y
|
|
|
|
|
sbc /S.IP-S.ETH
|
|
|
|
|
sta ZPDataInLen+1
|
|
|
|
|
|
2017-03-13 15:34:56 +00:00
|
|
|
|
ldy #S.TCP.DATAOFFSET
|
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-03-15 06:58:13 +00:00
|
|
|
|
and #$F0 Get TCP Header len in DWORD
|
2017-03-13 15:34:56 +00:00
|
|
|
|
lsr
|
2017-03-15 06:58:13 +00:00
|
|
|
|
lsr
|
2017-03-13 15:34:56 +00:00
|
|
|
|
sta TmpOffset
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
lda ZPDataInLen
|
2017-03-13 15:34:56 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc TmpOffset
|
|
|
|
|
sta ZPDataInLen
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
bcs .1
|
|
|
|
|
dec ZPDataInLen+1
|
2017-03-15 06:58:13 +00:00
|
|
|
|
|
|
|
|
|
.1 lda ZPFrameInPtr
|
2017-03-19 21:47:54 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.IP
|
2017-03-21 21:54:59 +00:00
|
|
|
|
pha
|
2017-03-15 06:58:13 +00:00
|
|
|
|
|
|
|
|
|
lda ZPFrameInPtr+1
|
2017-03-19 21:47:54 +00:00
|
|
|
|
adc /S.IP
|
2017-03-21 21:54:59 +00:00
|
|
|
|
tax
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-21 21:54:59 +00:00
|
|
|
|
pla
|
2017-03-19 21:47:54 +00:00
|
|
|
|
clc
|
|
|
|
|
adc TmpOffset
|
|
|
|
|
bcc .2
|
|
|
|
|
|
2017-03-21 21:54:59 +00:00
|
|
|
|
inx
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-21 21:54:59 +00:00
|
|
|
|
.2 sta ZPDataInPtr
|
|
|
|
|
stx ZPDataInPtr+1
|
|
|
|
|
rts
|
2017-03-13 15:34:56 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-10 16:35:54 +00:00
|
|
|
|
TCP.OUT jsr SKT.GetTCB
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTTOSEND+1
|
|
|
|
|
ldy SKT.TCBCache+S.TCB.OUTTOSEND
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
bne .1
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
tax
|
2017-03-29 06:33:26 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
* Y,A=0 : no data to send
|
2017-03-14 07:32:31 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.OPTIONS
|
|
|
|
|
lda (ZPPtrSKT),y
|
2017-04-10 06:07:14 +00:00
|
|
|
|
bne TCP.OUT.SendOptA a least an option...
|
2017-03-23 16:41:36 +00:00
|
|
|
|
clc No, data, no flag....exit
|
|
|
|
|
rts
|
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
.1 cpy #K.TCP.MSS
|
|
|
|
|
pha
|
|
|
|
|
sbc /K.TCP.MSS OUTDATA > MSS ?
|
|
|
|
|
pla
|
2017-03-24 07:31:30 +00:00
|
|
|
|
bcc .2 no....keep data len
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
>LDYAI K.TCP.MSS yes send only MSS
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-14 07:32:31 +00:00
|
|
|
|
.2 jsr TCP.NewFrame
|
2017-03-23 16:41:36 +00:00
|
|
|
|
bcs TCP.OUT.9
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
jsr SKT.GetDataFromSktOut
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.OPTIONS
|
|
|
|
|
lda (ZPPtrSKT),y
|
2018-09-05 11:31:49 +00:00
|
|
|
|
ora #S.TCP.OPTIONS.ACK
|
2017-04-10 06:07:14 +00:00
|
|
|
|
jsr TCP.OUT.SendOptA.1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-23 16:41:36 +00:00
|
|
|
|
bcs TCP.OUT.9
|
2017-03-31 06:28:43 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTNEXTSEQ+3
|
2017-03-31 06:28:43 +00:00
|
|
|
|
clc
|
|
|
|
|
adc ZPDataOutLen
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ+3
|
2017-03-31 06:28:43 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTNEXTSEQ+2
|
2017-03-31 06:28:43 +00:00
|
|
|
|
adc ZPDataOutLen+1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ+2
|
2017-03-31 06:28:43 +00:00
|
|
|
|
bcc .80
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.OUTNEXTSEQ+1
|
2017-03-31 06:28:43 +00:00
|
|
|
|
bne .80
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.OUTNEXTSEQ
|
2017-03-31 06:28:43 +00:00
|
|
|
|
|
2018-09-04 15:29:15 +00:00
|
|
|
|
.80 jmp SKT.StoreTCB exits with CC
|
2017-03-23 16:41:36 +00:00
|
|
|
|
TCP.OUT.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-04-10 06:07:14 +00:00
|
|
|
|
TCP.OUT.SendOptA
|
|
|
|
|
sta .1+1
|
2017-03-23 16:41:36 +00:00
|
|
|
|
>LDYAI 0
|
|
|
|
|
jsr TCP.NewFrame
|
|
|
|
|
bcs TCP.OUT.9
|
|
|
|
|
|
2017-03-30 06:31:12 +00:00
|
|
|
|
.1 lda #$ff
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
TCP.OUT.SendOptA.1
|
|
|
|
|
ldy #S.TCP.OPTIONS
|
2017-03-27 06:28:25 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
2018-09-05 11:31:49 +00:00
|
|
|
|
bit #S.TCP.OPTIONS.ACK
|
|
|
|
|
beq .10
|
2017-04-07 06:31:47 +00:00
|
|
|
|
|
2017-03-29 06:33:26 +00:00
|
|
|
|
ldx #3
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.TCP.ACKNUM+3
|
2017-03-29 06:33:26 +00:00
|
|
|
|
|
2017-04-12 06:12:39 +00:00
|
|
|
|
.1 lda SKT.TCBCache+S.TCB.OUTACKNUM,x
|
2017-03-29 06:33:26 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
2017-04-12 06:12:39 +00:00
|
|
|
|
bpl .1
|
2017-03-29 06:33:26 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
.10 ldx #3
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.TCP.SEQNUM+3
|
2017-03-13 15:34:56 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
.2 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
|
2017-03-13 15:34:56 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
2017-03-23 16:41:36 +00:00
|
|
|
|
bpl .2
|
2017-03-13 15:34:56 +00:00
|
|
|
|
|
2017-03-23 16:41:36 +00:00
|
|
|
|
ldy #S.TCP.WINDOW
|
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE+1
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
|
|
|
|
|
jsr FRM.SendIP
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-02-15 21:46:21 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.OPTIONS
|
2017-03-09 07:11:44 +00:00
|
|
|
|
lda #0
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
2017-03-23 16:41:36 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
* clc
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.9 rts
|
2017-02-13 07:26:18 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-16 16:26:11 +00:00
|
|
|
|
TCP.NewFrame ldx #S.IP.PROTOCOL.TCP
|
|
|
|
|
jsr FRM.NewIP
|
|
|
|
|
bcs .9
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
jsr SKT.SetFrameOutDstIP
|
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
jsr SKT.SetFrameOutTCPUDPPorts
|
2017-02-17 07:20:57 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.TCP.DATAOFFSET
|
|
|
|
|
lda #$50 Header size = 5 DWORDS
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
|
|
|
|
|
ldy #S.TCP.WINDOW
|
2017-03-13 07:07:07 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE+1
|
2017-02-17 07:20:57 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
2017-03-13 07:07:07 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE
|
2017-02-17 07:20:57 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
|
2016-04-09 09:15:11 +00:00
|
|
|
|
clc
|
2017-02-16 16:26:11 +00:00
|
|
|
|
.9 rts
|
2016-04-09 09:15:11 +00:00
|
|
|
|
*--------------------------------------
|
2016-01-16 22:04:22 +00:00
|
|
|
|
MAN
|
2017-03-30 06:31:12 +00:00
|
|
|
|
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.TCP
|
|
|
|
|
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
2016-01-16 22:04:22 +00:00
|
|
|
|
ASM
|