diff --git a/.Docs/LIBTCPIP.md b/.Docs/LIBTCPIP.md index 3655f526..339b62ea 100644 --- a/.Docs/LIBTCPIP.md +++ b/.Docs/LIBTCPIP.md @@ -94,21 +94,34 @@ A = hFile # SKT.Read (STREAM) - Read data in pBuf -**In:** - PUSHB = hSocket - PUSHW = pBuf - PUSHW = len + +## C +`int skt.read(hFD fd, void *buf, int count);` + +## ASM +**In:** +`>PUSHWI count` +`>PUSHW buf` +`lda fd` +`>SYSCALL read` **Out:** - Y,A = bytes transfered +CC: Y,A = bytes read +CS: A = EC # SKT.Write (STREAM) - Send block of data -**In:** - PUSHB = hSocket - PUSHW = pBuf - PUSHW = len -**Out:** + +## C +`int skt.write(hFD fd, const void *buf, int count);` + +## ASM +**In:** +`>PUSHWI count` +`>PUSHW buf` +`lda fd` +`>SYSCALL write` +**Out:** +CC: Y,A = bytes written +CS: A = EC # SKT.Rcvd (DGRAM,RAW) **In:** diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 062425a1..050896f7 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/.Floppies/A2OSX.SRC.po b/.Floppies/A2OSX.SRC.po index 4bf83dd8..552a4b50 100644 Binary files a/.Floppies/A2OSX.SRC.po and b/.Floppies/A2OSX.SRC.po differ diff --git a/BIN/TELNET.S.txt b/BIN/TELNET.S.txt index 5d649ff4..30a960c2 100644 --- a/BIN/TELNET.S.txt +++ b/BIN/TELNET.S.txt @@ -11,7 +11,7 @@ AUTO 4,1 .INB INC/ETH.I .INB INC/LIBTCPIP.I *-------------------------------------- -TIMEOUT.MAX .EQ 20 2 sec. +TIMEOUT.MAX .EQ 40 4 sec. BUFSIZE .EQ 256 *-------------------------------------- ZPIPCfgPtr .EQ ZPBIN @@ -169,9 +169,10 @@ CS.RUN.OPENSKT ldx #3 CS.RUN.LOOP >SLEEP - >PUSHB.G hSocket - >PUSHW ZPBufPtr >PUSHWI BUFSIZE + >PUSHW ZPBufPtr + >LDA.G hSocket + >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Read bcc .1 @@ -204,9 +205,9 @@ CS.RUN.LOOP >SLEEP cmp #3 Ctrl-C beq CS.RUN.USER - >PUSHB.G hSocket - >PUSHW ZPBufPtr >PUSHW ZPBufLen + >PUSHW ZPBufPtr + >LDA.G hSocket >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Write bcs CS.RUN.SKTERR @@ -287,7 +288,7 @@ hLIBTCPIP .BS 1 MSG.IPKO .AZ "TCP/IP Not Loaded/Configured." MSG.USAGE .AZ "Usage : TELNET [port]" MSG.UNKNOWN .AZ "%s: Unknown host\r\n" -MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s) ...\r\n" +MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..." MSG.SKTKO .AZ "Failed to Open Socket." MSG.SKTOK .AZ "Connected." MSG.SKTERR .AZ "Socket Error : $%h\r\n" diff --git a/DRV/CONSOLE.DRV.S.txt b/DRV/CONSOLE.DRV.S.txt index cb8f89a8..2d31fad5 100644 --- a/DRV/CONSOLE.DRV.S.txt +++ b/DRV/CONSOLE.DRV.S.txt @@ -1081,13 +1081,13 @@ KeyRemappedRGHT .HS 1B5B4300 esc[C TelnetOpt .DA #IAC,#DO,#TELOPT.ECHO TelnetOpt.LEN .EQ *-TelnetOpt *-------------------------------------- -WILLDO .DA #TELOPT.BINARY,#TELOPT.SGA,#TELOPT.NAWS +WILLDO .DA #TELOPT.BINARY,#TELOPT.SGA WILLDO.CNT .EQ *-WILLDO -WILLDONT .DA #TELOPT.TSPEED,#TELOPT.LINEMODE +WILLDONT .DA #TELOPT.TSPEED,#TELOPT.LINEMODE,#TELOPT.STATUS WILLDONT.CNT .EQ *-WILLDONT DOWILL .DA #TELOPT.BINARY,#TELOPT.SGA,#TELOPT.NAWS,#TELOPT.TTYPE DOWILL.CNT .EQ *-DOWILL -DOWONT .DA #TELOPT.NEWENVIRON +DOWONT .DA #TELOPT.NEWENVIRON,#TELOPT.XDISPLOC,#TELOPT.TSPEED,#TELOPT.LFLOW,#TELOPT.NAWS DOWONT.CNT .EQ *-DOWONT SB.IS.TTYPE .DA #IAC,#SB,#TELOPT.TTYPE,#SB.IS .AS 'XTERM' diff --git a/LIB/LIBTCPIP.S.SKT.txt b/LIB/LIBTCPIP.S.SKT.txt index 64b9da7d..a271d9ae 100644 --- a/LIB/LIBTCPIP.S.SKT.txt +++ b/LIB/LIBTCPIP.S.SKT.txt @@ -328,17 +328,22 @@ SKT.MkNod sta .1+1 .9 rts */-------------------------------------- * # SKT.Read (STREAM) -* Read data in pBuf -* **In:** -* PUSHB = hSocket -* PUSHW = pBuf -* PUSHW = len +* ## C +* `int skt.read(hFD fd, void *buf, int count);` +* ## ASM +* **In:** +* `>PUSHWI count` +* `>PUSHW buf` +* `lda fd` +* `>SYSCALL read` * **Out:** -* Y,A = bytes transfered +* CC: Y,A = bytes read +* CS: A = EC *\-------------------------------------- -SKT.Read >PULLW ZPDataInLen !!!use DataInPtr/Len +SKT.Read pha >PULLW ZPDataInPtr !!!DataOut trashed when sending ACK in TCP.OUT - >PULLA + >PULLW ZPDataInLen !!!use DataInPtr/Len + pla SKT.Read.I jsr SKT.Get.I bcs .99 @@ -373,16 +378,22 @@ SKT.Read.I jsr SKT.Get.I .99 rts */-------------------------------------- * # SKT.Write (STREAM) -* Send block of data -* **In:** -* PUSHB = hSocket -* PUSHW = pBuf -* PUSHW = len -* **Out:** +* ## C +* `int skt.write(hFD fd, const void *buf, int count);` +* ## ASM +* **In:** +* `>PUSHWI count` +* `>PUSHW buf` +* `lda fd` +* `>SYSCALL write` +* **Out:** +* CC: Y,A = bytes written +* CS: A = EC *\-------------------------------------- -SKT.Write >PULLW ZPDataInLen +SKT.Write pha >PULLW ZPDataInPtr - >PULLA + >PULLW ZPDataInLen + pla jsr SKT.Get.I bcs .9 @@ -820,7 +831,8 @@ SKT.GetDataFromSktIn clc rts -.9 lda #0 NO DATA +.9 +* lda #0 NO DATA sec rts *-------------------------------------- diff --git a/LIB/LIBTCPIP.S.TCP.txt b/LIB/LIBTCPIP.S.TCP.txt index 04a1ae6f..28a26af8 100644 --- a/LIB/LIBTCPIP.S.TCP.txt +++ b/LIB/LIBTCPIP.S.TCP.txt @@ -150,8 +150,8 @@ TCP.IN.JMP.LISTEN TCP.IN.JMP.SYNSENT ldy #S.TCP.OPTIONS SYN Send, only accept SYN.ACK packet, then Send ACK lda (ZPFrameInPtr),y - cmp #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK - bne .8 + bit #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK + beq .8 jsr SKT.GetTCB @@ -462,6 +462,8 @@ TCP.OUT.SendOptA.1 bit #S.TCP.OPTIONS.ACK beq .10 +* pha + ldx #3 ldy #S.TCP.ACKNUM+3 @@ -471,10 +473,20 @@ TCP.OUT.SendOptA.1 dex bpl .1 -.10 ldx #3 +* pla + +.10 +* clc +* bit #S.TCP.OPTIONS.FIN +* beq .11 +* sec + +.11 ldx #3 ldy #S.TCP.SEQNUM+3 .2 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x +* adc #0 +* sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x sta (ZPFrameOutPtr),y dey dex