[Nino K] built a portable game player for text adventures. He decided he had spent enough time with the ATmega328 kit from NerdKits to build a more advanced project.
To start with, he built a prototype PCB and tested out the concept. It worked so he began on the real thing. He tore out the guts from a broken Game Gear, saving some parts like those responsible for supplying power. Impressively, he etched his own replacement boards for the Game Gear’s control pads; surprising himself at how simple it ended up being. He fit a 16×4 LCD into the space previously occupied by the Game Gear’s screen.
The program itself is a simple text adventure of his own creation. He even added little 8-bit sprites. The story is classic, a princess has gotten herself in some trouble and a brave hero has been coerced into saving her. Last, he added some music and sound effects from Zelda with a piezo buzzer.
This project is guaranteed to disappoint a visiting younger cousin or relative, but we like to think of that as a feature and not a bug. Great work!
Zork, Hitchhiker’s Guide to the Galaxy, and all the other Infocom text adventures are much more clever than the appear at first glance. They actually run on a virtual machine, with all the code for the game files squirreled away in the Z-machine format. This is great if you’re writing a game for a dozen platforms; once you have an interpreter running on one system, the entire library of games can be shipped out the door.
While the Z-machine has been ported to all the retrocomputers you can imagine and a few different brands of microcontrollers, no one has yet implemented the Z-machine in hardware. There’s a reason for this: it’s crazy. Nevertheless, [Charlie] managed to implement the Z-machine in an FPGA, using only a few extra commands for driving a display.
The circuit is constructed with a $10 eBay special FPGA, the Cyclone II EP2C5. Other than that, it’s just some Flash, some RAM, a display, and a whole lot of wire. The standard Z-machine spec is followed, version 3 specifically, meaning this text adventure on a chip can run nearly every Infocom game ever written. The most popular ones, at least.
This isn’t [Charlie]’s first time in the ring with the Infocom Z-machine. He ported the Z-machine to a freakin’ pen a few years ago.
You can check out [Charlie]’s video demo below. Because there was a bit of extra space in the FPGA, [Charlie] managed to put a Mandelbrot implementation and Space Invaders in as an easter egg.
Continue reading “The Zork Virtual Machine Implemented In Hardware”