Jump to content
tschak909

#FujiNet - a WIP SIO Network Adapter for the Atari 8-bit

Recommended Posts

11 hours ago, Curt Vendel said:

I was actually having this very discussion with Thom... having something akina to a Fujinet version of Google, but yes, like Gopher for finding and going to various servers.  We'd have to establish a FujiDNS type server system and have a Foogle type search engine of sorts...    It would DEFINITELTY be great to have email, chat/IM which should'n't be an issue, we all had those going back to the Compuserve and even into the AOL days, so those don't require any graphics and as for webpages and such, ATASCII could do the trick...

 

This seems like a lot of reinventing the wheel. Gopher still exists, has an official RFC. If we need to denote a text file as being ATASCII we could do so by using the '{' character for an item type designation. This would appear as a spade character to the Atari. I'm just trying to figure out why a seperate DNS would be needed. Isn't the current one doing the job?

  • Like 1

Share this post


Link to post
Share on other sites

Since people are talking about accessing the internet via FujiNet using Gopher, I did a little research since I hadn't a clue about what Gopher was.

 

Wikipedia Gopher (protocol)

When Gopher Ruled the Internet

The Overbite Project (adding Gopher to present day browsers)

 

I installed OverbiteWX in my Linux box for Firefox from the Add-Ons page, since it appeared to be the easiest and safest way for me to experience Gopher. And then I went to this URL...

https://gopher.floodgap.com/gopher/gw

Where I saw the following menu (only a portion of the page is being shown)...

 

Gopher_Page.png.5d2e588c7721608ad441d76ce6d6b4d3.png

 

I then proceeded to click on some of the links, and navigate the subsequent pages which all had a similar look and feel. Yes I can see how this would definitely work for the limited graphics abilities of our A8 machines. Be even nicer if an ST mouse were supported for selecting and clicking on links from an Atari version of a Gopher browser.

 

  • Like 3

Share this post


Link to post
Share on other sites

Somehow my reply to this got lost, rewriting:

 

* I abhor NIH, and reinventing wheels, this is why I chose TNFS for file storage.

* Yes, Gopher is a good idea to pursue.

* DNS works, and works well, and we have the ability to leverage mDNS to both advertise and consume local network services.

* I am working through the ability to deal with consuming and producing links to different things on the internet that may be potentially long or unweildy to type. If anyone wants to try working through a way to deal with this, it would be of tremendous benefit to everyone who uses #FujiNet. :)

 

-Thom

Edited by tschak909
  • Like 1

Share this post


Link to post
Share on other sites

The N: device has had a major rewrite, and is starting to breathe again! This device will allow TCP and HTTP communication at the operating system level. The prototype is written in C, will be ported to assembler when feature complete. 

ujtYkeo.jpg

  • Like 7

Share this post


Link to post
Share on other sites

#Atari8bit #FujiNet here is an example of what can be returned via the STATUS command to the N: device, given different AUX1 values.

 

montage.thumb.png.16974fc88973782c9567cf6a8e9bc2f5.png

 

This is ultimately in the esp32/tests/tcp test, and is documented, here:

https://github.com/FujiNetWIFI/atariwifi/wiki/CIO-Commands-for-N-Device

 

Of typical note, this means that devicespecs opened via the N: device will have the following format:

 

Nx:<TCP|HTTP>:HOST:PORT

for client connections, and:

Nx:<TCP|HTTP>:PORT

for listening connections, when OPEN's AUX1=1.

 

Of particular note, the firmware keeps track seperately of client connections, of which up to 8 can be done, so, N1: to N8:

and up to 8 possible server listening ports, also N1: to N8:

 

This means that the meaning is overloaded, and therefore if you CLOSE one of the IOCBs, that only closes the client connection, potentially freeing the listening socket for further use.

 

To close a listening socket, you must issue an UNLISTEN command, e.g. in BASIC:

XIO 117,#1,0,0,"N:"

This means, if you have a socket waiting, you can ACCEPT it on any client IOCB, e.g.

