Emulation Situation

Hello folks,

I don’t know if there’s anyone interested in this kind of thing, but I’m hoping I can get some help. If not, no biggie.

The back story is that this past weekend I decided to re-live my childhood days and used Altirra (an Atari 8-bit computer emulator) and Hatari (an Atari 16- 32-bit emulator) to telnet into various BBS’. It was a hoot.

I can get Hatari to compile on Haiku, so I figured it would be neat to see if I could do it from my trusty Haiku box. However, for Hatari to do network stuff on macOS, it needs two other programs running: tcpser and socat. So I figured, Haiku probably would also, since Hatari re-directs the emulated Atari’s serial ports to a directory. tcpser and socat work together to re-direct (in this instance) telnet traffic to and from that directory.

Trying to compile tcpser results in an error saying “FASYNC is undeclared”. I don’t know what FASYNC is (some sort of asynchronous traffic). The compiler suggests it meant O_SYNC. If anyone out there has Linux or BSD experience and knows about this, I’d take any suggestions.

Trying to compile socat fails with not knowing what VLNEXT or IMAXBEL are. The compiler suggests T_NX and MAXTT, respectively. Are those good alternatives? Are they part of a library?

As a bonus round, I had found out that the latest version of Atari800 has support for the 850 interface (it provided standard serial and parallel ports to the Atari 8-bit line) enabled by default. I’m pleased to say that Atari800 still compiles out of the box. However, it doesn’t look like it’s including the rdevice stuff (for the 850 Interface). I can’t figure out why. Even if I force support on, it doesn’t seem to be happening. And there’s no errors that I see.

So, if someone wanted to play with that (and, maybe, create an hpkg) and see if they could get it working, that’d be real keen. Or even ‘wizard’.

Thanks in advance if anyone has any good ideas or workarounds.

There are old hatari ports in the past, do not know if available in Depot.

Don’t trust the compiler with these suggestions. What it does is find any variable of constant with a similar name. This is useful when you have a typo in code you just wrote, but not so much in this case.

FASYNC seems to be linux specific and I don’t find clear documentation from a quick search.

VLNEXT and IMAXBEL appear to be specific to the GNU C library, and some implementations of termios, respectively

vlnext: Other Special (The GNU C Library)
imaxbel: stty sane set terminal options, define control characters for INTR, QUIT and SUSP signals

I would guess it’s possible to disable these parts of the code in socat and tcpser and still get things somewhat running. But maybe we will need to add support for these things in Haiku if it’s missing.

Hmm, there’s already a port of Hatari around on HP… Maybe they added FASYNC stuff since then without proper checks ?

I found a lot of references to it, but not much about what it is. I guess I’ll try going through the code and see if there’s an alternative to these. Thanks for the help!

That’s a section for RetroArch, if you want to use it with that. I prefer using it on it’s own (so I don’t have to navigate the RetroArch menu) so I just compile it myself.

But FASYNC isn’t an Hatari problem, it’s with a utility called tcpser that I use on macOS.

The way it works is, Hatari re-directs the Atari ST serial port activity to a directory. Then tcpser and socat work together to re-direct what gets written to that directory to and from a network connection. In this case, a Telnet connection.

On the Hatari side, the emulated ST thinks it’s sending and receiving information through a serial port, like a modem.

If there was something else on Haiku that would achieve the same thing, I’d be golden, but I don’t know of anything that will do that.

FASYNC shows up at line 107 of src/serial.c inside the ser_init_conn definition (initialize serial connection, presumably). Here is that line and the associated comments:

/* Make the file descriptor asynchronous (the manual page says only
O_APPEND and O_NONBLOCK, will work with F_SETFL…) */
fcntl(fd, F_SETFL, FASYNC)

This appears to be setting a flag called FASYNC on the file descriptor (fd) used, which according to the comments above and probably the manual for the system call makes the file descriptor (and maybe accesses to it?) asynchronous. There are a bunch of functions with fasync in the name in fcntl.c

I don’t know a whole lot, but I’m guessing some of the code might need reworking for Haiku. If you’ve got an easy way to test the code under FreeBSD that might be worthwhile just to see if it workscleanly out of the box,

The error is quite clear. FASYNC is an undeclared symbol/identifier/whathave you. If you got that on Linux you would probably be missing a needed header file, but it may simply not be an option on Haiku. You probably would need to see what should be done to perform serial I/O on Haiku.

Thanks! I guess I’ll have to roll up my sleeves and dig into the serial stuff. Maybe when I get some vacation I can dig into it.