
Zeugma
Zeugma is a modern, highly optimised, open-source Z-machine implementation for the 6502 processor family. It is designed around a virtual memory model, where pages are retrieved on demand from an external storage resource, 512 KB in size, which must be preloaded with the game file.

There are tools to extract story files from Infocom's C64 releases, and if you load those files into zeugma you will experience a dramatic speed improvement compared to the original, despite the fact that text is now rendered using bitmap graphics in order to fit more characters on the screen. Apart from the obvious benefits of loading from REU rather than floppy, the increased responsiveness is the result of highly optimised code, with extensive use of redundant decoding look-up tables, inlining, self-modifying zero-page code and other trickery. But see below for some depressing facts about recent games.
While the Z-code engine itself is written in generic 6502 assembly language, the virtual memory solution and input/output facilities are platform-dependent. Currently, there is only one implementation, Zeugma-C64-REU, for a Commodore 64 (or a C128 in C64 mode) with a 512 KB RAM Expansion Unit. Today, most active C64 users own a multi-function cartridge such as the 1541 Ultimate, which can be configured to provide REU functionality. For now, zeugma requires the game file to be preloaded into the REU before the program is run, something which is easily done via the menu system of the 1541 Ultimate. Should you wish to use this program with a vintage REU from Commodore, you'll have to devise some alternative way of getting the story file into the REU.
Note
Added 131001: To run Zeugma on a 1541 Ultimate II, configure the Ultimate for a 16 MB REU and use at least version 1.2 of Zeugma.
Download
- zeugma-c64-reu-1.2 (C64 executable file, 16.5 kB)
- zeugma-c64-reu-src-1.2 (Source tarball, 29.1 kB)
- zeugma-c64-reu-1.1 (C64 executable file, 16.5 kB)
- zeugma-c64-reu-src-1.1 (Source tarball, 29.0 kB)
- zeugma-c64-reu-1.0 (C64 executable file, 16.5 kB)
- zeugma-c64-reu-widehack-1.0 (C64 executable file, 16.5 kB)
- zeugma-c64-reu-src-1.0 (Source tarball, 29.0 kB)
The widehack version is required for the Infocom game Trinity.
Zeugma is released under the MIT license (included in the source tarball). The font (Schumacher Clean 6x8) is redistributed in compliance with its license, also included in the source tarball, and a copyright notice is displayed when the program starts.
Background
Being active in the C64 demoscene, and more of a lurker in the world of interactive fiction, it struck me that the two communities have certain things in common. Both are about exploring an obscure art form and finding joy in constraints that appear stifling or pointless to outsiders. Both have formed around some once-blossoming technology — commercially viable years ago, now overtaken by shinier gadgets and left by the wayside — that has been picked up by amateurs and nourished into sprouting more beautiful flowers than ever. Likewise, both communities attract the kind of patient, intelligent people who understand the distinction between vivid imagery and photorealistic graphics, and for whom instant gratification has about as much appeal as instant coffee.
The history of the Z-machine goes as follows: Drafted in 1979 on a coffee table in Pittsburgh, with the aim of making the game Zork (hence 'Z') platform independent, it went on to give the company Infocom a competitive edge: Their text adventure games could be developed once, and then released for an assortment of computer systems. In the mid-1990s, thanks to Graham Nelson, Mark Howell and several other enthusiasts, the format was reverse-engineered. A high-level language, Inform, was invented for writing interactive fiction that would run on all the existing Z-code interpreters.
As technology marched on, people got their hands on more powerful computers, and Z-code interpreters were implemented for them. Newly written games were larger, because computer memory had become plentiful. The file format was extended, and at some point backwards-compatibility with the old interpreters was abandoned. Furthermore, as computers got faster, games got slower, but nobody noticed.
Fans of interactive fiction and vintage computer enthusiasts flocked together into separate subcultures. Zeugma is an attempt to bridge the gap between them. C64 aficionados now have access to a wide selection of interactive fiction, some of very high quality. For the interactive fiction crowd, the benefits are not as obvious. However, I personally find that the vintage hardware brings back something to the playing experience that got lost along the way. You sit down in front of a physical machine that is running nothing but the game. There are no distractions, popups, forums, inboxes, reminders, instant messages and what have you. Every turn takes a few seconds, so you think before you type. You don't speed-read for keywords while fluttering aimlessly around the map, instead taking the time to actually read the text and let it sink in. I find that this does wonders for the sense of immersion. Also, because there's no scrollback, and because you can't conveniently have a text-editor running in another window like on a modern computer, you'll find yourself drawing maps and making notes in pencil. All of this makes the exploration of the game delightfully tangible, and the notes become an embodiment of your personal view of the fictional world.
Fiction compatibility
Zeugma supports Z-code versions 4, 5 and 8 (story files with filename extensions .z4, .z5 and .z8). Some games come in blorb files, from which the story file must be extracted. Here are some tools for that.
Old Infocom games fly. Inform 6 games walk. Inform 7 games are unfortunately way too slow to be playable (unless you happen to have a 20 MHz SuperCPU). I might elaborate on the technical reasons for this in a later post.
Recommendations
If you are familiar with interactive fiction, you probably already know what games you'd like to try out. Otherwise, head to the Interactive Fiction Archive, and look in the zcode directory, as well as the zcode subdirectories of the yearly competition directories. Most games begin in medias res, after which they display a banner with version information. If this banner contains the text "Inform 7" anywhere, you'll find the game unbearably slow. Inform 7 was released in 2006, so earlier competition directories are safe. Wikipedia has a list of notable Inform 6 games. A few personal recommendations follow; these are some of the games that I played while testing zeugma:
- Spiral (Justin Morgan, 2012). This game ranked #6 in the 2012 Interactive Fiction Competition, proving that high-quality games are still being developed in Inform 6.
- Varicella (Adam Cadre, 1999). This is a difficult game, but many agree that it's a masterpiece.
- Trinity (Brian Moriarty, 1986) and Bureaucracy (Douglas Adams et al., 1987) are two lovely games from Infocom. Activision, the owner of the copyrights, has been re-releasing Infocom games as recently as 2012 (for iOS), so these titles can't really be regarded as abandonware. If you own the original disks, there are tools to extract the .z4 files from them.
Trinity refuses to run in the relatively cramped screen space provided by Zeugma-C64-REU (53 x 25 characters). Use the widehack version of the interpreter to get around this; it will lie to the game about the size of the screen, so some quote boxes will end up in strange places, but the game is playable.
Limitations
As mentioned, Inform 7 games are too slow to play. This is the greatest limitation in my opinion.
In addition, zeugma currently doesn't support file system operations. This means you can't save or restore games, and you can't work with transcripts. Also, for reasons of performance and memory conservation, undo and restart are not supported. To restart the game, you have to preload the REU again, and relaunch zeugma.
Zeugma-C64-REU is monochrome, but provides bold and reverse text styles. Non-ASCII characters are currently not displayed correctly.
The name
A zeugma is a rhetorical device that, much like a virtual machine, lets you re-use a piece of meaning in several contexts without having to write it all over again: With zeugma, authors have access to an antique type-saving device; an antique tape-loading device, authors.
Version history
130822 | 1.0 | Initial release. |
130915 | 1.1 | Bugfix in op_tokenise. Tolerate invalid property numbers. |
131001 | 1.2 | Bugfix for REU > 512 kB |
Posted Thursday 22-Aug-2013 23:14
Discuss this page
Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.
Jag tar inget ansvar för det som skrivs i forumet, förutom mina egna inlägg. Vänligen rapportera alla inlägg som bryter mot reglerna, så ska jag se vad jag kan göra. Som regelbrott räknas till exempel förolämpningar, förtal, spam och olagligt material. Mata inte trålarna.
Ralph Corderoy
Fri 23-Aug-2013 14:43
Please do, the nitty-gritty in your posts is often very interesting.
25 more comments hidden. Click to show all.
Wed 22-Aug-2018 16:17
BeebSCUMM -> https://stardot.org.uk/forums/viewtopic.php?t=15273
Fri 18-Jan-2019 14:48
I have downloaded and run some of the examples from your dialog program and am working through the docs (prolog newbie)
How would I get a v7 *.gblorb file into zeugma ?
I've tried using babel, but it only generates a blorb and / or ulx file.
Mike
Fri 18-Jan-2019 14:50
mstram wrote:
Although you say v7 is too slow to play, I'm more interested in just exploring how the system works.I have downloaded and run some of the examples from your dialog program and am working through the docs (prolog newbie)
How would I get a v7 *.gblorb file into zeugma ?
I've tried using babel, but it only generates a blorb and / or ulx file.
Mike
Sorry for any confusion, I realize that dialog has nothing to do with v7 / babel :) Just meant that I'm trying all the tool chains.
Sat 24-Apr-2021 16:43
How slowly does it play, or: have you tried it?
https://ifarchive.org/if-archive/games/zcode/Advent.z5
What would it take to port this over to the Apple II?