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-10-08 15:41:00 +00:00
|
|
|
|
TCP.IN jsr FRM.GetTargetSKT.TCPUDP
|
2018-11-01 08:53:47 +00:00
|
|
|
|
|
2018-10-01 05:48:42 +00:00
|
|
|
|
jsr SKT.FindMatchingLocRem
|
|
|
|
|
bcs TCP.IN.JMP.CLOSED no socket, go discard
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2018-10-01 05:48:42 +00:00
|
|
|
|
>STYA ZPPtrSKT
|
2018-11-01 08:53:47 +00:00
|
|
|
|
|
2018-10-01 05:48:42 +00:00
|
|
|
|
ldy #S.SOCKET.PROTO
|
2016-03-13 22:09:00 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
2018-10-08 15:41:00 +00:00
|
|
|
|
cmp #S.IP.PROTOCOL.TCP
|
2018-10-01 05:48:42 +00:00
|
|
|
|
bne TCP.IN.JMP.CLOSED wrong protocol, go discard
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
ldy #S.TCP.OPTIONS
|
|
|
|
|
lda (ZPFrameInPtr),y
|
2018-10-01 05:48:42 +00:00
|
|
|
|
and #S.TCP.OPTIONS.RST RST ? go Kill this socket...
|
|
|
|
|
bne TCP.IN.RST ...and discard frame
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.S
|
2017-02-16 16:26:11 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
asl
|
|
|
|
|
tax
|
2018-09-27 15:34:38 +00:00
|
|
|
|
jmp (J.TCP.IN,x)
|
2017-02-16 16:26:11 +00:00
|
|
|
|
*--------------------------------------
|
2018-10-01 05:48:42 +00:00
|
|
|
|
TCP.IN.RST jsr SKT.Destroy
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.CLOSED
|
2018-10-11 06:09:35 +00:00
|
|
|
|
* lda hFrameIn
|
|
|
|
|
* >SYSCALL FreeMem
|
2018-10-01 05:48:42 +00:00
|
|
|
|
rts
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-16 16:26:11 +00:00
|
|
|
|
TCP.IN.JMP.LISTEN
|
2018-10-01 15:52:58 +00:00
|
|
|
|
ldy #S.SOCKET.T Create a new client socket
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
tax Same type a listening socket
|
2018-11-01 08:53:47 +00:00
|
|
|
|
iny #S.SOCKET.PROTO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
|
2018-10-01 15:52:58 +00:00
|
|
|
|
jsr SKT.Socket.I get new socket in ZPTmpPtr1
|
|
|
|
|
bcs TCP.IN.JMP.CLOSED
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2018-10-01 15:52:58 +00:00
|
|
|
|
jsr SKT.AddToQueueA Queued successfully ?
|
2016-04-09 09:15:11 +00:00
|
|
|
|
|
2018-10-01 15:52:58 +00:00
|
|
|
|
bcs TCP.IN.JMP.CLOSED no, discard frame and new socket
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2018-10-01 05:48:42 +00:00
|
|
|
|
jsr ARP.AddFromFrameInPtr
|
|
|
|
|
|
2018-10-01 15:52:58 +00:00
|
|
|
|
lda ZPTmpPtr1
|
2017-03-13 07:07:07 +00:00
|
|
|
|
sta ZPPtrSKT
|
2018-11-01 08:53:47 +00:00
|
|
|
|
lda ZPTmpPtr1+1
|
2017-03-13 07:07:07 +00:00
|
|
|
|
sta ZPPtrSKT+1
|
2017-02-17 07:20:57 +00:00
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
jsr SKT.SetLocAddr
|
|
|
|
|
jsr SKT.SetRemAddr
|
|
|
|
|
|
|
|
|
|
jsr SKT.NewTCB
|
|
|
|
|
bcs .99
|
2017-02-17 07:20:57 +00:00
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
jsr TCP.IN.ACKTheSYN
|
2017-02-16 16:26:11 +00:00
|
|
|
|
|
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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
lda #S.SOCKET.TCP.S.SYNRCVD
|
2018-11-01 08:53:47 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.S
|
|
|
|
|
jmp SKT.StoreTCB
|
2017-03-13 07:07:07 +00:00
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
.9 lda #ERR.SKT.OOS
|
2017-03-13 07:07:07 +00:00
|
|
|
|
.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
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
.1 lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x
|
2017-03-13 15:34:56 +00:00
|
|
|
|
adc #0
|
2018-10-08 15:41:00 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
lda #S.SOCKET.TCP.S.ESTBLSH
|
2018-11-01 08:53:47 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.S
|
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
|
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
.1 lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ,x Check if ACK=OUTNEXTSEQ+1
|
2017-03-29 06:33:26 +00:00
|
|
|
|
adc #0
|
2018-10-08 15:41:00 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.OUTSEQNUM,x setup SEQNUM
|
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
lda #S.SOCKET.TCP.S.ESTBLSH
|
2018-11-01 08:53:47 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.S
|
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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.S
|
|
|
|
|
lda #S.SOCKET.TCP.S.CLWAIT
|
2017-02-17 16:39:38 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
2018-11-01 08:53:47 +00:00
|
|
|
|
jmp SKT.StoreTCB
|
|
|
|
|
|
2017-03-27 06:28:25 +00:00
|
|
|
|
.8 clc
|
2017-03-10 16:35:54 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.CLWAIT
|
2018-11-01 08:53:47 +00:00
|
|
|
|
clc Wait for SKT.shutdown
|
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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.S
|
|
|
|
|
lda #S.SOCKET.TCP.S.FINWT2
|
2017-03-24 16:27:44 +00:00
|
|
|
|
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
|
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.S
|
|
|
|
|
lda #S.SOCKET.TCP.S.TIMEWT
|
2017-03-24 16:27:44 +00:00
|
|
|
|
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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.S
|
|
|
|
|
lda #S.SOCKET.TCP.S.TIMEWT
|
2017-03-24 16:27:44 +00:00
|
|
|
|
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
|
|
|
|
*--------------------------------------
|
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
|
2018-10-08 15:41:00 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.INLASTSEQNUM,x
|
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
|
2018-09-21 15:28:46 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-09-13 15:29:02 +00:00
|
|
|
|
TCP.IN.ACKTheFIN
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.O
|
2018-09-13 15:29:02 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ora #S.TCP.OPTIONS.ACK
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
jsr SKT.GetTCB
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.TCP.ACKNUM+3
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
.3 lda SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
|
2018-09-13 15:29:02 +00:00
|
|
|
|
adc #0
|
2018-10-08 15:41:00 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.OUTACKNUM,x
|
2018-09-13 15:29:02 +00:00
|
|
|
|
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
|
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
TCP.OUT.I lda SKT.TmpCache+S.SOCKET.TCP.OUTTOSEND+1
|
|
|
|
|
ldy SKT.TmpCache+S.SOCKET.TCP.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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.O
|
2017-03-14 07:32:31 +00:00
|
|
|
|
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
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.O
|
2017-02-15 16:14:41 +00:00
|
|
|
|
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
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+3
|
2017-03-31 06:28:43 +00:00
|
|
|
|
clc
|
|
|
|
|
adc ZPDataOutLen
|
2018-10-08 15:41:00 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+3
|
2017-03-31 06:28:43 +00:00
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
lda SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+2
|
2017-03-31 06:28:43 +00:00
|
|
|
|
adc ZPDataOutLen+1
|
2018-10-08 15:41:00 +00:00
|
|
|
|
sta SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+2
|
2017-03-31 06:28:43 +00:00
|
|
|
|
bcc .80
|
2018-10-08 15:41:00 +00:00
|
|
|
|
inc SKT.TmpCache+S.SOCKET.TCP.OUTNEXTSEQ+1
|
2017-03-31 06:28:43 +00:00
|
|
|
|
bne .80
|
2018-10-08 15:41:00 +00:00
|
|
|
|
inc SKT.TmpCache+S.SOCKET.TCP.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
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
.1 lda SKT.TmpCache+S.SOCKET.TCP.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
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
.2 lda SKT.TmpCache+S.SOCKET.TCP.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
|
2018-10-08 15:41:00 +00:00
|
|
|
|
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
|
2017-03-23 16:41:36 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
2018-10-08 15:41:00 +00:00
|
|
|
|
lda SKT.TmpCache+S.SOCKET.TCP.INFREE
|
2017-03-23 16:41:36 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
|
|
|
|
|
jsr FRM.SendIP
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2018-09-28 15:24:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.O
|
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
|
2018-10-08 15:41:00 +00:00
|
|
|
|
lda SKT.TmpCache+S.SOCKET.TCP.INFREE+1
|
2017-02-17 07:20:57 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
2018-10-08 15:41:00 +00:00
|
|
|
|
lda SKT.TmpCache+S.SOCKET.TCP.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
|