OPEN #2,12,0,"N2:":REM PREPARE FOR ACCEPTED SOCKET
XIO 97,#1,0,0,"N2:":REM ACCEPT SOCKET

Do your socket I/O:

PRINT #1;"HELLO FROM YOUR ATARI!"

And close the socket.

CLOSE #1

When you're done serving, you can unlisten, as I typed above.

 

  • Like 6

Share this post


Link to post
Share on other sites
On 1/27/2020 at 11:22 PM, tschak909 said:

meh, just make a way to send that link efficiently to the fujinet. something worth researching. :)

 

-Thom

what about 8 virtual files on the fujinet that would contain full url

 

so I write the long url to "U:URL1" file

 

and then can use the URL1 in all functions, D and N: devices...

 

so usecase:

put "http://www.verylong.com/address/foo/foo/bar/secret.bas" as content of file U:URL1

 

LOAD "N:URL1"

 

URL1 can be optionally just part of url if we will be able to append to it, something like:

LOAD "N:URL1/program.bas"

 

so normally:

"LOAD: N:http://pigwa.net/atari/8bit/demos/hedgehog.com" 

 

will be be just

 

LOAD "N:URL1/hedgehog.com"

 

ideally if we could use own shortcut url names like

"LOAD N:pigwademos/hedgehog.com"

 

 

 

 

 

 

 

 

 

  • Like 3

Share this post


Link to post
Share on other sites
5 hours ago, goldy/gmg aka lopez453 said:

what about 8 virtual files on the fujinet that would contain full url

 

so I write the long url to "U:URL1" file

 

and then can use the URL1 in all functions, D and N: devices...

 

so usecase:

put "http://www.verylong.com/address/foo/foo/bar/secret.bas" as content of file U:URL1

 

LOAD "N:URL1"

 

URL1 can be optionally just part of url if we will be able to append to it, something like:

LOAD "N:URL1/program.bas"

 

so normally:

"LOAD: N:http://pigwa.net/atari/8bit/demos/hedgehog.com" 

 

will be be just

 

LOAD "N:URL1/hedgehog.com"

 

ideally if we could use own shortcut url names like

"LOAD N:pigwademos/hedgehog.com"

 

 

 

 

 

 

 

 

 

Yup, this was what I essentially implemented for Set BASE URL command, which is implemented in the UCD.COM command (see esp32/tests/http-fetch)

 

But I am wondering if we can leverage integration with other devices in a cleaner way to augment this, such as what SIO2BT is doing with being able to click on a link on AtariAge and have it mount on the SIO2BT.. something similar.

 

So many things to explore. :)

 

p.s. if anyone wants to see how I implemented ucd.com:

 

/**
 * ucd - Set the base URL for N:
 *
 * Author: Thomas Cherryhomes
 *  <[email protected]>
 *
 * Licensed under GPL v3, see
 * LICENSE for details.
 */

#include <atari.h>
#include <string.h>
#include <stdlib.h>
#include <peekpoke.h>
#include "sio.h"
#include "conio.h"
#include "err.h"

unsigned char url[80];

void set_base_url(void)
{
  OS.dcb.ddevic=0x70;
  OS.dcb.dunit=1;
  OS.dcb.dcomnd=0xE3; // Set Base URL
  OS.dcb.dstats=0x80;
  OS.dcb.dbuf=&url;
  OS.dcb.dtimlo=0x0f;
  OS.dcb.dbyt=sizeof(url);
  OS.dcb.daux=0;
  siov();
  
  if (OS.dcb.dstats!=1)
    {
      err_sio();
      exit(OS.dcb.dstats);
    }
}

int main(int argc, char* argv[])
{
  unsigned char i;

  OS.lmargn=2;
  
  if (_is_cmdline_dos() && argc>1)
    strcpy(url,argv[1]);
  else
    {
      // DOS 2.0
      print("\x9b");
      print("ENTER BASE URL OR \xA0\xD2\xC5\xD4\xD5\xD2\xCE\xA0 TO CLEAR?\x9b");
      get_line(url,sizeof(url));

      // remove EOL
      for (i=0;i<sizeof(url);i++)
	if (url[i]==0x9b)
	  url[i]=0x00;
    }

  set_base_url();

  print("N: = ");
  print(url);
  print("\x9b");
  return(0);
}

