mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-25 19:30:44 +00:00
Kernel version 0.9 : TCP & Sockets, bugfix session #4
This commit is contained in:
parent
b5f7300385
commit
6775ed4e56
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -576,29 +576,73 @@ SKT.AddToQueueA sta .2+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From TCP.IN
|
||||
* Src : A,X
|
||||
* Dst : hOutMem/OUTTAIL
|
||||
*--------------------------------------
|
||||
SKT.FreeDataFromSktOutAX
|
||||
pha
|
||||
ldy #S.SOCKET.SQ.OUTTAIL
|
||||
clc
|
||||
adc (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
iny
|
||||
txa
|
||||
adc (ZPPtrSKT),y
|
||||
and /K.TCP.WSIZE-1
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
pla
|
||||
sta .1+1
|
||||
stx .2+1
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTFREE
|
||||
clc
|
||||
adc (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
iny
|
||||
txa
|
||||
adc (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTUSED
|
||||
sec
|
||||
lda (ZPPtrSKT),y
|
||||
.1 sbc #$ff
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
iny
|
||||
adc (ZPPtrSKT),y
|
||||
.2 sbc #$ff
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From TCP.IN
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hInMem/INHEAD
|
||||
*--------------------------------------
|
||||
SKT.AddDataToSktIn
|
||||
jsr SKT.GetCopy
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx ZPDataInLen
|
||||
cpx SKT.TmpCache+S.SOCKET.SQ.INFREE
|
||||
cpx SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
lda ZPDataInLen+1
|
||||
sbc SKT.TmpCache+S.SOCKET.SQ.INFREE+1
|
||||
sbc SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.STREAM.hInMem
|
||||
lda SKT.TCBCache+S.SOCKET.STREAM.hInMem
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.INHEAD
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.INHEAD+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
@ -627,13 +671,13 @@ SKT.AddDataToSktIn
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TmpCache+S.SOCKET.SQ.INHEAD
|
||||
.4 inc SKT.TCBCache+S.SOCKET.SQ.INHEAD
|
||||
bne .1
|
||||
inc SKT.TmpCache+S.SOCKET.SQ.INHEAD+1
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INHEAD+1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TmpCache+S.SOCKET.SQ.INHEAD+1
|
||||
stz SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
@ -644,23 +688,23 @@ SKT.AddDataToSktIn
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.TmpCache+S.SOCKET.SQ.INFREE
|
||||
.8 lda SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INFREE
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INFREE+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INFREE+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INUSED+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INUSED+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
|
||||
jsr SKT.PutCopy
|
||||
jsr SKT.StoreTCB
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -669,25 +713,25 @@ SKT.AddDataToSktIn
|
||||
* Dst : hOutMem/OUTHEAD
|
||||
*--------------------------------------
|
||||
SKT.AddDataToSktOut
|
||||
jsr SKT.GetCopy
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx ZPDataInLen
|
||||
cpx SKT.TmpCache+S.SOCKET.SQ.OUTFREE
|
||||
cpx SKT.TCBCache+S.SOCKET.SQ.OUTFREE
|
||||
lda ZPDataInLen+1
|
||||
sbc SKT.TmpCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sbc SKT.TCBCache+S.SOCKET.SQ.OUTFREE+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.STREAM.hOutMem
|
||||
lda SKT.TCBCache+S.SOCKET.STREAM.hOutMem
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.OUTHEAD
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
@ -716,13 +760,13 @@ SKT.AddDataToSktOut
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TmpCache+S.SOCKET.SQ.OUTHEAD
|
||||
.4 inc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD
|
||||
bne .1
|
||||
inc SKT.TmpCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TmpCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
stz SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
@ -733,23 +777,23 @@ SKT.AddDataToSktOut
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.TmpCache+S.SOCKET.SQ.OUTFREE
|
||||
.8 lda SKT.TCBCache+S.SOCKET.SQ.OUTFREE
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.OUTFREE
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTFREE
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTFREE+1
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.OUTUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTUSED
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.OUTUSED
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.OUTUSED+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTUSED+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.OUTUSED+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTUSED+1
|
||||
|
||||
jsr SKT.PutCopy
|
||||
jsr SKT.StoreTCB
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -758,19 +802,19 @@ SKT.AddDataToSktOut
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
*--------------------------------------
|
||||
SKT.GetDataFromSktOut
|
||||
jsr SKT.GetCopy
|
||||
jsr SKT.GetTCB
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.STREAM.hOutMem
|
||||
lda SKT.TCBCache+S.SOCKET.STREAM.hOutMem
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.OUTTAIL
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataOutLen
|
||||
@ -799,13 +843,13 @@ SKT.GetDataFromSktOut
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TmpCache+S.SOCKET.SQ.OUTTAIL
|
||||
.4 inc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL
|
||||
bne .1
|
||||
inc SKT.TmpCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TmpCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
stz SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
@ -816,7 +860,7 @@ SKT.GetDataFromSktOut
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From SKT.Write
|
||||
* From SKT.Read
|
||||
* In:
|
||||
* Src : hInMem/INTAIL
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
@ -831,15 +875,15 @@ SKT.GetDataFromSktIn
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
jsr SKT.GetCopy
|
||||
jsr SKT.GetTCB
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.INTAIL
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TmpCache+S.SOCKET.SQ.INTAIL+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataOutLen
|
||||
@ -862,25 +906,25 @@ SKT.GetDataFromSktIn
|
||||
beq .7
|
||||
pha
|
||||
|
||||
.2 lda SKT.TmpCache+S.SOCKET.SQ.INTAIL
|
||||
eor SKT.TmpCache+S.SOCKET.SQ.INHEAD
|
||||
.2 lda SKT.TCBCache+S.SOCKET.SQ.INTAIL
|
||||
eor SKT.TCBCache+S.SOCKET.SQ.INHEAD
|
||||
bne .3
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INTAIL+1
|
||||
eor SKT.TmpCache+S.SOCKET.SQ.INHEAD+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
eor SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
beq .8 no more data....
|
||||
|
||||
.3 lda (ZPTmpPtr2)
|
||||
pha
|
||||
|
||||
inc SKT.TmpCache+S.SOCKET.SQ.INTAIL
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.INTAIL
|
||||
bne .5
|
||||
|
||||
inc SKT.TmpCache+S.SOCKET.SQ.INTAIL+1
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INTAIL+1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .4
|
||||
|
||||
stz SKT.TmpCache+S.SOCKET.SQ.INTAIL+1
|
||||
stz SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
lda ZPTmpPtr1
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
@ -919,25 +963,25 @@ SKT.GetDataFromSktIn
|
||||
eor ZPTmpPtr3+1
|
||||
beq .9
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INFREE
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
clc
|
||||
adc ZPTmpPtr3
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INFREE
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INFREE+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
adc ZPTmpPtr3+1
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INFREE+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
sec
|
||||
sbc ZPTmpPtr3
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INUSED
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
|
||||
lda SKT.TmpCache+S.SOCKET.SQ.INUSED+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
sbc ZPTmpPtr3+1
|
||||
sta SKT.TmpCache+S.SOCKET.SQ.INUSED+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
|
||||
jsr SKT.PutCopy
|
||||
jsr SKT.StoreTCB
|
||||
>LDYA ZPTmpPtr3
|
||||
clc
|
||||
rts
|
||||
@ -946,15 +990,15 @@ SKT.GetDataFromSktIn
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.GetCopy ldy #S.SOCKET-1
|
||||
SKT.GetTCB ldy #S.SOCKET-1
|
||||
.1 lda (ZPPtrSKT),y
|
||||
sta SKT.TmpCache
|
||||
sta SKT.TCBCache,y
|
||||
dey
|
||||
bpl .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.PutCopy ldy #S.SOCKET-1
|
||||
.1 lda SKT.TmpCache
|
||||
SKT.StoreTCB ldy #S.SOCKET-1
|
||||
.1 lda SKT.TCBCache,y
|
||||
sta (ZPPtrSKT),y
|
||||
dey
|
||||
bpl .1
|
||||
|
@ -211,15 +211,66 @@ TCP.IN.JMP.ESTBLSH
|
||||
ldy #S.TCP.OPTIONS
|
||||
lda (ZPFrameInPtr),y
|
||||
bit #S.TCP.OPTIONS.ACK
|
||||
beq .1
|
||||
beq .2
|
||||
|
||||
jsr TCP.UpdateSktAckNum
|
||||
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
|
||||
ldx #3
|
||||
|
||||
.1 jsr TCP.SetDataInPtrAndLen
|
||||
.1 lda (ZPFrameInPtr),y
|
||||
sta TmpDWord,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
ldy #S.SOCKET.SQ.ACKNUM Substract old Ack from socket
|
||||
sec
|
||||
lda (ZPPtrSKT),y
|
||||
sbc TmpDWord
|
||||
pha save result LO for FreeData
|
||||
|
||||
lda TmpDWord
|
||||
sta (ZPPtrSKT),y and store new ACK in skt
|
||||
|
||||
iny
|
||||
lda (ZPPtrSKT),y
|
||||
sbc TmpDWord+1
|
||||
|
||||
tax save result HI for FreeData
|
||||
|
||||
lda TmpDWord+1 we stop here, will never be more than K.TCP.WSIZE
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
iny
|
||||
lda TmpDWord+2
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
iny
|
||||
lda TmpDWord+3
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
pla
|
||||
jsr SKT.FreeDataFromSktOutAX
|
||||
*----------
|
||||
.2 lda ZPDataInLen
|
||||
ora ZPDataInLen+1
|
||||
beq .8 No data in this incoming frame...
|
||||
|
||||
ldy #S.TCP.SEQ.NUMBER+3
|
||||
ldx #3
|
||||
|
||||
.3 lda (ZPFrameInPtr),y
|
||||
sta TmpDWord,x
|
||||
dey
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
|
||||
|
||||
jsr TCP.SetDataInPtrAndLen
|
||||
jsr SKT.AddDataToSktIn
|
||||
|
||||
|
||||
clc
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.CLWAIT
|
||||
|
@ -293,13 +293,13 @@ DNS.HostName .BS K.DNS.MAXLEN+1
|
||||
DNS.TmpCache .BS S.DNSCACHE
|
||||
ARP.TmpCache .BS S.ARP
|
||||
SKT.Template .BS S.SOCKET.TEMPLATE
|
||||
SKT.TmpCache .BS S.SOCKET
|
||||
SKT.TCBCache .BS S.SOCKET
|
||||
TmpDWord .BS 4
|
||||
TmpOffset .BS 2
|
||||
hFrameIn .BS 1
|
||||
hFrameOut .BS 1
|
||||
hSocket .BS 1
|
||||
bTextMode .BS 1
|
||||
TmpOffset .BS 2
|
||||
HST.DecStr .BS 4
|
||||
HST.IP .BS 5
|
||||
IP.ID .BS 2
|
||||
|
Loading…
Reference in New Issue
Block a user