Classic Macintosh Infocom Software

01/01/2024 21:22:00

(While the games I mention here are long out of print, and widely available on the internet, I will not be linking directly to most of these resources to be extra safe regarding copyright issues… A few minutes with Google will point you in the right directions though.)

A few years ago, I fell down a rabbit hole emulating classic Macintosh computers. Over the holidays I was reading a book that a friend recommended, and ended up digging back into some of the games I owned from that time, which included some of the Infocom classics.

Previously, I was able to get my copies of Zork I and Moonmist to run, and even able to access my old save game files. No – there is no real reason for this. Yes – it was completely a waste of time. Yes – it was a lot of fun…

On a whim, I dug around and was able to find downloads that seemed to be cracked versions of Zork 2 and Zork 3 that were the same versions that I owned. They worked, and were able to load my save game files for those games as well. This leaves me short of Hitchhiker’s Guide to the Galaxy, but my disk was corrupted, so I’m not sure that those files will ever be recovered. (I never got very far in that game, so it’s not a huge loss….)

Years ago, I had looked briefly into modern tools for writing interactive fiction, including Inform 6 and Inform 7. I decided to look around again, and also to look into tools related to Infocom games in particular, since large troves of files were released on the internet from one (more?) of their old hard drives. There was much exploring, but I will focus on a few key fruitful avenues of exploration:

  1. Finding old Infocom games.
  2. Running old Infocom games
  3. Recreating classic Macintosh versions of Infocom games that I was unable to find
  4. Playing around with creating interactive fiction compatible with the old Infocom interpreters for the Macintosh

Finding Old Infocom Games

Years ago, I found a lot of sites containing Infocom games in various forms (Macintosh compatible applications, raw story files, etc.) The usual classic Mac software repositories, the Internet Archive, and the Obsessively Complete Infocom Catalog were all very helpful in finding more this go around. Especially – I found the story files (.z3, .z5, .z6 files) for almost every version of every Infocom game released. It was impressive!

Running Old Infocom Games

There is no shortage of interpreters for these story files for every OS you can imagine. But as a child of the 70s and 80s, the one that I think of as canonical is the Macintosh parser that I used for all three Zorks, Hitchhiker’s Guide, and Moonmist. (Though Moonmist was a touch more modern.) I found some versions of the games that had interpreters for classic Macintoshes, but only a small percentage compared to the total number of variations out there, and a few key versions were missing.

Rebuilding the Past

(This section represents new knowledge – I was not able to find any information out there about this, but perhaps my Google-fu was weak…)

What I really wanted was to be able to run some of these story files in the form that fits with my childhood, however. It just doesn’t feel right playing a game from 1984 in a modern interpreter, even though they have tons of new features. I wanted to be able to check a couple out on my virtual Mac 128k, just like I experienced as a kid.

(BTW – There are tons of articles about the technologic innovations that went into the way Zork was built and played. If you’re a tech nerd, it is really interesting to learn about. Google away – Z-Machine, Interpreters, virtual machines, etc.)

Because of the way that Infocom games were built (the game file itself was bit for bit identical across machines, with different interpreters “wrapped” around the game depending on your operating system and hardware), it seemed as though this should be possible.

My first attempt was to diff 2 different games with what should have been similar, if not identical, interpreters. I ended up with sources that had lots of commonalities, but lots of differences, all scattered throughout. I was hoping that one end of the app would be identical (representing the interpreter), and the other end would be different (representing the different story files.) I was wrong.

I then realized two things:

  1. The story files shared a lot of code – the early games were built by copying the previous game’s source, and then modifying it until you had the new game. These kept much of the core vocabulary and parser intact from game to game. It would make sense for the story file to have lots of shared sections of code, interspersed with differences.

  2. Classic Macintosh files (especially applications) had separate resource forks and data forks.

These realizations allowed me to make the key “breakthrough” in my understanding of what was happening – the Macintosh applications contained the story file in the data fork, and the interpreter in the resource fork. It looks like one file, but is really two separate files under the hood. Yes – I understand that this is not really new information, but it hit me in a new way and let me realize that with a collection of appropriate parsers from a small subset of games, I could combine them into a much larger set of games reflecting the Infocom catalog across the years.

I then came up with two ways of building my own “old-school” Infocom games…

The Classic “By Hand” Approach

Within a classic Macintosh computer, real or virtual, you can use ResEdit to swap out the resource and data forks separately to create new applications that you cannot find elsewhere.

Basically, you need the desired story file for a game you don’t have (e.g. a .z5 file for Wishbringer), and a working copy of a different game from the same time period (basically the two game versions you are using need to both use the same format (e.g. .z3, .z5, or .z6)). We’ll assume we have a working copy of Hitchhiker’s Guide. For consistency, we’ll use the Solid Gold release of both games (which uses the .z5 format).

