Glulxa
A symbolic assembler for the Glulx 32-bit virtual machine used by modern interactive fiction.
Created by Simon Stapleton
Glulxa is a symbolic assembler for Glulx, the 32-bit virtual machine that powers most modern interactive fiction released since the early 2000s. Written by Simon Stapleton and distributed as open-source C code through the IF Archive, Glulxa lets authors write story files directly in Glulx assembly mnemonics rather than going through a higher-level language like Inform.
While the vast majority of Glulx story files are produced by the Inform 6 and Inform 7 compilers, Glulxa fills a small but important niche: it makes the bare metal of the Glulx VM accessible to humans, providing a way to hand-craft, study, or experiment with bytecode for a virtual machine that was designed specifically for text adventures.
History and Origins
To understand Glulxa, you first have to understand the problem it sits on top of. The classic Z-machine, designed by Infocom in the late 1970s, dominated interactive fiction for two decades. By the late 1990s, however, its 16-bit address space and tight memory limits were chafing against the ambitions of modern IF authors who wanted larger games, richer multimedia, and more flexible I/O.
Andrew Plotkin (widely known in the IF community as “Zarf”) designed Glulx as a clean-sheet replacement. According to the Glulx specification document, the initial Glulx specification was published publicly in 1999, with an early stable revision following around 2000. Glulx is a 32-bit virtual machine with a generous address space, a simple stack-based execution model, and a clearly documented instruction set — exactly the sort of target that benefits from a textual assembler.
Glulxa emerged in this early-2000s timeframe as a community contribution from Simon Stapleton. The exact first-release date of Glulxa is not well documented (the metadata year of 2000 should be treated as approximate), but it has been distributed for many years through the IF Archive’s programming/glulx/compilers/ directory. A second, independently developed Glulx assembler called Glas, written by Joonas Pihlaja, sits alongside it; the two are the canonical low-level entry points to the Glulx VM.
Design Philosophy
Glulxa is unapologetically low-level. Its design goals are narrow and pragmatic:
- Direct mapping to the Glulx instruction set. Each Glulxa mnemonic corresponds to a documented Glulx opcode, so reading Glulxa source is essentially reading the VM’s behavior step by step.
- Symbolic convenience. Like any sensible assembler, it supports labels, symbolic constants, and structured data declarations so that authors are not stuck counting byte offsets by hand.
- Story-file output. The assembler emits a complete Glulx
.ulxstory file (typically wrapped in a Blorb resource file when packaged for distribution) that can run on any conforming Glulx interpreter such as Glulxe or Git. - Minimalism. Glulxa does not try to be a high-level language. Authors who want object models, parsers, and world state should use Inform; Glulxa is for people who specifically want to write Glulx code.
Key Features
Glulxa exposes the full Glulx execution model to the programmer:
- 32-bit word operations — arithmetic, bitwise logic, comparisons, and branches on 32-bit values
- Stack-based calling convention with explicit local variable declarations per function
- Glk I/O calls — Glulx delegates all input and output to the Glk library, and Glulxa lets you invoke Glk gestalt and selector calls directly
- Memory regions — explicit control over RAM, ROM, and stack layout as defined by the Glulx specification
- String and dictionary support for the encoded string formats Glulx defines
Because Glulx is intentionally simpler than a CPU instruction set, Glulxa is correspondingly small: a programmer who understands the Glulx specification can become productive with Glulxa quickly.
Evolution
Glulxa has not had the kind of rolling version history that a mainstream language enjoys. It is a small, focused tool distributed as source. The Glulx VM specification itself has continued to evolve — reportedly into the 3.x series, with the addition of opcodes such as floating-point and double-precision instructions — and Glulx assemblers have absorbed those additions as needed.
In practice, the bigger story around Glulxa is the broader Glulx ecosystem:
- Inform 6 gained a Glulx back-end early on, allowing existing Inform code to target the larger VM.
- Inform 7, released in 2006, made Glulx the default compilation target for new IF, dramatically increasing the install base of Glulx interpreters.
- Interpreters such as Glulxe (the reference interpreter) and Git (an optimized interpreter) became widely available across desktop, web, and mobile platforms, meaning that anything Glulxa produces will run almost anywhere a modern IF player is installed.
Current Relevance
Glulxa today is a specialist’s tool. The day-to-day work of writing interactive fiction is done in Inform 7, TADS 3, Dialog, or similar high-level systems. Few authors ever need to drop down to Glulx assembly. But Glulxa remains valuable in a handful of situations:
- Studying the Glulx VM by reading and writing small example programs
- Producing test cases for new Glulx interpreters
- Experimenting with code-generation strategies for hypothetical Glulx-targeting compilers
- Building small, hand-tuned demonstrations that show off specific VM features
The combination of an authoritative, openly published specification and a working open-source assembler means that the Glulx platform stays open to anyone curious enough to look under the hood.
Why It Matters
Glulxa is a small piece of a much larger story: the long survival of text-based interactive fiction as a living art form. The Z-machine kept Infocom’s games playable for decades; Glulx, and the assemblers and compilers that target it, ensure the same will be true for the modern IF being written today. Tools like Glulxa preserve the option for any sufficiently determined author to bypass every layer of abstraction and speak directly to the virtual machine — a capability that, in a medium built almost entirely on volunteer effort and open formats, is more than a curiosity. It is part of what makes interactive fiction a genuinely durable platform.
Timeline
Notable Uses & Legacy
Hand-coded Glulx experiments
Hobbyists exploring the Glulx instruction set use Glulxa to write small story files directly in assembly rather than going through Inform.
Glulx VM education
Glulxa serves as a teaching aid for understanding the Glulx bytecode format, since assembly mnemonics map closely to the documented opcodes in the Glulx specification.
Compiler back-end prototyping
Developers prototyping alternative compilers targeting Glulx can emit Glulxa source as an intermediate form to inspect generated code before producing binary story files.