C64 Å-machine interpreter

My two text games Tethered and Pas De Deux are now available for the Commodore 64.

Both of these games were implemented in Dialog. For some time, the Dialog compiler has been able to produce bytecode for the Å-machine, which was designed from the outset with 8-bit systems in mind. But I had only released an interpreter written in Javascript, so the games could only be played from within a web browser. Now I have finally released an Å-machine interpreter for the C64.


Read the instruction sheet (inlined to the right).

Read more about each game on its respective page: Tethered and Pas De Deux.

About the 6502 engine

The new interpreter pairs an engine, written in generic 6502 assembly language, with a system-specific frontend for the Commodore 64 (equipped with a 1541-compatible floppy drive). A RAM Expansion Unit (REU) is required for the UNDO command, but is otherwise optional. The presence of a large (at least 256 kB) REU will also improve performance dramatically.

Creating a Commodore 64 version of an Å-machine game is easy. As before, the Å-machine toolkit contains a command-line tool called aambundle, that can read an .aastory file and create a directory with a self-contained web player. With the option -t c64, it will create a disk image for the C64 instead.

The performance on a stock system (C64 + 1541) is competitive. The first few commands tend to be slow (about 10–15 seconds), as the engine retrieves data on demand from disk. Once the system is warmed up, the typical response time before output starts to appear is about 1–3 seconds. Of course, printing a large chunk of text also takes time, especially if new content has to be loaded from disk. But that is all happening while you read, so it is not as frustrating as the initial wait.

With a REU, response times are typically less than a second.

When the same two games are compiled for the Z-machine, and played on a C64 with a REU (using Zeugma), they respond to commands in about 3–7 seconds. Without a REU (using Ozmoo), the response time is 1–3 minutes (!) because of the increased disk access. (I would have used the same interpreter for the benchmark, but Zeugma needs a REU by design, and Ozmoo crashed on these games in REU mode.) Part of the reason for the speed boost is that Å-machine storyfiles are only about half the size of their Z-machine counterparts. Each of these games now fits comfortably on a single disk side, along with the interpreter.

To put this in context, the original Hitchhiker's Guide for the C64 (using Infocom's own interpreter, and paging from disk) has response times of around 1–5 seconds. With a modern interpreter (e.g. Ozmoo with a REU), this can be reduced to half a second. So Dialog games are now on par with classic Infocom games in terms of performance, despite the fact that Dialog is a high-level, rule-based language with a complex in-game parser and standard library, more in the spirit of Inform 7 than ZIL.

In the long run, I hope this will open the gates for lots of modern, narrative-driven text games for the Commodore 64!

Posted Monday 25-Nov-2019 21:57

Discuss this page

There are no comments here yet.