Telnet to a BBS using a terminal program in the Hatari emulator

UPDATE (2020-09-03): In the years since I wrote this blog post, I have found some ways to improve this process. Please read my new tutorial on how to telnet to a BBS using a terminal inside the Hatari emulator.

When I was a kid calling BBSes, I used an Atari ST computer. But I seldom used the ST’s native terminal mode: VT-52.

The reason is simple. Atari’s VT-52 mode offered only 4 colors in medium resolution. PC clones, however had an 80×25 mode with 16 colors and special graphics characters. This was known as ANSI.

PC BBSes with their colorful ANSI graphics were dominant in the early to mid-1990s, while Atari BBSes were dying out. Since I was mostly calling PC boards in those days, I used a terminal program called “ANSIterm” which could display ANSI graphics on the Atari ST using special tricks.

I’ve been thinking about Space Empire Elite, one of the first BBS door games I ever played. SEE was written for Atari ST BBSes. It supported VT-52 as well as plain ASCII, but not ANSI. But I had never seen it in VT-52. How would it have looked? I was curious.

The problem

I no longer own my Atari 520ST and 1040STe, so using actual hardware was not an option. Could I somehow connect to a BBS using an Atari terminal in emulation?

It turns out that the emulator Hatari has an option to emulate the Atari’s serial port. If you have a serial modem attached to your Mac or PC, Hatari can allow programs running inside the emulator to connect to it, and consequently the emulated Atari can dial in to a BBS.

I no longer own a modem, either. Heck, I don’t even have a land line.

That led me to think about telnet, the main way I connect to BBSes these days. I use SyncTerm for Mac OS X, which supports ANSI colors and graphics, as well as PETSCII and ATASCII (for 8-bit Commodores and Atari BBSes, respectively).

Alas, SyncTerm does not support the Atari ST flavor of VT-52. Nor could I find any other terminal programs that did so.

The idea

I figured maybe there was a way to link a telnet connection to a virtual serial port that Hatari could access. I had no idea how one might accomplish such a thing, but it seemed possible.

I scoured the web and came up with two names:

  • socat, “a relay for bidirectional data transfer between two independent data channels”
  • tcpser4j, “a piece of software that runs on a PC/Mac/Workstation and turns a regular rs232 port into an emulated Hayes compatible modem [that] uses TCP/IP for the connection.”

Jim Brain created tcpser and tcpser4j (the Java version) to allow old Commodore computers to make telnet connections.

The way it’s typically used, tcpser is installed on a modern, internet-connected Mac or PC. Then you connect the Commodore to the Mac with a serial cable. After that, you can type Hayes “AT” commands into your Commodore’s terminal program, or even host a BBS on your Commodore. As icing on the cake, some versions of tcpser offer sound effects to make it sound like a modem is dialing and handshaking with another modem. Cool!

I had a Mac on which I could run tcpser, but I did not have an Atari ST to connect to it. All I had was the Hatari emulator. But maybe socat could allow tcpser to communicate with Hatari.

The details

I downloaded tcpser4j and socat and installed them on my machine, a Mac Pro running OS X Mountain Lion.

The first trick was getting tcpser4j to run. It requires RXTXComm, and initially RXTXComm wouldn’t work on my 64-bit Mac Pro. However, by following instructions from Marcel Fiechter I got RXTXComm working.

I found out that tcpser4j offers something called an “IP232 port option” that is meant to work with a Commodore emulator called WinVICE. Sounded like just what I needed.

To enable this, I edited tcpser4j’s config-linux.xml file. I commented out this line …

<Modem type="rs232" device="/dev/ttyS0" speed="38400"> 

… and then uncommented this line:

<Modem type="ip232" device="25232">

Next came the tricky part.

The documentation for socat is thorough, but it’s Greek to me. I just don’t understand all the TCP, ports, pipes, ttyS0s, and stuff.

Still, I did the best I could and tried many variations. To my amazement, I landed on something that worked.

After launching tcpser4j, I fired up socat on the Mac OS X command line like this:

socat PTY,link=/tmp/josh,raw,echo=0 TCP4:localhost:25232

The last step was to open Hatari and edit to its preferences, setting its serial emulation to use that same /tmp/josh file.

I immediately launched an old copy of VanTerm from within Hatari. I tried typing an AT command, and it echoed. It was working!

I telnetted in to an Atari ST BBS called Dark Force and headed to the games area. At last I had the answer to my question. Here’s how Space Empire looks in VT52 mode:

Anyway, I think what I’m doing is using socat to pipe tcpser4j’s serial connection on port 25232 into the /tmp/josh file. Hatari can then communicate with this file.

I may not have that exactly right, but the fact remains — it works!

My emulated Atari can telnet!

(Final note: If you try this yourself, make sure you wait to activate Hatari’s serial emulation until after you the terminal program is loaded. I’ve noticed Freeze Dried Terminal and others often freeze the emulator if you start the serial emulation before launching them.)

13 thoughts on “Telnet to a BBS using a terminal program in the Hatari emulator

    1. Kirkman Post author

      Jas, that’s a decent idea, though I would point out that all the pieces are available at the links I included in the body of the blog post. I’ll see what I can assemble.

      Reply
  1. mechatour

    Hi – great article that really got me thinking (and messing about for 3 days!)

    I based everything I’ve done on your article, although I’m using netcat to do socat’s job (socat was just not very happy on Windows – didn’t like the locked files from Hatari.)

    Finally I got it working, not with TCPSER4J, but the older command line driven TCPSERV. For some reason connecting to Darkforce winds up with a load of “-4” codes repeating for ever with the newer java based version! I’m thinking it’s all in the configuration. Did you have teething problems? If you did it would be interesting to know what you did to solve the issue and maybe to see your config.xml for TCPSER4J. I could compare my settings to yours and hopefully try to get this working 100%.

    The main issue appears to be receiving files over X/Y/ZModem however. I get CRC errors and the download falls apart. Can you confirm if you can transfer files OK using your setup? I’m not sure if it’s TCPSERV or that it’s just incompatible. Another reason it would be beneficial to me to see your config file! At least I could troubleshoot where the issue is.

    So I’m 90% of the way there, and it’s all thanks to your article. When I get everything working well I’ll probably create a blog post, linking back to yours, explaining what I did. Doing a search for the issue pretty much only reveals your article, so I guess there aren’t many of us wanting to connect to a BBS with an Atari Emulator over TCP. Who would of thought it? =)

    P.S. connecting to a BBS with files dating back 20-odd years is amazing! It’s like time travelling to the 90’s, bringing back so many memories. Thanks again for helping out =)

    Reply
    1. Josh Renaud Post author

      I hadn’t tried file transfers within the emulator until now, mostly because I could do the same transfers using other telnet apps (SyncTerm being the best).

      Unfortunately, I’m getting the same CRC/data errors you are, though I tested with ANSIterm. I would probably chalk this up to a problem with tcpser, but it’s possible there are bugs in Hatari’s serial emulation.

      As you said, this is not a task very many people seem interested in trying (alas).

      Reply
  2. Pingback: BBS on Hatari | codebetyar

  3. Pingback: Atari Portfolio notes – pɔs.skʁip.tɔm

  4. Bikerbob

    Josh, did you ever look at this for running BBS software? know of anyone who did? the Hatari guys are all Linux and really have no interest in trying to make this easier to work on WIN7,8,10 .. I

    Reply

Share your thoughts!