Since we now have Wishbringer.z5 on our virtual Macintosh, we need to open up ResEdit.

  1. Open the HHGTTG app in ResEdit. Copy all of the resources.
  2. Open Wishbringer.z5 in ResEdit. You’ll need to approve creating a new resource fork, since there was not one previously.
  3. Paste the resources you copied previously. (You must have booted from a writeable disk so that ResEdit has a place to put a copy buffer. Running from a locked boot disk will not work.)
  4. Save Wishbringer.z5
  5. Use ResEdit’s “Get File/Folder Info” command, and make the Type/Creator codes of Wishbringer match those of HHGTTG. Check the “Has BNDL” and “Inited” checkboxes for the same reason. Save your changes and quit ResEdit.
  6. Remove the .z5 file extension from the file name for appearances.

You should now be able to run Wishbringer. You can use the “version” and “$verify” commands to make sure things seem are correct, and off you go! You’re playing your own hand-built replica of the Infocom version of Wishbringer! Save and Restore should work just fine, so you get the full experience.

The Bulk Approach

I started down this rabbit hole, because I was curious whether there was a way to create my own demo interactive fiction game, but to play it inside a classic Infocom interpreter on a virtual Mac. This was something I only dreamed of as a kid, and I figured it was possible. I also wanted a reliable way to easily recreate my results in the future.

Basically we’ll do the same thing as the “By Hand” approach, but in a way that is scriptable and happens mostly on the macOS side, rather than the classic Macintosh side. I’ll describe the basic steps.

  1. Use the same approach as above to copy the resources from a working game into a new file (it can be a blank file, the story data is not needed yet.) You also don’t need to worry about type and creator codes right now.
  2. Use BinHex (or something similar) to protect the file while transferring it to your macOS computer (which probably requires Xcode and the build environment.)
  3. On macOS, use something similar to macbinary decode -o Interpreter <filename.Bin> to decode the file you just downloaded.
  4. Decompile the resources into a text file – DeRez Interpreter > Interpreter.r
  5. Compile the resources into a new file’s resource fork – Rez -o NewInterpreter Interpreter.r
  6. Add the story file to the data fork – cat someGame.z3 > NewInterpreter
  7. Set the type/creator codes and BNDL bit (SetFile -t APPL -c INFO -a B NewInterpreter)
  8. protect the file – macbinary encode -o NewInterpreter.bin NewInterpreter
  9. Send the .bin file back to your virtual machine
  10. Decode it there with BinHex
  11. Run your new game.

(By itself, this is just a more complicated way of doing the same thing we did above….)

The reason I wanted this approach was that I wanted to be able to automate as much as possible. This can all be scripted with a simple bash script, allowing you to specify which interpreter version to use (I extracted a couple of z3 compatible interpreters and a z5 version for the Solid Gold and other more modern games). I also hand-modified the decompiled resource files so that the application creator type is now YYZZ and the save game file type is now WWXX. So far, these letter combinations have not appeared anywhere in the binary data, which allows me to then find/replace in my scripts to automatically set the creator and save game file types automatically, and modify the relevant portions of the CODE resources. I make sure this matches the creator code in the SetFile step, and my custom apps can have different creator codes so that the save game files don’t conflict (Infocom was not good about this.) Or I can match the Infocom codes so that my game will read and write files that are compatible with the Infocom version.

With this technique, I was able to build Solid Gold versions of games I was otherwise unable to find, as well as put custom games created by Inform into a wrapper that runs just like the old school Infocom games on Mini vMac.

Figuring this was not particularly productive, but it was a lot of fun and pretty rewarding. :) My understanding of computers and how to hack things together is a lot more advanced than it was in 1986…

Building With Inform

I was interested in experimenting with the some of the things that can be done with modern interactive fiction. And I wanted to be able to play it on an older Mac, just for fun.

I figured this means I need to create a pretty compact game file, so I was interested in targeting .z3 instead of .z5. Which meant Inform 6 instead of Inform 7. I also discovered PunyInform, which allows the creation of smaller .z3 files while keeping the most important functionality.

I successfully compiled the Library of Horror demo from PunyInform into a .z3 story file, which I then combined with a z3 Infocom interpreter using the above approach, and successfully played the demo on Macintosh system 6. Whether I do anything else with this — we’ll see. But it was fun to discover and experiment with! I have some ideas around procedurally generated mysteries that I want to experiment with.

One More Discovery

While looking for ways to play z3 files on classic Macs, I discovered mojozork. This is a very small z3 interpreter in C, written as a single file.

It didn’t help me with the classic Macintosh goal, but it was interesting to play with to compile a simple interpreter from scratch. It’s crazy to look at how simple the interpreter code is – it’s a relatively short file with not all that much code. Which just shows how impressive the original design of Zork was – the virtual machine handles almost everything, so that porting the game to new hardware is really easy….

Similar Pages