HOME

TheInfoList



OR:

The Z-machine is a
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
that was developed by Joel Berez and Marc Blank in 1979 and used by
Infocom Infocom, Inc., was an American software company based in Cambridge, Massachusetts, that produced numerous works of interactive fiction. They also produced a business application, a relational database called ''Cornerstone (software), Cornerston ...
for its text adventure games. Infocom compiled game code to files containing Z-machine instructions (called story files or Z-code files) and could therefore port its text adventures to a new platform simply by writing a Z-machine implementation for that platform. With the large number of incompatible home computer systems in use at the time, this was an important advantage over using native code or developing a compiler for each system.


History and design


Nomenclature and conventions

The "Z" of Z-machine stands for ''
Zork ''Zork'' is a text adventure game first released in 1977 by developers Tim Anderson (programmer), Tim Anderson, Marc Blank, Bruce Daniels, and Dave Lebling for the PDP-10 mainframe computer. The original developers and others, as the company ...
'', Infocom's first adventure game. Infocom used file extensions of .dat (Data) and .zip (ZIP = Z-machine Interpreter Program), but the latter clashed with the widespread use of .zip for PKZIP-compatible archive files starting in the 1990s, after
Activision Activision Publishing, Inc. is an American video game publisher based in Santa Monica, California. It serves as the publishing business for its parent company, Activision Blizzard, and consists of several subsidiary studios. Activision is one o ...
had closed Infocom. Infocom produced six versions of the Z-machine. Files using versions 1 and 2 are very rare. Only two version 1 files are known to have been released by Infocom and only two of version 2. Version 3 covers the majority of Infocom's released games. Later versions had more capabilities, culminating in some graphic support in version 6. The modern convention for Z-code files usually have names ending in .z1, .z2, .z3, .z4, .z5, .z6, .z7, or .z8, where the number is the version number of the Z-machine on which the file is intended to be run, as given by the first
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable un ...
of the story file. As previously noted, the Infocom games used the equivalent of .z1 through .z6; .z7 and .z8 were proposed and adopted after Infocom had shut down.


Before Z-machine

