Scroll to navigation

Z80DASM(1) Z80 disassembler User's manual Z80DASM(1)

NAME

z80dasm - Z80 assembly generating disassembler

SYNOPSIS

z80dasm [ options ] file

DESCRIPTION

z80dasm disassembles a binary file containing Z80 machine code into Z80 assembly language source (including a number of undocumented opcodes). It can try to guess locations of labels in the code or the labels can be specified by hand in the form of a symbol file. If given proper information the disassembler can also split the binary file into code and data sections of several different types.

Generated source file can be assembled back into the original binary using z80asm, zasm or the original Zilog assembler (when the --zilog option was used).

OPTIONS

Print the address of the memory location corresponding to each line of assembly code in a comment at the end of the line.
Read block information from a file. If this option is not specified the default is for the entire file to contain machine code. See BLOCK FILE below.
Specify the start address of the binary code being disassembled. A corresponding org directive is generated in the output file. The argument is read in hexadecimal if it begins with 0x or 0X, in octal if it begins with 0, and in base 10 otherwise. Default is 0x0100.
Show summary of options and exit.
Try to guess label locations from jump instructions and add them to the assembly code.
Specify the output file. Default is to write to standard output.
Ordering of symbols in the symbol file. SORT can be default (sort by value) or frequency (sort by usage frequency).
Write symbol information into a file.
Read symbol information from a file. See SYMBOL FILE below.
Print the binary data corresponding to each line of assembly code in a comment at the end of the line. Data is printed in hex and ASCII. This is useful for identifying data sections in the first disassembly.
By default, all undocumented instructions are disassembled as defb directives with the instruction name in a comment. This is due to missing or buggy support for many of these instructions in z80asm. If this option is specified, undocumented instructions are written directly into the disassembly.
Increase verbosity level. Specify multiple times to be more verbose. Messages are sent to standard error.
Display version information and exit.
Enable compatibility mode for the original Zilog Z80 assembler. This currently only changes the syntax of relative jumps.

SYMBOL FILE

Symbol files written by z80dasm can be directly used as input symbol files with the --sym-input option. The following directives are recognized in input symbol files and are propagated to the output symbol files:

Include another symbol file. Double quotes are mandatory. Included files must be in the current directory.

symbol: equ value
Define a symbol with a value. The value is read in hexadecimal if it begins with 0x or 0X, in octal if it begins with 0, and in base 10 otherwise. Default is 0x0100.

; comment
All characters between a semi-colon and end of line are ignored.

BLOCK FILE

Block files specify the boundaries between different blocks (sections) of binary data in the disassembler input file. The following directives are recognized:

name: [ unlabeled ] [ start | first ] address [ unlabeled ] [ end | last ] address type type
Define a block with the start and end address that contains a certain type of binary data.

Start address is the 16 bit address of the first byte in the block. Keywords "start" and "first" are synonymous. If the keyword "end" is used, the end address is the 16 bit address of the last byte in the block plus one. If the keyword "last" is used, the end address is the 16 bit address of the last byte in block.

Normally labels are defined at the addresses specified in the block definition. This can be suppressed by adding the keyword "unlabeled" before the address.

; comment
All characters between a semi-colon and end of line are ignored.

The following block types are supported:

Block containing Z80 machine code. Data in this block will be written in Z80 assembly language.

Data block containing separate bytes. Data in this block will be written with defb directives.

Data block containing 16 bit words (low order byte first). Data in this block will be written with defw directives.

Data block containing 16 bit pointers (low order byte first). This type is equivalent to worddata except that values will be replaced with labels where that is possible.

DIAGNOSTICS

If disassembly was successful z80dasm returns 0. On error diagnostic messages are printed to standard error and z80dasm returns 1.

BUGS

Please report bugs to tomaz.solc@tablix.org

AUTHOR

z80dasm is based largely on dz80 , written by Jan Panteltje. Feature enhancements and bug fixes were made by Tomaz Solc.

SEE ALSO

z80asm(1)

2007-06-14 Tomaz Solc