ZD(1) | General Commands Manual | ZD(1) |
zd
— disassemble
Z-machine stories
zd |
[-DVdin ] [-A
address_file] [-a
address] [-w
width] file |
zd |
[-Vinv ] [-A
address_file] [-a
address] file |
zd |
[-Vin ] -b
bytestring [-w
width] [-z
z-machine version] |
zd |
[-Vinv ] -b
bytestring [-z
z-machine version] |
The zd
utility disassembles Z-machine
stories, displaying the results in a manner similar to the
txd(1) disassembler. The main difference to
txd(1) is that txd(1) has knowledge of
how Infocom and Inform lay out story files. As such,
txd(1) can get confused by stories that do not conform to
a layout it expects. On the other hand, txd(1) is able to
find code (such as action routines) that zd
will not
detect, because zd
only finds code that is reachable
directly from the initial program counter address. If you know the address
of code that is not reachable from the initial program counter address,
zd
can decode it if you use the
-a
or -A
option.
There are two major modes of display: standard and visual.
Standard mode operates much like the txd(1) disassembler,
dumping a list of instructions. Visual mode diagrams each instruction at the
bit level. Standard mode is default, and visual mode can be selected with
the -v
option.
The following options are available:
-a
addresszd
starts disassembling at the address
at byte 0x06
in the header, which is the starting
location of the program counter. The -a
option
allows other addresses to be used as a starting location. Any number of
-a
options can be given, allowing multiple
addresses to be examined. Addresses must be specified in hexadecimal, with
an optional leading 0x
.
If the -a
option is used, the story's
reported program counter starting address will not be examined. If you
wish to include it as well, specify an address of 0.
Please note that any values passed to
-a
are assumed to be unpacked routine
addresses.
-A
address_file-a
option, except that
addresses are read, one per line, from the file
address_file. If address_file
is a single dash (‘-
’), read from
standard input.-b
bytestringb211aac634
’-d
-D
option. This is available only in the standard
display mode.-D
-d
option will not dump the
constituent bytes of strings, because these tend to be very long. The
-D
option instructs zd
to
dump the strings as well as instructions. This is available only in the
standard display mode.-i
zd
will exit with an error message. This
option instructs it to continue to attempt to disassemble. All bets are
off at this point, although in some cases zd
will
continue to disassemble correctly.--max-instructions
count-n
^
character to
represent a newline instead of an actual newline characer.--start-offset
offset-v
In this mode, UTF-8 text is directly written, so a terminal capable of displaying UTF-8 is required.
-V
zd
runs in two phases. First, it scans through a
story file, decoding everything that appears to be an instruction. Next,
it displays the decoded instructions in order. This second phase is what's
normally displayed. The -V
option also displays
the first phase.-w
width-d
option is selected, the display of
bytes is wrapped at width bytes per line, so the
screen is less cluttered. If no -w
option is
given, a default of 8 is used.-z
zversion-z
option
allows the Z-machine version to be specified.Chris Spiegel ⟨cspiegel@gmail.com⟩
September 14, 2023 |