diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 9412c957..a6e411e8 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/BIN/IPCONFIG.S.DHCP.txt b/BIN/IPCONFIG.S.DHCP.txt index b2ac6db3..ddfc4663 100644 --- a/BIN/IPCONFIG.S.DHCP.txt +++ b/BIN/IPCONFIG.S.DHCP.txt @@ -62,11 +62,12 @@ DHCP.RUN >PUSHBI 0 no protocol jsr Init.Timeout -DHCP.RUN.SDISC >PUSHWI DHCP.DISC.LEN +DHCP.RUN.SDISC >PUSHW L.SA.DEST + >PUSHWI DHCP.DISC.LEN >PUSHW L.DHCP.DISC >LDA.G hSocket - >LIBCALL hLIBTCPIP,LIBTCPIP.Send + >LIBCALL hLIBTCPIP,LIBTCPIP.SendTo bcc .1 jmp DHCP.RUN.KO @@ -100,10 +101,11 @@ DHCP.RUN.SREQ ldx #3 >LDYA L.MSG.DHCP.CFG2 >SYSCALL printf + >PUSHW L.SA.DEST >PUSHWI DHCP.REQ.LEN >PUSHW L.DHCP.REQ >LDA.G hSocket - >LIBCALL hLIBTCPIP,LIBTCPIP.Send + >LIBCALL hLIBTCPIP,LIBTCPIP.SendTo bcs DHCP.RUN.KO lda #S.IPCFG.STATUS.SREQ diff --git a/BIN/IPCONFIG.S.txt b/BIN/IPCONFIG.S.txt index 1bf36de7..38b47ff9 100644 --- a/BIN/IPCONFIG.S.txt +++ b/BIN/IPCONFIG.S.txt @@ -95,6 +95,7 @@ J.CFG.Keywords .DA CFG.Read.address *-------------------------------------- L.SA.LOCAL .DA SA.LOCAL L.SA.REMOTE .DA SA.REMOTE +L.SA.DEST .DA SA.DEST L.MSG.DHCP.CFG1 .DA MSG.DHCP.CFG1 L.MSG.DHCP.CFG2 .DA MSG.DHCP.CFG2 L.MSG.DHCP.KO .DA MSG.DHCP.KO @@ -465,6 +466,11 @@ SA.LOCAL .DA #AF.INET S.SOCKADDR.AF .DA UDP.PORT.DHCPC S.SOCKADDR.PORT *-------------------------------------- SA.REMOTE .DA #AF.INET S.SOCKADDR.AF + .BS 1 + .HS 00.00.00.00 S.SOCKADDR.ADDR + .DA UDP.PORT.DHCPS S.SOCKADDR.PORT +*-------------------------------------- +SA.DEST .DA #AF.INET S.SOCKADDR.AF .BS 1 .HS FF.FF.FF.FF S.SOCKADDR.ADDR .DA UDP.PORT.DHCPS S.SOCKADDR.PORT diff --git a/BIN/NETSTAT.S.txt b/BIN/NETSTAT.S.txt index 755ae684..2d324ff9 100644 --- a/BIN/NETSTAT.S.txt +++ b/BIN/NETSTAT.S.txt @@ -60,6 +60,7 @@ L.MSG1.S .DA MSG1.S.0 .DA MSG1.S.8 .DA MSG1.S.9 .DA MSG1.S.10 + .DA MSG1.S.11 .DA MSG1.S.INV .DA 0 *-------------------------------------- @@ -193,16 +194,17 @@ MSG1.P.TCP .AZ "TCP " MSG1.P.UDP .AZ "UDP " MSG1.P.INV .AZ "??? " MSG1.S.0 .AZ "*" -MSG1.S.1 .AZ "LISTENING" -MSG1.S.2 .AZ "SYN-SENT" -MSG1.S.3 .AZ "SYN-RECEIVED" -MSG1.S.4 .AZ "ESTABLISHED" -MSG1.S.5 .AZ "CLOSE-WAIT" -MSG1.S.6 .AZ "LAST-ACK" -MSG1.S.7 .AZ "FIN-WAIT-1" -MSG1.S.8 .AZ "FIN-WAIT-2" -MSG1.S.9 .AZ "CLOSING" -MSG1.S.10 .AZ "TIME-WAIT" +MSG1.S.1 .AZ "OPENED" +MSG1.S.2 .AZ "LISTENING" +MSG1.S.3 .AZ "SYN-SENT" +MSG1.S.4 .AZ "SYN-RECEIVED" +MSG1.S.5 .AZ "ESTABLISHED" +MSG1.S.6 .AZ "CLOSE-WAIT" +MSG1.S.7 .AZ "LAST-ACK" +MSG1.S.8 .AZ "FIN-WAIT-1" +MSG1.S.9 .AZ "FIN-WAIT-2" +MSG1.S.10 .AZ "CLOSING" +MSG1.S.11 .AZ "TIME-WAIT" MSG1.S.INV .AZ "???" *-------------------------------------- .DUMMY diff --git a/BIN/SH.S.EXP.txt b/BIN/SH.S.EXP.txt index 35f5651f..16e0f816 100644 --- a/BIN/SH.S.EXP.txt +++ b/BIN/SH.S.EXP.txt @@ -11,35 +11,28 @@ EXP.GET jsr CORE.ArgV.Next .1 >LDYA ZPArgVBufPrev >SYSCALL AToL - bcs .99 - - >PULLL M32.ACC + bcs .9 .2 >LDYA L.EXP.OP.MATH + - .... ? jsr CORE.LookupArgVBuf - bcs .9 + bcs .94 txa >STA.G CORE.Operator - - jsr M32.ACC2ARG jsr CORE.ArgV.Next get next argument in ACC - beq .9 + beq .94 >LDYA ZPArgVBufPtr >SYSCALL AToL - bcs .9 + bcs .94 - >PULLL M32.ACC - jsr EXP.GET.OP -.99 bcs .9 + jsr EXP.FPU.EXEC jsr CORE.ArgV.Next another op ? bne .2 -.8 >PUSHL M32.ACC - >PUSHBI 4 +.8 >PUSHBI 4 ACC on stack >PUSHW L.M32.Printf >LEA.G M32.BUF >SYSCALL sprintf @@ -49,14 +42,21 @@ EXP.GET jsr CORE.ArgV.Next rts +.94 lda pStack POP 4 bytes + clc + adc #4 + sta pStack + .9 lda #E.ESYN sec rts -EXP.GET.OP >LDA.G CORE.Operator - asl +EXP.FPU.EXEC >LDA.G CORE.Operator tax - jmp (J.EXP.OP.MATH,x) + lda EXP.OP.MATH.FPU,x + tax + + jmp A2osX.FpuCall *-------------------------------------- EXP.TEST lda (ZPArgVBufPtr) beq .9 @@ -281,8 +281,36 @@ EXP.TEST.BINARY.NUM >PULLL M32.ARG - jsr M32.Cmp + ldx #4 + ldy #0 + + sec + +.1 lda M32.ARG,y + sbc M32.ACC,y + sta M32.ACC,y + iny + dex + bne .1 + + bcc .5 CC if ACC < ARG + + lda M32.ACC + ora M32.ACC+1 + ora M32.ACC+2 + ora M32.ACC+3 Z if ACC = ARG + + bne .4 + + lda #%010 010 ACC = ARG + bra EXP.TEST.BINARY.END + +.4 lda #%100 100 ACC > ARG + bra EXP.TEST.BINARY.END + +.5 lda #%001 001 ACC < ARG + EXP.TEST.BINARY.END pha diff --git a/BIN/SH.S.txt b/BIN/SH.S.txt index 6758db41..d176a02e 100644 --- a/BIN/SH.S.txt +++ b/BIN/SH.S.txt @@ -1,6 +1,5 @@ NEW -PREFIX -AUTO 4,1 + AUTO 4,1 .LIST OFF .OP 65C02 .OR $2000 @@ -182,11 +181,6 @@ J.EXP.OP.UNARY .DA EXP.OP.UNARY.D .DA EXP.OP.UNARY.Z L.EXP.OP.BINARY .DA EXP.OP.BINARY L.EXP.OP.MATH .DA EXP.OP.MATH -J.EXP.OP.MATH .DA M32.Add - .DA M32.Sub - .DA M32.Mul - .DA M32.Div - .DA M32.Mod L.EXP.OP.LOGIC .DA EXP.OP.LOGIC L.HOME .DA HOME L.HOME.PROFILE .DA HOME.PROFILE @@ -694,11 +688,11 @@ EXP.OP.MATH .AZ "+" .AZ "/" .AZ "MOD" .HS 00 +EXP.OP.MATH.FPU .DA #0,#2,#6,#10,#14 EXP.OP.LOGIC .AZ "AND" .AZ "OR" .HS 00 *-------------------------------------- - .INB USR/SRC/SHARED/X.M32.S .INB USR/SRC/SHARED/X.ERRORS.S *-------------------------------------- EscChars .AS 'DBAC' diff --git a/DRV/UTHERNET.DRV.S.txt b/DRV/UTHERNET.DRV.S.txt index a80b4770..3e0ff728 100644 --- a/DRV/UTHERNET.DRV.S.txt +++ b/DRV/UTHERNET.DRV.S.txt @@ -453,16 +453,6 @@ WRITE php >STYA ZPIOCTL ldx DEVSLOTx0 - -* lda /PP.BufEvent -* sta PacketPagePTR+1,x -* lda #PP.BufEvent -* sta PacketPagePTR,x - -* lda PacketPageDATA+1,x -* ldy PacketPageDATA,x -* and /PP.BufEvent.Rdy4Tx -* beq .9 lda /PP.TxCMD.LID+PP.TxCMD.TxStartFULL sta TxCMD+1,x @@ -495,7 +485,7 @@ WRITE php lda PacketPageDATA+1,x ldy PacketPageDATA,x - and /PP.BusST.Rdy4TxNOW + bit /PP.BusST.Rdy4TxNOW beq READWRITE.9 ldy #S.IOCTL.BUFPTR diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index 458c49ef..a0a3f706 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -46,7 +46,7 @@ ZPBIN.SIZE .EQ 40 8+32 A2osX.SYSCALL .EQ $BD00 A2osX.LIBCALL .EQ $BD03 A2osX.ATKCALL .EQ $BD06 -A2osX.ROMCALL .EQ $BD09 +A2osX.FPUCALL .EQ $BD09 A2osX.BADCALL .EQ $BD0C *-------------------------------------- A2osX.SLEEP .EQ $BD10 diff --git a/INC/LIBBLKDEV.I.txt b/INC/LIBBLKDEV.I.txt index 56194db9..71649dba 100644 --- a/INC/LIBBLKDEV.I.txt +++ b/INC/LIBBLKDEV.I.txt @@ -1,13 +1,9 @@ NEW -PREFIX -AUTO 4,1 - .LIST OFF - .OP 65C02 -*-------------------------------------- - + AUTO 3,1 + .LIST OFF *-------------------------------------- LIBBLKDEV.GetProDOSCatSize .EQ 4 LIBBLKDEV.BuildProDOSCat .EQ 6 *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/LIBBLKDEV.I +SAVE INC/LIBBLKDEV.I diff --git a/INC/LIBCRYPT.I.txt b/INC/LIBCRYPT.I.txt index ef02a681..16aec9ab 100644 --- a/INC/LIBCRYPT.I.txt +++ b/INC/LIBCRYPT.I.txt @@ -1,8 +1,6 @@ NEW -PREFIX -AUTO 4,1 - .LIST OFF - .OP 65C02 + AUTO 3,1 + .LIST OFF *-------------------------------------- LIBCRYPT.MD5 .EQ 4 LIBCRYPT.MD5Init .EQ 6 @@ -23,4 +21,4 @@ S.MD5.FINALIZED .EQ 25 S.MD5 .EQ 26 *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/LIBCRYPT.I +SAVE INC/LIBCRYPT.I diff --git a/INC/LIBGUI.I.txt b/INC/LIBGUI.I.txt index 1db7b9fb..b29eb4a1 100644 --- a/INC/LIBGUI.I.txt +++ b/INC/LIBGUI.I.txt @@ -1,8 +1,6 @@ NEW -PREFIX -AUTO 4,1 - .LIST OFF - .OP 65C02 + AUTO 3,1 + .LIST OFF *-------------------------------------- LIBGUI.Draw .EQ 4 LIBGUI.SetCursor .EQ 6 @@ -156,6 +154,6 @@ S.TEXT.TEXT .EQ S.OBJ+8 * ... *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/LIBGUI.I +SAVE INC/LIBGUI.I LOAD USR/SRC/LIB/LIBGUI.S ASM diff --git a/INC/LIBPAK.I.txt b/INC/LIBPAK.I.txt index 6c275390..db2eef37 100644 --- a/INC/LIBPAK.I.txt +++ b/INC/LIBPAK.I.txt @@ -1,6 +1,6 @@ NEW -PREFIX -AUTO 4,1 + AUTO 3,1 + .LIST OFF *-------------------------------------- * File Header : *-------------------------------------- @@ -31,4 +31,4 @@ LIBPAK.Pak .EQ 4 LIBPAK.UnPak .EQ 6 *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/LIBPAK.I +SAVE INC/LIBPAK.I diff --git a/INC/LIBTCPIP.I.txt b/INC/LIBTCPIP.I.txt index 26409b62..05fa7710 100644 --- a/INC/LIBTCPIP.I.txt +++ b/INC/LIBTCPIP.I.txt @@ -5,7 +5,7 @@ NEW *-------------------------------------- K.ARPCACHE.SIZE .EQ 10 K.DNSCACHE.SIZE .EQ 10 -K.SKTTABLE.SIZE .EQ 64 +K.SKTTABLE.SIZE .EQ 16 K.FRMQUEUE.SIZE .EQ 16 K.FRMSEND.RETRY .EQ 10 K.ETH.FRAME.LEN .EQ 1514 @@ -150,11 +150,14 @@ S.SOCKET.REM.PORT .EQ S.FD.DSOCK+14 * Raw Type Queue * Datagram type Queue * Seq Packet type Queue +*-------------------------------------- S.SOCKET.HQ.HEAD .EQ S.FD.DSOCK+16 S.SOCKET.HQ.TAIL .EQ S.FD.DSOCK+17 S.SOCKET.HQ .EQ S.FD.DSOCK+18 S.SOCKET.HQ.MAX .EQ 14 14 hMem (frames) +*-------------------------------------- * Stream type Queue +*-------------------------------------- S.SOCKET.SQ.hInMem .EQ S.FD.DSOCK+16 S.SOCKET.SQ.hOutMem .EQ S.FD.DSOCK+17 * @@ -162,35 +165,35 @@ S.SOCKET .EQ S.FD.DSOCK+32 *-------------------------------------- S.SOCKET.TCP.S .EQ S.SOCKET S.SOCKET.TCP.S.CLOSED .EQ 0 -S.SOCKET.TCP.S.LISTEN .EQ 1 -S.SOCKET.TCP.S.SYNSENT .EQ 2 -S.SOCKET.TCP.S.SYNRCVD .EQ 3 -S.SOCKET.TCP.S.ESTBLSH .EQ 4 -S.SOCKET.TCP.S.CLWAIT .EQ 5 -S.SOCKET.TCP.S.LASTACK .EQ 6 -S.SOCKET.TCP.S.FINWT1 .EQ 7 -S.SOCKET.TCP.S.FINWT2 .EQ 8 -S.SOCKET.TCP.S.CLOSING .EQ 9 -S.SOCKET.TCP.S.TIMEWT .EQ 10 - +S.SOCKET.TCP.S.OPENED .EQ 1 +S.SOCKET.TCP.S.LISTEN .EQ 2 +S.SOCKET.TCP.S.SYNSENT .EQ 3 +S.SOCKET.TCP.S.SYNRCVD .EQ 4 +S.SOCKET.TCP.S.ESTBLSH .EQ 5 +S.SOCKET.TCP.S.CLWAIT .EQ 6 +S.SOCKET.TCP.S.LASTACK .EQ 7 +S.SOCKET.TCP.S.FINWT1 .EQ 8 +S.SOCKET.TCP.S.FINWT2 .EQ 9 +S.SOCKET.TCP.S.CLOSING .EQ 10 +S.SOCKET.TCP.S.TIMEWT .EQ 11 +* S.SOCKET.TCP.O .EQ S.SOCKET+1 - -S.SOCKET.TCP.INTAIL .EQ S.SOCKET+2 -S.SOCKET.TCP.INHEAD .EQ S.SOCKET+4 -S.SOCKET.TCP.INFREE .EQ S.SOCKET+6 -S.SOCKET.TCP.INUSED .EQ S.SOCKET+8 * -S.SOCKET.TCP.OUTTAIL .EQ S.SOCKET+10 -S.SOCKET.TCP.OUTTAILSENT .EQ S.SOCKET+12 -S.SOCKET.TCP.OUTHEAD .EQ S.SOCKET+14 -S.SOCKET.TCP.OUTFREE .EQ S.SOCKET+16 -S.SOCKET.TCP.OUTTOSEND .EQ S.SOCKET+18 -S.SOCKET.TCP.OUTUSED .EQ S.SOCKET+20 +S.SOCKET.TCP.INSEQNUM .EQ S.SOCKET+2 Recv:Last SEQ received from remote +S.SOCKET.TCP.OUTNEXTSEQ .EQ S.SOCKET+6 Send:Next SEQ to send +S.SOCKET.TCP.OUTSENTSEQ .EQ S.SOCKET+10 Send:SEQ sent not yet ACKed (retransmit) * -S.SOCKET.TCP.INSEQNUM .EQ S.SOCKET+22 Recv:Last SEQ received from remote - -S.SOCKET.TCP.OUTNEXTSEQ .EQ S.SOCKET+26 Send:Next SEQ to send -S.SOCKET.TCP.OUTSENTSEQ .EQ S.SOCKET+30 Send:SEQ sent not yet ACKed (retransmit) +S.SOCKET.TCP.INTAIL .EQ S.SOCKET+14 +S.SOCKET.TCP.INHEAD .EQ S.SOCKET+16 +S.SOCKET.TCP.INFREE .EQ S.SOCKET+18 +S.SOCKET.TCP.INUSED .EQ S.SOCKET+20 +* +S.SOCKET.TCP.OUTTAIL .EQ S.SOCKET+22 +S.SOCKET.TCP.OUTTAILSENT .EQ S.SOCKET+24 +S.SOCKET.TCP.OUTHEAD .EQ S.SOCKET+26 +S.SOCKET.TCP.OUTFREE .EQ S.SOCKET+28 +S.SOCKET.TCP.OUTTOSEND .EQ S.SOCKET+30 +S.SOCKET.TCP.OUTUSED .EQ S.SOCKET+32 * S.SOCKET.TCP .EQ S.SOCKET+34 *-------------------------------------- diff --git a/INC/MACROS.I.txt b/INC/MACROS.I.txt index 5e7fc49a..37afd8d8 100644 --- a/INC/MACROS.I.txt +++ b/INC/MACROS.I.txt @@ -1,6 +1,6 @@ NEW -PREFIX -AUTO 4,1 + AUTO 3,1 + .LIST OFF *-------------------------------------- .MA DEBUG :1 bit $C000 @@ -27,11 +27,6 @@ AUTO 4,1 ldx #]2 jsr A2osX.LIBCALL .EM -*-------------------------------------- - .MA ROMCALL - ldx #ROM.]1 - jsr A2osX.ROMCALL - .EM *-------------------------------------- .MA SLEEP jsr A2osX.SLEEP @@ -122,6 +117,48 @@ AUTO 4,1 jsr GP.MLICall .EM *-------------------------------------- +* FPU +*-------------------------------------- + .MA ADD32 + ldx #0 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA SUB32 + ldx #2 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA MUL32 + ldx #4 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA IMUL32 + ldx #6 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA DIV32 + ldx #8 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA IDIV32 + ldx #10 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA MOD32 + ldx #12 + jsr A2osX.FpuCall + .EM +*-------------------------------------- + .MA IMOD32 + ldx #14 + jsr A2osX.FpuCall + .EM +*-------------------------------------- * Global DATA Segment Access *-------------------------------------- .MA LEA.G @@ -471,5 +508,6 @@ AUTO 4,1 .AS "]1" :1 .EQ * .EM +*-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/MACROS.I +SAVE INC/MACROS.I diff --git a/INC/MLI.E.I.txt b/INC/MLI.E.I.txt index 30ad1796..9a986d9b 100644 --- a/INC/MLI.E.I.txt +++ b/INC/MLI.E.I.txt @@ -1,8 +1,5 @@ -PR#3 -PREFIX NEW -INC 1 -AUTO 6 + AUTO 3,1 .LIST OFF *-------------------------------------- *$00 - No Error @@ -39,4 +36,4 @@ MLI.E.OPEN .EQ $50 File Already Open * .EQ $5A File Structure Damaged *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/MLI.E.I +SAVE INC/MLI.E.I diff --git a/INC/MONITOR.I.txt b/INC/MONITOR.I.txt index b4b9796a..75cde81c 100644 --- a/INC/MONITOR.I.txt +++ b/INC/MONITOR.I.txt @@ -1,10 +1,9 @@ NEW -PREFIX -AUTO 4,1 + AUTO 3,1 + .LIST OFF *-------------------------------------- * ROM Standard Routines *-------------------------------------- - .LIST OFF BRKVECT .EQ $3F0 POWERUP .EQ $3F2 POWERUPBYTE .EQ $3F4 @@ -89,4 +88,4 @@ MONZ .EQ $FF69 ENTER MONITOR QUIETLY GETNUM .EQ $FFA7 ASCII TO HEX IN 3E & 3F *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/MONITOR.I +SAVE INC/MONITOR.I diff --git a/INC/NET.SMB.I.txt b/INC/NET.SMB.I.txt index 98827bc4..6fb614db 100644 --- a/INC/NET.SMB.I.txt +++ b/INC/NET.SMB.I.txt @@ -5,6 +5,7 @@ TCP.PORT.CIFS .EQ 445 *-------------------------------------- S.SMB.HEADER.PROTO .EQ 0 \xFF 'SMB' S.SMB.HEADER.CMD .EQ 4 +S.SMB.HEADER.CMD.NEGOTIATE .EQ $72 S.SMB.HEADER.STATUS .EQ 5 S.SMB.HEADER.FLAGS .EQ 9 S.SMB.HEADER.FLAGS.LOCKANDREADOK .EQ 1 @@ -17,9 +18,6 @@ S.SMB.HEADER.FLAGS2.DFS .EQ %00010000.00000000 S.SMB.HEADER.FLAGS2.READIFEXEC .EQ %00100000.00000000 S.SMB.HEADER.FLAGS2.NTSTATUS .EQ %01000000.00000000 S.SMB.HEADER.FLAGS2.UNICODE .EQ %10000000.00000000 - - - S.SMB.HEADER.PIDHI .EQ 12 S.SMB.HEADER.SECFEAT .EQ 14 S.SMB.HEADER.RSVD .EQ 22 diff --git a/INC/NIC.8900A.I.txt b/INC/NIC.8900A.I.txt index 6d19868d..01514515 100644 --- a/INC/NIC.8900A.I.txt +++ b/INC/NIC.8900A.I.txt @@ -102,4 +102,4 @@ PP.RxFrame .EQ $0404 PP.TxFrame .EQ $0A00 *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/NIC.8900A.I +SAVE INC/NIC.8900A.I diff --git a/INC/NIC.91C96.I.txt b/INC/NIC.91C96.I.txt index a961ca2d..b837ffa0 100644 --- a/INC/NIC.91C96.I.txt +++ b/INC/NIC.91C96.I.txt @@ -61,4 +61,4 @@ L91C96.3.RCV .EQ $C08C L91C96.BSR .EQ $C08E *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/NIC.91C96.I +SAVE INC/NIC.91C96.I diff --git a/INC/NIC.W5100.I.txt b/INC/NIC.W5100.I.txt index dc291967..35f1bf2e 100644 --- a/INC/NIC.W5100.I.txt +++ b/INC/NIC.W5100.I.txt @@ -75,4 +75,4 @@ RX.BASE .EQ $6000 RXTX.MASK .EQ $1FFF *-------------------------------------- MAN -SAVE /A2OSX.BUILD/INC/NIC.W5100.I +SAVE INC/NIC.W5100.I diff --git a/LIB/LIBTCPIP.S.CFG.txt b/LIB/LIBTCPIP.S.CFG.txt index c2a169e1..d43d9000 100644 --- a/LIB/LIBTCPIP.S.CFG.txt +++ b/LIB/LIBTCPIP.S.CFG.txt @@ -80,7 +80,15 @@ CFG.SET >PULLW ZPTmpPtr1 IPCFG >PUSHW L.SA.LOCAL lda hDNSSocket - jmp SKT.Bind + jsr SKT.Bind + bcs .9 + + >LDYAI UDP.PORT.DNS + >STYA SA.REMOTE+S.SOCKADDR.PORT + + >PUSHW L.SA.REMOTE + lda hDNSSocket + jmp SKT.Connect .8 clc .9 rts diff --git a/LIB/LIBTCPIP.S.FRM.txt b/LIB/LIBTCPIP.S.FRM.txt index 5f00eb75..14f12cd4 100644 --- a/LIB/LIBTCPIP.S.FRM.txt +++ b/LIB/LIBTCPIP.S.FRM.txt @@ -148,7 +148,11 @@ FRM.NewIP stx .8+1 .9 rts *-------------------------------------- -FRM.SendIP ldx #3 Copy SRC.IP even if IP offload +* clc Queue if fail +* sec DONT Queue if fail +*-------------------------------------- +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 @@ -229,7 +233,7 @@ FRM.SendIP ldx #3 Copy SRC.IP even if IP offload sbc /S.IP dey - sta (ZPFrameOutPtr),y + sta (ZPFrameOutPtr),y jsr IP.ComputeUDPChecksum bra .5 @@ -249,11 +253,16 @@ FRM.SendIP ldx #3 Copy SRC.IP even if IP offload bcs FRM.Queue jsr FRM.Discard + + plp clc rts *-------------------------------------- -FRM.Queue ldy hFrameOut no hFrame, cannot queue for retry - beq .9 +FRM.Queue plp + bcs .9 DONT queue + + ldy hFrameOut no hFrame, cannot queue for retry + beq FRM.Discard.9 ldx FRM.QUEUE.Head inx @@ -263,7 +272,7 @@ FRM.Queue ldy hFrameOut no hFrame, cannot queue for retry ldx #0 .1 cpx FRM.QUEUE.Tail - beq FRM.Discard + beq FRM.Discard CS ldy FRM.QUEUE.Head stx FRM.QUEUE.Head @@ -278,52 +287,51 @@ FRM.Queue ldy hFrameOut no hFrame, cannot queue for retry lda ZPFrameOutLen+1 sta FRM.QUEUE.LenH,y -.9 sec - rts + clc +.9 rts *-------------------------------------- FRM.Discard lda hFrameOut - beq .9 + beq FRM.Discard.9 >SYSCALL2 FreeMem stz hFrameOut -.9 sec + +FRM.Discard.9 sec rts *-------------------------------------- FRM.Retry ldx FRM.QUEUE.Tail -.10 cpx FRM.QUEUE.Head +.1 cpx FRM.QUEUE.Head beq .8 Queue is empty, exit... - lda FRM.QUEUE.hMem,x - >SYSCALL2 GetMemPtr - >STYA ZPFrameOutPtr - - ldx FRM.QUEUE.Tail - lda FRM.QUEUE.LenL,x sta ZPFrameOutLen lda FRM.QUEUE.LenH,x sta ZPFrameOutLen+1 + lda FRM.QUEUE.hMem,x + >SYSCALL2 GetMemPtr + >STYA ZPFrameOutPtr + + ldx FRM.QUEUE.Tail + lda FRM.QUEUE.State,x cmp #ERR.ARP.PENDING - bne .1 + bne .2 jsr IP.SetDestMAC Err is ARP or higher, retry getting MAC - bcs .2 still error getting dest MAC + bcs .3 still error getting dest MAC -.1 jsr FRM.Send try sending again to DRV - bcc .3 - -.2 ldx FRM.QUEUE.Tail save error... - sta FRM.QUEUE.State,x +.2 jsr FRM.Send try sending again to DRV + bcc .4 + +.3 ldx FRM.QUEUE.Tail + sta FRM.QUEUE.State,x save error... dec FRM.QUEUE.Retry,x bne .8 exit....until next run! -.3 ldx FRM.QUEUE.Tail Success,or max retry, discard entry - lda FRM.QUEUE.hMem,x - >SYSCALL2 FreeMem +.4 ldx FRM.QUEUE.Tail + lda FRM.QUEUE.hMem,x Success,or max retry, discard entry - ldx FRM.QUEUE.Tail inx cpx #K.FRMQUEUE.SIZE bne .5 @@ -331,8 +339,10 @@ FRM.Retry ldx FRM.QUEUE.Tail ldx #0 .5 stx FRM.QUEUE.Tail - bra .10 + >SYSCALL2 FreeMem + bra FRM.Retry + .8 rts *-------------------------------------- FRM.Send ldx #3 diff --git a/LIB/LIBTCPIP.S.ICMP.txt b/LIB/LIBTCPIP.S.ICMP.txt index 30ddcbfc..c17707e7 100644 --- a/LIB/LIBTCPIP.S.ICMP.txt +++ b/LIB/LIBTCPIP.S.ICMP.txt @@ -42,6 +42,7 @@ ICMP.IN.ECHOREQ ldy #S.IP.DST+3 dex bpl .3 + clc Queue if fail jmp FRM.SendIP ICMP.IN.EXIT lda hFrameIn @@ -54,16 +55,14 @@ ICMP.IN.ECHOREP jsr FRM.GetTargetSKT.RAW ldy #S.ICMP.IDENTIFIER lda (ZPFrameInPtr),y - sta SKT.LOC.ADDR+S.SOCKADDR.PORT + sta SKT.LOC.ADDR+S.SOCKADDR.PORT+1 iny lda (ZPFrameInPtr),y - sta SKT.LOC.ADDR+S.SOCKADDR.PORT+1 + sta SKT.LOC.ADDR+S.SOCKADDR.PORT jsr SKT.FindMatchingLocRem bcs ICMP.IN.EXIT - ldy #S.SOCKET.PROTO - lda (ZPPtrSKT),y ldy #S.SOCKET.PROTO lda (ZPPtrSKT),y cmp #S.IP.PROTOCOL.ICMP diff --git a/LIB/LIBTCPIP.S.IP.txt b/LIB/LIBTCPIP.S.IP.txt index dfbe3e0a..b2621b4f 100644 --- a/LIB/LIBTCPIP.S.IP.txt +++ b/LIB/LIBTCPIP.S.IP.txt @@ -2,25 +2,20 @@ NEW AUTO 3,1 .LIST OFF *-------------------------------------- -IP.IN ldy #S.IP.PROTOCOL +IP.IN ldy #S.IP.PROTOCOL lda (ZPFrameInPtr),y cmp #S.IP.PROTOCOL.ICMP bne .2 + jmp ICMP.IN .2 cmp #S.IP.PROTOCOL.UDP bne .3 - - jsr FRM.GetTargetSKT.TCPUDP + jsr FRM.GetTargetSKT.TCPUDP jsr SKT.FindMatchingLocRem bcs .9 - ldy #S.SOCKET.PROTO - lda (ZPPtrSKT),y - cmp #S.IP.PROTOCOL.UDP - bne .9 - lda hFrameIn jsr SKT.AddToQueueA bcs .9 Q full, discard... @@ -28,7 +23,7 @@ IP.IN ldy #S.IP.PROTOCOL .3 cmp #S.IP.PROTOCOL.TCP bne .9 - jsr TCP.IN TCP will NOT discard FrameIn + jsr TCP.IN TCP may NOT discard FrameIn .9 lda hFrameIn beq .8 diff --git a/LIB/LIBTCPIP.S.SKT.txt b/LIB/LIBTCPIP.S.SKT.txt index 65d044bf..00185858 100644 --- a/LIB/LIBTCPIP.S.SKT.txt +++ b/LIB/LIBTCPIP.S.SKT.txt @@ -184,17 +184,18 @@ SKT.connect.SEQPACKET jsr SKT.NewTCB bcs SKT.listen.RTS + lda #S.SOCKET.TCP.S.OPENED + jsr SKT.StoreTCB.S + lda #S.TCP.OPTIONS.SYN jsr TCP.OUT.SendOptA Send SYN -* bcs .9 could be queued for ARP.... + bcs .8 failed ARP lookup.... lda #S.SOCKET.TCP.S.SYNSENT jmp SKT.StoreTCB.S - -*.9 lda #ERR.SKT.BAD -* sec -* clc -*.99 rts + +.8 clc + rts */-------------------------------------- * # Listen * Listen for connections on a socket @@ -366,15 +367,14 @@ SKT.shutdown.STREAM lda #S.SOCKET.TCP.S.FINWT1 jmp SKT.StoreTCB.S -.1 bcs .8 Already Closing -* cmp #S.SOCKET.TCP.S.TIMEWT -* beq .8 +.1 cmp #S.SOCKET.TCP.S.CLWAIT + beq .3 - lda #S.TCP.OPTIONS.RST +.2 lda #S.TCP.OPTIONS.RST jsr TCP.OUT.SendOptA Send RST bcs .9 - lda #S.SOCKET.TCP.S.TIMEWT +.3 lda #S.SOCKET.TCP.S.TIMEWT jmp SKT.StoreTCB.S .8 clc @@ -926,8 +926,10 @@ SKT.Send clc jsr SKT.PullhFDDataInPtrLen plp bcc .1 + jsr SKT.PullRemAddr - jsr SKT.SetRemAddr +* jsr SKT.SetRemAddr + .1 ldy #S.SOCKET.T lda (ZPPtrSKT),y tax @@ -938,17 +940,18 @@ SKT.Send.RAW ldy #S.SOCKET.PROTO tax >LDYA ZPDataInLen jsr FRM.NewIP - bcs SKT.Send.9 - bra SKT.Send.DGRAM.8 + bcc SKT.Send.8 + + rts *-------------------------------------- SKT.Send.DGRAM ldx #S.IP.PROTOCOL.UDP - >LDYA ZPDataInLen jsr FRM.NewIP bcs SKT.Send.9 jsr SKT.SetFrameOutTCPUDPPorts -SKT.Send.DGRAM.8 - jsr SKT.SetFrameOutDstIP + +SKT.Send.8 jsr SKT.SetFrameOutDstIP jsr SKT.CopyDataInToOut + clc Queue if fail jmp FRM.SendIP *-------------------------------------- SKT.Send.STREAM lda #ERR.SKT.BAD @@ -956,7 +959,13 @@ SKT.Send.STREAM lda #ERR.SKT.BAD SKT.Send.9 rts *-------------------------------------- SKT.Send.SEQPACKET - bra * + >LDYA ZPDataInLen + jsr TCP.NewFrame + bcs SKT.Send.9 + + jsr SKT.CopyDataInToOut + sec DONT Queue if fail + jmp FRM.SendIP */-------------------------------------- * # GetSockOpt * Set Socket Options @@ -1041,15 +1050,18 @@ SKT.CheckStream ldy #S.SOCKET.T cmp #S.SOCKET.TCP.S.ESTBLSH bcc .8 cmp #S.SOCKET.TCP.S.CLWAIT - bcs .91 + bne .91 + .8 lda #0 + clc rts CC=ESTBLSH...or less .91 lda #MLI.E.IO sec rts -.99 lda #ERR.SKT.BAD +.99 +SKT.BAD lda #ERR.SKT.BAD sec rts */-------------------------------------- @@ -1105,10 +1117,14 @@ SKT.SetRemAddr ldy #S.SOCKET.REM.PORT+1 bcs .1 rts *-------------------------------------- +* SKT.REM.ADDR = Incoming Frame SRC +* SKT.LOC.ADDR = Incoming Frame DST +*-------------------------------------- SKT.FindMatchingLocRem .DO IPDEBUG=1 jsr FRM.Dump .FIN + ldx #0 .1 lda SKT.TABLE,x @@ -1127,6 +1143,13 @@ SKT.FindMatchingLocRem cmp #AF.INET bne .8 + ldy #S.SOCKET.PROTO + lda (ZPPtrSKT),y + + ldy #S.IP.PROTOCOL + cmp (ZPFrameInPtr),y + bne .8 + ldy #S.SOCKET.LOC.ADDR .2 lda (ZPPtrSKT),y @@ -1155,27 +1178,26 @@ SKT.FindMatchingLocRem .6 lda SKT.REM.ADDR+S.SOCKADDR.ADDR - cmp #$ff FF.FF.FF.FF, Broadcast ? + cmp #$ff incoming frame is FF.FF.FF.FF, Broadcast ? bne .41 + * ldy #S.SOCKET.O lda (ZPPtrSKT),y and #S.SOCKET.O.BROADCAST - beq .9 this socket does not accept broadcast + bne .43 +* sec + rts this socket does not accept broadcast - bra .43 - .41 ldy #S.SOCKET.REM.ADDR -.5 lda (ZPPtrSKT),y - - cmp #$ff accept 255.255.255.255 ? - bne .42 + lda (ZPPtrSKT),y + bne .44 -.43 ldy #S.SOCKET.REM.PORT Boradcast, check port only +.43 ldy #S.SOCKET.REM.PORT Frame is Broadcast, or listening is 0.0.0.0 check port only .42 lda (ZPPtrSKT),y - cmp SKT.REM.ADDR+S.SOCKADDR.ADDR-S.SOCKET.REM.ADDR,y +.44 cmp SKT.REM.ADDR+S.SOCKADDR.ADDR-S.SOCKET.REM.ADDR,y bne .8 wrong remote host, exit.... iny cpy #S.SOCKET.REM.PORT+2 @@ -1221,7 +1243,7 @@ SKT.AddToQueueA pha * sec rts *-------------------------------------- -SKT.NewTCB ldx #S.SOCKET.TCP.INTAIL +SKT.NewTCB ldx #S.SOCKET.TCP.INSEQNUM .1 stz SKT.Cache,x inx @@ -1262,7 +1284,7 @@ SKT.NewTCB ldx #S.SOCKET.TCP.INTAIL * clc .9 rts *-------------------------------------- -SKT.GetTCB ldy #S.SOCKET.TCP.INTAIL +SKT.GetTCB ldy #S.SOCKET.TCP.INSEQNUM .1 lda (ZPPtrSKT),y sta SKT.Cache,y iny @@ -1273,7 +1295,7 @@ SKT.GetTCB ldy #S.SOCKET.TCP.INTAIL SKT.StoreTCB.S ldy #S.SOCKET.TCP.S sta (ZPPtrSKT),y -SKT.StoreTCB ldy #S.SOCKET.TCP.INTAIL +SKT.StoreTCB ldy #S.SOCKET.TCP.INSEQNUM .1 lda SKT.Cache,y sta (ZPPtrSKT),y iny @@ -1284,22 +1306,34 @@ SKT.StoreTCB ldy #S.SOCKET.TCP.INTAIL *-------------------------------------- SKT.SetFrameOutDstIP ldy #S.SOCKET.REM.ADDR - ldx #4 + ldx #3 .1 lda (ZPPtrSKT),y + beq .3 pha iny dex - bne .1 + bpl .1 ldy #S.IP.DST+3 - ldx #4 + ldx #3 .2 pla sta (ZPFrameOutPtr),y dey dex - bne .2 + bpl .2 + + rts + +.3 ldy #S.IP.DST+3 + +.4 lda SKT.REM.ADDR+S.SOCKADDR.ADDR,x + sta (ZPFrameOutPtr),y + dey + dex + bpl .4 + rts *-------------------------------------- SKT.SetFrameOutTCPUDPPorts @@ -1316,10 +1350,17 @@ SKT.SetFrameOutTCPUDPPorts ldy #S.SOCKET.REM.PORT lda (ZPPtrSKT),y + beq .1 + tax iny lda (ZPPtrSKT),y - ldy #S.TCPUDP.DSTPORT + bra .2 + +.1 lda SKT.REM.ADDR+S.SOCKADDR.PORT+1 + ldx SKT.REM.ADDR+S.SOCKADDR.PORT + +.2 ldy #S.TCPUDP.DSTPORT sta (ZPFrameOutPtr),y iny txa diff --git a/LIB/LIBTCPIP.S.TCP.txt b/LIB/LIBTCPIP.S.TCP.txt index 7f3f0fed..5c5ba671 100644 --- a/LIB/LIBTCPIP.S.TCP.txt +++ b/LIB/LIBTCPIP.S.TCP.txt @@ -3,15 +3,9 @@ NEW .LIST OFF *-------------------------------------- TCP.IN jsr FRM.GetTargetSKT.TCPUDP - jsr SKT.FindMatchingLocRem bcs TCP.IN.JMP.CLOSED no socket, go discard - ldy #S.SOCKET.PROTO - lda (ZPPtrSKT),y - cmp #S.IP.PROTOCOL.TCP - bne TCP.IN.JMP.CLOSED wrong protocol, go discard - ldy #S.TCP.OPTIONS lda (ZPFrameInPtr),y and #S.TCP.OPTIONS.RST RST ? go Kill this socket... @@ -26,6 +20,7 @@ TCP.IN jsr FRM.GetTargetSKT.TCPUDP TCP.IN.RST lda SKT.TABLE,x jsr SKT.shutdown *-------------------------------------- +TCP.IN.JMP.OPENED TCP.IN.JMP.CLOSED lda hFrameIn stz hFrameIn @@ -200,7 +195,7 @@ TCP.IN.JMP.ESTBLSH sbc TmpDWord+2 sta SKT.Cache+S.SOCKET.TCP.OUTUSED+1 -* jsr SKT.StoreTCB + jsr SKT.StoreTCB * Store incoming data .4 jsr TCP.IN.SetDataInPtrAndLen @@ -215,15 +210,16 @@ TCP.IN.JMP.ESTBLSH eor SKT.Cache+S.SOCKET.TCP.INSEQNUM,x bne .9 Missed a frame..... - dey +.51 dey dex bpl .5 jsr SKT.AddDataToSktIn yes, queue data if there is room for.... - bcs .9 Should never appends.... + bcs * Should never appends.... + +* clc lda SKT.Cache+S.SOCKET.TCP.INSEQNUM+3 -* clc adc ZPDataInLen sta SKT.Cache+S.SOCKET.TCP.INSEQNUM+3 @@ -237,8 +233,11 @@ TCP.IN.JMP.ESTBLSH .6 jsr SKT.StoreTCB update socket - jsr TCP.SetSocketTCPO.ACK ...and ack data - +* jsr TCP.SetSocketTCPO.ACK ...and ack data + lda #S.TCP.OPTIONS.ACK + jsr TCP.OUT.SendOptA +* bcs * + .7 ldy #S.TCP.OPTIONS lda (ZPFrameInPtr),y and #S.TCP.OPTIONS.FIN @@ -251,12 +250,14 @@ TCP.IN.JMP.ESTBLSH jsr TCP.IN.ACKTheFIN lda #S.TCP.OPTIONS.FIN+S.TCP.OPTIONS.ACK jsr TCP.SetSocketTCPO FIN received, Send FIN.ACK - -.8 jsr TCP.OUT Send ACK as soon as possible - +* jsr TCP.OUT.SendOptA +.8 +* jsr TCP.OUT Send ACK as soon as possible + clc + rts .9 -* clc -* rts + sec + rts *-------------------------------------- TCP.IN.JMP.CLWAIT clc Wait for SKT.shutdown @@ -285,7 +286,7 @@ TCP.IN.JMP.FINWT1 lda #S.TCP.OPTIONS.FIN+S.TCP.OPTIONS.ACK jsr TCP.OUT.SendOptA Send FIN.ACK - bcs .9 + bcs TCP.IN.JMP.TIMEWT.RTS lda #S.SOCKET.TCP.S.FINWT2 jmp SKT.StoreTCB.S @@ -293,34 +294,26 @@ TCP.IN.JMP.FINWT1 .1 jsr TCP.IN.ACKTheFIN FIN/ACK lda #S.TCP.OPTIONS.FIN+S.TCP.OPTIONS.ACK - jsr TCP.OUT.SendOptA Send FIN.ACK - bcs .9 - - lda #S.SOCKET.TCP.S.TIMEWT - jmp SKT.StoreTCB.S - -* clc -.9 rts + bra TCP.IN.JMP.FINWT.ACK Send FIN.ACK *-------------------------------------- TCP.IN.JMP.FINWT2 ldy #S.TCP.OPTIONS only accept ACK packet lda (ZPFrameInPtr),y bit #S.TCP.OPTIONS.ACK - beq .8 + beq TCP.IN.JMP.TIMEWT jsr SKT.GetTCB jsr TCP.IN.ACKTheFIN lda #S.TCP.OPTIONS.ACK + +TCP.IN.JMP.FINWT.ACK jsr TCP.OUT.SendOptA FIN received, Send ACK - bcs .9 + bcs TCP.IN.JMP.TIMEWT.RTS lda #S.SOCKET.TCP.S.TIMEWT jmp SKT.StoreTCB.S - -.8 clc -.9 rts *-------------------------------------- TCP.IN.JMP.CLOSING ldy #S.TCP.OPTIONS only accept ACK packet @@ -338,6 +331,7 @@ TCP.IN.JMP.CLOSING *-------------------------------------- TCP.IN.JMP.TIMEWT clc Wait for TCP.Close +TCP.IN.JMP.TIMEWT.RTS rts *-------------------------------------- TCP.IN.ACKTheSYN @@ -441,13 +435,29 @@ TCP.SENDCLOSE ldx #0 beq .4 cmp #S.SOCKET.TCP.S.ESTBLSH - bne .8 + bne .2 jsr SKT.GetTCB jsr TCP.OUT bra .8 +.2 cmp #S.SOCKET.TCP.S.OPENED + bne .8 + + jsr SKT.GetTCB + lda #S.TCP.OPTIONS.SYN + jsr TCP.OUT.SendOptA Send SYN + bcs .8 failed ARP lookup.... + + lda #S.SOCKET.TCP.S.SYNSENT + jsr SKT.StoreTCB.S + bra .8 + + lda #S.TCP.OPTIONS.SYN + jsr TCP.OUT.SendOptA Send SYN + bra .8 + .4 ldy #S.SOCKET.SQ.hInMem lda (ZPPtrSKT),y beq .5 @@ -583,6 +593,7 @@ TCP.OUT.Send ldy #S.TCP.OPTIONS dex bpl .3 + sec DONT Queue if fail jsr FRM.SendIP bcs TCP.OUT.Send.9 diff --git a/LIB/LIBTCPIP.S.txt b/LIB/LIBTCPIP.S.txt index 3998e3cb..a120e2e6 100644 --- a/LIB/LIBTCPIP.S.txt +++ b/LIB/LIBTCPIP.S.txt @@ -136,6 +136,7 @@ L.HST.SScanF .DA HST.SScanF L.IOCTL .DA IOCTL L.DCB.NIC .DA DCB.NIC J.TCP.IN .DA TCP.IN.JMP.CLOSED + .DA TCP.IN.JMP.OPENED .DA TCP.IN.JMP.LISTEN .DA TCP.IN.JMP.SYNSENT .DA TCP.IN.JMP.SYNRCVD @@ -228,11 +229,6 @@ PULSE and #S.EVT.F.T1SEC .1 jsr FRM.RETRY every 100ms jsr DNS.POLL - -* lda A2osX.TIMER16 -* lsr -* bcs INCOMING.RTS Only every 200ms - jmp TCP.SENDCLOSE *-------------------------------------- GetDynPort inc DYNPORT.LAST @@ -474,8 +470,8 @@ HST.SScanF .AZ "%d.%d.%d.%d" IP.ID .BS 2 .DO IPDEBUG=1 MSG.IPID .AZ "IPID:%H\r\n" -MSG.FRM.Dump .AZ "FRM:SRC=%d.%d.%d.%d:%D DST=%d.%d.%d.%d:%D\r\n" -MSG.SKT.Dump .AZ "SKT:LOC=%d.%d.%d.%d:%D REM=%d.%d.%d.%d:%D\r\n" +MSG.FRM.Dump .AZ "->FRM:SRC=%d.%d.%d.%d:%D DST=%d.%d.%d.%d:%D\r\n" +MSG.SKT.Dump .AZ " ?SKT:LOC=%d.%d.%d.%d:%D REM=%d.%d.%d.%d:%D\r\n" .FIN *-------------------------------------- MAN diff --git a/SBIN/CIFSD.S.txt b/SBIN/CIFSD.S.txt index 3a428640..8a27c57a 100644 --- a/SBIN/CIFSD.S.txt +++ b/SBIN/CIFSD.S.txt @@ -46,6 +46,7 @@ CS.START cld L.LIBTCPIP .DA LIBTCPIP L.MSG.USAGE .DA MSG.USAGE L.MSG.UNKNOWN .DA MSG.UNKNOWN +L.SMB.Negotiate .DA SMB.Negotiate .DA 0 *-------------------------------------- * Called once at process creation @@ -53,48 +54,22 @@ L.MSG.UNKNOWN .DA MSG.UNKNOWN *-------------------------------------- CS.INIT >LDYA L.LIBTCPIP >SYSCALL LoadLib - bcs .99 + bcs .9 sta hLIBTCPIP >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ? - bcs .99 + bcs .9 >STYA ZPIPCfgPtr lda (ZPIPCfgPtr) Configured ? - bmi .1 + bmi .8 lda #E.SYN sec rts - -.1 lda #AF.INET - >STA.G SA.LOCAL - >STA.G SA.REMOTE - - ldy #S.IPCFG.IP+3 - -.2 lda (ZPIPCfgPtr),y - pha - dey - cpy #S.IPCFG.IP-1 - bne .2 - - ldy #SA.REMOTE+S.SOCKADDR.PORT - -.3 pla - sta (pData),y - iny - cpy #SA.REMOTE+S.SOCKADDR.PORT+4 - bne .3 - - lda #TCP.PORT.CIFS - >STA.G SA.REMOTE+S.SOCKADDR.PORT - iny - lda /TCP.PORT.CIFS - sta (pData),y - clc -.99 rts +.8 clc +.9 rts *-------------------------------------- * Called until exit with CS * if RUN exits with CC, RUN entered again @@ -102,9 +77,15 @@ CS.INIT >LDYA L.LIBTCPIP CS.RUN jsr CS.RUN.CheckArgs bcs .90 + jsr CS.RUN.Connect + bcs .9 + + jsr CS.RUN.Negotiate + + lda #0 sec - rts +.9 rts .90 >LDYA L.MSG.USAGE >SYSCALL puts @@ -139,34 +120,63 @@ CS.RUN.CheckArgs >LDYA L.MSG.UNKNOWN >SYSCALL printf sec - rts +.9 rts + +.2 lda #AF.INET + >STA.G SA.LOCAL + >STA.G SA.REMOTE + + ldy #S.IPCFG.IP+3 + +.3 lda (ZPIPCfgPtr),y + pha + dey + cpy #S.IPCFG.IP-1 + bne .3 + + ldy #SA.REMOTE+S.SOCKADDR.PORT + +.4 pla + sta (pData),y + iny + cpy #SA.REMOTE+S.SOCKADDR.PORT+4 + bne .4 + + lda #TCP.PORT.CIFS + >STA.G SA.REMOTE+S.SOCKADDR.PORT + iny + lda /TCP.PORT.CIFS + sta (pData),y -.2 clc rts - -.9 sec - rts *-------------------------------------- CS.RUN.Connect >PUSHBI 0 no protocol - lda #S.SOCKET.T.STREAM + lda #S.SOCKET.T.SEQPACKET >LIBCALL hLIBTCPIP,LIBTCPIP.Socket bcs .9 >STA.G hSocket - >PUSHW.G SA.LOCAL + >PUSHEA.G SA.LOCAL >LDA.G hSocket >LIBCALL hLIBTCPIP,LIBTCPIP.Bind bcs .9 - >PUSHW.G SA.REMOTE + >PUSHEA.G SA.REMOTE >LDA.G hSocket >LIBCALL hLIBTCPIP,LIBTCPIP.Connect .9 rts *-------------------------------------- +CS.RUN.Negotiate + >PUSHWI SMB.Negotiate.end-SMB.Negotiate + >PUSHW L.SMB.Negotiate + >LDA.G hSocket + >LIBCALL hLIBTCPIP,LIBTCPIP.Send + rts +*-------------------------------------- * Called if option S.PS.F.EVENT enabled in Header * Timer Event : every 10th seconds *-------------------------------------- @@ -200,6 +210,27 @@ hLIBTCPIP .BS 1 MSG.USAGE .AZ "Usage : CIFSD sharename mountpoint" MSG.UNKNOWN .AZ "%s: Unknown host\r\n" *-------------------------------------- +SMB.Negotiate .DA #$FF + .AS "SMB" + .DA #S.SMB.HEADER.CMD.NEGOTIATE + .HS 00000000 + .DA #0 S.SMB.HEADER.FLAGS + .DA /S.SMB.HEADER.FLAGS2.LONGNAMES + .DA #S.SMB.HEADER.FLAGS2.LONGNAMES + .DA 0 PIDHI + .HS 0000000000000000 SECFEAT + .DA 0 RSVD + .DA $FFFF TID + .DA $FEFF PIDLO + .DA 0 UID + .DA 0 MID + .DA #0 WORD COUNT + .DA /SMB.Negotiate.end-* + .DA #SMB.Negotiate.end-* + .DA #2 + .AZ "NT LM 0.12" +SMB.Negotiate.end .EQ * +*-------------------------------------- * Per Process DATA segement (0 filled before INIT) *-------------------------------------- .DUMMY diff --git a/SBIN/NETWORKD.S.txt b/SBIN/NETWORKD.S.txt index f7c72fb5..79e849fa 100644 --- a/SBIN/NETWORKD.S.txt +++ b/SBIN/NETWORKD.S.txt @@ -6,6 +6,7 @@ NEW .TF SBIN/NETWORKD *-------------------------------------- LIB.MAX .EQ 4 +FRM.MAX .EQ 4 *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I @@ -14,6 +15,7 @@ LIB.MAX .EQ 4 .INB INC/NIC.I .INB INC/ETH.I .INB INC/LIB.NET.I + .INB INC/LIBTCPIP.I *-------------------------------------- * Zero Page Segment, up to 32 bytes *-------------------------------------- @@ -209,7 +211,7 @@ CS.INIT.CONF >LDYAI 64 .81 lda hLineBuf >SYSCALL FreeMem - +CS.INIT.CONF.8 clc rts *-------------------------------------- @@ -220,29 +222,29 @@ CS.RUN >PUSHW L.IOCTL bcs .8 No Frame sta hFrameIn + +.3 ldx #0 LIB index - ldx #0 - -.1 ldy hLIBs,x - beq .2 +.4 ldy hLIBs,x + beq .7 >PUSHW L.IOCTL - lda hFrameIn - phx + phx Save LIB index + + lda hFrameIn ldx #LIBNET.INCOMING jsr A2osX.LIBCALL + plx - bcc CS.RUN + bcc .8 inx - bra .1 + bra .4 -.2 lda hFrameIn +.7 lda hFrameIn >SYSCALL freemem - bra CS.RUN - .8 clc rts *-------------------------------------- diff --git a/SYS/KERNEL.S.GP.txt b/SYS/KERNEL.S.GP.txt index 1f687840..bf402723 100644 --- a/SYS/KERNEL.S.GP.txt +++ b/SYS/KERNEL.S.GP.txt @@ -31,7 +31,7 @@ GP.CodeStart jmp GP.SysCall * X = ROM Function * Y,A = Param *-------------------------------------- - jmp GP.RomCall + jmp GP.FpuCall *-------------------------------------- * BADCALL *-------------------------------------- @@ -172,6 +172,24 @@ GP.AtkCall dec IRQ.InKernel inc IRQ.InKernel rts *-------------------------------------- +GP.FpuCall dec IRQ.InKernel + jsr .1 + inc IRQ.InKernel + + clc + rts + +.1 jmp (.2,x) + +.2 .DA FPU.ADD32 + .DA FPU.SUB32 + .DA FPU.MUL32 + .DA FPU.IMUL32 + .DA FPU.DIV32 + .DA FPU.IDIV32 + .DA FPU.MOD32 + .DA FPU.IMOD32 +*-------------------------------------- GP.RomCallPushFAC jsr GP.ROMCALL diff --git a/SYS/KERNEL.S.NUM.txt b/SYS/KERNEL.S.NUM.txt index ec5e7c8a..7e40b1fb 100644 --- a/SYS/KERNEL.S.NUM.txt +++ b/SYS/KERNEL.S.NUM.txt @@ -4,6 +4,193 @@ NEW * http://6502.org/source/integers/32muldiv.htm * http://nparker.llx.com/a2/mult.html *-------------------------------------- +* >PUSHL ARG +* >PUSHL ACC +* >ADC32 +* >PULLL (ARG+ACC) +*-------------------------------------- +FPU.ADD32 clc + .HS B0 BCS +FPU.SUB32 sec + + php + + jsr NUM.PopACC32 + + ldy #0 + ldx #3 + + plp + bcs .2 + +.1 lda (pStack),y + adc ACC32,y + sta (pStack),y + iny + dex + bpl .1 + + rts + +.2 lda (pStack),y + sbc ACC32,y + sta (pStack),y + iny + dex + bpl .2 + +FPU.SUB32.RTS rts +*-------------------------------------- +* >PUSHL ARG +* >PUSHL ACC +* >(I)MUL32 +* >PULLL (ARG*ACC) +*-------------------------------------- +FPU.MUL32 clc + .HS B0 BCS +FPU.IMUL32 sec + + php + jsr NUM.MULDIVMOD.COMMON + jsr NUM.MUL32 + + plp + bcc FPU.SUB32.RTS + +FPU.RETURN.ITMP lda ACC32.Sign + eor ARG32.Sign + bpl NUM.PutTMP32 + bra NUM.PutNotTMP32 +*-------------------------------------- +* >PUSHL ARG +* >PUSHL ACC +* >(I)DIV32 +* >PULLL (ARG / ACC) +*-------------------------------------- +* >PUSHL ARG +* >PUSHL ACC +* >(I)MOD32 +* >PULLL (ARG mod ACC) +*-------------------------------------- +FPU.DIV32 clc + .HS B0 BCS +FPU.IDIV32 sec + clv + bra FPU.DIVMOD + +FPU.MOD32 clc + .HS B0 BCS +FPU.IMOD32 sec + bit FPU.SUB32.RTS $60 + +FPU.DIVMOD php + jsr NUM.MULDIVMOD.COMMON + jsr NUM.DIVMOD32 + + plp + bcc .3 + bvs FPU.RETURN.ITMP IMOD + + lda ACC32.Sign IDIV + eor ARG32.Sign + bmi NUM.PutARG32 + bra NUM.PutNotARG32 + +.3 bvs NUM.PutARG32 DIV +*-------------------------------------- +NUM.PutTMP32 ldy #0 MOD + ldx #3 + +.1 lda TMP32,y + sta (pStack),y + iny + dex + bpl .1 + rts +*-------------------------------------- +NUM.PutNotTMP32 ldy #0 + ldx #3 + + sec + +.1 lda TMP32,y two's complement of X bytes + eor #$ff + adc #0 + sta (pStack),y + iny + dex + bpl .1 + + rts +*-------------------------------------- +NUM.PutARG32 ldy #0 + ldx #3 + +.1 lda ARG32,y + sta (pStack),y + iny + dex + bpl .1 + rts +*-------------------------------------- +NUM.PutNotARG32 ldy #0 + ldx #3 + + sec + +.1 lda ARG32,y two's complement of X bytes + eor #$ff + adc #0 + sta (pStack),y + iny + dex + bpl .1 + + rts +*-------------------------------------- +NUM.PopACC32 ldy #$ff + +.1 iny + lda (pStack),y + sta ACC32,y + cpy #3 + bne .1 + + sta ACC32.Sign + + tya +* sec + adc pStack + sta pStack + + rts +*-------------------------------------- +NUM.GetARG32 ldy #$ff + +.1 iny + lda (pStack),y + sta ARG32,y + cpy #3 + bne .1 + + sta ARG32.Sign + + rts +*-------------------------------------- +NUM.MULDIVMOD.COMMON + php + + jsr NUM.PopACC32 + jsr NUM.GetARG32 + + plp + bcc .1 + + jsr NUM.ACC32ABS + jsr NUM.ARG32ABS + +.1 rts +*-------------------------------------- * ARG32*ACC32->TMP32 *-------------------------------------- NUM.MUL32 jsr NUM.TMP32ZERO @@ -35,7 +222,7 @@ NUM.MUL32 jsr NUM.TMP32ZERO adc ACC32+3 sta TMP32+3 -.3 jsr ACC32.T2 +.3 jsr NUM.ACC32.T2 dex bne .2 @@ -221,9 +408,7 @@ NUM.Hex2ACC32 lda (ZPPtr2) jsr MEM.IsHexDigit bcs .9 - jsr NUM.ACC32ZERO - - sta ACC32 + jsr NUM.A2ACC32 ldy #0 @@ -237,8 +422,7 @@ NUM.Hex2ACC32 lda (ZPPtr2) ldx #4 -.2 jsr ACC32.T2 - bcs .99 overflow!!! +.2 jsr NUM.ACC32.T2 dex bne .2 @@ -250,7 +434,6 @@ NUM.Hex2ACC32 lda (ZPPtr2) .8 clc rts -.99 pla .9 sec rts *-------------------------------------- @@ -278,7 +461,7 @@ NUM.Dec2ACC32 jsr NUM.ACC32ZERO bcs .8 phy Save Y, pointing to next char - jsr ACC32.T10 + jsr NUM.ACC32.T10 ply bcs .9 @@ -313,45 +496,35 @@ NUM.Dec2ACC32 jsr NUM.ACC32ZERO .88 clc rts *-------------------------------------- -ACC32.T10 ldx #3 +NUM.ACC32.T10 ldx #3 .1 lda ACC32,x save ACC32 for 4+1 pha dex bpl .1 - jsr ACC32.T2 STDLIB.32 * 2 -> STDLIB.32 - bcs ACC32.9 overflow!!! + jsr NUM.ACC32.T2 ACC32 * 2 -> ACC32 - jsr ACC32.T2 STDLIB.32 * 4 -> STDLIB.32 - bcs ACC32.9 overflow!!! + jsr NUM.ACC32.T2 ACC32 * 4 -> ACC32 ldx #0 ldy #4 * clc -.2 pla STDLIB.32 * 4 + STDLIB.32 -> STDLIB.32 +.2 pla ACC32 * 4 + ACC32 -> ACC32 adc ACC32,x sta ACC32,x inx dey bne .2 - bcs ACC32.RTS overflow!!! - -ACC32.T2 asl ACC32 +NUM.ACC32.T2 asl ACC32 rol ACC32+1 rol ACC32+2 rol ACC32+3 - rts if CS, overflow!!! -ACC32.9 pla discard saved STDLIB.32 - pla - pla - pla - -ACC32.RTS rts + rts *-------------------------------------- NUM.A2ACC32 sta ACC32 .HS 2C BIT ABS @@ -367,19 +540,31 @@ NUM.TMP32ZERO stz TMP32 stz TMP32+3 rts *-------------------------------------- -NUM.ACC32NEG sec +NUM.ARG32ABS lda ARG32.Sign + bmi NUM.ARG32NEG + rts +*-------------------------------------- +NUM.ACC32ABS lda ACC32.Sign + bpl NUM.ACC32NEG.RTS +*-------------------------------------- +NUM.ACC32NEG ldy #ACC32 + .HS 2C BIT ABS + +NUM.ARG32NEG ldy #ARG32 - ldy #0 ldx #3 -.1 lda ACC32,y two's complement of X bytes + sec + +.1 lda $0,y two's complement of X bytes eor #$ff adc #0 - sta ACC32,y + sta $0,y iny dex bpl .1 +NUM.ACC32NEG.RTS rts *-------------------------------------- MAN diff --git a/SYS/KERNEL.S.txt b/SYS/KERNEL.S.txt index d8a50bc0..393b1098 100644 --- a/SYS/KERNEL.S.txt +++ b/SYS/KERNEL.S.txt @@ -56,6 +56,7 @@ A2osX.D2 .PH $D000 .INB USR/SRC/SYS/KERNEL.S.PS .INB USR/SRC/SYS/KERNEL.S.ENV .INB USR/SRC/SYS/KERNEL.S.MATH + .INB USR/SRC/SYS/KERNEL.S.ARG .EP A2osX.E0 .PH $E000 .INB USR/SRC/SYS/KERNEL.S.JMP @@ -67,7 +68,6 @@ A2osX.E0 .PH $E000 .INB USR/SRC/SYS/KERNEL.S.PFT .INB USR/SRC/SYS/KERNEL.S.IO ********* TMP ***** go to A2osX.D2 - .INB USR/SRC/SYS/KERNEL.S.ARG .INB USR/SRC/SYS/KERNEL.S.PWD .LIST ON DevMgr.FreeMem .EQ *