2016-01-16 22:04:22 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-03-19 21:47:54 +00:00
|
|
|
|
LOMEM $900
|
2016-01-16 22:04:22 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
2017-01-31 16:40:37 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.New
|
2017-02-13 07:26:18 +00:00
|
|
|
|
* Create a new socket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-01-31 16:40:37 +00:00
|
|
|
|
* PUSHW = PTR to S.SOCKET template
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-01-31 16:40:37 +00:00
|
|
|
|
* YA = PTR to new S.SOCKET
|
|
|
|
|
* X = hSocket
|
|
|
|
|
*\--------------------------------------
|
2017-03-13 07:07:07 +00:00
|
|
|
|
SKT.New clc
|
|
|
|
|
.HS B0 BCS
|
|
|
|
|
SKT.New.Listen sec
|
|
|
|
|
ror
|
|
|
|
|
sta .71+1
|
|
|
|
|
>PULLW ZPTmpPtr1
|
2016-01-16 22:04:22 +00:00
|
|
|
|
ldy #S.SOCKET.SRC.PORT+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
lda (ZPTmpPtr1),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
dey
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ora (ZPTmpPtr1),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jsr GetDynPort
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta (ZPTmpPtr1),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
txa
|
|
|
|
|
iny
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta (ZPTmpPtr1),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-02-10 07:29:58 +00:00
|
|
|
|
.1 lda hSocketTable
|
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-03-13 22:09:00 +00:00
|
|
|
|
>STYA ZPTmpPtr2
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-01-30 21:03:12 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
sta TmpOffset to keep track of any free slot
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2016-01-16 22:04:22 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.2 lda (ZPTmpPtr2)
|
2017-01-30 21:03:12 +00:00
|
|
|
|
beq .4 empty!!!
|
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp (ZPTmpPtr1)
|
2017-01-30 21:03:12 +00:00
|
|
|
|
bne .5 not same SKT type...try next
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ldy #S.SOCKET.SRC.ADDR
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.3 lda (ZPTmpPtr1),y
|
|
|
|
|
cmp (ZPTmpPtr2),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
bne .5
|
2016-03-13 22:09:00 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #S.SOCKET.DST.PORT+2
|
|
|
|
|
bne .3
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-01-30 21:03:12 +00:00
|
|
|
|
lda #ERR.SKT.BUSY same one!!!!! busy...
|
2016-01-16 22:04:22 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2017-01-30 21:03:12 +00:00
|
|
|
|
.4 lda TmpOffset
|
|
|
|
|
bpl .5 already found an empty slot....
|
|
|
|
|
|
|
|
|
|
>LDYA ZPTmpPtr2 found one...
|
|
|
|
|
>STYA ZPTmpPtr3 save it!
|
2017-01-30 16:30:39 +00:00
|
|
|
|
stx TmpOffset
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.5 lda ZPTmpPtr2
|
2016-01-16 22:04:22 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.SOCKET
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta ZPTmpPtr2
|
2016-01-16 22:04:22 +00:00
|
|
|
|
bcc .6
|
2016-03-13 22:09:00 +00:00
|
|
|
|
inc ZPTmpPtr2+1
|
2016-01-16 22:04:22 +00:00
|
|
|
|
.6 inx
|
|
|
|
|
cpx #K.SKTTABLE.SIZE
|
|
|
|
|
bne .2
|
|
|
|
|
|
2017-01-30 21:03:12 +00:00
|
|
|
|
lda TmpOffset Did we found an empty slot ?
|
|
|
|
|
bmi .9
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
ldy #S.SOCKET.HDR-1
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.7 lda (ZPTmpPtr1),y
|
|
|
|
|
sta (ZPTmpPtr3),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .7
|
|
|
|
|
|
2017-02-10 07:29:58 +00:00
|
|
|
|
lda (ZPTmpPtr1)
|
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPTmpPtr1),y
|
|
|
|
|
and #S.SOCKET.SO.ACCEPTCONN
|
|
|
|
|
bne .8
|
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
jsr SKT.NewTCB
|
2017-02-10 07:29:58 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-03-13 07:07:07 +00:00
|
|
|
|
.71 lda #$ff
|
|
|
|
|
bmi .8 From Listen, do not send SYN packet
|
|
|
|
|
|
|
|
|
|
>LDYA ZPTmpPtr3
|
|
|
|
|
>STYA ZPPtrSKT
|
2017-03-23 16:41:36 +00:00
|
|
|
|
lda #S.TCP.OPTIONS.SYN
|
2017-04-10 06:07:14 +00:00
|
|
|
|
jsr TCP.OUT.SendOptA Send SYN,Only for CLIENT conn!!!!
|
2017-03-13 07:07:07 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-03-13 15:34:56 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda #S.SOCKET.TCP.STATUS.SYNSENT
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
.8 lda TmpOffset
|
|
|
|
|
ora #$80
|
|
|
|
|
tax
|
2016-03-13 22:09:00 +00:00
|
|
|
|
>LDYA ZPTmpPtr3
|
2016-01-16 22:04:22 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.9 lda #ERR.SKT.OOS
|
2016-01-16 22:04:22 +00:00
|
|
|
|
sec
|
2017-02-10 07:29:58 +00:00
|
|
|
|
.99 rts
|
2017-02-13 07:26:18 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.CloseA
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Close socket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* A = hSocket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*\--------------------------------------
|
2017-03-19 21:47:54 +00:00
|
|
|
|
SKT.CloseA and #$7f
|
|
|
|
|
cmp #K.SKTTABLE.SIZE
|
2017-03-10 16:35:54 +00:00
|
|
|
|
bcs .9
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
jsr SKT.GetA.I
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #S.SOCKET.SOCK.DGRAM
|
2017-03-10 16:35:54 +00:00
|
|
|
|
beq .1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
cmp #S.SOCKET.SOCK.RAW
|
2017-03-10 16:35:54 +00:00
|
|
|
|
beq .1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
2017-03-10 16:35:54 +00:00
|
|
|
|
bne .9
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
bit #S.SOCKET.SO.ACCEPTCONN
|
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
bne *
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.OPTIONS
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ora #S.TCP.OPTIONS.FIN
|
|
|
|
|
sta (ZPPtrSKT),y
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
jsr TCP.OUT SKT.Close, Try to push FIN
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
.9 lda #ERR.SKT.BAD
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.SOCKET.HQ.TAIL
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ldy #S.SOCKET.HQ.HEAD
|
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
clc
|
|
|
|
|
adc #S.SOCKET.HQ
|
|
|
|
|
tax
|
|
|
|
|
pla
|
|
|
|
|
inx
|
|
|
|
|
cmp #S.SOCKET.HQ.MAX
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
.2
|
|
|
|
|
ldy #S.SOCKET.HQ.TAIL
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>SYSCALL FreeMemA
|
|
|
|
|
bra .1
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.8 lda #0
|
|
|
|
|
sta (ZPPtrSKT)
|
|
|
|
|
clc
|
2017-03-10 16:35:54 +00:00
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.GetA
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Get Ptr to socket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* A = hSocket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Y,A = pS.SOCKET
|
|
|
|
|
*\--------------------------------------
|
2017-03-19 21:47:54 +00:00
|
|
|
|
SKT.GetA jsr SKT.GetA.I
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
bcs .9
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
>LDYA ZPPtrSKT
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
SKT.GetA.I and #$7f
|
|
|
|
|
|
|
|
|
|
cmp #K.SKTTABLE.SIZE
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
pha
|
2017-02-15 16:14:41 +00:00
|
|
|
|
lda hSocketTable
|
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>STYA ZPPtrSKT
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
pla
|
2017-02-15 16:14:41 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
stz .1+1
|
|
|
|
|
lsr
|
|
|
|
|
ror .1+1
|
|
|
|
|
lsr
|
|
|
|
|
ror .1+1
|
|
|
|
|
lsr
|
|
|
|
|
ror .1+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
pha
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
lda ZPPtrSKT
|
|
|
|
|
clc
|
|
|
|
|
.1 adc #$ff
|
|
|
|
|
sta ZPPtrSKT
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
pla
|
|
|
|
|
adc ZPPtrSKT+1
|
|
|
|
|
sta ZPPtrSKT+1
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.8 lda (ZPPtrSKT)
|
2017-03-19 21:47:54 +00:00
|
|
|
|
beq .9
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
.9 lda #ERR.SKT.BAD
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.GetTable
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Get socket table
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
|
|
|
|
* ## Out :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Y,A = pS.SOCKET
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
SKT.GetTable lda hSocketTable
|
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.AcceptA
|
2017-02-13 07:26:18 +00:00
|
|
|
|
* Check for an incoming connection
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-13 07:26:18 +00:00
|
|
|
|
* A = hListeningSocket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-13 07:26:18 +00:00
|
|
|
|
* A = hSocket
|
|
|
|
|
*\--------------------------------------
|
2017-02-10 07:29:58 +00:00
|
|
|
|
SKT.AcceptA jsr SKT.GetA.I
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
and #S.SOCKET.SO.ACCEPTCONN
|
2017-02-15 21:46:21 +00:00
|
|
|
|
beq .99
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
ldy #S.SOCKET.HQ.TAIL
|
2017-02-17 22:04:53 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ldy #S.SOCKET.HQ.HEAD
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp (ZPPtrSKT),y Queue Empty
|
2017-02-17 22:04:53 +00:00
|
|
|
|
beq .9 CS
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-02-17 22:04:53 +00:00
|
|
|
|
pha save tail...
|
2016-03-13 22:09:00 +00:00
|
|
|
|
inc
|
2017-01-31 16:40:37 +00:00
|
|
|
|
cmp #S.SOCKET.HQ.MAX
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .1
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
lda #0
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-02-17 22:04:53 +00:00
|
|
|
|
.1 ldy #S.SOCKET.HQ.TAIL
|
|
|
|
|
sta (ZPPtrSKT),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
pla
|
|
|
|
|
clc
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc #S.SOCKET.HQ
|
2016-03-13 22:09:00 +00:00
|
|
|
|
tay
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
clc
|
2016-01-16 22:04:22 +00:00
|
|
|
|
rts
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.99 lda #ERR.SKT.BAD
|
2016-01-16 22:04:22 +00:00
|
|
|
|
sec
|
2016-03-13 22:09:00 +00:00
|
|
|
|
.9 rts
|
2017-03-07 16:40:32 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.MkNodA
|
2017-03-07 16:40:32 +00:00
|
|
|
|
* Create a new file from TCP socket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-03-07 16:40:32 +00:00
|
|
|
|
* A = hSocket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-03-07 16:40:32 +00:00
|
|
|
|
* A = hFile
|
|
|
|
|
*\--------------------------------------
|
2017-04-10 06:07:14 +00:00
|
|
|
|
SKT.MkNodA sta NODE.SSOCK+S.NODE.SSOCK.HSKT
|
|
|
|
|
>SYSCALL MkNodA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPTmpPtr1
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.NODE.SSOCK-1
|
|
|
|
|
|
|
|
|
|
.1 lda NODE.SSOCK,y
|
|
|
|
|
sta (ZPTmpPtr1),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
txa
|
|
|
|
|
* clc
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2017-02-13 07:26:18 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.Write (DGRAM,STREAM,RAW)
|
2017-02-13 07:26:18 +00:00
|
|
|
|
* Send block of data
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-13 07:26:18 +00:00
|
|
|
|
* PUSHB = hSocket
|
|
|
|
|
* PUSHW = pBuf
|
|
|
|
|
* PUSHW = len
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-13 07:26:18 +00:00
|
|
|
|
*\--------------------------------------
|
2017-02-15 16:14:41 +00:00
|
|
|
|
SKT.Write >PULLW ZPDataInLen
|
2017-01-31 16:40:37 +00:00
|
|
|
|
>PULLW ZPDataInPtr
|
2017-03-14 07:32:31 +00:00
|
|
|
|
>PULLA
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-03-23 16:41:36 +00:00
|
|
|
|
jsr SKT.GetA.I
|
2016-01-16 22:04:22 +00:00
|
|
|
|
bcs .9
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
cmp #S.SOCKET.SOCK.DGRAM
|
2017-02-15 16:14:41 +00:00
|
|
|
|
beq SKT.Write.UDP
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-03-23 16:41:36 +00:00
|
|
|
|
cmp #S.SOCKET.SOCK.RAW
|
|
|
|
|
beq SKT.Write.RAW
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
2017-03-23 16:41:36 +00:00
|
|
|
|
bne .99
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
and #S.SOCKET.SO.ACCEPTCONN
|
|
|
|
|
bne .99
|
2017-02-15 16:14:41 +00:00
|
|
|
|
jmp SKT.Write.TCP
|
2017-01-30 16:30:39 +00:00
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
.99 lda #ERR.SKT.BAD
|
|
|
|
|
sec
|
2016-01-16 22:04:22 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-03-23 16:41:36 +00:00
|
|
|
|
SKT.Write.RAW ldy #S.SOCKET.RAW.PROTO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
>LDYA ZPDataInLen
|
|
|
|
|
jsr FRM.NewIP
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr SKT.SetFrameOutDstIP
|
|
|
|
|
|
|
|
|
|
jsr SKT.CopyDataInToOut
|
|
|
|
|
|
|
|
|
|
jmp FRM.SendIP
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-02-15 16:14:41 +00:00
|
|
|
|
SKT.Write.UDP ldx #S.IP.PROTOCOL.UDP
|
2017-02-13 07:26:18 +00:00
|
|
|
|
>LDYA ZPDataInLen
|
|
|
|
|
jsr FRM.NewIP
|
2016-01-16 22:04:22 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
jsr SKT.SetFrameOutDstIP
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-02-16 16:26:11 +00:00
|
|
|
|
ldy #S.SOCKET.SRC.PORT
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
tax
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ldy #S.UDP.SRCPORT
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.DST.PORT
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
tax
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ldy #S.UDP.DSTPORT
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
jsr SKT.CopyDataInToOut
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
jmp FRM.SendIP
|
2017-01-31 16:40:37 +00:00
|
|
|
|
|
2017-03-10 16:35:54 +00:00
|
|
|
|
.9 rts
|
2017-02-13 07:26:18 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-15 16:14:41 +00:00
|
|
|
|
SKT.Write.TCP ldy #S.SOCKET.TCP.STATUS
|
2017-02-08 06:52:30 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
2017-02-15 16:14:41 +00:00
|
|
|
|
cmp #S.SOCKET.TCP.STATUS.ESTBLSH
|
|
|
|
|
bne .91
|
2017-02-06 17:04:03 +00:00
|
|
|
|
|
2017-03-24 16:27:44 +00:00
|
|
|
|
jsr SKT.AddDataToSktOut will call SKT.GetTCB
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bcs .90
|
2017-02-09 16:24:19 +00:00
|
|
|
|
|
2017-03-24 16:27:44 +00:00
|
|
|
|
jsr TCP.OUT.I SKT.GetTCB called, try to push, ignore error....
|
2017-02-09 16:24:19 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.90 lda #0 no data transfered
|
2017-02-09 16:24:19 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
.91 lda #MLI.ERR.IO
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2017-02-09 16:24:19 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.ReadA (DGRAM,RAW)
|
|
|
|
|
* ## In :
|
2017-02-09 16:24:19 +00:00
|
|
|
|
* A = hSocket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-09 16:24:19 +00:00
|
|
|
|
* A = hFrame
|
|
|
|
|
*\--------------------------------------
|
2017-02-15 16:14:41 +00:00
|
|
|
|
SKT.ReadA jsr SKT.GetA.I
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
ldy #S.SOCKET.HQ.TAIL
|
2016-03-13 22:09:00 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
2016-03-27 21:06:56 +00:00
|
|
|
|
tax
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
ldy #S.SOCKET.HQ.HEAD
|
2016-03-13 22:09:00 +00:00
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
inc
|
2017-01-31 16:40:37 +00:00
|
|
|
|
cmp #S.SOCKET.HQ.MAX
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .1
|
|
|
|
|
lda #0
|
2016-03-27 21:06:56 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 ldy #S.SOCKET.HQ.TAIL
|
2016-03-27 21:06:56 +00:00
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
|
|
|
|
txa
|
2016-03-13 22:09:00 +00:00
|
|
|
|
clc
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc #S.SOCKET.HQ
|
2016-03-13 22:09:00 +00:00
|
|
|
|
tay
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
clc
|
2016-01-16 22:04:22 +00:00
|
|
|
|
rts
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
|
|
|
|
.99 sec
|
|
|
|
|
.9 rts
|
2017-02-09 16:24:19 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.PutC (STREAM)
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Write a Char To Stream
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* PUSHB = hSocket
|
|
|
|
|
* PUSHB = Char
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*\--------------------------------------
|
2017-03-07 16:40:32 +00:00
|
|
|
|
SKT.PutC >PULLB TmpByte
|
|
|
|
|
|
2017-03-14 07:32:31 +00:00
|
|
|
|
ldx #1
|
2017-03-23 07:32:11 +00:00
|
|
|
|
stx ZPDataInLen
|
|
|
|
|
stz ZPDataInLen+1
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-03-14 07:32:31 +00:00
|
|
|
|
ldx L.TmpByte
|
2017-03-23 07:32:11 +00:00
|
|
|
|
stx ZPDataInPtr
|
2017-03-14 07:32:31 +00:00
|
|
|
|
|
|
|
|
|
ldx L.TmpByte+1
|
2017-03-23 07:32:11 +00:00
|
|
|
|
stx ZPDataInPtr+1
|
2017-03-23 16:41:36 +00:00
|
|
|
|
bra SKT.PutS.1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.PutS (STREAM)
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Write Line in pBuf
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* PUSHB = hSocket
|
|
|
|
|
* PUSHW = PSTR
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*\--------------------------------------
|
2017-03-07 16:40:32 +00:00
|
|
|
|
SKT.PutS >PULLW ZPDataOutPtr
|
2017-03-23 07:32:11 +00:00
|
|
|
|
lda (ZPDataInPtr)
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-03-23 07:32:11 +00:00
|
|
|
|
sta ZPDataInLen
|
|
|
|
|
stz ZPDataInLen+1
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-03-23 07:32:11 +00:00
|
|
|
|
inc ZPDataInPtr
|
2017-03-23 16:41:36 +00:00
|
|
|
|
bne SKT.PutS.1
|
2017-03-23 07:32:11 +00:00
|
|
|
|
inc ZPDataInPtr+1
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-03-23 16:41:36 +00:00
|
|
|
|
SKT.PutS.1 >PULLA
|
|
|
|
|
jsr SKT.GetA.I
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
jmp SKT.Write.TCP
|
|
|
|
|
|
|
|
|
|
.9 lda #ERR.SKT.BAD
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.GetCA (STREAM)
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* Read a Char From Stream in A
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* A = hSocket
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* A = char
|
|
|
|
|
*\--------------------------------------
|
2017-03-14 07:32:31 +00:00
|
|
|
|
SKT.GetCA stz bTextMode
|
2017-03-07 16:40:32 +00:00
|
|
|
|
|
2017-03-14 07:32:31 +00:00
|
|
|
|
ldx #1
|
|
|
|
|
stx ZPDataOutLen
|
2017-03-07 16:40:32 +00:00
|
|
|
|
stz ZPDataOutLen+1
|
|
|
|
|
|
2017-03-14 07:32:31 +00:00
|
|
|
|
ldx L.TmpByte
|
|
|
|
|
stx ZPDataOutPtr
|
|
|
|
|
ldx L.TmpByte+1
|
|
|
|
|
stx ZPDataOutPtr+1
|
2017-03-15 06:58:13 +00:00
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
jsr SKT.Read.I
|
|
|
|
|
bcs .9
|
|
|
|
|
lda TmpByte
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2017-02-10 16:49:14 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.GetS (STREAM)
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* Read a CR terminated Line in pBuf
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* PUSHB = hSocket
|
|
|
|
|
* PUSHW = pBuf
|
|
|
|
|
* PUSHW = len
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-10 07:29:58 +00:00
|
|
|
|
* Y,A = bytes read
|
|
|
|
|
*\--------------------------------------
|
2017-02-10 16:49:14 +00:00
|
|
|
|
SKT.GetS sec
|
|
|
|
|
.HS 90 bcc
|
2017-02-10 07:29:58 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SKT.Read (STREAM)
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* Read data in pBuf
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* PUSHB = hSocket
|
|
|
|
|
* PUSHW = pBuf
|
|
|
|
|
* PUSHW = len
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2017-02-10 16:49:14 +00:00
|
|
|
|
* Y,A = bytes transfered
|
2017-02-09 16:24:19 +00:00
|
|
|
|
*\--------------------------------------
|
2017-02-15 16:14:41 +00:00
|
|
|
|
SKT.Read clc
|
|
|
|
|
ror bTextMode
|
|
|
|
|
>PULLW ZPDataOutLen
|
2017-02-10 16:49:14 +00:00
|
|
|
|
>PULLW ZPDataOutPtr
|
2017-03-14 07:32:31 +00:00
|
|
|
|
>PULLA
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
SKT.Read.I jsr SKT.GetA.I
|
2017-02-10 16:49:14 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
cmp #S.SOCKET.SOCK.STREAM
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .90 bad skt
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SO
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
and #S.SOCKET.SO.ACCEPTCONN
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .90 Bad Skt
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
cmp #S.SOCKET.TCP.STATUS.ESTBLSH
|
2017-03-21 21:54:59 +00:00
|
|
|
|
bcc .92 Not yet established...no data
|
|
|
|
|
bne .91 closing...IO err
|
2017-03-15 06:58:13 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
jsr SKT.GetDataFromSktIn
|
2017-03-10 16:35:54 +00:00
|
|
|
|
rts if CS, No data...
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
.90 lda #ERR.SKT.BAD
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.91 lda #MLI.ERR.IO
|
2017-02-10 16:49:14 +00:00
|
|
|
|
sec
|
2017-03-21 21:54:59 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.92 lda #0
|
|
|
|
|
sec
|
2017-02-10 16:49:14 +00:00
|
|
|
|
.99 rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* PRIVATE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ZPPtrSKT -> actual socket
|
|
|
|
|
* A = hSocket or hFrame
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SKT.AddToQueueA sta .2+1
|
|
|
|
|
ldy #S.SOCKET.HQ.HEAD
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
tax
|
|
|
|
|
inc
|
|
|
|
|
cmp #S.SOCKET.HQ.MAX
|
|
|
|
|
bne .1
|
|
|
|
|
lda #0
|
|
|
|
|
.1 ldy #S.SOCKET.HQ.TAIL
|
|
|
|
|
cmp (ZPPtrSKT),y
|
|
|
|
|
beq .9 Queue full!!
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.HQ.HEAD
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
txa
|
|
|
|
|
clc
|
|
|
|
|
adc #S.SOCKET.HQ
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.2 lda #$ff
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* From TCP.IN
|
|
|
|
|
* Src : ZPDataInPtr/ZPDataInLen
|
|
|
|
|
* Dst : hInMem/INHEAD
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SKT.AddDataToSktIn
|
2017-03-15 06:58:13 +00:00
|
|
|
|
ldx SKT.TCBCache+S.TCB.INFREE
|
|
|
|
|
cpx ZPDataInLen
|
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE+1
|
|
|
|
|
sbc ZPDataInLen+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bcc .9 Not enough room in Q
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.TCP.SEQNUM+3
|
2017-03-27 06:28:25 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.10 lda (ZPFrameInPtr),y
|
2017-04-10 06:07:14 +00:00
|
|
|
|
eor SKT.TCBCache+S.TCB.INLASTSEQNUM,x
|
2017-03-27 06:28:25 +00:00
|
|
|
|
bne .9
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .10
|
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
ldy #S.SOCKET.SQ.hInMem
|
|
|
|
|
lda (ZPPtrSKT),y
|
2017-02-10 16:49:14 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1
|
|
|
|
|
clc
|
2017-03-09 16:38:27 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.INHEAD
|
2017-02-10 16:49:14 +00:00
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1+1
|
2017-03-09 16:38:27 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.INHEAD+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
lda ZPDataInLen
|
|
|
|
|
eor #$FF
|
|
|
|
|
tax
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
lda ZPDataInLen+1
|
|
|
|
|
eor #$FF
|
|
|
|
|
pha
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 inx
|
|
|
|
|
bne .2
|
|
|
|
|
pla
|
|
|
|
|
inc
|
2017-02-10 16:49:14 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2017-03-24 07:31:30 +00:00
|
|
|
|
pha
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
.2 lda (ZPDataInPtr),y
|
|
|
|
|
sta (ZPTmpPtr2)
|
|
|
|
|
iny
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPDataInPtr+1
|
|
|
|
|
|
|
|
|
|
.3 inc ZPTmpPtr2
|
2017-02-10 16:49:14 +00:00
|
|
|
|
bne .4
|
2017-02-15 16:14:41 +00:00
|
|
|
|
inc ZPTmpPtr2+1
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
.4 inc SKT.TCBCache+S.TCB.INHEAD
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .1
|
2017-03-09 16:38:27 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.INHEAD+1
|
|
|
|
|
lda SKT.TCBCache+S.TCB.INHEAD+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
cmp /K.TCP.WSIZE
|
|
|
|
|
bne .1
|
2017-03-09 16:38:27 +00:00
|
|
|
|
stz SKT.TCBCache+S.TCB.INHEAD+1
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
sta ZPTmpPtr2+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
.8 lda SKT.TCBCache+S.TCB.INFREE
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc ZPDataInLen
|
2017-03-09 16:38:27 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.INFREE
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sbc ZPDataInLen+1
|
2017-03-09 16:38:27 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.INFREE+1
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INUSED
|
2017-02-15 16:14:41 +00:00
|
|
|
|
clc
|
|
|
|
|
adc ZPDataInLen
|
2017-03-09 16:38:27 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.INUSED
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INUSED+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
adc ZPDataInLen+1
|
2017-03-09 16:38:27 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.INUSED+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-27 06:28:25 +00:00
|
|
|
|
clc
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INLASTSEQNUM+3
|
2017-03-27 06:28:25 +00:00
|
|
|
|
adc ZPDataInLen
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.INLASTSEQNUM+3
|
2017-03-27 06:28:25 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INLASTSEQNUM+2
|
2017-03-27 06:28:25 +00:00
|
|
|
|
adc ZPDataInLen+1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.INLASTSEQNUM+2
|
2017-03-27 06:28:25 +00:00
|
|
|
|
bcc .80
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.INLASTSEQNUM+1
|
2017-03-27 06:28:25 +00:00
|
|
|
|
bne .80
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.INLASTSEQNUM
|
2017-03-27 06:28:25 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
.80 clc
|
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-22 16:39:01 +00:00
|
|
|
|
* From SKT.Read
|
|
|
|
|
* In:
|
|
|
|
|
* Src : hInMem/INTAIL
|
|
|
|
|
* Dst : ZPDataOutPtr/ZPDataOutLen
|
|
|
|
|
* bTextMode
|
|
|
|
|
* Out:
|
|
|
|
|
* Y,A = bytes read
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-22 16:39:01 +00:00
|
|
|
|
SKT.GetDataFromSktIn
|
2017-03-24 16:27:44 +00:00
|
|
|
|
jsr SKT.GetTCB
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INUSED
|
|
|
|
|
ora SKT.TCBCache+S.TCB.INUSED+1
|
|
|
|
|
bne .10
|
|
|
|
|
sec
|
2017-04-06 06:31:50 +00:00
|
|
|
|
rts A=0,NO DATA
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.10 ldy #S.SOCKET.SQ.hInMem
|
2017-03-09 16:38:27 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
2017-02-15 16:14:41 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1
|
|
|
|
|
clc
|
2017-03-22 16:39:01 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.INTAIL
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.INTAIL+1
|
|
|
|
|
sta ZPTmpPtr2+1
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPDataOutLen
|
2017-02-15 16:14:41 +00:00
|
|
|
|
eor #$FF
|
|
|
|
|
tax
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPDataOutLen+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
eor #$FF
|
|
|
|
|
pha
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
stz ZPTmpPtr3 Reset byte counter
|
|
|
|
|
stz ZPTmpPtr3+1
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #0
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.1 inx Check if room left in dest buffer
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .2
|
|
|
|
|
pla
|
|
|
|
|
inc
|
|
|
|
|
beq .8
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
2017-03-16 07:32:24 +00:00
|
|
|
|
pha
|
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.2 lda SKT.TCBCache+S.TCB.INTAIL
|
|
|
|
|
eor SKT.TCBCache+S.TCB.INHEAD
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .3
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INTAIL+1
|
|
|
|
|
eor SKT.TCBCache+S.TCB.INHEAD+1
|
|
|
|
|
beq .7 no more data....
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.3 lda (ZPTmpPtr2)
|
|
|
|
|
pha
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.INTAIL
|
|
|
|
|
bne .5
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.INTAIL+1
|
|
|
|
|
lda SKT.TCBCache+S.TCB.INTAIL+1
|
|
|
|
|
cmp /K.TCP.WSIZE
|
|
|
|
|
bne .4
|
2017-03-09 16:38:27 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
stz SKT.TCBCache+S.TCB.INTAIL+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
lda ZPTmpPtr1
|
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
sta ZPTmpPtr2+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bra .5
|
2017-02-10 16:49:14 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.4 inc ZPTmpPtr2
|
|
|
|
|
bne .5
|
|
|
|
|
inc ZPTmpPtr2+1
|
2017-01-31 22:13:26 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.5 pla get back data....
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bit bTextMode do we need to check CR ?
|
|
|
|
|
bpl .6
|
2017-01-30 22:23:16 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
cmp #13
|
|
|
|
|
beq .7
|
2017-03-15 07:30:01 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.6 sta (ZPDataOutPtr),y
|
2017-02-15 16:14:41 +00:00
|
|
|
|
iny
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bne .61
|
2017-02-15 16:14:41 +00:00
|
|
|
|
inc ZPDataOutPtr+1
|
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.61 inc ZPTmpPtr3
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
inc ZPTmpPtr3+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
bra .1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.7 pla discard byte counter HI
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.8 bit bTextMode here, bacause dst buf full....
|
|
|
|
|
bmi .9 ....and TextMode selected, NO ending CR found
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPTmpPtr3 Do we have transfered something?
|
2017-03-29 06:33:26 +00:00
|
|
|
|
ora ZPTmpPtr3+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
beq .9
|
2017-03-13 15:34:56 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE
|
|
|
|
|
clc
|
|
|
|
|
adc ZPTmpPtr3
|
|
|
|
|
sta SKT.TCBCache+S.TCB.INFREE
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INFREE+1
|
|
|
|
|
adc ZPTmpPtr3+1
|
|
|
|
|
sta SKT.TCBCache+S.TCB.INFREE+1
|
2017-03-13 15:34:56 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INUSED
|
|
|
|
|
sec
|
|
|
|
|
sbc ZPTmpPtr3
|
|
|
|
|
sta SKT.TCBCache+S.TCB.INUSED
|
2017-03-19 21:47:54 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.INUSED+1
|
|
|
|
|
sbc ZPTmpPtr3+1
|
|
|
|
|
sta SKT.TCBCache+S.TCB.INUSED+1
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTACKNUM+3
|
|
|
|
|
clc
|
2017-03-22 16:39:01 +00:00
|
|
|
|
adc ZPTmpPtr3
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTACKNUM+3
|
2017-03-13 15:34:56 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTACKNUM+2
|
2017-03-22 16:39:01 +00:00
|
|
|
|
adc ZPTmpPtr3+1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTACKNUM+2
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
bcc .80
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.OUTACKNUM+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bne .80
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.OUTACKNUM
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.80 jsr SKT.StoreTCB
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.TCP.OPTIONS
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
ora #S.TCP.OPTIONS.ACK
|
|
|
|
|
sta (ZPPtrSKT),y
|
|
|
|
|
|
2017-04-04 20:40:25 +00:00
|
|
|
|
jsr TCP.OUT.I SKT.GetTCB already called, Try to ACK read DATA
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
>LDYA ZPTmpPtr3
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #0 NO DATA
|
|
|
|
|
sec
|
2017-03-10 16:35:54 +00:00
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-22 16:39:01 +00:00
|
|
|
|
* From SKT.Write.TCP
|
|
|
|
|
* Src : ZPDataInPtr/ZPDataInLen
|
|
|
|
|
* Dst : hOutMem/OUTHEAD
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-22 16:39:01 +00:00
|
|
|
|
SKT.AddDataToSktOut
|
|
|
|
|
jsr SKT.GetTCB
|
2017-03-23 07:32:11 +00:00
|
|
|
|
ldx SKT.TCBCache+S.TCB.OUTFREE
|
|
|
|
|
cpx ZPDataInLen
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
|
|
|
|
sbc ZPDataInLen+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bcc .9 Not enough room in Q
|
|
|
|
|
|
|
|
|
|
ldy #S.SOCKET.SQ.hOutMem
|
2016-03-13 22:09:00 +00:00
|
|
|
|
lda (ZPPtrSKT),y
|
2017-02-15 16:14:41 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1
|
|
|
|
|
clc
|
2017-03-22 16:39:01 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.OUTHEAD
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
|
|
|
|
|
lda ZPTmpPtr1+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.OUTHEAD+1
|
|
|
|
|
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPDataInLen
|
2017-02-15 16:14:41 +00:00
|
|
|
|
eor #$FF
|
|
|
|
|
tax
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPDataInLen+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
eor #$FF
|
|
|
|
|
pha
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #0
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.1 inx
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bne .2
|
|
|
|
|
pla
|
|
|
|
|
inc
|
2017-03-15 07:30:01 +00:00
|
|
|
|
beq .8
|
2017-01-31 16:40:37 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
pha
|
2017-01-30 22:23:16 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.2 lda (ZPDataInPtr),y
|
|
|
|
|
sta (ZPTmpPtr2)
|
|
|
|
|
iny
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPDataInPtr+1
|
|
|
|
|
|
|
|
|
|
.3 inc ZPTmpPtr2
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPTmpPtr2+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.4 inc SKT.TCBCache+S.TCB.OUTHEAD
|
|
|
|
|
bne .1
|
|
|
|
|
inc SKT.TCBCache+S.TCB.OUTHEAD+1
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTHEAD+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
cmp /K.TCP.WSIZE
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bne .1
|
|
|
|
|
stz SKT.TCBCache+S.TCB.OUTHEAD+1
|
2017-02-10 07:29:58 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
2017-02-15 16:14:41 +00:00
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
sta ZPTmpPtr2+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2017-02-10 07:29:58 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.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
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
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
|
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTTOSEND
|
2017-04-04 20:40:25 +00:00
|
|
|
|
clc
|
|
|
|
|
adc ZPDataInLen
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTTOSEND
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTTOSEND+1
|
2017-04-04 20:40:25 +00:00
|
|
|
|
adc ZPDataInLen+1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTTOSEND+1
|
2017-04-04 20:40:25 +00:00
|
|
|
|
jsr SKT.StoreTCB
|
2017-04-06 06:31:50 +00:00
|
|
|
|
rts
|
2017-03-22 16:39:01 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* From TCP.OUT
|
|
|
|
|
* Src : hOutMem/OUTTAIL
|
|
|
|
|
* Dst : ZPDataOutPtr/ZPDataOutLen
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SKT.GetDataFromSktOut
|
|
|
|
|
ldy #S.SOCKET.SQ.hOutMem
|
|
|
|
|
lda (ZPPtrSKT),y
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
|
|
|
|
|
2017-04-04 20:40:25 +00:00
|
|
|
|
lda ZPTmpPtr1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
clc
|
2017-04-10 06:07:14 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.OUTTAILNEXT
|
2017-04-04 20:40:25 +00:00
|
|
|
|
sta ZPTmpPtr2 Make ZPTmpPtr2=base+nexttail
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
2017-04-04 20:40:25 +00:00
|
|
|
|
lda ZPTmpPtr1+1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
adc SKT.TCBCache+S.TCB.OUTTAILNEXT+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
sta ZPTmpPtr2+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPDataOutLen
|
|
|
|
|
eor #$FF
|
|
|
|
|
tax
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPDataOutLen+1
|
|
|
|
|
eor #$FF
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 inx
|
|
|
|
|
bne .2
|
|
|
|
|
pla
|
|
|
|
|
inc
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPTmpPtr2)
|
|
|
|
|
sta (ZPDataOutPtr),y
|
2017-02-15 16:14:41 +00:00
|
|
|
|
iny
|
2017-03-22 16:39:01 +00:00
|
|
|
|
bne .3
|
2017-02-15 16:14:41 +00:00
|
|
|
|
inc ZPDataOutPtr+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.3 inc ZPTmpPtr2
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPTmpPtr2+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
.4 inc SKT.TCBCache+S.TCB.OUTTAILNEXT
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
inc SKT.TCBCache+S.TCB.OUTTAILNEXT+1
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTTAILNEXT+1
|
2017-03-22 16:39:01 +00:00
|
|
|
|
cmp /K.TCP.WSIZE
|
|
|
|
|
bne .1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
stz SKT.TCBCache+S.TCB.OUTTAILNEXT+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
|
|
|
|
sta ZPTmpPtr2
|
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
sta ZPTmpPtr2+1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
bra .1
|
2017-03-15 07:30:01 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
.8 lda SKT.TCBCache+S.TCB.OUTTOSEND
|
2017-04-04 20:40:25 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc ZPDataOutLen
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTTOSEND
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTTOSEND+1
|
2017-04-04 20:40:25 +00:00
|
|
|
|
sbc ZPDataOutLen+1
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTTOSEND+1
|
2017-04-04 20:40:25 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2017-03-22 16:39:01 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* From TCP.IN
|
|
|
|
|
* Src : A,X
|
|
|
|
|
* Dst : hOutMem/OUTTAIL
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SKT.AckDataToSktOut
|
2017-04-10 06:07:14 +00:00
|
|
|
|
ldy #S.TCP.ACKNUM+3 Get new ACK number from FrameIn...
|
2017-03-27 06:28:25 +00:00
|
|
|
|
ldx #3 Substract old ACK from socket
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
|
|
|
|
sec
|
2017-03-28 06:33:18 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.1 lda (ZPFrameInPtr),y
|
|
|
|
|
pha
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sbc SKT.TCBCache+S.TCB.OUTSEQNUM,x
|
2017-03-22 16:39:01 +00:00
|
|
|
|
sta TmpDWord,x
|
2017-03-29 06:33:26 +00:00
|
|
|
|
pla ....and Set SEQ = new SEQ
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTSEQNUM,x
|
2017-03-22 16:39:01 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2017-03-29 06:33:26 +00:00
|
|
|
|
lda TmpDWord+3
|
|
|
|
|
ldx TmpDWord+2
|
2017-03-22 16:39:01 +00:00
|
|
|
|
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
|
2017-02-15 16:14:41 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTFREE
|
2017-03-10 16:35:54 +00:00
|
|
|
|
clc
|
2017-03-29 06:33:26 +00:00
|
|
|
|
adc TmpDWord+3
|
2017-03-22 16:39:01 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTFREE
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
2017-03-29 06:33:26 +00:00
|
|
|
|
adc TmpDWord+2
|
2017-03-22 16:39:01 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTUSED
|
|
|
|
|
sec
|
2017-03-29 06:33:26 +00:00
|
|
|
|
sbc TmpDWord+3
|
2017-03-22 16:39:01 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTUSED
|
|
|
|
|
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
2017-03-29 06:33:26 +00:00
|
|
|
|
sbc TmpDWord+2
|
2017-03-22 16:39:01 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
2017-03-29 06:33:26 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SKT.NewTCB >PUSHWI S.TCB
|
|
|
|
|
>PUSHBI S.MEM.F.INIT0
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA .4+1
|
|
|
|
|
txa
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
ldy #S.SOCKET.SQ.hTCB
|
|
|
|
|
sta (ZPTmpPtr3),y
|
2017-03-10 16:35:54 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
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
|
2017-03-15 06:58:13 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
.2 lda A2osX.TIMER16,x
|
2017-04-10 06:07:14 +00:00
|
|
|
|
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
|
2017-03-22 16:39:01 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-03-22 16:39:01 +00:00
|
|
|
|
>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
|
2016-03-13 22:09:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-09 16:38:27 +00:00
|
|
|
|
SKT.GetTCB ldy #S.SOCKET.SQ.hTCB
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
>SYSCALL GetMemPtrA
|
2017-03-21 21:54:59 +00:00
|
|
|
|
bcs *
|
2017-03-09 16:38:27 +00:00
|
|
|
|
>STYA .1+1
|
|
|
|
|
|
|
|
|
|
ldx #S.TCB-1
|
|
|
|
|
|
|
|
|
|
.1 lda $ffff,x
|
|
|
|
|
sta SKT.TCBCache,x
|
|
|
|
|
dex
|
2017-02-10 16:49:14 +00:00
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-09 16:38:27 +00:00
|
|
|
|
SKT.StoreTCB ldy #S.SOCKET.SQ.hTCB
|
|
|
|
|
lda (ZPPtrSKT),y
|
|
|
|
|
>SYSCALL GetMemPtrA
|
2017-03-21 21:54:59 +00:00
|
|
|
|
bcs *
|
2017-03-09 16:38:27 +00:00
|
|
|
|
>STYA .2+1
|
|
|
|
|
|
|
|
|
|
ldx #S.TCB-1
|
|
|
|
|
|
|
|
|
|
.1 lda SKT.TCBCache,x
|
|
|
|
|
.2 sta $ffff,x
|
|
|
|
|
dex
|
2017-02-10 16:49:14 +00:00
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-22 16:39:01 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-01-31 16:40:37 +00:00
|
|
|
|
SKT.SetFrameOutDstIP
|
|
|
|
|
ldy #S.SOCKET.DST.ADDR
|
|
|
|
|
ldx #4
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtrSKT),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ldy #S.IP.DST+3
|
|
|
|
|
ldx #4
|
|
|
|
|
|
|
|
|
|
.2 pla
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SKT.CopyDataInToOut
|
2017-02-13 07:26:18 +00:00
|
|
|
|
lda ZPDataInPtr+1
|
|
|
|
|
pha
|
|
|
|
|
lda ZPDataOutPtr+1
|
|
|
|
|
pha
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda ZPDataInLen
|
|
|
|
|
eor #$ff
|
2017-02-13 07:26:18 +00:00
|
|
|
|
tax
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda ZPDataInLen+1
|
|
|
|
|
eor #$ff
|
2017-02-13 07:26:18 +00:00
|
|
|
|
pha
|
2017-01-31 16:40:37 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
.1 inx
|
2017-01-31 16:40:37 +00:00
|
|
|
|
bne .2
|
2017-02-13 07:26:18 +00:00
|
|
|
|
pla
|
|
|
|
|
inc
|
2017-01-31 16:40:37 +00:00
|
|
|
|
beq .9
|
2017-02-13 07:26:18 +00:00
|
|
|
|
pha
|
2017-01-31 16:40:37 +00:00
|
|
|
|
|
|
|
|
|
.2 lda (ZPDataInPtr),y
|
|
|
|
|
sta (ZPDataOutPtr),y
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
inc ZPDataInPtr+1
|
|
|
|
|
inc ZPDataOutPtr+1
|
|
|
|
|
bne .1
|
2017-02-13 07:26:18 +00:00
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
sta ZPDataOutPtr+1
|
|
|
|
|
pla
|
|
|
|
|
sta ZPDataInPtr+1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-01-16 22:04:22 +00:00
|
|
|
|
MAN
|
2017-03-30 06:31:12 +00:00
|
|
|
|
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.SKT
|
|
|
|
|
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
2016-01-16 22:04:22 +00:00
|
|
|
|
ASM
|