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

When I was a kid calling BBSes, I used an Atari ST computer. However, I rarely if ever used the Atari’s native terminal mode: VT52.

The reason is simple. Atari’s VT52 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.

ANSI graphics were prevalent on BBSes in the early to mid-1990s. VT52 was not. So I stuck to a program called “ANSIterm” which could approximate ANSI graphics on the Atari using some special tricks.

Anyway, in recent weeks I’ve been thinking about Space Empire Elite, one of the first BBS door games I ever played. SEE was an Atari ST BBS game and did not support ANSI, so I always played it in plain ASCII mode.

How did SEE look in its native VT52 mode? I was curious. But I was also unsure how I might go about experiencing it in VT52 today.

The problem

I sold my Atari 520ST and 1040STe long ago, 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 can emulate the Atari’s serial port. If you have a modem attached to your Mac or PC, you can set Hatari to connect to it, and consequently the emulated Atari can dial in to a BBS.

But there’s the rub. I no longer have a modem, either. Heck, I don’t even have land line service at all.

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, one thing SyncTerm does not offer is support for the Atari ST flavor of VT52. Nor could I find any other terminal programs that did so.

The idea

So I figured maybe there was a way to somehow pipe 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.”

As I understand it, tcpser4j was created to allow old Commodore machines to make telnet connections. You install tcpser4j on a modern computer connected to the internet, like a Mac.
Then you connect the Commodore to the Mac with a serial cable. After that, you can type Hayes “AT-” style commands into your Commodore’s terminal to connect to a BBS via telnet. Tcpser4j also allows the reverse: You host a BBS on your Commodore, and folks can telnet in to it with the help of tcpser4j on your Mac. As icing on the cake, tcpser offers sound effects to make it sound like a modem is dialing and handshaking with another modem. Wow.

Obivously I didn’t have a physical Atari to use with tcpser. But maybe socat could be used to allow tcpser to communicate with the Hatari emulator.

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.)

8 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

Share your thoughts!