The MDL programming language was derived from
Lisp Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
at the
Massachusetts Institute of Technology The Massachusetts Institute of Technology (MIT) is a Private university, private research university in Cambridge, Massachusetts, United States. Established in 1861, MIT has played a significant role in the development of many areas of moder ...
by the Dynamic Modeling group of the Laboratory for Computer Science (LCS) in the 1970s; inspired by '' Colossal Cave Adventure'' (1977), members of that group went on to write ''Zork'' in MDL, completing the initial version two weeks later. Like ''Adventure'', ''Zork'' was programmed for the DEC
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
; the finished version occupies 1 MB of MDL code and requires 512 KB of RAM to run. Because contemporary home computers did not have these resources, considerable effort was needed to port the game. Eventually, the developers split ''Zork'' into two games for personal computers. The compression required to run ''Zork'' from
floppy disk A floppy disk or floppy diskette (casually referred to as a floppy, a diskette, or a disk) is a type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined with a ...
s with approximately 80 KB of storage seemed like an insurmountable barrier to Blank. Berez realized that
UCSD Pascal UCSD Pascal is a Pascal programming language system that runs on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1977. It was developed at the University of California, San Diego (UC ...
used a
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
(VM) model to generate executable files that could be readily ported across platforms, and together with Blank, they devised requirements for a lightweight VM optimized for text adventure games, which would retrieve data and execute instructions as needed from storage to compensate for the relatively small RAM sizes in typical microcomputers. The resulting Z-machine used an object tree structure for in-game items, locations, characters, and weapons. For comparison, the Z-machine parser occupies 3  kB of storage, while the original PDP-10 parser occupies 10  Kwords ( 36-bit).


ZIL and ZIP, ZILCH and ZAP

To complement the Z-machine, Infocom developed the high-level
computer language A computer language is a formal language used to communicate with a computer. Types of computer languages include: * Software construction#Construction languages, Construction language – all forms of communication by which a human can Comput ...
Zork Implementation Language (ZIL) by streamlining MDL, and the Z-language Interpreter Program (ZIP), which compiles ZIL into Z-machine instructions in a two-stage process; this made text adventure development platform-independent and enabled porting to different systems simply by writing an appropriate Z-machine interpreter. ZIP consists of a
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
(ZILCH, short for ZIL Compiler Hack) and an assembler (ZAP, the Z-machine Assembler Program). ZILCH has never been released, although documentation of ZIL still exists, and an open-source replacement "ZILF" has been written. After Mediagenic moved Infocom to California in 1989, ''
Computer Gaming World ''Computer Gaming World'' (CGW) was an American Video game journalism, computer game magazine that was published between 1981 and 2006. One of the few magazines of the era to survive the video game crash of 1983, it was sold to Ziff Davis in 199 ...
'' stated that "ZIL ... is functionally dead", and reported rumors of a "completely new parser that may never be used".


Graham Nelson and ''Inform''

In May 1993,
Graham Nelson Graham A. Nelson (born 1968) is a British mathematician, poet, and the creator of the Inform, Inform design system for creating interactive fiction (IF) games. He has authored several IF games, including ''Curses (computer game), Curses'' (1993) ...
released the first version of his ''
Inform Inform is a programming language and design system for interactive fiction originally created in 1993 by Graham Nelson. Inform can generate programs designed for the Z-machine, Z-code or Glulx virtual machines. Versions 1 through 5 were released ...
'' compiler, which also generates Z-machine story files as its output, even though the Inform source language is quite different from ZIL. Inform has become popular in the
interactive fiction Interactive fiction (IF) is software simulating environments in which players use text Command (computing), commands to control Player character, characters and influence the environment. Works in this form can be understood as literary narrati ...
community. A large proportion of interactive fiction is in the form of Z-machine story files. Demand for the ability to create larger game files led Nelson to specify versions 7 and 8 of the Z-machine, though version 7 is rarely used. Because of the way addresses are handled, a version 3 story file can be up to 128K in length, a version 5 story can be up to 256K in length, and a version 8 story can be up to 512k in length. Though these sizes may seem small by today's computing standards, for text-only adventures, these are large enough for elaborate games. During the 1990s, Graham Nelson drew up a Z-Machine Standard based on detailed studies of the existing Infocom files. The standard also includes extensions used by his newer versions, as well as links to the "
Blorb Blorb is a package format for interactive fiction games. Many such games incorporate resources such as sound effects, music, or pictures. Blorb's purpose is to bind these together into one file. The format was devised by Andrew Plotkin and is ...
" resource format used by Infocom, and a "
Quetzal Quetzals () are strikingly colored birds in the trogon family. They are found in forests, especially in humid highlands, with the five species from the genus ''Pharomachrus'' being exclusively Neotropical, while a single species, the eared quet ...
" savefile format. In 2006, Nelson expanded Z-machine to the 32-bit Glulx format for Inform 7. The Interactive Fiction Technology Foundation, founded 2016, manages all these standards.


ZIL (Zork Implementation Language)

The ZIL is based on MDL from MIT. Here is the definition of Zork I's brass lantern in ZIL, with added comments to illustrate the meaning of each line: #_Defines weight to limit inventory capacity The equivalent object in MDL is defined as: LAMP" "LANTE" "LIGHT" BRASS" "lamp" <+ ,OVISON ,TAKEBIT ,LIGHTBIT> LANTERN () (ODESC0 "A battery-powered brass lantern is on the trophy case." ODESC1 "There is a brass lantern (battery-powered) here." OSIZE 15 OLINT >> A more complex example involving combat, along with its MDL Zork equivalent, is presented in a 2019 blog post by Andrew Plotkin. Notably, the Z-machine has no support for garbage collection and ZIL has no concept of Lisp's list system.


Interpreters

Interpreters for Z-code files are available on a wide variety of platforms. The Inform website lists links to freely available interpreters for 15 desktop operating systems (including 8-bit microcomputers from the 1980s such as the
Apple II Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
, TRS-80, and , and grouping "Unix" and "Windows" as one each), 10 mobile operating systems (including Palm OS and the Game Boy), and four interpreter platforms (Emacs, Java, JavaScript, and Scratch). According to Nelson, it is "possibly the most portable virtual machine ever created". Popular interpreters include Nitfol and Frotz. Nitfol makes use of the Glk
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
, and supports versions 1 through 8 of the Z-machine, including the version 6 graphical Z-machine. Save files are stored in the standard
Quetzal Quetzals () are strikingly colored birds in the trogon family. They are found in forests, especially in humid highlands, with the five species from the genus ''Pharomachrus'' being exclusively Neotropical, while a single species, the eared quet ...
save format. Binary files are available for several different
operating systems An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
, including the
classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Mac (computer), Macintosh family of personal computers by Apple Computer, Inc. from 1984 to 2001, starting with System 1 and end ...
,
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems, DOS, and
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
. Frotz was written in C by Stefan Jokisch in 1995 for DOS. Over time it was ported to other platforms, such as
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems,
RISC OS RISC OS () is an operating system designed to run on ARM architecture, ARM computers. Originally designed in 1987 by Acorn Computers of England, it was made for use in its new line of ARM-based Acorn Archimedes, Archimedes personal computers an ...
, and
iOS Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
. Sound effects and graphics were supported to varying degrees. By 2002, development stalled and the program was picked up by David Griffith. The code base was split between
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
and
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine fro ...
portions in such a way that the virtual machine became independent from any user interface. This allowed more variety in porting Frotz. One of the stranger ports is also one of the simplest: an
instant messaging Instant messaging (IM) technology is a type of synchronous computer-mediated communication involving the immediate ( real-time) transmission of messages between two or more parties over the Internet or another computer network. Originally involv ...
bot Bot or BOT may refer to: Sciences Computing and technology * Chatbot, a computer program that converses in natural language * Internet bot, a software application that runs automated tasks (scripts) over the Internet **Spambot, an internet bot ...
is wrapped around a version of Frotz with the minimum I/O functionality creating a bot with which one can play most Z-machine games using an instant messaging client. Another popular client for
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
and other
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems is Zoom. It supports the same
Quetzal Quetzals () are strikingly colored birds in the trogon family. They are found in forests, especially in humid highlands, with the five species from the genus ''Pharomachrus'' being exclusively Neotropical, while a single species, the eared quet ...
save-format, but the packaging of the file-structure is different.


See also

* Glulx – Similar to the Z-machine, but relieves several legacy limitations *
Inform Inform is a programming language and design system for interactive fiction originally created in 1993 by Graham Nelson. Inform can generate programs designed for the Z-machine, Z-code or Glulx virtual machines. Versions 1 through 5 were released ...
– A computer language that can produce Z-machine programs * SCUMM – Script Creation Utility for Maniac Mansion by
LucasArts Lucasfilm Games (known as LucasArts between 1990 and 2021) is an American video game brand licensing, licensor, former video game developer and video game publisher, publisher, and a subsidiary of Lucasfilm. It was founded in May 1982 by George ...
, a graphical system similar to Z-machine * TADS – Like Glulx, made to address some of its limitations


References


External links


The Z-Machine standards document
* (PDF) is the Infocom ZIL manual from 1989 * (PDF) the Z-Language Interpreter Program (Infocom Internal Document) from 1989

describes the creation and design of the Z-machine {{Video game engines Interactive fiction engines Virtual machines Infocom Articles with example Lisp (programming language) code