The print and get_line are simple calls to CIO. is_cmdline_dos is an excellent routine that CC65 provides to detect DOS types.

 

Does anyone have questions as to how I am implementing these things?

-Thom

  • Like 1

Share this post


Link to post
Share on other sites

I was thinking that maybe we just need an implementation of the TNFS server for android (and iphone?). That way we can keep downloading stuff from atariage.com and then access those in the moment using the tnfs client you already developed.

Now, regarding the idea of webserver "address book", I think it is seems simple and great.

Edited by manterola
  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, tschak909 said:

being able to click on a link on AtariAge and have it mount on the SIO2BT.. something similar.

 

If we have mDNS and simple webserver on fujinet, 

I could click hyperlink on Atariage from the PC browser that is in the same local network as fujinet,

and the link like this should work:

<a href="http://myfujinet.local/set_base_url?device=1&url=http://atariage.com/folder/disk1.atr">Load to my fujinet</a>

Without any special software on the PC from unmodified browser.  

If you want to use more Fujinet devices, of course only the first one with default name will have this "comfort".

 

Or be able to copy/paste the url via simple web interface. 

Edited by goldy/gmg aka lopez453

Share this post


Link to post
Share on other sites
3 hours ago, manterola said:

I was thinking that maybe we just need an implementation of the TNFS server for android (and iphone?). That way we can keep downloading stuff from atariage.com and then access those in the moment using the tnfs client you already developed.

Now, regarding the idea of webserver "address book", I think it is seems simple and great.

I had exactly the same idea :)

TNFS server C source code is available, so maybe someone could port it to Android.

Share this post


Link to post
Share on other sites
5 hours ago, tschak909 said:

But I am wondering if we can leverage integration with other devices in a cleaner way to augment this, such as what SIO2BT is doing with being able to click on a link on AtariAge and have it mount on the SIO2BT.. something similar.

SIO2BT doesn't actually work this way. You can't directly mount links. First you have to download a file, then you can mount it

Share this post


Link to post
Share on other sites

#FujiNet #deepdive In this video, I talk a bit about how the Central I/O system on the #Atari 8-bit system works, and how I have implemented a prototype of the N: device handler, that interfaces #FujiNet to the CIO in C.

 

Should you wish to follow along:

https://github.com/FujiNetWIFI/atariwifi/tree/master/esp32/tests/tcp

 

Please watch and comment, especially if I am wrong.

-Thom

  • Like 4

Share this post


Link to post
Share on other sites
41 minutes ago, TheMontezuma said:

I had exactly the same idea :)

TNFS server C source code is available, so maybe someone could port it to Android.

The Bluetooth option is a very decent substitute to the tnfs server for android. 

However, the Bluetooth emulation never worked for me. Not using your short program for the esp32, nor using the latest firmware and pressing Boot. 

It it detected by sio2bt app in android, I can do the pairing and the connection. So everything looks great up to that point: it shows connected and I selected the images. But then nothing happens if I try to boot an image or read a directory (only Atari farts). Not sure what is wrong since your small program it is quite simple. Maybe there is an option I did not selected in the Arduino IDE...

BTW the same phone with sio2bt app works perfectly with the original SIO2BT modules.

 

 

Edited by manterola

Share this post


Link to post
Share on other sites
8 hours ago, manterola said:

However, the Bluetooth emulation never worked for me. Not using your short program for the esp32, nor using the latest firmware and pressing Boot. 

It it detected by sio2bt app in android, I can do the pairing and the connection. So everything looks great up to that point: it shows connected and I selected the images. But then nothing happens if I try to boot an image or read a directory (only Atari farts). Not sure what is wrong since your small program it is quite simple. Maybe there is an option I did not selected in the Arduino IDE...

BTW the same phone with sio2bt app works perfectly with the original SIO2BT modules.

 

 

