Networking with Hatari?

A forum about the Hatari ST/STE/Falcon emulator - the current version is v2.5.0

Moderators: simonsunnyboy, npomarede, thothy, Moderator Team

MegaSTEarian
Atari Super Hero
Atari Super Hero
Posts: 550
Joined: Tue Aug 18, 2020 5:23 pm

Networking with Hatari?

Post by MegaSTEarian »

Sorry if this has been discussed before, I couldn't find any post.


Is it possible to emulate any kind of network card under Hatari?


Edit:
Found this which is a bit old: https://www.atari-forum.com/viewtopic.php?t=30958, which is MiNT only
and
This: http://www.dest-unreach.org/socat/ not what I am asking though

My question is about Hatari. If it can emulate any network card the same way it emulates Atari hardware.
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

I haven't seen any news on this since last time the topic was brought up.

I guess it comes down to what the active developers wants to out their time and efforts into, which is fair. Still, it is imo a great pity that the such a powerful emulator can't do networking, as it would massively extend its uses.

Regards,

/Joakim
MegaSTEarian
Atari Super Hero
Atari Super Hero
Posts: 550
Joined: Tue Aug 18, 2020 5:23 pm

Re: Networking with Hatari?

Post by MegaSTEarian »

True, it would be absolutely useful. I assume Aranym is using some sort of virtual NIC driver to provide networking or reads the hardware when it runs natively.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

Aranym does not emulate any network card. It just provides some simple functions to give mint the needed information like IP address, and functions to read/write data. In some cases (like on macOS) it also uses a BPF module to rewrite the packets. But all that is much simpler than that what Hatari would have to do, pretending that a network card is accessible at some I/O space, and emulating all its behaviour.

Edit.: implementing the same interface in Hatari as in Aranym would be rather easy: https://github.com/aranym/aranym/blob/m ... hernet.cpp

But then you would need to write a driver for Sting/Stik that makes use of this interface. Maybe that is possible, and surely simpler than emulating real hardware.
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3899
Joined: Sun Jul 31, 2011 1:11 pm

Re: Networking with Hatari?

Post by Eero Tamminen »

Till's NE2000 emulation for (very old) Hatari version has rather harsh downsides: To get that to Hatari upstream, somebody would need to at least:
  • Dig up some documentation for that HW, and provide SW setup which can be used to test it
  • Put the code to a separate (e.g. ne2000.c) file with HW register accesses done through ioMemTab<machine>.c tables. Example of how that works can be seen e.g. from this VME register interception commit: https://git.tuxfamily.org/hatari/hatari ... 743f11d76e
  • Find out some way to get it working without needing root access
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3899
Joined: Sun Jul 31, 2011 1:11 pm

Re: Networking with Hatari?

Post by Eero Tamminen »

ThorstenOtto wrote: ↑Wed May 05, 2021 3:34 pm Edit.: implementing the same interface in Hatari as in Aranym would be rather easy: https://github.com/aranym/aranym/blob/m ... hernet.cpp

But then you would need to write a driver for Sting/Stik that makes use of this interface. Maybe that is possible, and surely simpler than emulating real hardware.
Besides MiNT, also m68k Linux includes NatFeats network driver, which would make Linux much more usable under Hatari. And unlike Till's solution, it would not require root...

(Main use-case for running m68k Linux under Hatari would be making sure that Linux still works on real Atari HW i.e. debugging/profiling.)
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

ThorstenOtto wrote: ↑Wed May 05, 2021 3:34 pm Edit.: implementing the same interface in Hatari as in Aranym would be rather easy: https://github.com/aranym/aranym/blob/m ... hernet.cpp

But then you would need to write a driver for Sting/Stik that makes use of this interface. Maybe that is possible, and surely simpler than emulating real hardware.
I suppose it would then also be technically possible to do a similar solution, writing a driver targetting mintnet instead, addressing the same interface?

Just goes to show how much easier it is to write a wishlist rather than actual software 😜
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

GokMasE wrote: ↑Fri May 07, 2021 11:37 am I suppose it would then also be technically possible to do a similar solution, writing a driver targetting mintnet instead, addressing the same interface?
Such a driver already exists: https://github.com/freemint/freemint/tr ... /xif/nfeth

This is what Aranym uses, and what could also be used for Hatari if the same interface is implemented there.

But on Hatari, you typically run plain TOS, not MiNT, that's why it may be neccessary to also write a driver for STinG.
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

