Thursday, June 16, 2005


I don't know for sure, but I would guess that not many people know what a Z-Machine is.

It's the name given to the virtual (imaginary) computer that ran the old Infocom text adventure games. Even today, decades after the fact, I'm amazed at the foresight that Joel Berez and Marc Blank had in architecting this system.

Very much like .NET (and even more like Java), the Z-Machine provides for a compile-once, run anywhere architecture. Story files were compiled for this imaginary computer, and then all that Infocom had to do was write an "emulator" or virtual machine for each platform that ran the Z-machine's byte code. Very cool!

I found the extremely well written The Z-Machine Standards Document by Graham Nelson on Peer Schaefer's if-resources site. It's 182 pages, but anyone interested in Emulation, Virtualization, Infocom games, Assembly Language, Embedded Architecture, etc, MUST CHECK THIS OUT!

Given that this virtual system was first designed on a coffee table in Pittsburg in 1979 with the intention of porting it to multiple 8-bit platforms that existed at that time, it will certainly give you an appreciation for how easy we have it today.

Also, I remember using disk editors and memory editors to try to find text used by the story files (in order to try to snoop around the various games), but could never find anything more than garbage. I always thought that Infocom either encrypted their text or used an alternate character set.

Well, it's actually a form of compression that they use by stuffing three characters into two bytes. The ZSCII character set was roughly based on ASCII, but used only 5-bits per character. 3 * 5 bits = 15 bits, with the high bit of each word serving as the string termination marker. That explains why I didn't see any plain text!

Oh, and the "Z" in Z-Machine stands for Zork.