mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-12 17:30:23 +00:00
Kernel 0.93+
This commit is contained in:
parent
18f087ddcc
commit
06f901b121
Binary file not shown.
@ -15,7 +15,7 @@ AUTO 4,1
|
||||
.INB INC/NET.HTTP.I
|
||||
*--------------------------------------
|
||||
RESP.BUFSIZE .EQ 1024
|
||||
TIMEOUT.MAX .EQ 100 10 sec.
|
||||
TIMEOUT.MAX .EQ 200 20 sec.
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
@ -24,10 +24,13 @@ ZPIPCfgPtr .BS 2
|
||||
ZPHostPtr .BS 2
|
||||
ZPPtr .BS 2
|
||||
ZPReqBufPtr .BS 2
|
||||
|
||||
ZPReqBufLen .BS 2
|
||||
ZPEncodedBufPtr .BS 2
|
||||
ZPEncodedBufLen .BS 2
|
||||
ZPRespBufPtr .BS 2
|
||||
|
||||
hSocket .BS 1
|
||||
ZS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
@ -56,9 +59,9 @@ L.SA.REMOTE.AD .DA SA.REMOTE+S.SOCKADDR.ADDR
|
||||
L.MSG.IPKO .DA MSG.IPKO
|
||||
L.MSG.USAGE .DA MSG.USAGE
|
||||
L.MSG.UNKNOWN .DA MSG.UNKNOWN
|
||||
L.MSG.HOSTOK .DA MSG.HOSTOK
|
||||
L.MSG.CONNECT .DA MSG.CONNECT
|
||||
L.MSG.SKTKO .DA MSG.SKTKO
|
||||
L.MSG.SKTOK .DA MSG.SKTOK
|
||||
L.MSG.CONNECTED .DA MSG.CONNECTED
|
||||
L.MSG.SKTERR .DA MSG.SKTERR
|
||||
L.MSG.IOERR .DA MSG.IOERR
|
||||
L.HTTP.GET1 .DA HTTP.GET1
|
||||
@ -85,11 +88,13 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
||||
|
||||
CS.RUN.IPOK ldy #S.IPCFG.IP+3
|
||||
ldx #3
|
||||
|
||||
.1 lda (ZPIPCfgPtr),y
|
||||
sta SA.LOCAL+S.SOCKADDR.ADDR,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
>INC.G ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .9
|
||||
@ -110,6 +115,7 @@ CS.RUN.IPOK ldy #S.IPCFG.IP+3
|
||||
>LDYA L.MSG.UNKNOWN
|
||||
>SYSCALL printf
|
||||
bra CS.RUN.ESYN
|
||||
|
||||
.9 >PUSHBI 0
|
||||
>LDYA L.MSG.USAGE
|
||||
>SYSCALL printf
|
||||
@ -121,39 +127,49 @@ CS.RUN.RTS rts
|
||||
CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcc .10
|
||||
|
||||
jmp CS.RUN.PORTOK
|
||||
|
||||
.10 >STYA ZPPtr
|
||||
lda (ZPPtr)
|
||||
cmp #'-'
|
||||
beq .1
|
||||
|
||||
>LDYA ZPPtr
|
||||
>SYSCALL atoi
|
||||
bcs CS.RUN.RTS
|
||||
|
||||
>STYA SA.REMOTE+S.SOCKADDR.PORT
|
||||
>INC.G ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .8
|
||||
|
||||
>STYA ZPPtr
|
||||
lda (ZPPtr)
|
||||
cmp #'-'
|
||||
bne CS.RUN.ESYN
|
||||
|
||||
.1 ldy #1
|
||||
lda (ZPPtr),y
|
||||
cmp #'U'
|
||||
bne .2
|
||||
|
||||
>INC.G ArgIndex
|
||||
>SYSCALL ArgV
|
||||
|
||||
.9 bcs CS.RUN.ESYN
|
||||
|
||||
>STYA ZPReqBufPtr
|
||||
>SYSCALL strlen
|
||||
>STYA ZPReqBufLen
|
||||
.8 bra CS.RUN.PORTOK
|
||||
|
||||
.2 cmp #'F'
|
||||
bne CS.RUN.ESYN
|
||||
>INC.G ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs CS.RUN.RTS
|
||||
|
||||
pha
|
||||
>PUSHWZ Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
@ -161,51 +177,75 @@ CS.RUN.HOSTOK >INC.G ArgIndex
|
||||
pla
|
||||
>SYSCALL LoadTxtFile
|
||||
bcs .9
|
||||
|
||||
>STYA ZPReqBufLen
|
||||
txa
|
||||
>STA.G hReqBuf
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPReqBufPtr
|
||||
|
||||
CS.RUN.PORTOK >PUSHW ZPHostPtr
|
||||
>PUSHW SA.REMOTE+S.SOCKADDR.PORT
|
||||
|
||||
ldx #3
|
||||
|
||||
.1 >PUSHB SA.REMOTE+S.SOCKADDR.ADDR,x
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
>PUSHBI 8
|
||||
>LDYA L.MSG.HOSTOK
|
||||
>LDYA L.MSG.CONNECT
|
||||
>SYSCALL printf
|
||||
|
||||
|
||||
CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
lda #S.SOCKET.T.STREAM
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
||||
bcs .9
|
||||
|
||||
>STA.G hSocket
|
||||
pha
|
||||
sta hSocket
|
||||
|
||||
>PUSHW L.SA.LOCAL
|
||||
pla
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
||||
bcc .2
|
||||
.9 >LDYA L.MSG.SKTKO
|
||||
bcc .1
|
||||
|
||||
.9 pha
|
||||
>LDYA L.MSG.SKTKO
|
||||
>SYSCALL puts
|
||||
lda #E.SYN
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
.2 >PUSHW L.SA.REMOTE
|
||||
>LDA.G hSocket
|
||||
.99 rts
|
||||
|
||||
.1 jsr Init.Timeout
|
||||
|
||||
.2 >SLEEP
|
||||
|
||||
>PUSHW L.SA.REMOTE
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
|
||||
bcs .9
|
||||
>LDYA L.MSG.SKTOK
|
||||
bcc .3
|
||||
|
||||
cmp #ERR.SKT.NOCONN
|
||||
bne .9
|
||||
|
||||
jsr Wait.Timeout
|
||||
bcc .2
|
||||
lda #ERR.SKT.NOCONN
|
||||
bra .9
|
||||
|
||||
.3 >LDYA L.MSG.CONNECTED
|
||||
>SYSCALL puts
|
||||
|
||||
>LDYAI RESP.BUFSIZE
|
||||
>SYSCALL getmem
|
||||
bcs .9
|
||||
bcs .99
|
||||
|
||||
>STYA ZPRespBufPtr
|
||||
txa
|
||||
>STA.G hRespBuf
|
||||
|
||||
>SLEEP
|
||||
|
||||
CS.RUN.GET jsr CS.RUN.ENCODE
|
||||
bcs .99
|
||||
* >PUSHW ZPEncodedBufLen
|
||||
@ -213,6 +253,7 @@ CS.RUN.GET jsr CS.RUN.ENCODE
|
||||
* ldy #S.PS.hStdOut
|
||||
* lda (pPs),y
|
||||
* >SYSCALL fwrite
|
||||
|
||||
jsr CS.RUN.REQUEST
|
||||
bcs .99
|
||||
|
||||
@ -323,28 +364,21 @@ CS.RUN.ADDTOBUF sta (ZPPtr)
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.REQUEST jsr Init.Timeout
|
||||
.10 >PUSHWI HTTP.GET1.LEN
|
||||
|
||||
>PUSHWI HTTP.GET1.LEN
|
||||
>PUSHW L.HTTP.GET1
|
||||
|
||||
jsr .8
|
||||
bcc .1
|
||||
inc
|
||||
bne .99
|
||||
>SLEEP
|
||||
jsr Wait.TimeOut
|
||||
bcc .10
|
||||
.99 lda #MLI.E.IO
|
||||
sec
|
||||
rts
|
||||
bcs .99
|
||||
|
||||
.1 >PUSHW ZPEncodedBufLen
|
||||
>PUSHW ZPEncodedBufLen
|
||||
>PUSHW ZPEncodedBufPtr
|
||||
jsr .8
|
||||
bcs .9
|
||||
|
||||
>PUSHWI HTTP.GET2.LEN
|
||||
>PUSHW L.HTTP.GET2
|
||||
jsr .8
|
||||
bcs .9
|
||||
.99 bcs .9
|
||||
|
||||
>LDYA ZPHostPtr
|
||||
>SYSCALL strlen
|
||||
@ -356,7 +390,10 @@ CS.RUN.REQUEST jsr Init.Timeout
|
||||
>PUSHWI HTTP.GET3.LEN
|
||||
>PUSHW L.HTTP.GET3
|
||||
|
||||
.8 >LDA.G hSocket
|
||||
.8 lda #'!'
|
||||
>SYSCALL putchar
|
||||
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Write
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -365,17 +402,18 @@ CS.RUN.RESPONSE jsr Init.Timeout
|
||||
.1 >SLEEP
|
||||
>PUSHWI RESP.BUFSIZE
|
||||
>PUSHW ZPRespBufPtr
|
||||
>LDA.G hSocket
|
||||
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Read
|
||||
bcc .2
|
||||
|
||||
tay
|
||||
|
||||
cmp #E.NODATA
|
||||
bne .8
|
||||
>LDA.G bResponse
|
||||
bne .81
|
||||
|
||||
jsr Wait.Timeout
|
||||
bcs .99
|
||||
bcs .80
|
||||
bra .1
|
||||
|
||||
.2 >PUSHYA len
|
||||
>PUSHW ZPRespBufPtr
|
||||
ldy #S.PS.hStdOut
|
||||
@ -385,15 +423,18 @@ CS.RUN.RESPONSE jsr Init.Timeout
|
||||
|
||||
>INC.G bResponse
|
||||
bra .1
|
||||
|
||||
.8 cmp #MLI.E.IO SKT Close ?
|
||||
bne .9
|
||||
|
||||
.80 >LDA.G bResponse
|
||||
beq .99
|
||||
|
||||
.81 clc
|
||||
rts
|
||||
|
||||
.99 lda #MLI.E.IO
|
||||
.9 sec
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT lda (pEvent)
|
||||
@ -405,7 +446,7 @@ CS.DOEVENT lda (pEvent)
|
||||
.9 sec do not discard TIMER event
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT >LDA.G hSocket
|
||||
CS.QUIT lda hSocket
|
||||
beq .1
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
||||
@ -443,9 +484,9 @@ MSG.USAGE .AS "Usage : HTTPGET <ip|host> [port]\r\n"
|
||||
.AS " -U Url\r\n"
|
||||
.AZ " -F UrlFile\r\n"
|
||||
MSG.UNKNOWN .AZ "%s: Unknown host\r\n"
|
||||
MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..."
|
||||
MSG.CONNECT .AZ "Connecting to %d.%d.%d.%d:%D (%s)..."
|
||||
MSG.SKTKO .AZ "Failed to Open Socket."
|
||||
MSG.SKTOK .AZ "Connected."
|
||||
MSG.CONNECTED .AZ "Connected."
|
||||
MSG.SKTERR .AZ "Socket Error : $%h\r\n"
|
||||
MSG.IOERR .AZ "I/O Error : $%h\r\n"
|
||||
*--------------------------------------
|
||||
@ -485,7 +526,6 @@ hReqBuf .BS 1
|
||||
hEncodedBuf .BS 1
|
||||
hRespBuf .BS 1
|
||||
bResponse .BS 1
|
||||
hSocket .BS 1
|
||||
TimeOut .BS 1
|
||||
DS.END
|
||||
.ED
|
||||
|
@ -11,7 +11,7 @@ NEW
|
||||
.INB INC/LIBTCPIP.I
|
||||
.INB INC/NET.TELNET.I
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 100 10 sec.
|
||||
TIMEOUT.MAX .EQ 200 20 sec.
|
||||
BUFSIZE .EQ 256
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
@ -70,11 +70,13 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
||||
>STYA ZPIPCfgPtr
|
||||
lda (ZPIPCfgPtr) Configured ?
|
||||
bmi CS.RUN.IPOK
|
||||
|
||||
>LDYA L.MSG.IPKO
|
||||
>SYSCALL puts
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
|
||||
CS.RUN.IPOK ldy #S.PS.ARGC
|
||||
lda (pPs),y
|
||||
cmp #1
|
||||
@ -86,16 +88,18 @@ CS.RUN.IPOK ldy #S.PS.ARGC
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
.2 >PUSHW L.SA.REMOTE.AD
|
||||
.2 >SLEEP
|
||||
|
||||
>PUSHW L.SA.REMOTE.AD
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GETBYNAME
|
||||
bcc CS.RUN.HOSTOK
|
||||
>SLEEP
|
||||
lda TimeOut
|
||||
bne .2
|
||||
|
||||
@ -106,6 +110,7 @@ CS.RUN.IPOK ldy #S.PS.ARGC
|
||||
>LDYA L.MSG.UNKNOWN
|
||||
>SYSCALL printf
|
||||
bra .99
|
||||
|
||||
.9 >LDYA L.MSG.USAGE
|
||||
>SYSCALL puts
|
||||
|
||||
@ -118,15 +123,18 @@ CS.RUN.HOSTOK lda #2
|
||||
bcs CS.RUN.PORTOK
|
||||
>SYSCALL atoi
|
||||
>STYA SA.REMOTE+S.SOCKADDR.PORT
|
||||
|
||||
CS.RUN.PORTOK lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHW SA.REMOTE+S.SOCKADDR.PORT
|
||||
|
||||
ldx #3
|
||||
|
||||
.1 >PUSHB SA.REMOTE+S.SOCKADDR.ADDR,x
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
>PUSHBI 8
|
||||
>LDYA L.MSG.HOSTOK
|
||||
>SYSCALL printf
|
||||
@ -142,21 +150,40 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
||||
bcc .2
|
||||
.9 >LDYA L.MSG.SKTKO
|
||||
|
||||
.9 pha
|
||||
>LDYA L.MSG.SKTKO
|
||||
>SYSCALL puts
|
||||
lda #E.SYN
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
.2 >PUSHW L.SA.REMOTE
|
||||
.99 rts
|
||||
|
||||
.2 lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
.3 >SLEEP
|
||||
|
||||
>PUSHW L.SA.REMOTE
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
|
||||
bcs .9
|
||||
bcc CS.RUN.LOOP
|
||||
|
||||
cmp #ERR.SKT.NOCONN
|
||||
bne .9
|
||||
|
||||
lda TimeOut
|
||||
bne .3
|
||||
|
||||
lda #ERR.SKT.NOCONN
|
||||
bra .9
|
||||
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG.SKTOK
|
||||
>SYSCALL printf
|
||||
>LDYAI BUFSIZE
|
||||
>SYSCALL getmem
|
||||
bcs .9
|
||||
bcs .99
|
||||
|
||||
>STYA ZPBufPtr
|
||||
stx hBuf
|
||||
|
||||
@ -193,10 +220,12 @@ CS.RUN.LOOP >SLEEP
|
||||
lda (pPs),y
|
||||
>SYSCALL fread
|
||||
.11 bcs CS.RUN.IOERR
|
||||
|
||||
.3 >STYA ZPBufLen
|
||||
lda (ZPBufPtr)
|
||||
cmp #$14 Ctrl-T
|
||||
cmp #$14 Ctrl-T
|
||||
beq CS.RUN.USER
|
||||
|
||||
>PUSHW ZPBufLen
|
||||
>PUSHW ZPBufPtr
|
||||
lda hSocket
|
||||
@ -241,12 +270,17 @@ CS.QUIT lda hSocket
|
||||
beq .1
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
||||
|
||||
.1 lda hBuf
|
||||
beq .2
|
||||
|
||||
>SYSCALL freemem
|
||||
|
||||
.2 lda hLIBTCPIP
|
||||
beq .8
|
||||
|
||||
>SYSCALL UnloadLib
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -63,6 +63,7 @@ LIBTCPIP.GetTable .EQ 62
|
||||
ERR.SKT.OOS .EQ $BF
|
||||
ERR.SKT.BUSY .EQ $BE
|
||||
ERR.SKT.BAD .EQ $BD
|
||||
ERR.SKT.NOCONN .EQ $BC
|
||||
|
||||
ERR.DNS.PENDING .EQ $B9
|
||||
ERR.DNS.ERROR .EQ $B8
|
||||
|
@ -131,14 +131,17 @@ FRM.NewIP stx .8+1
|
||||
FRM.SendIP php
|
||||
ldx #3 Copy SRC.IP even if IP offload
|
||||
ldy #S.IP.SRC+3 for proper UDP/TCP CRC calculation
|
||||
|
||||
.1 lda IPCFG+S.IPCFG.IP,x
|
||||
sta (ZPFrameOutPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
lda IPCFG+S.NETCFG.DevFlags
|
||||
and #S.DCB.NIC.FLAGS.IPOFFLOAD
|
||||
bne .21
|
||||
|
||||
ldy #S.IP.TOTAL.LENGTH+1
|
||||
lda ZPFrameOutLen
|
||||
sec
|
||||
@ -159,7 +162,9 @@ FRM.SendIP php
|
||||
clc
|
||||
|
||||
ldy #S.IP.V.IHL.DSCP.ECN
|
||||
|
||||
ldx #10 10 words for IP Header
|
||||
|
||||
.2 lda (ZPFrameOutPtr),y
|
||||
adc IP.CHECKSUM
|
||||
sta IP.CHECKSUM
|
||||
@ -171,6 +176,7 @@ FRM.SendIP php
|
||||
iny
|
||||
dex
|
||||
bne .2
|
||||
|
||||
ldy #S.IP.HDR.CHECKSUM
|
||||
lda IP.CHECKSUM
|
||||
adc #0
|
||||
@ -186,10 +192,13 @@ FRM.SendIP php
|
||||
lda (ZPFrameOutPtr),y
|
||||
cmp #S.IP.PROTOCOL.TCP
|
||||
bne .3
|
||||
|
||||
jsr IP.ComputeTCPChecksum
|
||||
bra .5
|
||||
|
||||
.3 cmp #S.IP.PROTOCOL.UDP
|
||||
bne .4
|
||||
|
||||
lda ZPFrameOutLen
|
||||
sec
|
||||
sbc #S.IP
|
||||
@ -201,17 +210,22 @@ FRM.SendIP php
|
||||
sta (ZPFrameOutPtr),y
|
||||
jsr IP.ComputeUDPChecksum
|
||||
bra .5
|
||||
|
||||
.4 cmp #S.IP.PROTOCOL.ICMP
|
||||
bne .5
|
||||
|
||||
jsr IP.ComputeICMPChecksum
|
||||
|
||||
.5 lda IPCFG+S.NETCFG.DevFlags
|
||||
and #S.DCB.NIC.FLAGS.ARPOFFLOAD
|
||||
bne .6
|
||||
|
||||
jsr IP.SetDestMAC
|
||||
bcs FRM.Queue
|
||||
|
||||
.6 jsr FRM.Send
|
||||
bcs FRM.Queue
|
||||
|
||||
jsr FRM.Discard
|
||||
|
||||
plp
|
||||
@ -219,7 +233,8 @@ FRM.SendIP php
|
||||
rts
|
||||
*--------------------------------------
|
||||
FRM.Queue plp
|
||||
bcs .9 DONT queue
|
||||
bcs FRM.Discard DONT queue
|
||||
|
||||
ldy hFrameOut no hFrame, cannot queue for retry
|
||||
beq FRM.Discard.9
|
||||
|
||||
@ -227,7 +242,9 @@ FRM.Queue plp
|
||||
inx
|
||||
cpx #K.FRMQUEUE.SIZE
|
||||
bne .1
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 cpx FRM.QUEUE.Tail
|
||||
beq FRM.Discard CS
|
||||
ldy FRM.QUEUE.Head
|
||||
@ -247,8 +264,10 @@ FRM.Queue plp
|
||||
*--------------------------------------
|
||||
FRM.Discard lda hFrameOut
|
||||
beq FRM.Discard.9
|
||||
|
||||
>SYSCALL2 FreeMem
|
||||
stz hFrameOut
|
||||
|
||||
FRM.Discard.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -292,10 +311,12 @@ FRM.Retry ldx FRM.QUEUE.Tail
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
FRM.Send ldx #3
|
||||
|
||||
.1 lda ZPFrameOutPtr,x Get Frame Ptr & Len
|
||||
sta IOCTL+S.IOCTL.BUFPTR,x
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
FRM.Send.IOCTL >PUSHW L.IOCTL
|
||||
>PUSHBI IOCTL.WRITE
|
||||
lda IPCFG+S.NETCFG.DevID
|
||||
|
@ -172,28 +172,52 @@ SKT.connect >SYSCALL2 GetMemPtr
|
||||
lda (ZPPtrSKT),y
|
||||
tax
|
||||
jmp (J.SKT.connect,x)
|
||||
|
||||
SKT.connect.RAW
|
||||
SKT.connect.DGRAM
|
||||
jmp SKT.SetRemAddr
|
||||
|
||||
SKT.connect.STREAM
|
||||
SKT.connect.SEQPACKET
|
||||
jsr SKT.SetRemAddr
|
||||
ldy #S.SOCKET.TCP.S
|
||||
lda (ZPPtrSKT),y
|
||||
beq .1
|
||||
|
||||
cmp #S.SOCKET.TCP.S.ESTBLSH
|
||||
beq .8
|
||||
bcs .9
|
||||
|
||||
cmp #S.SOCKET.TCP.S.OPENED
|
||||
beq .2
|
||||
|
||||
cmp #S.SOCKET.TCP.S.SYNSENT
|
||||
beq .3
|
||||
bra .9
|
||||
|
||||
.1 jsr SKT.SetRemAddr
|
||||
jsr SKT.NewTCB
|
||||
bcs SKT.listen.RTS
|
||||
|
||||
* lda #S.SOCKET.TCP.S.OPENED
|
||||
* jsr SKT.StoreTCB.S
|
||||
lda #S.SOCKET.TCP.S.OPENED
|
||||
jsr SKT.StoreTCB.S
|
||||
|
||||
lda #S.TCP.OPTIONS.SYN
|
||||
.2 lda #S.TCP.OPTIONS.SYN
|
||||
jsr TCP.OUT.SendOptA Send SYN
|
||||
bcs .9 failed ARP lookup....
|
||||
|
||||
bcs .3
|
||||
|
||||
lda #S.SOCKET.TCP.S.SYNSENT
|
||||
jmp SKT.StoreTCB.S
|
||||
jsr SKT.StoreTCB.S
|
||||
|
||||
.3 lda #ERR.SKT.NOCONN
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
.9 lda #ERR.SKT.BAD
|
||||
sec
|
||||
clc
|
||||
.99 rts
|
||||
*/--------------------------------------
|
||||
* # Listen
|
||||
* Listen for connections on a socket
|
||||
@ -945,6 +969,7 @@ SKT.Send.STREAM lda #ERR.SKT.BAD
|
||||
SKT.Send.9 rts
|
||||
*--------------------------------------
|
||||
SKT.Send.SEQPACKET
|
||||
bra *
|
||||
>LDYA ZPDataInLen
|
||||
jsr TCP.NewFrame
|
||||
bcs SKT.Send.9
|
||||
@ -1030,13 +1055,21 @@ SKT.CheckStream ldy #S.SOCKET.T
|
||||
|
||||
ldy #S.SOCKET.TCP.S
|
||||
lda (ZPPtrSKT),y
|
||||
cmp #S.SOCKET.TCP.S.ESTBLSH
|
||||
beq .8
|
||||
bcc .90
|
||||
|
||||
cmp #S.SOCKET.TCP.S.CLWAIT
|
||||
bcc .8 ESTBLSH or less
|
||||
bne .91 more than CLWAIT
|
||||
|
||||
.8 lda #0
|
||||
clc
|
||||
rts
|
||||
|
||||
.90 lda #ERR.SKT.NOCONN
|
||||
sec
|
||||
rts
|
||||
|
||||
.91 lda #MLI.E.IO
|
||||
sec
|
||||
rts
|
||||
@ -1067,35 +1100,45 @@ SKT.PullhFDDataInPtrLen
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.PullLocAddr >PULLW ZPTmpPtr1
|
||||
|
||||
ldy #S.SOCKADDR-1
|
||||
|
||||
.1 lda (ZPTmpPtr1),y
|
||||
sta SKT.LOC.ADDR,y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.PullRemAddr >PULLW ZPTmpPtr1
|
||||
|
||||
ldy #S.SOCKADDR-1
|
||||
|
||||
.1 lda (ZPTmpPtr1),y
|
||||
sta SKT.REM.ADDR,y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.SetLocAddr ldy #S.SOCKET.LOC.PORT+1
|
||||
|
||||
.1 lda SKT.LOC.ADDR+S.SOCKADDR.ADDR-S.SOCKET.LOC.ADDR,y
|
||||
sta (ZPPtrSKT),y
|
||||
dey
|
||||
cpy #S.SOCKET.LOC.ADDR
|
||||
bcs .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.SetRemAddr ldy #S.SOCKET.REM.PORT+1
|
||||
|
||||
.1 lda SKT.REM.ADDR+S.SOCKADDR.ADDR-S.SOCKET.REM.ADDR,y
|
||||
sta (ZPPtrSKT),y
|
||||
dey
|
||||
cpy #S.SOCKET.REM.ADDR
|
||||
bcs .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* SKT.REM.ADDR = Incoming Frame SRC
|
||||
@ -1257,6 +1300,7 @@ SKT.NewTCB ldx #S.SOCKET.TCP.INSEQNUM
|
||||
sta SKT.Cache+S.SOCKET.TCP.OUTNEXTSEQ,x
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
|
@ -225,9 +225,10 @@ TCP.IN.JMP.ESTBLSH
|
||||
lda #S.TCP.OPTIONS.FIN+S.TCP.OPTIONS.ACK
|
||||
jsr TCP.SetSocketTCPO FIN received, Send FIN.ACK
|
||||
* jsr TCP.OUT.SendOptA
|
||||
.8* jsr TCP.OUT Send ACK as soon as possible
|
||||
.8
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -497,15 +498,19 @@ TCP.OUT.Send ldy #S.TCP.OPTIONS
|
||||
sta (ZPFrameOutPtr),y
|
||||
bit #S.TCP.OPTIONS.ACK
|
||||
beq .2
|
||||
|
||||
ldx #3
|
||||
ldy #S.TCP.ACKNUM+3
|
||||
|
||||
.1 lda SKT.Cache+S.SOCKET.TCP.INSEQNUM,x
|
||||
sta (ZPFrameOutPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
.2 ldx #3
|
||||
ldy #S.TCP.SEQNUM+3
|
||||
|
||||
.3 lda SKT.Cache+S.SOCKET.TCP.OUTNEXTSEQ,x
|
||||
sta (ZPFrameOutPtr),y
|
||||
dey
|
||||
@ -513,6 +518,7 @@ TCP.OUT.Send ldy #S.TCP.OPTIONS
|
||||
bpl .3
|
||||
|
||||
sec DONT Queue if fail
|
||||
|
||||
jsr FRM.SendIP
|
||||
bcs TCP.OUT.Send.9
|
||||
ldy #S.SOCKET.TCP.O
|
||||
|
Loading…
x
Reference in New Issue
Block a user