Ok, that makes sense, I didn't realize it may even be reused like that - very interesting. If the same interface would be available under Hatari, I would absolutely be (mainly) interested in using it with MiNT.
simonsunnyboy
Moderator
Moderator
Posts: 5775
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Networking with Hatari?

Post by simonsunnyboy »

Sting and its ancestor STiK use a sort of memorymapped interface and system call.
Hatari could provide a this as "hardware" registers and an additional small ROM somewhere.

Then only some cookies and detection must be handled from a TOS side driver.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
MegaSTEarian
Atari Super Hero
Atari Super Hero
Posts: 550
Joined: Tue Aug 18, 2020 5:23 pm

Re: Networking with Hatari?

Post by MegaSTEarian »

simonsunnyboy wrote: ↑Fri May 07, 2021 3:11 pm Sting and its ancestor STiK use a sort of memorymapped interface and system call.
Hatari could provide a this as "hardware" registers and an additional small ROM somewhere.

Then only some cookies and detection must be handled from a TOS side driver.

This is what I was thinking pretty much. Could be anything that has software support on TOS/MiNT and would be emulated on the hardware level.

A possible solution would be emulating NetUSBee (all or part of it) as it combines lots of stuff, has current drivers and goes into the cartridge slot that's already emulated and it is contemporary and info can be found. unfortunately I am not much of a programmer so not able to assist in this.
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

simonsunnyboy wrote: ↑Fri May 07, 2021 3:11 pm Sting and its ancestor STiK use a sort of memorymapped interface and system call.
Hatari could provide a this as "hardware" registers and an additional small ROM somewhere.

Then only some cookies and detection must be handled from a TOS side driver.
Although, let's assume that someone would add to Hatari the same fundamental natfeat network interface as the one in aranym, there would then be a ready-to-use driver for mintnet already waiting - if so, then it would seem more logical to me (and maybe involving less work) to do a stik/sting driver stand-alone as well, addressing the network interface of Hatari the same way as the mintnet driver would.

In my mind it would seem more tidy to have each driver (be it mintnet or stik) connecting the same way to the same networking interface within Hatari, rather than having one of them sort of built-in, but I could be missing some aspect of it for sure.
simonsunnyboy
Moderator
Moderator
Posts: 5775
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Networking with Hatari?

Post by simonsunnyboy »

I have no idea what would be easier. Write a complete Sting driver from scratch or something halfway only?

As a user I would prefer something more native than Netusbee emulation. The latter is slow over the cratridge port and I assume emulating this special behaviour is way more complicated than adding such a Netfeats networt interface.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

MegaSTEarian wrote: ↑Fri May 07, 2021 3:46 pm has current drivers and goes into the cartridge slot that's already emulated
The problem to emulate something that uses the cartridge slot is that it prevents the GEMDOS emulation to be used at the same time, since Hatari also uses the cartridge for that.
Although, let's assume that someone would add to Hatari the same fundamental natfeat network interface as the one in aranym,
I'm working on it. But may take some time since i don't have a working mint installation for Hatari currently.
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

ThorstenOtto wrote: ↑Sat May 08, 2021 6:01 am
Although, let's assume that someone would add to Hatari the same fundamental natfeat network interface as the one in aranym,
I'm working on it. But may take some time since i don't have a working mint installation for Hatari currently.
That is awesome news, please keep us posted :D
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

GokMasE wrote: ↑Sat May 08, 2021 6:18 am That is awesome news, please keep us posted :D
Unfortunately, my network setup for aranym is not working anymore (had this problem already about half a year ago). So if i have to get that running again first before i can do any tests.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

Now that my network works again, i'm making a bit progress:
Screenshot_20210509_185949.png
There you can see Hatari running a (slightly hacked) 030 MiNT kernel, pinging the host it is running on.