You can download an app "Bluetooth Terminal" to see if you get any data from Atari.

And yes, it could be related to Arduino, it's configuration or ESP32 support. Perhaps software update would help.

Edited by TheMontezuma

Share this post


Link to post
Share on other sites

@everyone anyone who wants to test esp32/tests/tcp, please let me know. There is a tcp.atr disk on irata.online, which can be used with it, and you can see how to write TCP programs. The Tincans program uses TCP port 2000, so you need to forward it to your fujinet, if you want to test with someone over the internet.

  • Like 1

Share this post


Link to post
Share on other sites

#FujiNet showing the TINCANS chat program written in BASIC. Uses a standard TCP socket, as can be seen from the PC connecting to the #atari8bit #Atari.

 

EfGvJDV.jpg

 

ApqQpts.jpg

  • Like 1

Share this post


Link to post
Share on other sites

The source code for TINCANS.BAS

0 DIM H$(80),D$(80),MSG$(254)
100 REM TINCANS - QUICK CHAT PROGRAM
110 ? CHR$(125)
120 PRINT "        TINCANS  CHAT PROGRAM
        "
130 PRINT
140 REM GET ADDRESSES
150 XIO 13,#1,1,0,"N:":REM GET EXT ADDRE
SS
160 PRINT "EXT ADDRESS: ";PEEK(746);".";
PEEK(747);".";PEEK(748);".";PEEK(749)
161 XIO 13,#1,2,0,"N:":REM GET INT ADDRE
SS
170 PRINT "INT ADDRESS: ";PEEK(746);".";
PEEK(747);".";PEEK(748);".";PEEK(749)
180 PRINT
200 REM GET HOSTNAME / LISTEN
210 PRINT "ENTER HOSTNAME OR RETURN FOR
LISTEN"
220 PRINT "> ";
230 INPUT #16,H$
240 IF H$="" THEN 300
250 REM CONNECT TO HOST
260 D$="N:TCP:":D$(7)=H$:D$(LEN(D$))=":2
000"
270 OPEN #1,12,0,D$
280 GOTO 400
300 REM LISTEN FOR CONNECTION
310 OPEN #1,12,1,"N:TCP:2000":REM LISTEN
 FOR CONNECTIONS TO PORT 2000
320 PRINT :PRINT "WAITING FOR CONNECTION
...";
330 STATUS #1,A
331 FOR X=1 TO 100:NEXT X:REM SLIGHT DEL
AY
340 IF PEEK(747)=0 THEN 330
350 XIO 16,#1,12,0,"N:":REM ACCEPT CONNE
CTION
360 PRINT :PRINT "CONNECTION SUCCESSFUL.
":PRINT
370 REM FALL THROUGH...
400 PRINT "CHAT ACTIVE. TYPE BYE TO END.
":PRINT
405 PRINT :PRINT " YOU:  ";
410 POKE 764,255
420 IF PEEK(764)<>255 THEN 550
430 STATUS #1,A
440 IF PEEK(746)>0 THEN 500
450 FOR X=1 TO 50:NEXT X:REM SLIGHT DELA
Y.
460 GOTO 420
500 REM RECEIVED A MESSAGE FROM THEM
510 INPUT #1,MSG$
520 PRINT :PRINT "??? THEM:  ";MSG$:PRIN
T
521 IF MSG$="BYE " THEN 600
530 GOTO 405
550 REM TAPPED A KEY FOR INPUT
560 INPUT #16,MSG$
570 PRINT #1;MSG$
580 IF MSG$="BYE" THEN 600
590 GOTO 405
600 REM CLOSE EVERYTHING
610 XIO 17,#1,0,0,"N:":REM UNLISTEN
620 CLOSE #1
630 PRINT :PRINT "CONNECTION CLOSED."
650 END

 

  • Like 2

Share this post


Link to post
Share on other sites

#FujiNet with the simplest possible terminal program for the N: device. Slow? Yes, but it works. #Atari #Atari8bit

unknown.png

 

