mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-26 11:30:07 +00:00
Kernel version 0.9 : TCP, bugfix in TCP.OUT new ACK computation
This commit is contained in:
parent
c851c10d52
commit
68110dc42a
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.DEV.po
BIN
A2OSX.DEV.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -179,7 +179,8 @@ S.TCB.OUTUSED .EQ 10
|
||||
S.TCB.INFREE .EQ 12
|
||||
S.TCB.OUTFREE .EQ 14
|
||||
S.TCB.SEQNUM .EQ 16
|
||||
S.TCB.ACKNUM .EQ 20
|
||||
S.TCB.NEXTSEQNUM .EQ 20
|
||||
S.TCB.ACKNUM .EQ 24
|
||||
*
|
||||
S.TCB .EQ 32
|
||||
*--------------------------------------
|
||||
|
@ -95,7 +95,7 @@ SKT.New.Listen sec
|
||||
and #S.SOCKET.SO.ACCEPTCONN
|
||||
bne .8
|
||||
|
||||
jsr SKT.New.TCB
|
||||
jsr SKT.NewTCB
|
||||
bcs .99
|
||||
|
||||
.71 lda #$ff
|
||||
@ -120,65 +120,6 @@ SKT.New.Listen sec
|
||||
.9 lda #ERR.SKT.OOS
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
SKT.New.TCB >PUSHWI S.TCB
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA .4+1
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hTCB
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
ldx #S.TCB.OUTUSED+1
|
||||
|
||||
.1 stz SKT.TCBCache,x
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
lda #K.TCP.WSIZE
|
||||
sta SKT.TCBCache+S.TCB.INFREE
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda /K.TCP.WSIZE
|
||||
sta SKT.TCBCache+S.TCB.INFREE+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
ldx #3
|
||||
|
||||
.2 lda A2osX.TIMER16,x
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
>PUSHWI K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
>PUSHWI K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
ldx #S.TCB-1
|
||||
|
||||
.3 lda SKT.TCBCache,x
|
||||
.4 sta $ffff,x
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* #SKT.CloseA
|
||||
* Close socket
|
||||
@ -671,57 +612,6 @@ SKT.AddToQueueA sta .2+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From TCP.IN
|
||||
* Src : A,X
|
||||
* Dst : hOutMem/OUTTAIL
|
||||
*--------------------------------------
|
||||
SKT.AckDataToSktOut
|
||||
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
|
||||
ldx #3 Substract old ACK from socket
|
||||
|
||||
sec
|
||||
|
||||
.1 lda (ZPFrameInPtr),y
|
||||
pha
|
||||
sbc SKT.TCBCache+S.TCB.ACKNUM,x
|
||||
sta TmpDWord,x
|
||||
pla
|
||||
sta SKT.TCBCache+S.TCB.ACKNUM,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTTAIL
|
||||
clc
|
||||
adc TmpDWord
|
||||
sta SKT.TCBCache+S.TCB.OUTTAIL
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
adc TmpDWord+1
|
||||
and /K.TCP.WSIZE-1
|
||||
sta SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
clc
|
||||
adc TmpDWord
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
adc TmpDWord+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
sec
|
||||
sbc TmpDWord
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
sbc TmpDWord+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From TCP.IN
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hInMem/INHEAD
|
||||
*--------------------------------------
|
||||
@ -809,192 +699,6 @@ SKT.AddDataToSktIn
|
||||
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From SKT.Write.TCP
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hOutMem/OUTHEAD
|
||||
*--------------------------------------
|
||||
SKT.AddDataToSktOut
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx ZPDataInLen
|
||||
cpx SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda ZPDataInLen+1
|
||||
sbc SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.TCB.OUTHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataInLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPDataInPtr),y
|
||||
sta (ZPTmpPtr2)
|
||||
iny
|
||||
bne .3
|
||||
inc ZPDataInPtr+1
|
||||
|
||||
.3 inc ZPTmpPtr2
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TCBCache+S.TCB.OUTHEAD
|
||||
bne .1
|
||||
inc SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
lda SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From TCP.OUT
|
||||
* Src : hOutMem/OUTTAIL
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
*--------------------------------------
|
||||
SKT.GetDataFromSktOut
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.TCB.OUTTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataOutLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataOutLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .5
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPTmpPtr2)
|
||||
sta (ZPDataOutPtr),y
|
||||
iny
|
||||
bne .3
|
||||
inc ZPDataOutPtr+1
|
||||
|
||||
.3 inc ZPTmpPtr2
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TCBCache+S.TCB.OUTTAIL
|
||||
bne .1
|
||||
inc SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
lda SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.5 lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
clc
|
||||
adc ZPDataOutLen
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
adc ZPDataOutLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
sec
|
||||
sbc ZPDataOutLen
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
sbc ZPDataOutLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM+3
|
||||
clc
|
||||
adc ZPDataOutLen
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM+3
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM+2
|
||||
adc ZPDataOutLen+1
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM+2
|
||||
bcc .8
|
||||
inc SKT.TCBCache+S.TCB.SEQNUM+1
|
||||
bne .8
|
||||
inc SKT.TCBCache+S.TCB.SEQNUM
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From SKT.Read
|
||||
* In:
|
||||
* Src : hInMem/INTAIL
|
||||
@ -1153,6 +857,309 @@ SKT.GetDataFromSktIn
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From SKT.Write.TCP
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hOutMem/OUTHEAD
|
||||
*--------------------------------------
|
||||
SKT.AddDataToSktOut
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx ZPDataInLen
|
||||
cpx SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda ZPDataInLen+1
|
||||
sbc SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.TCB.OUTHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataInLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPDataInPtr),y
|
||||
sta (ZPTmpPtr2)
|
||||
iny
|
||||
bne .3
|
||||
inc ZPDataInPtr+1
|
||||
|
||||
.3 inc ZPTmpPtr2
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TCBCache+S.TCB.OUTHEAD
|
||||
bne .1
|
||||
inc SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
lda SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From TCP.OUT
|
||||
* Src : hOutMem/OUTTAIL
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
*--------------------------------------
|
||||
SKT.GetDataFromSktOut
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTTAIL
|
||||
sta ZPTmpPtr3 Make ZPTmpPtr3=actual TAIL
|
||||
clc
|
||||
adc ZPTmpPtr1
|
||||
sta ZPTmpPtr2 Make ZPTmpPtr2=buffer base+TAIL
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
sta ZPTmpPtr3+1
|
||||
adc ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataOutLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataOutLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPTmpPtr2)
|
||||
sta (ZPDataOutPtr),y
|
||||
iny
|
||||
bne .3
|
||||
inc ZPDataOutPtr+1
|
||||
|
||||
.3 inc ZPTmpPtr2
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc ZPTmpPtr3
|
||||
bne .1
|
||||
inc ZPTmpPtr3+1
|
||||
lda ZPTmpPtr3+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz ZPTmpPtr3+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
* SKT.AckDataToSktOut should update these values
|
||||
|
||||
.5 lda SKT.TCBCache+S.TCB.SEQNUM+3
|
||||
clc
|
||||
adc ZPDataOutLen
|
||||
sta SKT.TCBCache+S.TCB.NEXTSEQNUM+3
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM+2
|
||||
adc ZPDataOutLen+1
|
||||
sta SKT.TCBCache+S.TCB.NEXTSEQNUM+2
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM+1
|
||||
adc #0
|
||||
sta SKT.TCBCache+S.TCB.NEXTSEQNUM+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM
|
||||
adc #0
|
||||
sta SKT.TCBCache+S.TCB.NEXTSEQNUM
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
clc
|
||||
adc ZPDataOutLen
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
adc ZPDataOutLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
sec
|
||||
sbc ZPDataOutLen
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
sbc ZPDataOutLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
*--------------------------------------
|
||||
* From TCP.IN
|
||||
* Src : A,X
|
||||
* Dst : hOutMem/OUTTAIL
|
||||
*--------------------------------------
|
||||
SKT.AckDataToSktOut
|
||||
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
|
||||
ldx #3 Substract old SEQ from socket
|
||||
|
||||
sec
|
||||
|
||||
.1 lda (ZPFrameInPtr),y
|
||||
pha
|
||||
sbc SKT.TCBCache+S.TCB.SEQNUM,x
|
||||
sta TmpDWord,x
|
||||
pla ....and Set SEQ = new ACK
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
lda TmpDWord
|
||||
ldx TmpDWord+1
|
||||
bne .2
|
||||
tay
|
||||
beq .8
|
||||
|
||||
.2 clc
|
||||
adc SKT.TCBCache+S.TCB.OUTTAIL
|
||||
sta SKT.TCBCache+S.TCB.OUTTAIL
|
||||
|
||||
txa
|
||||
adc SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
and /K.TCP.WSIZE-1
|
||||
sta SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
clc
|
||||
adc TmpDWord
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
adc TmpDWord+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
sec
|
||||
sbc TmpDWord
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
sbc TmpDWord+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
SKT.NewTCB >PUSHWI S.TCB
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA .4+1
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hTCB
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
lda #K.TCP.WSIZE
|
||||
sta SKT.TCBCache+S.TCB.INFREE
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda /K.TCP.WSIZE
|
||||
sta SKT.TCBCache+S.TCB.INFREE+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
ldx #3
|
||||
|
||||
.2 lda A2osX.TIMER16,x
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||
sta SKT.TCBCache+S.TCB.NEXTSEQNUM,x
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
>PUSHWI K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
>PUSHWI K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
ldx #S.TCB-1
|
||||
|
||||
.3 lda SKT.TCBCache,x
|
||||
.4 sta $ffff,x
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
SKT.GetTCB ldy #S.SOCKET.SQ.hTCB
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
@ -1181,6 +1188,26 @@ SKT.StoreTCB ldy #S.SOCKET.SQ.hTCB
|
||||
bpl .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.Destroy ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
beq .1
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.1 ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
beq .2
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.2 ldy #S.SOCKET.SQ.hTCB
|
||||
lda (ZPPtrSKT),y
|
||||
beq .3
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.3 lda #0
|
||||
sta (ZPPtrSKT)
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.SetFrameOutDstIP
|
||||
ldy #S.SOCKET.DST.ADDR
|
||||
ldx #4
|
||||
|
@ -90,10 +90,7 @@ TCP.IN jsr IP.FillSKT.TemplateSrcDst
|
||||
.9 clc Discard frame
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.IN.RST lda #0
|
||||
sta (ZPPtrSKT)
|
||||
clc
|
||||
rts
|
||||
TCP.IN.RST jmp SKT.Destroy
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.LISTEN
|
||||
lda #S.SOCKET.SOCK.STREAM
|
||||
@ -258,23 +255,7 @@ TCP.IN.JMP.LASTACK
|
||||
cmp #S.TCP.OPTIONS.ACK
|
||||
bne .8
|
||||
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
beq .1
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.1 ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
beq .2
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.2 ldy #S.SOCKET.SQ.hTCB
|
||||
lda (ZPPtrSKT),y
|
||||
beq .3
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.3 lda #0
|
||||
sta (ZPPtrSKT)
|
||||
jmp SKT.Destroy
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
@ -408,8 +389,8 @@ TCP.OUT.SYNACK >LDYAI 0
|
||||
*--------------------------------------
|
||||
TCP.OUT jsr SKT.GetTCB
|
||||
|
||||
TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
ldy SKT.TCBCache+S.TCB.OUTUSED
|
||||
TCP.OUT.I ldy SKT.TCBCache+S.TCB.OUTUSED
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
bne .1
|
||||
|
||||
@ -442,10 +423,10 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
ldy #S.TCP.OPTIONS
|
||||
sta (ZPFrameOutPtr),y
|
||||
|
||||
ldx #7
|
||||
ldy #S.TCP.SEQ.NUMBER+7
|
||||
ldx #3
|
||||
ldy #S.TCP.ACK.NUMBER+3
|
||||
|
||||
.3 lda SKT.TCBCache+S.TCB.SEQNUM,x
|
||||
.3 lda SKT.TCBCache+S.TCB.ACKNUM,x
|
||||
sta (ZPFrameOutPtr),y
|
||||
dey
|
||||
dex
|
||||
|
Loading…
Reference in New Issue
Block a user