diff --git a/A2OSX.BOOT.po b/A2OSX.BOOT.po index 5ebfa61a..a41d4c30 100644 Binary files a/A2OSX.BOOT.po and b/A2OSX.BOOT.po differ diff --git a/A2OSX.DEV.po b/A2OSX.DEV.po index d9ceff5d..be6192c7 100644 Binary files a/A2OSX.DEV.po and b/A2OSX.DEV.po differ diff --git a/A2OSX.SRC.po b/A2OSX.SRC.po index 366601c3..03f762ea 100644 Binary files a/A2OSX.SRC.po and b/A2OSX.SRC.po differ diff --git a/INC/LIBTCPIP.I.txt b/INC/LIBTCPIP.I.txt index 4c9bb323..ebe4c738 100644 --- a/INC/LIBTCPIP.I.txt +++ b/INC/LIBTCPIP.I.txt @@ -28,23 +28,23 @@ LIBTCPIP.GET.IPCFG .EQ 6 LIBTCPIP.POLL .EQ 8 LIBTCPIP.PULSEA .EQ 10 -LIBTCPIP.ARP.CLEAR .EQ 12 -LIBTCPIP.ARP.QUERY .EQ 14 -LIBTCPIP.ARP.ADD .EQ 16 -LIBTCPIP.ARP.GETCACHE .EQ 18 +LIBTCPIP.ARP.Clear .EQ 12 +LIBTCPIP.ARP.Query .EQ 14 +LIBTCPIP.ARP.Add .EQ 16 +LIBTCPIP.ARP.GetCache .EQ 18 -LIBTCPIP.DNS.CLEAR .EQ 20 -LIBTCPIP.DNS.QUERY .EQ 22 -LIBTCPIP.DNS.ADD .EQ 24 -LIBTCPIP.DNS.GETCACHE .EQ 26 +LIBTCPIP.DNS.Clear .EQ 20 +LIBTCPIP.DNS.Query .EQ 22 +LIBTCPIP.DNS.Add .EQ 24 +LIBTCPIP.DNS.GetCache .EQ 26 -LIBTCPIP.HST.GETBYNAME .EQ 28 -LIBTCPIP.HST.GETBYADDR .EQ 30 +LIBTCPIP.HST.GetByName .EQ 28 +LIBTCPIP.HST.GetByAddr .EQ 30 LIBTCPIP.SKT.New .EQ 32 -LIBTCPIP.SKT.CLOSEA .EQ 34 -LIBTCPIP.SKT.GETTABLE .EQ 36 -LIBTCPIP.SKT.GETA .EQ 38 +LIBTCPIP.SKT.CloseA .EQ 34 +LIBTCPIP.SKT.GetTable .EQ 36 +LIBTCPIP.SKT.GetA .EQ 38 LIBTCPIP.SKT.AcceptA .EQ 40 LIBTCPIP.SKT.MkNodA .EQ 42 @@ -180,9 +180,8 @@ S.TCB.INFREE .EQ 12 S.TCB.OUTFREE .EQ 14 S.TCB.SEQNUM .EQ 16 S.TCB.ACKNUM .EQ 20 -S.TCB.NEXTSEQNUM .EQ 24 * -S.TCB .EQ 32 +S.TCB .EQ 24 *-------------------------------------- S.ETH.FRAMELEN .EQ 0 S.ETH.DSTMAC .EQ 2 diff --git a/LIB/LIBTCPIP.S.CFG.txt b/LIB/LIBTCPIP.S.CFG.txt index 2c8d7474..c4c8b81f 100644 --- a/LIB/LIBTCPIP.S.CFG.txt +++ b/LIB/LIBTCPIP.S.CFG.txt @@ -9,6 +9,7 @@ AUTO 6 *-------------------------------------- SET.IPCFG >PULLW ZPTmpPtr1 ldy #0 + .1 lda (ZPTmpPtr1),y sta IPCFG,y iny @@ -16,6 +17,7 @@ SET.IPCFG >PULLW ZPTmpPtr1 bne .1 ldx #5 + .2 lda IPCFG+S.IPCFG.MAC,x sta ARP.REQ.SRCMAC,x sta ARP.REQ.SHA,x @@ -25,6 +27,7 @@ SET.IPCFG >PULLW ZPTmpPtr1 bpl .2 ldx #3 + .3 lda IPCFG+S.IPCFG.IP,x sta ARP.REQ.SPA,x sta ARP.REP.SPA,x @@ -55,15 +58,18 @@ SET.IPCFG >PULLW ZPTmpPtr1 .4 lda hDNSSocket1 beq .41 jsr SKT.CLOSEA + stz hDNSSocket1 .41 lda hDNSSocket2 beq .42 jsr SKT.CLOSEA + stz hDNSSocket2 .42 lda IPCFG+S.IPCFG.DNS1 beq .6 ldx #3 + .5 lda IPCFG+S.IPCFG.DNS1,x sta DNS.SOCKET.DA,x dex @@ -82,6 +88,7 @@ SET.IPCFG >PULLW ZPTmpPtr1 beq .8 ldx #3 + .7 lda IPCFG+S.IPCFG.DNS2,x sta DNS.SOCKET.DA,x dex diff --git a/LIB/LIBTCPIP.S.SKT.txt b/LIB/LIBTCPIP.S.SKT.txt index a586e404..a7dd2aa2 100644 --- a/LIB/LIBTCPIP.S.SKT.txt +++ b/LIB/LIBTCPIP.S.SKT.txt @@ -103,7 +103,8 @@ SKT.New.Listen sec >LDYA ZPTmpPtr3 >STYA ZPPtrSKT - jsr TCP.OUT.SYN Only for CLIENT conn!!!! + lda #S.TCP.OPTIONS.SYN + jsr TCP.OUT.A Only for CLIENT conn!!!! bcs .99 ldy #S.SOCKET.TCP.STATUS @@ -325,29 +326,44 @@ SKT.Write >PULLW ZPDataInLen >PULLW ZPDataInPtr >PULLA -SKT.Write.I jsr SKT.GetA.I + jsr SKT.GetA.I bcs .9 cmp #S.SOCKET.SOCK.DGRAM beq SKT.Write.UDP + cmp #S.SOCKET.SOCK.RAW + beq SKT.Write.RAW + cmp #S.SOCKET.SOCK.STREAM - bne .1 + bne .99 ldy #S.SOCKET.SO lda (ZPPtrSKT),y and #S.SOCKET.SO.ACCEPTCONN bne .99 jmp SKT.Write.TCP - -.1 cmp #S.SOCKET.SOCK.RAW - bne .99 - jmp SKT.Write.RAW .99 lda #ERR.SKT.BAD sec .9 rts *-------------------------------------- +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 +*-------------------------------------- SKT.Write.UDP ldx #S.IP.PROTOCOL.UDP >LDYA ZPDataInLen jsr FRM.NewIP @@ -381,22 +397,6 @@ SKT.Write.UDP ldx #S.IP.PROTOCOL.UDP jmp FRM.SendIP -.9 rts -*-------------------------------------- -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 *-------------------------------------- SKT.Write.TCP ldy #S.SOCKET.TCP.STATUS @@ -464,8 +464,6 @@ SKT.ReadA jsr SKT.GetA.I *\-------------------------------------- SKT.PutC >PULLB TmpByte - >PULLA - ldx #1 stx ZPDataInLen stz ZPDataInLen+1 @@ -475,8 +473,7 @@ SKT.PutC >PULLB TmpByte ldx L.TmpByte+1 stx ZPDataInPtr+1 - - jmp SKT.Write.I + bra SKT.PutS.1 */-------------------------------------- * #SKT.PutS (STREAM) * Write Line in pBuf @@ -492,10 +489,21 @@ SKT.PutS >PULLW ZPDataOutPtr stz ZPDataInLen+1 inc ZPDataInPtr - bne .1 + bne SKT.PutS.1 inc ZPDataInPtr+1 -.1 jmp SKT.Write.I +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 */-------------------------------------- * #SKT.GetCA (STREAM) * Read a Char From Stream in A @@ -1013,44 +1021,6 @@ SKT.GetDataFromSktOut .8 clc rts - -* SKT.AckDataToSktOut should update these values - -.5 lda SKT.TCBCache+S.TCB.SEQNUM+3 - clc - adc ZPDataOutLen - sta SKT.TCBCache+S.TCB.NEXTSEQNUM+3 - - lda SKT.TCBCache+S.TCB.SEQNUM+2 - adc ZPDataOutLen+1 - sta SKT.TCBCache+S.TCB.NEXTSEQNUM+2 - - lda SKT.TCBCache+S.TCB.SEQNUM+1 - adc #0 - sta SKT.TCBCache+S.TCB.NEXTSEQNUM+1 - - lda SKT.TCBCache+S.TCB.SEQNUM - adc #0 - sta SKT.TCBCache+S.TCB.NEXTSEQNUM - - lda SKT.TCBCache+S.TCB.OUTFREE - clc - adc ZPDataOutLen - sta SKT.TCBCache+S.TCB.OUTFREE - - lda SKT.TCBCache+S.TCB.OUTFREE+1 - adc ZPDataOutLen+1 - sta SKT.TCBCache+S.TCB.OUTFREE+1 - - lda SKT.TCBCache+S.TCB.OUTUSED - sec - sbc ZPDataOutLen - sta SKT.TCBCache+S.TCB.OUTUSED - - lda SKT.TCBCache+S.TCB.OUTUSED+1 - sbc ZPDataOutLen+1 - sta SKT.TCBCache+S.TCB.OUTUSED+1 - *-------------------------------------- * From TCP.IN * Src : A,X diff --git a/LIB/LIBTCPIP.S.TCP.txt b/LIB/LIBTCPIP.S.TCP.txt index 64cc607b..25ce6db1 100644 --- a/LIB/LIBTCPIP.S.TCP.txt +++ b/LIB/LIBTCPIP.S.TCP.txt @@ -132,7 +132,8 @@ TCP.IN.JMP.LISTEN jsr ARP.AddFromFrameInPtr - jsr TCP.OUT.SYNACK + lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK + jsr TCP.OUT.A bcs .9 ldy #S.SOCKET.TCP.STATUS @@ -319,120 +320,72 @@ TCP.IN.SetDataInPtrAndLen stx ZPDataInPtr+1 rts *-------------------------------------- -TCP.OUT.SYN >LDYAI 0 - jsr TCP.NewFrame - bcs .9 - - ldx #3 - ldy #S.TCP.SEQ.NUMBER+3 - -.1 lda SKT.TCBCache+S.TCB.SEQNUM,x - sta (ZPFrameOutPtr),y - dey - dex - bpl .1 - - ldy #S.TCP.OPTIONS - lda #S.TCP.OPTIONS.SYN - sta (ZPFrameOutPtr),y - - iny S.TCP.WINDOW - lda /K.TCP.WSIZE - sta (ZPFrameOutPtr),y - iny - lda #K.TCP.WSIZE - sta (ZPFrameOutPtr),y - - jsr FRM.SendIP - bcs .9 - - ldy #S.SOCKET.TCP.OPTIONS - lda #0 - sta (ZPPtrSKT),y - - clc -.9 rts -*-------------------------------------- -TCP.OUT.SYNACK >LDYAI 0 - jsr TCP.NewFrame - bcs .9 - - ldx #7 - ldy #S.TCP.SEQ.NUMBER+7 - -.1 lda SKT.TCBCache+S.TCB.SEQNUM,x - sta (ZPFrameOutPtr),y - dey - dex - bpl .1 - - ldy #S.TCP.OPTIONS - lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK - sta (ZPFrameOutPtr),y - - iny S.TCP.WINDOW - lda /K.TCP.WSIZE - sta (ZPFrameOutPtr),y - iny - lda #K.TCP.WSIZE - sta (ZPFrameOutPtr),y - - jsr FRM.SendIP - bcs .9 - - ldy #S.SOCKET.TCP.OPTIONS - lda #0 - sta (ZPPtrSKT),y - - clc -.9 rts -*-------------------------------------- TCP.OUT jsr SKT.GetTCB -TCP.OUT.I ldy SKT.TCBCache+S.TCB.OUTUSED - lda SKT.TCBCache+S.TCB.OUTUSED+1 +TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1 + ldy SKT.TCBCache+S.TCB.OUTUSED bne .1 tax - bne .1 Y,A=0 : nothing to send + bne .1 Y,A=0 : no data to send ldy #S.SOCKET.TCP.OPTIONS lda (ZPPtrSKT),y - beq .88 No, data, no flag....exit - - txa a least one flag to send - tay - bra .2 go send a O len frame - + bne TCP.OUT.A a least an option... + clc No, data, no flag....exit + rts + .1 cpy #K.TCP.MSS pha sbc /K.TCP.MSS OUTDATA > MSS ? pla - bcs .2 no....get data len + bcs .2 no....keep data len >LDYAI K.TCP.MSS yes get only MSS .2 jsr TCP.NewFrame - bcs .9 + bcs TCP.OUT.9 jsr SKT.GetDataFromSktOut ldy #S.SOCKET.TCP.OPTIONS lda (ZPPtrSKT),y ldy #S.TCP.OPTIONS - sta (ZPFrameOutPtr),y + sta (ZPFrameOutPtr),y - ldx #7 +.7 jsr TCP.OUT.SEND + bcs TCP.OUT.9 + jmp SKT.StoreTCB +TCP.OUT.9 rts +*-------------------------------------- +TCP.OUT.A sta .1+1 + >LDYAI 0 + jsr TCP.NewFrame + bcs TCP.OUT.9 + + ldy #S.TCP.OPTIONS + +.1 lda #$ff + sta (ZPFrameOutPtr),y + +TCP.OUT.SEND ldx #7 ldy #S.TCP.SEQ.NUMBER+7 -.3 lda SKT.TCBCache+S.TCB.SEQNUM,x +.2 lda SKT.TCBCache+S.TCB.SEQNUM,x sta (ZPFrameOutPtr),y dey dex - bpl .3 + bpl .2 -.7 jsr FRM.SendIP + ldy #S.TCP.WINDOW + lda SKT.TCBCache+S.TCB.INFREE+1 + sta (ZPFrameOutPtr),y + iny + lda SKT.TCBCache+S.TCB.INFREE + sta (ZPFrameOutPtr),y + + jsr FRM.SendIP bcs .9 ldy #S.SOCKET.TCP.OPTIONS @@ -447,9 +400,8 @@ TCP.OUT.I ldy SKT.TCBCache+S.TCB.OUTUSED .8 ldy #S.SOCKET.TCP.OPTIONS lda #0 sta (ZPPtrSKT),y - - jmp SKT.StoreTCB -.88 clc + + clc .9 rts *-------------------------------------- TCP.NewFrame ldx #S.IP.PROTOCOL.TCP @@ -540,10 +492,23 @@ TCP.ComputeChecksum ldy #S.IP -.1 jsr DecDataInLen + lda ZPDataInLen + eor #$ff + tax + lda ZPDataInLen+1 + eor #$ff + + pha + +.1 inx + bne .11 + pla + inc beq .8 - lda (ZPTmpPtr1),y + pha + +.11 lda (ZPTmpPtr1),y adc IP.CHECKSUM sta IP.CHECKSUM @@ -551,14 +516,17 @@ TCP.ComputeChecksum bne .20 inc ZPTmpPtr1+1 -.20 jsr DecDataInLen +.20 inx bne .2 - lda #0 - bra .21 + pla + inc + beq .7 + + pha .2 lda (ZPTmpPtr1),y -.21 adc IP.CHECKSUM+1 + adc IP.CHECKSUM+1 sta IP.CHECKSUM+1 iny @@ -566,6 +534,9 @@ TCP.ComputeChecksum inc ZPTmpPtr1+1 bra .1 +.7 adc IP.CHECKSUM+1 A=0 from beq .7 + sta IP.CHECKSUM+1 + .8 ldy #S.TCP.CHECKSUM lda IP.CHECKSUM adc #0 Don't forget to add last carry!!! diff --git a/LIB/LIBTCPIP.S.txt b/LIB/LIBTCPIP.S.txt index 45717282..e818a4e0 100644 --- a/LIB/LIBTCPIP.S.txt +++ b/LIB/LIBTCPIP.S.txt @@ -108,8 +108,6 @@ L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED .DA TCP.IN.JMP.FINWT2 .DA TCP.IN.JMP.CLOSING .DA TCP.IN.JMP.TIMEWT -L.DUMP.LEN .DA DUMP.LEN -L.DUMP.DATA .DA DUMP.DATA .DA 0 *-------------------------------------- LIB.LOAD lda bFirstLoad @@ -168,8 +166,6 @@ POLL ldx #DEVMGR.READBLOCK cpx /S.ETH.ETHERTYPE.IP bne .9 -* jsr DumpFrame - jmp IP.IN .9 lda hFrameIn @@ -216,24 +212,6 @@ DecDataInLen lda ZPDataInLen .9 rts *-------------------------------------- NetDevJmp jmp * -*-------------------------------------- -DumpFrame ldy #3 - lda (ZPFrameInPtr),y - cmp #$ff - beq .9 - - >PUSHW ZPFrameInLen - >LDYA L.DUMP.LEN - >SYSCALL CPrintFYA - - ldy #63 -.1 >PUSHB (ZPFrameInPtr),y - dey - cpy #1 - bne .1 - >LDYA L.DUMP.DATA - >SYSCALL CPrintFYA -.9 rts *-------------------------------------- .INB LIB/LIBTCPIP.S.ARP .INB LIB/LIBTCPIP.S.CFG @@ -248,9 +226,6 @@ DumpFrame ldy #3 *-------------------------------------- CS.END *-------------------------------------- -DUMP.LEN >CSTR "Len :%D\r\n" -DUMP.DATA >CSTR "Data:%h%h%h%h%h%h%h%h%h%h%h%h%h%h %h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h\r\n %h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h %h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h\r\n" -*-------------------------------------- ARP.REQ .DA S.ARP-2 Frame size ARP.REQ.DSTMAC .HS FFFFFFFFFFFF ARP.REQ.SRCMAC .BS 6