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.
I think almost everybody who starts hacking on FPGA processors thinks at some point “I’ll make a hardware Z-Machine.” However, they run out of steam pretty quickly after realizing how many addressing modes and complex instructions there are. Impressive project!
What would be even more impressive is a full Glulx interpreter on an FPGA.
Get started bro
That’s crazy awesome.
I think the virtual machine technique would carry too much overhead these days, at least on non-server grade hardware without esxi…
You know how Java/Dalvik(android), .NET, and llvm work right?
Could it be Dark Magic from….
*Puts on his cloak*
….THE WORLD OF TOMMORROW!
[In my defense it’s all Futurama’s fault :P]
What about the “Leather Godesses of Phobos”?
I wonder if it’s possible to port the z maschine to the ESP8266…
Well, here it is running on the Arduino: http://hackaday.com/2014/04/30/the-zorkduino/
Short version: 1mb binary file on the SD card serves as virtual memory.
Awesome. Silly idea done well, plus retro text adventures. Should have a serial terminal for the interface, though. :)