mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
Kernel version 0.9 : TCP, added TCB explicit structure out of SKT
This commit is contained in:
parent
635529e795
commit
18a554a9d7
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.
@ -69,8 +69,6 @@ CS.RUN >LDYA L.MSG0
|
||||
lda #K.SKTTABLE.SIZE
|
||||
sta SocketCount
|
||||
|
||||
>DEBUG
|
||||
|
||||
.1 lda (ZPPTR1)
|
||||
beq .7
|
||||
|
||||
|
@ -17,7 +17,7 @@ S.DHCP.HOPS .EQ S.UDP+3 0
|
||||
S.DHCP.XID .EQ S.UDP+4 client : random number
|
||||
S.DHCP.SECS .EQ S.UDP+8
|
||||
S.DHCP.FLAGS .EQ S.UDP+10
|
||||
S.DHCP.FLAGS.BRDCST .EQ %10000000
|
||||
S.DHCP.FLAGS.BRDCST .EQ %00000000.10000000
|
||||
S.DHCP.CIADDR .EQ S.UDP+12
|
||||
S.DHCP.YIADDR .EQ S.UDP+16
|
||||
S.DHCP.SIADDR .EQ S.UDP+20
|
||||
|
@ -159,7 +159,7 @@ S.SOCKET.SRC.PORT .EQ 8
|
||||
S.SOCKET.DST.ADDR .EQ 10
|
||||
S.SOCKET.DST.PORT .EQ 14
|
||||
*
|
||||
S.SOCKET.TEMPLATE .EQ 16
|
||||
S.SOCKET.HDR .EQ 16
|
||||
* Listen type Queue
|
||||
* Raw Type Queue
|
||||
* Datagram type Queue
|
||||
@ -168,20 +168,24 @@ S.SOCKET.HQ.TAIL .EQ 17
|
||||
S.SOCKET.HQ .EQ 18
|
||||
S.SOCKET.HQ.MAX .EQ 14 14 hMem (frames)
|
||||
* Stream type Queue
|
||||
S.SOCKET.SQ.INHEAD .EQ 16
|
||||
S.SOCKET.SQ.INTAIL .EQ 18
|
||||
S.SOCKET.SQ.OUTHEAD .EQ 20
|
||||
S.SOCKET.SQ.OUTTAIL .EQ 22
|
||||
S.SOCKET.SQ.INFREE .EQ 24
|
||||
S.SOCKET.SQ.OUTFREE .EQ 26
|
||||
S.SOCKET.SQ.INUSED .EQ 28
|
||||
S.SOCKET.SQ.OUTUSED .EQ 30
|
||||
S.SOCKET.SQ.SEQNUM .EQ 32
|
||||
S.SOCKET.SQ.ACKNUM .EQ 36
|
||||
S.SOCKET.STREAM.hInMem .EQ 40
|
||||
S.SOCKET.STREAM.hOutMem .EQ 41
|
||||
S.SOCKET.SQ.hTCB .EQ 16
|
||||
S.SOCKET.SQ.hInMem .EQ 17
|
||||
S.SOCKET.SQ.hOutMem .EQ 18
|
||||
*
|
||||
S.SOCKET .EQ 42
|
||||
S.SOCKET .EQ 32
|
||||
*--------------------------------------
|
||||
S.TCB.INHEAD .EQ 0
|
||||
S.TCB.INTAIL .EQ 2
|
||||
S.TCB.OUTHEAD .EQ 4
|
||||
S.TCB.OUTTAIL .EQ 6
|
||||
S.TCB.INFREE .EQ 8
|
||||
S.TCB.OUTFREE .EQ 10
|
||||
S.TCB.INUSED .EQ 12
|
||||
S.TCB.OUTUSED .EQ 14
|
||||
S.TCB.SEQNUM .EQ 16
|
||||
S.TCB.ACKNUM .EQ 20
|
||||
*
|
||||
S.TCB .EQ 32
|
||||
*--------------------------------------
|
||||
S.ETH.FRAMELEN .EQ 0
|
||||
S.ETH.DSTMAC .EQ 2
|
||||
|
@ -74,7 +74,7 @@ SKT.New >PULLW ZPTmpPtr1
|
||||
lda TmpOffset Did we found an empty slot ?
|
||||
bmi .9
|
||||
|
||||
ldy #S.SOCKET.TEMPLATE-1
|
||||
ldy #S.SOCKET.HDR-1
|
||||
|
||||
.7 lda (ZPTmpPtr1),y
|
||||
sta (ZPTmpPtr3),y
|
||||
@ -102,39 +102,50 @@ SKT.New >PULLW ZPTmpPtr1
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
SKT.New.TCP ldy #S.SOCKET.SQ.INFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
SKT.New.TCP >PUSHW S.TCB
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPTmpPtr2
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.SQ.hTCB
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTFREE
|
||||
ldy #S.TCB.INFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
sta (ZPTmpPtr2),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
sta (ZPTmpPtr2),y
|
||||
|
||||
ldy #S.TCB.OUTFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPTmpPtr2),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
sta (ZPTmpPtr2),y
|
||||
|
||||
lda #0
|
||||
ldy #S.SOCKET.SQ.INUSED
|
||||
sta (ZPTmpPtr3),y
|
||||
ldy #S.TCB.INUSED
|
||||
sta (ZPTmpPtr2),y
|
||||
iny
|
||||
sta (ZPTmpPtr3),y
|
||||
sta (ZPTmpPtr2),y
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTUSED
|
||||
sta (ZPTmpPtr3),y
|
||||
ldy #S.TCB.OUTUSED
|
||||
sta (ZPTmpPtr2),y
|
||||
iny
|
||||
sta (ZPTmpPtr3),y
|
||||
sta (ZPTmpPtr2),y
|
||||
|
||||
ldx #3
|
||||
ldy #S.SOCKET.SQ.SEQNUM+3
|
||||
ldy #S.TCB.SEQNUM+3
|
||||
|
||||
.2 lda A2osX.TIMER16,x
|
||||
sta (ZPTmpPtr3),y
|
||||
.1 lda A2osX.TIMER16,x
|
||||
sta (ZPTmpPtr2),y
|
||||
dey
|
||||
dex
|
||||
bpl .2
|
||||
bpl .1
|
||||
|
||||
>PUSHW K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
@ -142,7 +153,7 @@ SKT.New.TCP ldy #S.SOCKET.SQ.INFREE
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.STREAM.hInMem
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
>PUSHW K.TCP.WSIZE
|
||||
@ -151,7 +162,7 @@ SKT.New.TCP ldy #S.SOCKET.SQ.INFREE
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.STREAM.hOutMem
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
clc
|
||||
@ -558,7 +569,7 @@ SKT.Read.I jsr SKT.GetA.I
|
||||
bcs .99 No data...
|
||||
|
||||
>STYA TmpOffset
|
||||
ldy #S.SOCKET.SQ.ACKNUM
|
||||
ldy #S.TCB.ACKNUM
|
||||
lda (ZPPtrSKT),y
|
||||
clc
|
||||
adc TmpOffset
|
||||
@ -633,7 +644,7 @@ SKT.AddToQueueA sta .2+1
|
||||
*--------------------------------------
|
||||
SKT.FreeDataFromSktOutAX
|
||||
pha
|
||||
ldy #S.SOCKET.SQ.OUTTAIL
|
||||
ldy #S.TCB.OUTTAIL
|
||||
clc
|
||||
adc (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
@ -648,7 +659,7 @@ SKT.FreeDataFromSktOutAX
|
||||
sta .1+1
|
||||
stx .2+1
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTFREE
|
||||
ldy #S.TCB.OUTFREE
|
||||
clc
|
||||
adc (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
@ -658,7 +669,7 @@ SKT.FreeDataFromSktOutAX
|
||||
adc (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTUSED
|
||||
ldy #S.TCB.OUTUSED
|
||||
sec
|
||||
lda (ZPPtrSKT),y
|
||||
.1 sbc #$ff
|
||||
@ -679,22 +690,23 @@ SKT.AddDataToSktIn
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx ZPDataInLen
|
||||
cpx SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
cpx SKT.TCBCache+S.TCB.INFREE
|
||||
lda ZPDataInLen+1
|
||||
sbc SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
sbc SKT.TCBCache+S.TCB.INFREE+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.STREAM.hInMem
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INHEAD
|
||||
adc SKT.TCBCache+S.TCB.INHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
adc SKT.TCBCache+S.TCB.INHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
@ -723,13 +735,13 @@ SKT.AddDataToSktIn
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TCBCache+S.SOCKET.SQ.INHEAD
|
||||
.4 inc SKT.TCBCache+S.TCB.INHEAD
|
||||
bne .1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
inc SKT.TCBCache+S.TCB.INHEAD+1
|
||||
lda SKT.TCBCache+S.TCB.INHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
stz SKT.TCBCache+S.TCB.INHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
@ -740,25 +752,23 @@ SKT.AddDataToSktIn
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
.8 lda SKT.TCBCache+S.TCB.INFREE
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
sta SKT.TCBCache+S.TCB.INFREE
|
||||
lda SKT.TCBCache+S.TCB.INFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
sta SKT.TCBCache+S.TCB.INFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TCBCache+S.TCB.INUSED
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
sta SKT.TCBCache+S.TCB.INUSED
|
||||
lda SKT.TCBCache+S.TCB.INUSED+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
sta SKT.TCBCache+S.TCB.INUSED+1
|
||||
|
||||
jsr SKT.StoreTCB
|
||||
clc
|
||||
rts
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From SKT.SEND.TCP
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
@ -768,22 +778,23 @@ SKT.AddDataToSktOut
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldx ZPDataInLen
|
||||
cpx SKT.TCBCache+S.SOCKET.SQ.OUTFREE
|
||||
cpx SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda ZPDataInLen+1
|
||||
sbc SKT.TCBCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sbc SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.STREAM.hOutMem
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD
|
||||
adc SKT.TCBCache+S.TCB.OUTHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
adc SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
@ -812,13 +823,13 @@ SKT.AddDataToSktOut
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD
|
||||
.4 inc SKT.TCBCache+S.TCB.OUTHEAD
|
||||
bne .1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTHEAD+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.SOCKET.SQ.OUTHEAD+1
|
||||
stz SKT.TCBCache+S.TCB.OUTHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
@ -829,25 +840,23 @@ SKT.AddDataToSktOut
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 lda SKT.TCBCache+S.SOCKET.SQ.OUTFREE
|
||||
.8 lda SKT.TCBCache+S.TCB.OUTFREE
|
||||
sec
|
||||
sbc ZPDataInLen
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTFREE
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTFREE+1
|
||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTUSED
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTUSED
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTUSED+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
adc ZPDataInLen+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.OUTUSED+1
|
||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||
|
||||
jsr SKT.StoreTCB
|
||||
clc
|
||||
rts
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From TCP.OUT
|
||||
* Src : hOutMem/OUTTAIL
|
||||
@ -856,17 +865,19 @@ SKT.AddDataToSktOut
|
||||
SKT.GetDataFromSktOut
|
||||
jsr SKT.GetTCB
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.STREAM.hOutMem
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL
|
||||
adc SKT.TCBCache+S.TCB.OUTTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
adc SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataOutLen
|
||||
@ -895,13 +906,13 @@ SKT.GetDataFromSktOut
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL
|
||||
.4 inc SKT.TCBCache+S.TCB.OUTTAIL
|
||||
bne .1
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.OUTTAIL+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.SOCKET.SQ.OUTTAIL+1
|
||||
stz SKT.TCBCache+S.TCB.OUTTAIL+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
@ -909,8 +920,7 @@ SKT.GetDataFromSktOut
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
.8 jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From SKT.Read
|
||||
* In:
|
||||
@ -922,7 +932,7 @@ SKT.GetDataFromSktOut
|
||||
* Y,A = bytes read
|
||||
*--------------------------------------
|
||||
SKT.GetDataFromSktIn
|
||||
ldy #S.SOCKET.STREAM.hInMem
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
@ -931,11 +941,11 @@ SKT.GetDataFromSktIn
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INTAIL
|
||||
adc SKT.TCBCache+S.TCB.INTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
adc SKT.TCBCache+S.TCB.INTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataOutLen
|
||||
@ -958,25 +968,25 @@ SKT.GetDataFromSktIn
|
||||
beq .7
|
||||
pha
|
||||
|
||||
.2 lda SKT.TCBCache+S.SOCKET.SQ.INTAIL
|
||||
eor SKT.TCBCache+S.SOCKET.SQ.INHEAD
|
||||
.2 lda SKT.TCBCache+S.TCB.INTAIL
|
||||
eor SKT.TCBCache+S.TCB.INHEAD
|
||||
bne .3
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
eor SKT.TCBCache+S.SOCKET.SQ.INHEAD+1
|
||||
lda SKT.TCBCache+S.TCB.INTAIL+1
|
||||
eor SKT.TCBCache+S.TCB.INHEAD+1
|
||||
beq .8 no more data....
|
||||
|
||||
.3 lda (ZPTmpPtr2)
|
||||
pha
|
||||
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.INTAIL
|
||||
inc SKT.TCBCache+S.TCB.INTAIL
|
||||
bne .5
|
||||
|
||||
inc SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
inc SKT.TCBCache+S.TCB.INTAIL+1
|
||||
lda SKT.TCBCache+S.TCB.INTAIL+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .4
|
||||
|
||||
stz SKT.TCBCache+S.SOCKET.SQ.INTAIL+1
|
||||
stz SKT.TCBCache+S.TCB.INTAIL+1
|
||||
lda ZPTmpPtr1
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
@ -1015,23 +1025,23 @@ SKT.GetDataFromSktIn
|
||||
eor ZPTmpPtr3+1
|
||||
beq .9
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
lda SKT.TCBCache+S.TCB.INFREE
|
||||
clc
|
||||
adc ZPTmpPtr3
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE
|
||||
sta SKT.TCBCache+S.TCB.INFREE
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
lda SKT.TCBCache+S.TCB.INFREE+1
|
||||
adc ZPTmpPtr3+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INFREE+1
|
||||
sta SKT.TCBCache+S.TCB.INFREE+1
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
lda SKT.TCBCache+S.TCB.INUSED
|
||||
sec
|
||||
sbc ZPTmpPtr3
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED
|
||||
sta SKT.TCBCache+S.TCB.INUSED
|
||||
|
||||
lda SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
lda SKT.TCBCache+S.TCB.INUSED+1
|
||||
sbc ZPTmpPtr3+1
|
||||
sta SKT.TCBCache+S.SOCKET.SQ.INUSED+1
|
||||
sta SKT.TCBCache+S.TCB.INUSED+1
|
||||
|
||||
jsr SKT.StoreTCB
|
||||
>LDYA ZPTmpPtr3
|
||||
@ -1042,17 +1052,31 @@ SKT.GetDataFromSktIn
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.GetTCB ldy #S.SOCKET-1
|
||||
.1 lda (ZPPtrSKT),y
|
||||
sta SKT.TCBCache,y
|
||||
dey
|
||||
SKT.GetTCB ldy #S.SOCKET.SQ.hTCB
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
|
||||
>STYA .1+1
|
||||
|
||||
ldx #S.TCB-1
|
||||
|
||||
.1 lda $ffff,x
|
||||
sta SKT.TCBCache,x
|
||||
dex
|
||||
bpl .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.StoreTCB ldy #S.SOCKET-1
|
||||
.1 lda SKT.TCBCache,y
|
||||
sta (ZPPtrSKT),y
|
||||
dey
|
||||
SKT.StoreTCB ldy #S.SOCKET.SQ.hTCB
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtrA
|
||||
|
||||
>STYA .2+1
|
||||
|
||||
ldx #S.TCB-1
|
||||
|
||||
.1 lda SKT.TCBCache,x
|
||||
.2 sta $ffff,x
|
||||
dex
|
||||
bpl .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -146,7 +146,7 @@ TCP.IN.JMP.LISTEN
|
||||
bpl .1
|
||||
|
||||
ldx #3
|
||||
ldy #S.SOCKET.SQ.ACKNUM+3
|
||||
ldy #S.TCB.ACKNUM+3
|
||||
|
||||
.4 lda TmpDWord,x Update new socket with ACK number
|
||||
sta (ZPPtrSKT),y
|
||||
@ -172,7 +172,7 @@ TCP.IN.JMP.SYNSENT
|
||||
bne .8
|
||||
|
||||
ldx #3
|
||||
ldy #S.SOCKET.SQ.SEQNUM+3
|
||||
ldy #S.TCB.SEQNUM+3
|
||||
|
||||
sec
|
||||
|
||||
@ -193,7 +193,7 @@ TCP.IN.JMP.SYNSENT
|
||||
bpl .11
|
||||
|
||||
ldx #3
|
||||
ldy #S.SOCKET.SQ.SEQNUM+3
|
||||
ldy #S.TCB.SEQNUM+3
|
||||
.12 lda TmpDWord,x
|
||||
sta (ZPPtrSKT),y
|
||||
dey
|
||||
@ -227,7 +227,7 @@ TCP.IN.JMP.ESTBLSH
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
ldy #S.SOCKET.SQ.ACKNUM Substract old Ack from socket
|
||||
ldy #S.TCB.ACKNUM Substract old Ack from socket
|
||||
sec
|
||||
lda (ZPPtrSKT),y
|
||||
sbc TmpDWord
|
||||
@ -317,7 +317,7 @@ TCP.OUT.SYNACK >LDYAI 0
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
TCP.OUT.ESTBLSH ldy #S.SOCKET.SQ.OUTUSED
|
||||
TCP.OUT.ESTBLSH ldy #S.TCB.OUTUSED
|
||||
lda (ZPPtrSKT),y
|
||||
|
||||
pha
|
||||
@ -345,7 +345,7 @@ TCP.OUT.ESTBLSH ldy #S.SOCKET.SQ.OUTUSED
|
||||
|
||||
jsr SKT.GetDataFromSktOut
|
||||
|
||||
ldy #S.SOCKET.SQ.SEQNUM compute new SEQ.NUM
|
||||
ldy #S.TCB.SEQNUM compute new SEQ.NUM
|
||||
lda (ZPPtrSKT),y
|
||||
clc
|
||||
adc TmpOffset
|
||||
@ -397,7 +397,7 @@ TCP.OUT.ESTBLSH ldy #S.SOCKET.SQ.OUTUSED
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
ldx #3
|
||||
ldy #S.SOCKET.SQ.SEQNUM+3
|
||||
ldy #S.TCB.SEQNUM+3
|
||||
|
||||
.71 lda TmpDWord,x
|
||||
sta (ZPPtrSKT),y
|
||||
@ -418,7 +418,7 @@ TCP.GetSktAckNum
|
||||
dex
|
||||
bne .1
|
||||
|
||||
ldy #S.SOCKET.SQ.ACKNUM+3
|
||||
ldy #S.TCB.ACKNUM+3
|
||||
ldx #4
|
||||
|
||||
.2 pla
|
||||
@ -429,7 +429,7 @@ TCP.GetSktAckNum
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.UpdateSktAckNum
|
||||
ldy #S.SOCKET.SQ.ACKNUM+3
|
||||
ldy #S.TCB.ACKNUM+3
|
||||
lda (ZPPtrSKT),y
|
||||
clc
|
||||
adc ZPDataInLen
|
||||
@ -513,7 +513,7 @@ TCP.NewFrame ldx #S.IP.PROTOCOL.TCP
|
||||
lda #$50 Header size = 5 DWORDS
|
||||
sta (ZPFrameOutPtr),y
|
||||
|
||||
ldy #S.SOCKET.SQ.INFREE
|
||||
ldy #S.TCB.INFREE
|
||||
lda (ZPPtrSKT),y
|
||||
pha
|
||||
iny
|
||||
@ -529,7 +529,7 @@ TCP.NewFrame ldx #S.IP.PROTOCOL.TCP
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
TCP.SendFrame ldy #S.SOCKET.SQ.SEQNUM+7
|
||||
TCP.SendFrame ldy #S.TCB.SEQNUM+7
|
||||
ldx #7
|
||||
|
||||
.1 lda (ZPPtrSKT),y
|
||||
|
@ -293,8 +293,8 @@ DNS.HostNameLen .BS 1
|
||||
DNS.HostName .BS K.DNS.MAXLEN+1
|
||||
DNS.TmpCache .BS S.DNSCACHE
|
||||
ARP.TmpCache .BS S.ARP
|
||||
SKT.Template .BS S.SOCKET.TEMPLATE
|
||||
SKT.TCBCache .BS S.SOCKET
|
||||
SKT.Template .BS S.SOCKET
|
||||
SKT.TCBCache .BS S.TCB
|
||||
TmpByte .BS 1
|
||||
TmpDWord .BS 4
|
||||
TmpOffset .BS 2
|
||||
|
@ -13,7 +13,7 @@ AUTO 6
|
||||
.INB /A2OSX.DEV/INC/LIBTCPIP.I
|
||||
.INB /A2OSX.DEV/INC/DHCP.I
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 100 10 sec.
|
||||
TIMEOUT.MAX .EQ 200 20 sec.
|
||||
*--------------------------------------
|
||||
ZPIPCfgPtr .EQ ZPBIN
|
||||
ZPFrameBase .EQ ZPBIN+2
|
||||
@ -269,15 +269,24 @@ CheckDHCPOffer jsr CheckDHCPXID
|
||||
cmp #S.DHCP.OPTIONS.DHCPOffer
|
||||
bne .9
|
||||
|
||||
ldy #S.DHCP.YIADDR+3
|
||||
ldy #S.DHCP.GIADDR+3
|
||||
ldx #3
|
||||
|
||||
.1 lda (ZPFrameBase),y
|
||||
sta DHCP.REQ.GIADDR,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
ldy #S.DHCP.YIADDR+3
|
||||
ldx #3
|
||||
|
||||
.2 lda (ZPFrameBase),y
|
||||
sta DHCP.REQ.OPT.REQIP,x
|
||||
sta IPCFG+S.IPCFG.IP,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
bpl .2
|
||||
|
||||
ldy #S.IP.SRC+3
|
||||
ldx #3
|
||||
@ -449,11 +458,11 @@ Socket .DA #S.SOCKET.SOCK.DGRAM
|
||||
DHCP.DISC .HS 01010600 OP,HTYPE,HLEN,HOPS
|
||||
DHCP.DISC.XID .BS 4
|
||||
.HS 0000 SECS
|
||||
.HS 0000 FLAGS
|
||||
.DA S.DHCP.FLAGS.BRDCST
|
||||
.HS 00000000 CIADDR
|
||||
DHCP.DISC.YIADDR .HS 00000000
|
||||
.HS 00000000 SIADDR
|
||||
.HS 00000000 GIADDR
|
||||
DHCP.DISC.GIADDR .HS 00000000
|
||||
DHCP.DISC.CHADDR .HS 00000000.00000000.00000000.00000000
|
||||
.BS 64 SNAME
|
||||
.BS 128 FILE
|
||||
@ -466,11 +475,11 @@ DHCP.DISC.LEN .EQ *-DHCP.DISC
|
||||
DHCP.REQ .HS 01010600 OP,HTYPE,HLEN,HOPS
|
||||
DHCP.REQ.XID .BS 4
|
||||
.HS 0000 SECS
|
||||
.HS 0000 FLAGS
|
||||
.DA S.DHCP.FLAGS.BRDCST
|
||||
.HS 00000000 CIADDR
|
||||
DHCP.REQ.YIADDR .HS 00000000
|
||||
.HS 00000000 SIADDR
|
||||
.HS 00000000 GIADDR
|
||||
DHCP.REQ.GIADDR .HS 00000000
|
||||
DHCP.REQ.CHADDR .HS 00000000.00000000.00000000.00000000
|
||||
.BS 64 SNAME
|
||||
.BS 128 FILE
|
||||
|
Loading…
Reference in New Issue
Block a user