I wished i could show a picture running netsurf, but unfortunately it crashes a with bus-error :(

PS.: if someone wants to experiment with a MiNT setup for Hatari, i've made available a harddisk image file + config for it: http://tho-otto.de/download/hatari-mint.zip
You do not have the required permissions to view the files attached to this post.
MegaSTEarian
Atari Super Hero
Atari Super Hero
Posts: 550
Joined: Tue Aug 18, 2020 5:23 pm

Re: Networking with Hatari?

Post by MegaSTEarian »

ThorstenOtto wrote: ↑Sun May 09, 2021 5:58 pm Now that my network works again, i'm making a bit progress:

Screenshot_20210509_185949.png

There you can see Hatari running a (slightly hacked) 030 MiNT kernel, pinging the host it is running on.

I wished i could show a picture running netsurf, but unfortunately it crashes a with bus-error :(

PS.: if someone wants to experiment with a MiNT setup for Hatari, i've made available a harddisk image file + config for it: http://tho-otto.de/download/hatari-mint.zip

Looks promising!
(image downloaded, thanks for that as well :) )
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

ThorstenOtto wrote: ↑Sun May 09, 2021 5:58 pm Now that my network works again, i'm making a bit progress:

Screenshot_20210509_185949.png

There you can see Hatari running a (slightly hacked) 030 MiNT kernel, pinging the host it is running on.

I wished i could show a picture running netsurf, but unfortunately it crashes a with bus-error :(

PS.: if someone wants to experiment with a MiNT setup for Hatari, i've made available a harddisk image file + config for it: http://tho-otto.de/download/hatari-mint.zip
It is so cool there is already progress on this, keep up the good work!

As for the MiNT setup (thanks for suppying it) I got it up and running but admit it took me a while to understand that the GEMDOS HDD emulation is a no-go under MiNT. I worked around it somewhat by booting into EmuTOS only when I need to transfer files between images and Host OS.

However, I am not successful with trying to enable the extended VDI modes when booting into MiNT/XaAES. Under EmuTOS it works as expected, but when I try it with MiNT/XaAES I always get: "exception 4 for AESSYS pc:FA0028 addr:0".

Could it be related to the missing include file referenced in xaaes.cnf as "include u:/c/mint/xa_video.cnf" by any chance? I seem to recall from back when migrating from my ancient XaAES setup (that was on the Falcon/CT60) to a more recent one, that wrong video settings can really rub XaAES the wrong way..
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

GokMasE wrote: ↑Sun May 09, 2021 10:56 pm it took me a while to understand that the GEMDOS HDD emulation is a no-go under MiNT.
Yes, that's a drawback. Maybe you can try to build your own MinT Kernel with OLDTOSFS defined, that should theoretically allow the GEMDOS emulation to work again. Another (cleaner) alternative would be to also add the HOSTFS native feature to Hatari.
I worked around it somewhat by booting into EmuTOS only when I need to transfer files between images and Host OS.
I mount the image on linux in order to populate it. There is only one partition on it, at offset 1024. Just don't forget do unmount it again before starting Hatari, that is likely to corrupt it. Using mtools should also work.
Could it be related to the missing include file referenced in xaaes.cnf as "include u:/c/mint/xa_video.cnf" by any chance?
I dont think so, but you can try to replace it with just a "video =" line.
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

ThorstenOtto wrote: ↑Mon May 10, 2021 5:24 am I dont think so, but you can try to replace it with just a "video =" line.
That made no difference, but I'll look into it some more this evening if time allows. In my previous experiences with XaAES it did seem overly sensitive to changing gfx settings, but I always suspected the ct60-patched TOS for that.
User avatar
GokMasE
Captain Atari
Captain Atari
Posts: 322
Joined: Sun Mar 02, 2003 11:16 pm
Location: Sweden
Contact:

Re: Networking with Hatari?

Post by GokMasE »

GokMasE wrote: ↑Mon May 10, 2021 11:54 am
ThorstenOtto wrote: ↑Mon May 10, 2021 5:24 am I dont think so, but you can try to replace it with just a "video =" line.
That made no difference, but I'll look into it some more this evening if time allows. In my previous experiences with XaAES it did seem overly sensitive to changing gfx settings, but I always suspected the ct60-patched TOS for that.
Ok, got it working now. I had installed NVDI but had totally forgotten that NVDI installer also tosses the infamous WDIALOG.PRG into /AUTO.

Disabling WDIALOG.PRG made XaAES cope with the extended VDI modes.


However, to get fully back on topic again - will the upcoming network support be available under Hatari regardless of the host OS? (I mean, will it work even if Hatari is running on Windows or Mac OS?)
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

Theoretically, yes, since (from the emulator side) its the same as in ARAnyM, and there it is supported. But i have not tried that yet (IIRC, you need a wintap driver for Windows)
MegaSTEarian
Atari Super Hero
Atari Super Hero
Posts: 550
Joined: Tue Aug 18, 2020 5:23 pm

Re: Networking with Hatari?

Post by MegaSTEarian »

Thanks @ThorstenOtto.Wondering what it would take for a NIC to be available under TOS as well.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: Networking with Hatari?

Post by ThorstenOtto »

As noted above, a driver for STinG maybe. I'm working on that, too. But i since i never used STinG directly, i could need some advice in how to set it up, and what application i can use for testing.
Post Reply

Return to β€œHatari”