Sunday, February 17, 2019


Decades ago, Infocom was synonymous with good storytelling and creative puzzles. It wasn’t the first company to release a text interactive fiction game, but its first release, Zork I, made it the flagbearer for all other IF games to follow. Infocom took over the personal computer market for interactive fiction games by having their games programmed in ZIL (Zork Implementation Language) which is a compact language that easily handled text and object structures. ZIL programs were compiled into Z-code, an assembly code that would run on a “Z-machine”. Infocom created multiple Z-machine emulators (AKA Zork Interpreter Program or ZIP) to run on various computers especially home computers like the TSR-80, Apple II, and Commodore 64. Such an approach allowed a single program to be run on different computers without having to create a separate program for each machine.

Buried in these ZIL programs were the basic structure of how an Infocom game is organized and executed. And it was Infocom’s parser which could understand complex commands with such a small amount of code that seemed miraculous to IF fans. The inner workings of Infocom games remained a mystery until reverse engineering was done that decoded the Z-code format. Much of the knowledge about Z-code was documented in the Z-Machine Standards Document by Graham Nelson and Mark Howell. In this, the Z-code instructions and data structure used by some of those instructions (like Vocabulary by read or objects by get_prop) tables were described. As it was a general document, other data structures specific to Infocom games like verb syntaxes were not mentioned. Several excellent utilities (infodump by Mark Howell and ZILF by Jesse McGrew and Josh Lawren) have helped provide more insight on the data structures of Infocom games. Utilities to translate the Z-code to a more easily readable format did help show the inner routines of the games. Without variable names, attribute references, and object property names, making sense of the game code remained difficult. An internal Infocom use only document, “Learning ZIL - or - Everything You Always Wanted to Know About Writing Interactive Fiction But Couldn't Find Anyone Still Working Here to Ask”, gave basic details about the how the games run and how the syntax parts of the game were designed in ZIL. The release of an MDL-based Zork source code did offer more insight into the inner workings of the original Zork game, but understanding MDL was an added barrier. While there are basic parsing and command processing algorithms in the MDL-version of Zork, they were significantly changed when translated to the microcomputer versions. The release of the Mini-Zork source code and other tidbits from the Infocom cabinet helped unmask and clarify the game code and the coding process that are essential to all Infocom games.

This blog will describe those hidden details of Infocom games, using Zork 1 as the base. It will also provide some of the modifications made to these core routines by specific Infocom games. Subsequent post will provide the inner puzzle workings in all Infocom games. Only the text games will be used. None of the graphics based games are analyzed.

All routine and variable names in the Infocom source code (Mini-Zork) and documentation are in all capital letters. Game names are in bold. Unnamed variables and routines are given names that are a best guess.

Apologizes for any errors in these posts. They'll be fixed if possible.

1 comment: