mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-12 17:30:23 +00:00
Kernel version 0.9 : TCP, bugfix in SKT.Write.....and many others!
This commit is contained in:
parent
bea1c35caf
commit
89058db18a
@ -95,7 +95,7 @@ SKT.New.Listen sec
|
||||
and #S.SOCKET.SO.ACCEPTCONN
|
||||
bne .8
|
||||
|
||||
jsr SKT.New.TCP
|
||||
jsr SKT.New.TCB
|
||||
bcs .99
|
||||
|
||||
.71 lda #$ff
|
||||
@ -106,6 +106,10 @@ SKT.New.Listen sec
|
||||
jsr TCP.OUT.SYN Only for CLIENT conn!!!!
|
||||
bcs .99
|
||||
|
||||
ldy #S.SOCKET.TCP.STATUS
|
||||
lda #S.SOCKET.TCP.STATUS.SYNSENT
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
.8 ldx TmpOffset
|
||||
>LDYA ZPTmpPtr3
|
||||
clc
|
||||
@ -115,7 +119,7 @@ SKT.New.Listen sec
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
SKT.New.TCP >PUSHWI S.TCB
|
||||
SKT.New.TCB >PUSHWI S.TCB
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
@ -126,23 +130,12 @@ SKT.New.TCP >PUSHWI S.TCB
|
||||
ldy #S.SOCKET.SQ.hTCB
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
* ldx #S.TCB.OUTTAIL+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
|
||||
|
||||
* stz SKT.TCBCache+S.TCB.INUSED
|
||||
* stz SKT.TCBCache+S.TCB.INUSED+1
|
||||
* stz SKT.TCBCache+S.TCB.OUTUSED
|
||||
* stz SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
ldx #3
|
||||
|
||||
@ -787,7 +780,7 @@ SKT.AddDataToSktIn
|
||||
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From SKT.SEND.TCP
|
||||
* From SKT.Write.TCP
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hOutMem/OUTHEAD
|
||||
*--------------------------------------
|
||||
@ -873,19 +866,7 @@ SKT.AddDataToSktOut
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM+1
|
||||
bcc .80
|
||||
inc SKT.TCBCache+S.TCB.SEQNUM+2
|
||||
bne .80
|
||||
inc SKT.TCBCache+S.TCB.SEQNUM+3
|
||||
|
||||
.80 jmp SKT.StoreTCB
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From TCP.OUT
|
||||
* Src : hOutMem/OUTTAIL
|
||||
@ -921,7 +902,7 @@ SKT.GetDataFromSktOut
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
beq .5
|
||||
|
||||
.2 lda (ZPTmpPtr2)
|
||||
sta (ZPDataOutPtr),y
|
||||
@ -947,6 +928,34 @@ SKT.GetDataFromSktOut
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.5 lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM
|
||||
lda SKT.TCBCache+S.TCB.SEQNUM+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.TCB.SEQNUM+1
|
||||
bcc .8
|
||||
inc SKT.TCBCache+S.TCB.SEQNUM+2
|
||||
bne .8
|
||||
inc SKT.TCBCache+S.TCB.SEQNUM+3
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -993,8 +1002,8 @@ SKT.GetDataFromSktIn
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .7
|
||||
pha
|
||||
beq .7
|
||||
|
||||
.2 lda SKT.TCBCache+S.TCB.INTAIL
|
||||
eor SKT.TCBCache+S.TCB.INHEAD
|
||||
@ -1022,7 +1031,7 @@ SKT.GetDataFromSktIn
|
||||
bra .5
|
||||
|
||||
.4 inc ZPTmpPtr2
|
||||
bne .4
|
||||
bne .5
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.5 pla get back data....
|
||||
|
@ -50,10 +50,8 @@ TCP.IN jsr IP.FillSKT.TemplateSrcDst
|
||||
ldy #S.TCP.OPTIONS yes, only accept SYN packet
|
||||
lda (ZPFrameInPtr),y
|
||||
|
||||
and #S.TCP.OPTIONS.SYN
|
||||
beq .7 maybe a regular frame for a regular socket
|
||||
|
||||
jmp TCP.IN.JMP.LISTEN
|
||||
cmp #S.TCP.OPTIONS.SYN SYN only, if SYN.ACK, pass to regular socket
|
||||
beq TCP.IN.JMP.LISTEN
|
||||
|
||||
.5 ldy #S.SOCKET.DST.ADDR
|
||||
|
||||
@ -99,10 +97,6 @@ TCP.IN.RST lda #0
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.CLOSED
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.LISTEN
|
||||
lda #S.SOCKET.SOCK.STREAM
|
||||
sta SKT.Template+S.SOCKET.SOCK
|
||||
@ -159,27 +153,43 @@ TCP.IN.JMP.LISTEN
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.SYNSENT
|
||||
clv
|
||||
bra *
|
||||
|
||||
ldy #S.TCP.OPTIONS only accept SYN.ACK packet
|
||||
ldy #S.TCP.OPTIONS SYN Stend, only accept SYN.ACK packet, then Send ACK
|
||||
lda (ZPFrameInPtr),y
|
||||
cmp #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
||||
bne .8
|
||||
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx #3
|
||||
ldy #S.TCP.SEQ.NUMBER+3
|
||||
|
||||
sec
|
||||
|
||||
.1 lda SKT.TCBCache+S.TCB.ACKNUM,x
|
||||
adc #0
|
||||
sta SKT.TCBCache+S.TCB.ACKNUM,x
|
||||
eor (ZPFrameInPtr),y
|
||||
bne .8
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
ldy #S.SOCKET.TCP.OPTIONS
|
||||
lda #S.TCP.OPTIONS.ACK
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
jsr TCP.OUT.I
|
||||
bcs .9
|
||||
|
||||
ldy #S.SOCKET.TCP.STATUS
|
||||
lda #S.SOCKET.TCP.STATUS.ESTBLSH
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.SYNRCVD
|
||||
ldy #S.TCP.OPTIONS only accept ACK packet
|
||||
ldy #S.TCP.OPTIONS SYN Recieved, SYN.ACK Sent, only accept ACK packet
|
||||
lda (ZPFrameInPtr),y
|
||||
cmp #S.TCP.OPTIONS.ACK
|
||||
bne .8
|
||||
@ -219,7 +229,7 @@ TCP.IN.JMP.ESTBLSH
|
||||
|
||||
jsr SKT.AckDataToSktOut
|
||||
|
||||
.1 jsr TCP.SetDataInPtrAndLen
|
||||
.1 jsr TCP.IN.SetDataInPtrAndLen
|
||||
|
||||
lda ZPDataInLen
|
||||
ora ZPDataInLen+1
|
||||
@ -251,7 +261,7 @@ TCP.IN.JMP.CLWAIT
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.LASTACK
|
||||
ldy #S.TCP.OPTIONS only accept ACK packet
|
||||
ldy #S.TCP.OPTIONS only accept ACK packet
|
||||
lda (ZPFrameInPtr),y
|
||||
cmp #S.TCP.OPTIONS.ACK
|
||||
bne .8
|
||||
@ -284,9 +294,44 @@ TCP.IN.JMP.FINWT2
|
||||
TCP.IN.JMP.CLOSING
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.TIMEWT
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.CLOSED
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.IN.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.OUT.SYN >LDYAI 0
|
||||
jsr TCP.NewFrame
|
||||
bcs .9
|
||||
@ -311,15 +356,12 @@ TCP.OUT.SYN >LDYAI 0
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPFrameOutPtr),y
|
||||
|
||||
ldy #S.TCP.SEQ.NUMBER
|
||||
ldx #3
|
||||
|
||||
jsr FRM.SendIP
|
||||
bcs .9
|
||||
|
||||
ldy #S.SOCKET.TCP.OPTIONS
|
||||
lda #0
|
||||
sta (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
@ -388,6 +430,15 @@ 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
|
||||
|
||||
.3 lda SKT.TCBCache+S.TCB.SEQNUM,x
|
||||
sta (ZPFrameOutPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
.7 jsr FRM.SendIP
|
||||
bcs .9
|
||||
|
||||
@ -408,39 +459,6 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
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.NewFrame ldx #S.IP.PROTOCOL.TCP
|
||||
jsr FRM.NewIP
|
||||
bcs .9
|
||||
|
Loading…
x
Reference in New Issue
Block a user