danwinslow Posted January 12, 2016 Author Share Posted January 12, 2016 (edited) Well, I ran out of space adding the TCP server side, and I've been on a long explore trying to see if I could use OS RAM. I've decided against that, so I am now refitting things to take up another bank of extended. It leads to some unfortunate extra copying, but it can't be helped. Once i get that new structure ironed out I'll be dropping the TCP server side in, and also will be posting a TELNET client example in BASIC at some point along the way. Once that's done, there's some tidying up and niceties about running under various DOS's and not trampling on membanks that are in use to be done, and a configurator program, and that should be about it. The final product will offer ICMP, UDP, and TCP access from any language capable of using CIO, with only a 3-4k real memory footprint from the driver. There are 4 'sockets' available and they can be any mix of the protocols. There's also a special 'UDP_STREAM' protocol I came up with that transmits & receives a 256 byte buffer every 30th of a second. The idea there is that you can stream hardware stuff like joystick positions and game data for multiplayer action games. The stack is driven via VB's, so it all just happens in the background. It does consume some VB time...a pass with nothing happening takes about 3k cycles, and passes with a lot happening can take up to 20k or so. Nobody will be writing scene demos using this code, but it should be ok for most game applications. Edited January 12, 2016 by danwinslow 6 Quote Link to comment Share on other sites More sharing options...
danwinslow Posted February 3, 2016 Author Share Posted February 3, 2016 Well, I got a second bank established, and moved the driver code into there. Came up with kind of a neat macro that lets me do direct interbank calls. Then I started worrying that my souped up U1MB 130XE might be hiding issues that could popup on stock machines, so I swapped in a old stock 130xe and started testing to make sure it would run on regular old hardware. It didn't. Argh. I just spent the last two weeks testing over and over and over trying to find out why my real hardware doesn't work, but Altirra does. I was getting all kinds of weird results, seemingly random crashes. Some of you can guess this one...extended bank memory errors, in bank 2. It FINALLY occurred to me that might be an issue, and a short session with XRAM021 showed that the bank for $E7 had several memory issues. Swapped in another 130xe stock, tested it's xram, good. Tested the AIP system, runs great. Argh. 3 Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 3, 2016 Share Posted February 3, 2016 Just had a weekend like that. Glad you got to the bottom of it. Quote Link to comment Share on other sites More sharing options...
danwinslow Posted February 4, 2016 Author Share Posted February 4, 2016 OK, gearing up to do the simple telnet in BASIC. As a preview, here's DNS resolve in BASIC: 10 REM DNS RESOLVE IN BASIC 20 DIM DNS$(100) 22 PRINT "DNS TO RESOLVE?" 24 INPUT DNS$ 30 GOSUB 1000 998 END 1005 DIM O$(100)$="I1:I:0:0:":O$(10, 10+LEN(DNS$))=DNS$ 1007 PRINT "OPENING: ";O$ 1010 OPEN #2,12,0,O$ 1030 I=(832)+2*16:REM CALC TO IOCB 1040 C=(PEEK(I+13)*256)+PEEK(I+12) 1062 CO=C+22:REM DESTINATION ADDR OFFS ET 1064 PRINT DNS$;" IS AT IP ";PEEK(CO); ".";PEEK(CO+1);".";PEEK(CO+2);".";PEEK (CO+3) 1070 RETURN Quote Link to comment Share on other sites More sharing options...
Kyle22 Posted February 4, 2016 Share Posted February 4, 2016 You'll get ERROR- 12 AT LINE 30. Line 1000 is missing Quote Link to comment Share on other sites More sharing options...
danwinslow Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) lol TRUE, shouldn't edit without running.... 10 REM DNS RESOLVE IN BASIC 20 DIM DNS$(100) 22 PRINT "DNS TO RESOLVE?" 24 INPUT DNS$ 30 GOSUB 1005 998 END 1005 DIM O$(100)$="I1:I:0:0:":O$(10, 10+LEN(DNS$))=DNS$ 1007 PRINT "OPENING: ";O$ 1010 OPEN #2,12,0,O$ 1030 I=(832)+2*16:REM CALC TO IOCB 1040 C=(PEEK(I+13)*256)+PEEK(I+12) 1062 CO=C+22:REM DESTINATION ADDR OFFS ET 1064 PRINT DNS$;" IS AT IP ";PEEK(CO); ".";PEEK(CO+1);".";PEEK(CO+2);".";PEEK (CO+3) 1070 Edited February 4, 2016 by danwinslow 4 Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 4, 2016 Share Posted February 4, 2016 Awesome work. Quote Link to comment Share on other sites More sharing options...
danwinslow Posted May 12, 2016 Author Share Posted May 12, 2016 (edited) This is not dead, by the way. Doing yet ANOTHER refactoring pass. Have the TCP client side pretty much done, even have a telnet client in BASIC (!) sort of working. Refactoring for speed and memory size, current usage is 3k of real and 2 banks of extended. Also writing a socket emulation layer in C that will allow direct recompilation of small ethernet client source code like a tiny telnet and IRC clients and so forth. Edited May 12, 2016 by danwinslow 2 Quote Link to comment Share on other sites More sharing options...
danwinslow Posted June 29, 2016 Author Share Posted June 29, 2016 Ok. I finally decided I had to put packet buffering in, and so I've ground my way through that. UDP is now fully buffered in it's own bank, in a custom packet ring buffer. TCP was already buffered but I've located it in it's own bank and expanded it's buffer size considerably. Now UDP and TCP are each in their own bank, for a total of 3 banks - main, udp, and tcp. If you don't want one or the other protocol you can configure it not to load at all. The main memory usage is still around 2.5k and I will be making that smaller shortly. Just to show what programming looks like now, here's a test program in BASIC. It opens all four channels for UDP, sends a packet to each connection to start things off, and then receives a flood of 400 256-byte packets from a small C# program I wrote, 100 to each channel. That program sends 1 packet every 75 milliseconds, so it finishes long before the program is done printing out the packets. Next up is to build the server side of the TCP layer ( listen, accept, etc. ), and then write a configuration utility to set where the extended banks are, where on disk the loadable .bnk files are, whether you want DHCP or static IP, etc. And then I'll be done and release beta to testers. One thing I want to do after that is write a R: handler that looks like a real modem handler but actually calls telnet, so we can re-use modem software to talk to things. I also plan on writing a unix-compatible C 'socket' layer so small programs can be directly compiled from the internet, and write some demos in Action, BasicXE, TurboBasic, and MAD Pascal. 0010 AIPPUTBYTES=40:AIPGETBYTES=41:MSGSWAITING=47 0020 DIM OB$(256):OB$(1)="A":OB$(256)="A":OB$(2)=OB$ 0030 DIM OB1$(256):OB1$(1)="A":OB1$(256)="A":OB1$(2)=OB1$ 0040 DIM OB2$(256):OB2$(1)="A":OB2$(256)="A":OB2$(2)=OB2$ 0050 DIM OB3$(256):OB3$(1)="A":OB3$(256)="A":OB3$(2)=OB3$ 0060 DIM CHANNEL(4) 0070 OPEN #1,12,0,"I1:U:0:45000:192.168.2.2" 0080 I=(832)+1*16:REM CALC TO IOCB 0090 C=(PEEK(I+13)*256)+PEEK(I+12) 0100 CHANNEL(1)=C 0110 OPEN #2,12,0,"I2:U:0:46000:192.168.2.2" 0120 I=(832)+2*16:REM CALC TO IOCB 0130 C=(PEEK(I+13)*256)+PEEK(I+12) 0140 CHANNEL(2)=C 0150 OPEN #3,12,0,"I3:U:0:47000:192.168.2.2" 0160 I=(832)+3*16:REM CALC TO IOCB 0170 C=(PEEK(I+13)*256)+PEEK(I+12) 0180 CHANNEL(3)=C 0190 OPEN #4,12,0,"I4:U:0:48000:192.168.2.2" 0200 I=(832)+4*16:REM CALC TO IOCB 0210 C=(PEEK(I+13)*256)+PEEK(I+12) 0220 CHANNEL(4)=C 0230 XIO AIPPUTBYTES,#1,12,0,OB$ 0240 XIO AIPPUTBYTES,#2,12,0,OB1$ 0250 XIO AIPPUTBYTES,#3,12,0,OB2$ 0260 XIO AIPPUTBYTES,#4,12,0,OB3$ 0270 COUNT=0 0280 IF PEEK(CHANNEL(1)+MSGSWAITING)=0 THEN GOTO 300 0290 COUNT=COUNT+1:XIO AIPGETBYTES,#1,12,0,OB$:PRINT 1;" ";COUNT;" ";OB$(1,10) 0300 IF PEEK(CHANNEL(2)+MSGSWAITING)=0 THEN GOTO 320 0310 COUNT=COUNT+1:XIO AIPGETBYTES,#2,12,0,OB1$:PRINT 2;" ";COUNT;" ";OB1$(1,10) 0320 IF PEEK(CHANNEL(3)+MSGSWAITING)=0 THEN GOTO 340 0330 COUNT=COUNT+1:XIO AIPGETBYTES,#3,12,0,OB2$:PRINT 3;" ";COUNT;" ";OB2$(1,10) 0340 IF PEEK(CHANNEL(4)+MSGSWAITING)=0 THEN GOTO 360 0350 COUNT=COUNT+1:XIO AIPGETBYTES,#4,12,0,OB3$:PRINT 4;" ";COUNT;" ";OB3$(1,10) 0360 IF COUNT < 400 THEN GOTO 280 0370 CLOSE #1 0380 CLOSE #2 0390 CLOSE #3 0400 CLOSE #4 6 Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted July 1, 2016 Share Posted July 1, 2016 Damn good work ! Quote Link to comment Share on other sites More sharing options...
TheNameOfTheGame Posted July 1, 2016 Share Posted July 1, 2016 Nice to see steady progress on this! :thumbsup: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.