2016-01-16 22:04:22 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
2017-01-28 22:05:20 +00:00
|
|
|
|
LOMEM $A00
|
2016-01-16 22:04:22 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2016-03-13 22:09:00 +00:00
|
|
|
|
TCP.IN ldy #S.IP.SRC+3
|
|
|
|
|
ldx #3
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta TmpSocket+S.SOCKET.DST.ADDR,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldy #S.TCP.SRCPORT
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta TmpSocket+S.SOCKET.DST.PORT+1
|
|
|
|
|
iny
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta TmpSocket+S.SOCKET.DST.PORT
|
|
|
|
|
|
|
|
|
|
ldy #S.IP.DST+3
|
|
|
|
|
ldx #3
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.2 lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta TmpSocket+S.SOCKET.SRC.ADDR,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
ldy #S.TCP.DSTPORT
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta TmpSocket+S.SOCKET.SRC.PORT+1
|
|
|
|
|
iny
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta TmpSocket+S.SOCKET.SRC.PORT
|
|
|
|
|
|
|
|
|
|
>LDYA L.SKT.TABLE
|
|
|
|
|
>STYA ZPPtrSKT
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.3 lda (ZPPtrSKT)
|
|
|
|
|
beq .7
|
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
|
|
|
|
bne .7
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SRC.ADDR
|
|
|
|
|
|
|
|
|
|
.4 lda TmpSocket,y
|
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
bne .7 Not for this socket...
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.SOCKET.SRC.PORT+2
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
and #S.SOCKET.SO.ACCEPTCONN Listening socket?
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
ldy #S.TCP.OPTIONS yes, only accept SYN packet
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameOutPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp #S.TCP.OPTIONS.SYN
|
|
|
|
|
bne .7 not for this listening socket
|
|
|
|
|
jmp TCP.IN.LISTEN.NEW
|
|
|
|
|
|
|
|
|
|
.5 ldy #S.SOCKET.DST.ADDR
|
|
|
|
|
|
|
|
|
|
.6 lda TmpSocket,y regular socket, check remote ADDR/PORT
|
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
bne .7
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.SOCKET.DST.PORT+2
|
|
|
|
|
bne .6
|
|
|
|
|
|
2017-01-28 22:05:20 +00:00
|
|
|
|
jmp TCP.IN.REGULAR
|
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
|
|
|
|
|
|
|
|
|
|
clc Discard frame
|
2016-01-16 22:04:22 +00:00
|
|
|
|
rts
|
2016-03-13 22:09:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.LISTEN.NEW
|
|
|
|
|
lda #S.SOCKET.SOCK.STREAM
|
|
|
|
|
sta TmpSocket
|
|
|
|
|
|
|
|
|
|
stz TmpSocket+S.SOCKET.SO
|
|
|
|
|
|
|
|
|
|
ldy #S.TCP.SEQ.NUMBER+3
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
sec
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
adc #0
|
|
|
|
|
sta TmpSocket+S.SOCKET.SQ.ACKNUM,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
.2 lda A2osX.TIMER16,x
|
|
|
|
|
sta TmpSocket+S.SOCKET.SQ.SEQNUM,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
>PUSHW L.TmpSocket
|
|
|
|
|
|
|
|
|
|
jsr SKT.NEW
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-04-09 09:15:11 +00:00
|
|
|
|
phy
|
|
|
|
|
pha
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
sta ZPPtrSKT+1
|
|
|
|
|
pla
|
|
|
|
|
sta ZPPtrSKT
|
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
bcc .3
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
lda #0 error
|
|
|
|
|
sta (ZPPtrSKT) clear this socket
|
|
|
|
|
lda #ERR.SKT.OOS
|
|
|
|
|
.9 rts
|
2016-04-09 09:15:11 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.3 ldy #S.SOCKET.STATUS
|
|
|
|
|
lda #S.SOCKET.STATUS.SYNRCVD
|
|
|
|
|
sta (ZPPtrSKT),y
|
2016-04-09 09:15:11 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
jmp TCP.SendSYNACK
|
2016-03-13 22:09:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-28 22:05:20 +00:00
|
|
|
|
TCP.IN.REGULAR stx hSocket
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ldy #S.SOCKET.STATUS
|
|
|
|
|
lda (ZPPtrSKT),y
|
2017-01-28 22:05:20 +00:00
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (L.TCP.IN.JMP,x)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.CLOSED
|
|
|
|
|
TCP.IN.JMP.LISTEN
|
|
|
|
|
TCP.IN.JMP.SYNSENT
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.SYNRCVD
|
|
|
|
|
ldy #S.TCP.OPTIONS 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
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.SOCKET.SQ.SEQNUM+3
|
|
|
|
|
sec
|
|
|
|
|
.10 lda (ZPPtrSKT),y
|
|
|
|
|
adc #0
|
|
|
|
|
sta TmpDWord,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .10
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.TCP.ACK.NUMBER+3
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.11 lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp TmpDWord,x
|
|
|
|
|
bne .8
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .11
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.SOCKET.SQ.SEQNUM+3
|
|
|
|
|
.12 lda TmpDWord,x
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .12
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.STATUS
|
|
|
|
|
lda #S.SOCKET.STATUS.ESTBLSH
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
2016-04-09 09:15:11 +00:00
|
|
|
|
>PUSHW K.TCP.WSIZE
|
|
|
|
|
>PUSHBI 0
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMem
|
2016-04-09 09:15:11 +00:00
|
|
|
|
bcs *
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SQ.hInMem
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
>PUSHW K.TCP.WSIZE
|
|
|
|
|
>PUSHBI 0
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMem
|
2016-04-09 09:15:11 +00:00
|
|
|
|
bcs *
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SQ.hOutMem
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2017-01-28 22:05:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.ESTBLSH
|
|
|
|
|
ldy #S.TCP.OPTIONS
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-01-28 22:05:20 +00:00
|
|
|
|
cmp #S.TCP.OPTIONS.ACK
|
2017-02-01 16:49:44 +00:00
|
|
|
|
bne .1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-02-01 16:49:44 +00:00
|
|
|
|
jsr TCP.UpdateSktAckNum
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2017-02-01 16:49:44 +00:00
|
|
|
|
.1 jsr TCP.SetDataInPtrAndLen
|
|
|
|
|
jsr TCP.AddDataToSkt
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
|
|
|
|
|
2017-02-01 16:49:44 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.IN.JMP.CLWAIT
|
|
|
|
|
TCP.IN.JMP.LASTACK
|
|
|
|
|
TCP.IN.JMP.FINWT1
|
|
|
|
|
TCP.IN.JMP.FINWT2
|
|
|
|
|
TCP.IN.JMP.CLOSING
|
|
|
|
|
TCP.IN.JMP.TIMEWT
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.UpdateSktAckNum
|
2017-01-28 22:05:20 +00:00
|
|
|
|
ldy #S.SOCKET.SQ.ACKNUM+3
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
clc
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc ZPDataInLen
|
2017-01-28 22:05:20 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPtrSKT),y
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc ZPDataInLen+1
|
2017-01-28 22:05:20 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
adc #0
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
adc #0
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-01 16:49:44 +00:00
|
|
|
|
ldy #S.TCP.ACK.NUMBER
|
2017-01-28 22:05:20 +00:00
|
|
|
|
ldx #4
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 lda (ZPFrameInPtr),y
|
2017-01-28 22:05:20 +00:00
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SQ.ACKNUM+3
|
|
|
|
|
ldx #4
|
|
|
|
|
|
|
|
|
|
.2 pla
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2016-03-13 22:09:00 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-01 16:49:44 +00:00
|
|
|
|
TCP.SetDataInPtrAndLen
|
|
|
|
|
ldy #S.TCP.DATAOFFSET
|
|
|
|
|
lda (ZPFrameInPtr),y
|
|
|
|
|
and #$F0
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
adc #S.TCP
|
|
|
|
|
sta TmpOffset
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
* clc
|
|
|
|
|
adc /S.TCP
|
|
|
|
|
sta TmpOffset+1 TmpOffset=Data Offset in Frame
|
|
|
|
|
|
|
|
|
|
lda ZPFrameInPtr
|
|
|
|
|
* clc
|
|
|
|
|
adc TmpOffset
|
|
|
|
|
sta ZPDataInPtr
|
|
|
|
|
|
|
|
|
|
lda ZPFrameInPtr+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPDataInPtr+1
|
|
|
|
|
|
|
|
|
|
lda ZPFrameInLen
|
|
|
|
|
sec
|
|
|
|
|
sbc TmpOffset
|
|
|
|
|
sta ZPDataInLen
|
|
|
|
|
|
|
|
|
|
lda ZPFrameInLen+1
|
|
|
|
|
sbc TmpOffset+1
|
|
|
|
|
sta ZPDataInLen+1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TCP.AddDataToSkt
|
|
|
|
|
ldy #S.SOCKET.SQ.hInMem
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SQ.INHEAD
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
tax save LO for compare later
|
|
|
|
|
clc
|
|
|
|
|
adc ZPTmpPtr1
|
|
|
|
|
sta ZPTmpPtr2 Make ZPTmpPtr2=actual head
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
pha save HI for compare later
|
|
|
|
|
adc ZPTmpPtr1+1
|
|
|
|
|
sta ZPTmpPtr2+1
|
|
|
|
|
|
|
|
|
|
lda ZPDataInLen
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPTmpPtr3 Make ZPTmpPtr3=!count
|
|
|
|
|
lda ZPDataInLen+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPTmpPtr3+1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 inc ZPTmpPtr3
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPTmpPtr3+1
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPDataInPtr),y
|
|
|
|
|
sta (ZPTmpPtr2)
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPDataInPtr+1
|
|
|
|
|
|
|
|
|
|
.3 inc ZPTmpPtr2
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPTmpPtr2+1
|
|
|
|
|
|
|
|
|
|
.4 pla
|
|
|
|
|
inx
|
|
|
|
|
bne .5
|
|
|
|
|
inc
|
|
|
|
|
.5 pha
|
|
|
|
|
cpx #K.TCP.WSIZE
|
|
|
|
|
sbc /K.TCP.WSIZE
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.6 inc ZPTmpPtr3
|
|
|
|
|
bne .7
|
|
|
|
|
inc ZPTmpPtr3+1
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
.7 lda (ZPDataInPtr),y
|
|
|
|
|
sta (ZPTmpPtr1)
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
bne .8
|
|
|
|
|
inc ZPDataInPtr+1
|
|
|
|
|
|
|
|
|
|
.8 inc ZPTmpPtr1
|
|
|
|
|
bne .6
|
|
|
|
|
inc ZPTmpPtr1+1
|
|
|
|
|
bra .6
|
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-28 22:05:20 +00:00
|
|
|
|
TCP.SendACK lda #S.TCP.OPTIONS.ACK
|
|
|
|
|
bra TCP.SendMSG
|
|
|
|
|
TCP.SendSYNACK lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
|
|
|
|
|
|
|
|
|
TCP.SendMSG sta TCP.MSG+S.TCP.OPTIONS
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SRC.ADDR+3
|
2016-04-09 09:15:11 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
.1 lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.IP.SRC,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SRC.PORT
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.TCP.SRCPORT+1
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.TCP.SRCPORT
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.DST.ADDR+3
|
|
|
|
|
ldx #3
|
|
|
|
|
.2 lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.IP.DST,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.DST.PORT
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.TCP.DSTPORT+1
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.TCP.DSTPORT
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SQ.SEQNUM+7
|
|
|
|
|
ldx #7
|
|
|
|
|
.3 lda (ZPPtrSKT),y
|
|
|
|
|
sta TCP.MSG+S.TCP.SEQ.NUMBER,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
>PUSHW L.TCP.MSG
|
2017-01-30 16:30:39 +00:00
|
|
|
|
* jsr FRM.SendTCP
|
2016-04-09 09:15:11 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-13 22:09:00 +00:00
|
|
|
|
TCP.ComputeChecksum
|
|
|
|
|
lda #0 RESET.TCP.CHECKSUM
|
|
|
|
|
ldy #S.TCP.CHECKSUM
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
iny
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
>LDYA ZPFrameOutPtr
|
2016-03-13 22:09:00 +00:00
|
|
|
|
>STYA ZPTmpPtr1
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda ZPFrameOutLen
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc #S.IP-2
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta ZPDataInLen
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda ZPFrameOutLen+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sbc /S.IP-2
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta ZPDataInLen+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
* lda ZPDataInLen+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
* adc #0 RESERVED (all zero)
|
|
|
|
|
sta IP.CHECKSUM
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda ZPDataInLen
|
2016-03-13 22:09:00 +00:00
|
|
|
|
adc #S.IP.PROTOCOL.TCP
|
|
|
|
|
sta IP.CHECKSUM+1
|
|
|
|
|
|
|
|
|
|
ldy #S.IP.SRC
|
|
|
|
|
|
|
|
|
|
ldx #4 4 words for SRC & DST IP
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.10 lda (ZPFrameOutPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
adc IP.CHECKSUM
|
|
|
|
|
sta IP.CHECKSUM
|
|
|
|
|
iny
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameOutPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
adc IP.CHECKSUM+1
|
|
|
|
|
sta IP.CHECKSUM+1
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
ldy #S.IP
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 jsr DecDataInLen
|
2016-03-13 22:09:00 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
lda (ZPTmpPtr1),y
|
|
|
|
|
adc IP.CHECKSUM
|
|
|
|
|
sta IP.CHECKSUM
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
bne .20
|
|
|
|
|
inc ZPTmpPtr1+1
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.20 jsr DecDataInLen
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .2
|
|
|
|
|
lda #0
|
|
|
|
|
bra .21
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPTmpPtr1),y
|
|
|
|
|
|
|
|
|
|
.21 adc IP.CHECKSUM+1
|
|
|
|
|
sta IP.CHECKSUM+1
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
inc ZPTmpPtr1+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 ldy #S.TCP.CHECKSUM
|
|
|
|
|
lda IP.CHECKSUM
|
|
|
|
|
adc #0 Don't forget to add last carry!!!
|
|
|
|
|
eor #$FF
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
iny
|
|
|
|
|
lda IP.CHECKSUM+1
|
|
|
|
|
adc #0 Don't forget to add last carry!!!
|
|
|
|
|
eor #$FF
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta (ZPFrameOutPtr),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE LIB/LIBTCPIP.S.TCP
|
|
|
|
|
LOAD LIB/LIBTCPIP.S
|
|
|
|
|
ASM
|