unknown.png

  • Like 4

Share this post


Link to post
Share on other sites

Relocatable code on the 8bit.  A question...

 

I'm working on a code relocator.  It's pretty straight forward in that it does the following:

  • Moves code from a particular memory region to MEMLO.
  • Remaps a function pointer table at MEMLO for three "public" functions.
  • The relocator scans for documented 3-byte instructions modifying the target to point to the new memory region - BUT ONLY if the target was in the initial high memory range.
  • Updates MEMLO to the first byte past the copied code.

It appears to be working.  When I do a FRE(0) with DOS loaded I show 32,274 bytes.  After the autorun.sys executes I show 32,224 bytes with FRE(0) - the three public assembly routines are very small obviously.  The C code starts at address 0x4000 (arbitrary) linking in an assembler file that exports beginning/end of code symbols so the C code knows how many bytes are to be copied.

 

The Question: When looking through the (documented) 6502 instruction list it didn't seem like I'd have to do anything to deal with the zeropage instructions as well as the various single byte instructions.  Am I missing something here?  I probably should add some of the undocumented 3 byte instructions as well...

 

 

atari000.png

  • Like 2

Share this post


Link to post
Share on other sites

Thanks so much, @damosan!

 

meanwhile, I've managed to debug the N: TCP device well enough to be able to log onto Level 29 BBS :)

 

This is a telnet program written in approximately 10 lines of BASIC.

 

The irony is, that I will be able to add full TELNET processing, on the ESP side, without affecting the BASIC code, whatsoever. This is critically important, as it means that people will be able to easily write networked applications, even in BASIC.

 

The terminal program is TERM.BAS on the tcp.atr disk in the esp32/tests/tcp/data if anyone wants to take a look.

 

 

Special thanks to FozzTexx. :)

 

-Thom

 

  • Like 7

Share this post


Link to post
Share on other sites
7 hours ago, damosan said:

Relocatable code on the 8bit.  A question...

 

I'm working on a code relocator.  It's pretty straight forward in that it does the following:

  • The relocator scans for documented 3-byte instructions modifying the target to point to the new memory region - BUT ONLY if the target was in the initial high memory range.

Make sure that any indirect JMPs (opcode $6C) don't end up with the low byte of the address as $FF  (JMP $xxFF).  This will trigger a known 6502 bug.  If you find that the relocated code does this, maybe increment your starting address (wasting a byte) and run your relocator again?  Repeat until you get a good conversion.

 

Share this post


Link to post
Share on other sites
9 hours ago, damosan said:

I'm working on a code relocator.  It's pretty straight forward in that it does the following:

You might have a look at MKRELO which is part of the ABC Compiler.

You compile your program twice, each time for a different target address. MKRELO then compares both files and creates a relocatable file.

 

I never tried it myself, but from the description in the manual this sounds completely independent from ABC itself.

Manual at MrFish's website: Chapter 5.2 Generating relocatable code

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, StickJock said:

Make sure that any indirect JMPs (opcode $6C) don't end up with the low byte of the address as $FF  (JMP $xxFF).  This will trigger a known 6502 bug.  If you find that the relocated code does this, maybe increment your starting address (wasting a byte) and run your relocator again?  Repeat until you get a good conversion.

 

Interesting - is that a bug in all 6502s?  Is it documented anywhere?

 

What I'll do is scan for indirect JMPs first - if I find any that would match this condition I'll shift the copied code one byte and try again.

 

Thanks.

Share this post


Link to post
Share on other sites

Now that the TCP routines in esp32/tests/tcp are working stably, I was able to port the #Atari8bit version of #PLATOTERM to #FujiNet's N: device, and as you see, it works quite well even for the preliminary 256 byte buffer.

 

 

  • Like 9

Share this post


Link to post
Share on other sites

#Atari8bit #FujiNet hardware demigod @mozzwald is hard at work assembling Ice Cream Sandwiches (the ESP32 variant of #FujiNet), I AM PSYCHED!

 

Image may contain: table and indoor

 

No photo description available.

  • Like 7

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...