2023-06-29 18:53:20 +00:00
|
|
|
# a2zip - Infocom ZIP interpreters for Apple II, Z-Machine architectures 1 through 4, partially reverse-engineered
|
2018-03-01 20:32:27 +00:00
|
|
|
|
|
|
|
Original code copyright Infocom, Inc.
|
2023-06-29 18:53:20 +00:00
|
|
|
Disassembly including labels and comments copyright 1983-2023 Eric Smith <spacewar@gmail.com>
|
2018-03-01 20:32:27 +00:00
|
|
|
|
|
|
|
z2zip development is hosted at the
|
|
|
|
[a2zip Github repository](https://github.com/brouhaha/a2zip/).
|
|
|
|
|
|
|
|
## Introduction
|
|
|
|
|
|
|
|
Infocom games are written in ZIL and compiled to Z-code, which is
|
|
|
|
interpreted on a ZIP interpreter. ZIP interpreters were written for
|
2023-06-29 18:53:20 +00:00
|
|
|
many computers, including the Apple II. In 1983 to 1984 I reverse-engineered
|
2018-03-14 02:16:52 +00:00
|
|
|
a substantial portion of the Apple II version 1 through 3 ZIP interpreters.
|
2018-03-01 20:32:27 +00:00
|
|
|
|
2023-07-06 01:36:07 +00:00
|
|
|
More recently I've partially reverse-engineered soem newer Apple II
|
2023-07-03 08:53:57 +00:00
|
|
|
ZIP, EZIP, and XZIP interpreters.
|
2018-03-01 20:32:27 +00:00
|
|
|
|
2023-06-29 21:51:27 +00:00
|
|
|
The reverse-engineered "source code" cross-assembles using the
|
|
|
|
Macro Assembler AS, which is open source and supports common development
|
|
|
|
host platforms.:
|
|
|
|
http://john.ccac.rwth-aachen.de:8000/as/
|
|
|
|
|
|
|
|
No effort has been made to make it possible to assemble the code with
|
|
|
|
any other assemblers, either native or cross. The code depends on the macro
|
|
|
|
and local label capabilities of AS.
|
|
|
|
|
|
|
|
The provided Makefile is for GNU Make.
|
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
## ZIP (Z-Machine architectures v1 through v3)
|
|
|
|
|
|
|
|
The Apple II ZIP intepreters for v1, v2, v3, v3 A, and v3B can be built from
|
2023-06-29 21:51:27 +00:00
|
|
|
the source file "zip.asm", which also uses an include file "zipmac.inc"
|
2023-06-29 22:01:25 +00:00
|
|
|
defining various macros. These interpreters depend on boot code and RWTS
|
|
|
|
(disk routines) not included here. Aside from being relocated to a different
|
|
|
|
start address, the RWTS routines are very similar to those Apple used in
|
|
|
|
DOS 3.2.1 and DOS 3.3, with minor changes for the relatively simple
|
|
|
|
copy protection.
|
2023-06-29 18:53:20 +00:00
|
|
|
|
|
|
|
Z-Machine architectures v1 through v3 have only fairly minor differences. The
|
|
|
|
interpreters for these versions are known as ZIP. The v1 and v2 architectures
|
|
|
|
were only used for early releases of Zork I and Zork II, and were quickly
|
|
|
|
obsolted by v3. which was the most common architecture for Infocom games that
|
|
|
|
did not require more than 128 KiB of virtual machine memory.
|
2018-03-14 02:16:52 +00:00
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
Z-Machine architecture v1 is only known to have been used for Zork I release 2
|
2018-03-14 02:20:48 +00:00
|
|
|
(which might not have been released for the Apple II), and Zork I release 5.
|
|
|
|
Zork I release 5 was provided for the Apple II on a 13-sector disk, while no
|
|
|
|
later releases or other Infocom games were available on 13-sector disks.
|
2018-03-14 02:16:52 +00:00
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
Z-Machine architecture v2 is only known to have been used for Zork I release 15
|
2018-03-14 02:20:48 +00:00
|
|
|
and Zork II release 7.
|
2018-03-14 02:16:52 +00:00
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
The earliest v3 interpreter for the Apple II, like those for v1 and v2, did
|
|
|
|
not have any more specific interpreter revision identification. Later v3
|
|
|
|
interpreter revisions had a revision letter, with revisions A, B, F, H, K,
|
|
|
|
and M known to exist. Of the lettered revisions, only A and B are currently
|
|
|
|
represented here.
|
2018-03-16 01:36:48 +00:00
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
Revision A added support for the Apple IIe 80-column text mode, with upper
|
2018-03-16 01:36:48 +00:00
|
|
|
and lower case display, and allowed the user to select a slot number for the
|
|
|
|
printer interface card, which previously was required to be slot 1.
|
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
Revision B added support for splitting the screen into two windows.
|
|
|
|
|
2023-07-03 08:53:57 +00:00
|
|
|
## Later ZIP interpreter revisions
|
2023-06-29 22:01:25 +00:00
|
|
|
|
2023-07-01 10:18:10 +00:00
|
|
|
Between revision B and revision F of the Apple II ZIP interpreters, a
|
2023-07-01 21:14:59 +00:00
|
|
|
substantial rearrangement of the code occurred.
|
2023-07-01 10:18:10 +00:00
|
|
|
|
2023-07-01 21:14:59 +00:00
|
|
|
The disk I/O routines are derived from RWTS but no longer structured
|
|
|
|
in the same way as Apple DOS RWTS, and are now more tightly integrated
|
|
|
|
with the interpreter.
|
|
|
|
|
|
|
|
Currently revisions F, H, K, and M can be built from the source file
|
|
|
|
"zip-late.asm".
|
2023-06-29 22:01:25 +00:00
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
## EZIP
|
|
|
|
|
|
|
|
Z-Machine architecture v4 doubled the available virtual machine memory size
|
|
|
|
to 256 KiB, allowed a game to have more objects, allowed vocabulary words to
|
|
|
|
have up to nine significant characters, and added some improvements to I/O
|
2023-07-03 08:53:57 +00:00
|
|
|
capabilities. The v4 interpreters are known as EZIP.
|
|
|
|
|
|
|
|
There were five revisions of the Apple II EZIP interpreter, designated
|
|
|
|
2A through 2D, and 2H. The numric character, 2 is a platform
|
|
|
|
identifier, referencing the Apple II family, while the alphabetic
|
|
|
|
character is the revision of the interpreter for that platform. These
|
|
|
|
interpeters require an Apple IIe, IIc, IIC+, or IIgs with at least 128
|
|
|
|
KiB of RAM.
|
2023-06-29 22:01:25 +00:00
|
|
|
|
|
|
|
As with later Apple II ZIP interpreter versions, the disk routines are more
|
|
|
|
tightly integrated with the interpreter. In EZIP (and the later XZIP),
|
|
|
|
games are usually distributed on two sides, designated A and B. Side A is
|
|
|
|
bootable and contains the lower addressed portion of the game image, in the
|
|
|
|
same mildly copy-protected form as the Apple II ZIP interpreters. Side B
|
|
|
|
is encoded in an 18 sector per track format, similar in concept to
|
|
|
|
Roland Gustafsson's RWTS18.
|
2018-03-16 01:36:48 +00:00
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
Early work on reverse-engineering these is present in the source file
|
2023-06-29 21:51:27 +00:00
|
|
|
"ezip.asm". This does not use an include file for macro definitions.
|
2018-03-14 02:16:52 +00:00
|
|
|
|
2023-07-03 08:53:57 +00:00
|
|
|
## XZIP
|
|
|
|
|
|
|
|
The Z-Machine architecture v5 added support for character-cell graphics and
|
|
|
|
timed input. The v5 interpreters are known as XZIP.
|
|
|
|
|
|
|
|
There were five revisions of the Apple II XZIP interpreter, A, C, E,
|
|
|
|
F, and H. The platform number will be reported as 2, except when using
|
|
|
|
an Apple IIc, which will be reported as 9.
|
|
|
|
|
2023-07-06 01:36:07 +00:00
|
|
|
Early work on reverse-engineering thes is present int eh source file
|
|
|
|
"xzip.asm". This does not use an include file for macro definitions.
|
2023-07-03 08:53:57 +00:00
|
|
|
|
|
|
|
## YZIP
|
|
|
|
|
|
|
|
Eventually Infocom added graphics and mouse support, resulting in
|
|
|
|
Z-Machine architectures 6, with the interpreter known as YZIP.
|
2023-06-29 18:53:20 +00:00
|
|
|
|
2023-07-03 08:53:57 +00:00
|
|
|
YZIP is not currently represented here.
|
2023-06-29 18:53:20 +00:00
|
|
|
|
|
|
|
## Archive of earliest reverse-engineered source files
|
|
|
|
|
|
|
|
When I originally reverse-engineered the early interpreters in 1983-1984, I
|
2023-06-29 21:51:27 +00:00
|
|
|
assembled the code using Microsoft ALDS, which is not easily available
|
2023-06-29 18:53:20 +00:00
|
|
|
or easy to use today. The version of the sources for that assembler are in
|
|
|
|
the "alds" subdirectory.
|
|
|
|
|
2018-03-24 18:00:00 +00:00
|
|
|
## Acknowledgements
|
|
|
|
|
|
|
|
Special thanks to:
|
|
|
|
|
2023-06-29 18:53:20 +00:00
|
|
|
* Richard Turk, for saving the printed listing from the work I did in 1983-1984,
|
2018-03-24 18:00:00 +00:00
|
|
|
which was otherwise lost
|
|
|
|
|
|
|
|
* 4am, for preserving disk images of huge amounts of Apple II software,
|
|
|
|
including early, now-rare Infocom games (e.g., Zork I release 5,
|
|
|
|
Zork II release 7)
|