Like the Commodore Amiga, the Atari ST was an iconic home computer, offering many people their first glimpse of the 16-bit digital world. After almost 40 years, it’s still an engaging design, although the internal hardware may need a few repairs and upgrades to fit in with the modern standards. In this article, you’ll see how to replace the internal electronics of an Atari-ST with a Raspberry Pi, while retaining the original keyboard. None of the changes performed require modifications to the original case or to the circuitry of the Atari, making the process completely reversible in the future.
Simulating a classic system on new hardware is nothing new, and after 40+ years of technological advancement, emulating home computers, classic mainframes, and even full-blown arcade machines is well within the reach of a small computer like the Raspberry Pi. What desktop emulation doesn’t have is the classic ’feel’ of the original machine. A modern keyboard and joystick don’t have the same tactile impact as a classic machine, and if you want to recapture that feeling but have access to modern system tools, then you’ll need to consider repurposing an existing machine.
Talk to the Keys
The classic Atari ST case with the built-in keyboard and parallelogram F key design is one of those features you can’t emulate in software, but it isn’t too difficult to interface original Atari hardware with a modern microcontroller, and you don’t even need to solder any wires to do so. Remove the screws from the base of your Atari ST, and remove the lid. Remove the motherboard and all internal components, keeping the keyboard and outer case to one side. This isn’t a difficult process, and there are no hidden screws or clips to worry about. You can safely store all of the components that you don’t need so that the whole process is reversible.
The original Atari keyboard has its own microcontroller built in to process key presses. Depending on your model of Atari, the keyboard will be connected to the motherboard by a single connector with either 8 or 18 connections. On earlier Atari machines, the 18-pin connector was used, routing joystick and mouse connections through the keyboard’s 6301 processor. On later machines like the 1040ST, only the keyboard signals were routed through the connector, so fewer pins were required.
|2||NC – Hole is blanked off to facilitate correct orientation of the plug|
|2||NC – Hole is blanked off|
|3||Joystick 0 Right|
|4||Joystick 0 Left|
|5||Joystick 0 Down|
|6||Joystick 0 Fire / Mouse Right Btn|
|7||Joystick 0 Up|
|8||Joystick 1 Right /Mouse YB|
|9||Joystick 1 Left / Mouse YA|
|10||Joystick 1 Down / Mouse XA|
|11||Joystick 1 Fire / Mouse Left Btn|
|12||Joystick 1 Up / Mouse XB|
The full pinout is shown here for completeness, but to interface with the keyboard, only five pins are actually necessary. The 5 V and Ground lines are needed to power the keyboard’s microprocessor, and the RX/TX pins are used to communicate. The Reset pin is needed to initialise the keyboard, and contrary to what you might read online, failing to connect this pin can lead to some very strange behaviour from the keyboard. Talking to the keyboard with a Raspberry Pi is just a matter of connecting these five pins to a suitable microcontroller that can be configured as a USB HID, reading the outputs from the keyboard’s microcontroller using a serial connection, and mapping the outputs to a modern-day USB keyboard equivalent. The keyboard communicates using a slightly unusual 7812 bps connection, and the connections are made RX to RX, TX to TX, which is frustrating but not uncommon. The process of translating the keyboard signals has been made easier, thanks to the work of Kevin Peat where you can find code for the Arduino Leonardo. The connection between the keyboard and the Arduino Leonardo can be accomplished with male DuPont connectors, meaning that no soldering or wire-cutting is necessary. A small dab of hot glue or Kapton tape will hold the connection together, and can be easily removed in the future.
Waggle Your Joystick
After the keyboard, the most iconic thing about Atari computers (and, likely, the first thing that people think of when you say the name Atari) is probably the classic black joystick. Originating with the Atari 2600, the joystick is digital, with five internal switches connected to a 9-pin D-sub plug. This 9-pin joystick connector remained in use across many computers and consoles for many years, with some changes to the internal wiring. On early Atari ST computers, the first joystick socket was shared with the system mouse. On later versions of the ST, the 9-pin sockets were replaced with a 15-pin variant that allowed for more connected devices. Connecting a classic joystick to a modern computer is a common task, and there are a variety of different ways that you can accomplish the task. One option is to use an off-the-shelf converter that has the correct socket fitted to a USB plug. This is the easiest solution, and requires zero tinkering to get working. However, from an aesthetic point of view, it requires USB cables going into the classic case, and it can look a little bit odd. For a classic Atari ST with side-mounted sockets, it’s much neater to mount a USB joystick encoder inside the Atari ST, wired to D-sub connectors in their proper place on the side of the case. There is a 3D-printed mount provided in the files for this project that will let you mount the sockets to a board that matches the PCB layout of the Atari ST motherboard. This means you can place in a dummy PCB, and mount the 3D-printed socket adapter into the Atari without needing to use any permanent fixings. The pinout for the Atari joysticks is very simple, as you can see from the table here.
If you’re wondering about the reason behind the Reserved and NC pins, those pins were used on the original Atari console for paddle controllers. In theory, you could use a joystick encoder to reproduce this functionality for emulation purposes, even though it isn’t a function found on Atari ST itself.
Of Mice and Mending
The difficult choice at this point is what to do with the mouse socket. The traditional Atari ST mouse plugged into the side of the Atari next to the joystick. If you wanted to play a game with two joysticks, you needed to remove the mouse and plug it in or build an external switch-box. With a modern machine, this isn’t an issue. You can either opt for a Bluetooth mouse, add extra USB sockets, or remain faithful to the original design and dedicate one of your sockets to being a mouse socket. If you’re lucky enough to have a working Atari ST mouse and want to do this, then there are adapters around that will let you connect the mouse via USB in the same way that you can connect the keyboard or joystick. If you prefer to find out how the mouse works and have a go at implementing this yourself, you can start by having a look at this Shaft Encoder Interface for an explanation of how the Atari mouse works. However, even the most ardent fan of the Atari ST will admit that the ball mouse was a bit of a brick by modern standards, and after decades of use, many old mice have failed microswitches or encoders. For the sake of simplicity, it’s probably a good idea to rely on a modern Bluetooth or USB mouse to control the Raspberry Pi, and then dedicate the original mouse port exclusively for joysticks. If you’d like to add a more authentic look, you can use this STL file of an Atari ST mouse and 3D-print your own version.
In terms of hardware, there’s little else to consider. Any holes left in the Atari ST case can be filled with 3D-printed plugs. No glue is required because the plugs are held in place with a rubber O-ring. A short HDMI extender fits neatly into the space previously occupied by the monitor socket, and a 2.5 mm socket mounted in the old power plug location can be used to provide power to the Raspberry Pi. USB extenders can bring out the USB sockets to the outside of the case in the same way.
Once you’ve connected up all of the necessary cables to your Raspberry Pi, it’s time to start thinking about emulation. The standard option for Atari ST emulation on a Raspberry Pi is Hatari, but since you’re already here, why not install support for something more than just the Atari ST?
RetroPie is a specialised system that brings together several emulation projects on the Raspberry Pi, including the Hatari emulator. You can either install it onto an existing system, or you can download an installation image for the Raspberry Pi that does the majority of the work for you. Installing RetroPie is as easy as downloading the appropriate image from retropie.org.uk, then write the image to a microSD card, insert the card into the Raspberry Pi, turn on the power, and follow the on-screen prompts.
The RetroPie website has excellent documentation, and this is the best place to start. Once RetroPie is installed, you’ll need to do a little bit of extra work to set up the Atari ST emulation. The Hatari emulator needs a valid TOS image installed in order to work.
The TOS image needs to be installed to the folder ~/RetroPie/BIOS/tos.img, while game images are copied to /home/pi/RetroPie/roms/atarist. The Hatari emulator uses disk images to load games from a virtual floppy drive (or drives). Starting the emulator with a disk image inserted
into the drive will automatically load that image. Loading games that require multiple disks means that you need to open up the Hatari emulator settings, and change the disk inserted in the virtual drive. You can find more information on this in the RetroPi docs and also from the Hatari user’s manual.