Tal Ofer's Arduino Sketch Turns an Espressif ESP32 Into a Standalone Z-Machine for Zork
After abandoning an earlier ATmega-based implementation, Tal Ofer's quest is complete: a standalone microcontroller running Z-machines.
Maker and vintage gaming enthusiast Tal Ofer has turned an Espressif ESP32 microcontroller in a compact, low-power device for playing the classic Infocom text adventure Zork — complete with PS/2 keyboard input and VGA video output.
"This project actually started 9 years ago, when I came across this post on the Arduino forum," Ofer explains of his inspiration. "The user Louis Davis did an amazing work of taking an existing Z-[code] interpreter and make it work on an Arduino Mega with SD card. The thing was, that you had to connect it to a computer and play over the serial monitor. So, I made several attempts to make a standalone unit."
"Adding a PS2 keyboard was easy, but finding a proper output, and get it all to work together was too complicated, and I just stopped trying at some point. Fast forward to a few weeks back, I came across another amazing work, which is the fabGL library for ESP32. Allowing you to basically turn the ESP32 into a small computer, with SD, PS2 mouse and keyboard, sound engine and the cherry on top — VGA output!"
With everything in place, Ofer forked the original project and set about getting it up and running on the Espressif ESP32. On the hardware side, the microcontroller was connected to an old VGA cable hooked into a breadboard via 270 Ohm resistors and to a PS/2 keyboard with a logic-level converter to prevent the 5V device frying the 3.3V ESP32. Finally, Ofer added sound and an SD card reader for storage.
The result is a mostly-fully-functional - with only some screen update functionality and the ability to save and load your game removed - version of Zork running entirely on an ESP32. Thanks to the way Z-code games works, additional titles are also supported — in theory, any game that runs as a Z-machine is compatible.
Ofer has published the source code for the project under an unspecified licence on GitHub, complete with a demo copy of Zork to get you started. A full tutorial for building the hardware, meanwhile, is available here on Hackster.io.