Z80DASM(1)
๐ NAME ๐
z80dasm โ the Z80 assembly generating disassembler, bestie edition ๐ฆ
โจ SYNOPSIS โจ
z80dasm [ options ] file
๐ธ DESCRIPTION ๐ธ
Okay so listen. z80dasm takes a binary file full of Z80 machine code and disassembles it into actual Z80 assembly language source. And yes, it handles a bunch of undocumented opcodes too, because it's an overachiever and we love that for it. ๐
It can try to guess where the labels go in the code โ or you can just tell it yourself by hand, in the form of a symbol file. And if you feed it the right info, it can also split that binary file into code sections and data sections of several different types. Multi-talented fr fr. ๐
The source file it spits out? You can assemble it right back into the original binary using z80asm, zasm, or the original Zilog assembler (that last one only when you used the --zilog option, iykyk).
๐ OPTIONS ๐
-a,--addressโ Prints the address of the memory location that corresponds to each line of assembly code, as a comment at the end of the line. Little breadcrumb trail, love that. โจ-b,--block-def=FILEโ Reads block information from a file. Don't specify it? Then the default is that the entire file is machine code. Peep the BLOCK FILE section below for the deets.-g,--origin=ORGโ Sets the start address of the binary code you're disassembling, and a matchingorgdirective gets generated in the output file. The argument is read as hexadecimal if it starts with0xor0X, as octal if it starts with0, and base 10 otherwise. Default is0x0100. ๐ซถ-h,--helpโ Shows a summary of the options and dips. Byeee ๐-l,--labelsโ Tries to guess where the labels go based on jump instructions, then adds them into the assembly code. Psychic energy, honestly. ๐ฎ-o,--output=FILEโ Picks the output file. Default is writing to standard output.-r,--sym-order=SORTโ The ordering of symbols in the symbol file.SORTcan bedefault(sorted by value) orfrequency(sorted by how often they're used).-s,--sym-output=FILEโ Writes symbol information into a file. ๐พ-S,--sym-input=FILEโ Reads symbol information from a file. Check the SYMBOL FILE section below.-t,--sourceโ Prints the binary data that corresponds to each line of assembly code, as a comment at the end of the line. Data comes out in hex and ASCII. Super useful for spotting data sections on that first disassembly pass. ๐-u,--undocโ By default, all undocumented instructions get disassembled asdefbdirectives with the instruction name tucked into a comment. Why? Becausez80asmhas missing or buggy support for a lot of these instructions, no cap. If you pass this option, those undocumented instructions get written directly into the disassembly. Live dangerously. ๐-v,--verboseโ Cranks up the verbosity level. Specify it multiple times to get even more verbose. Messages go to standard error.-V,--versionโ Displays version info and exits.-z,--zilogโ Turns on compatibility mode for the original Zilog Z80 assembler. Right now it only changes the syntax of relative jumps. Small but mighty. โญ
๐ง SYMBOL FILE ๐ง
Symbol files that z80dasm writes can be fed straight back in as input symbol files with the --sym-input option. Cute little round trip, we stan. ๐
These directives are recognized in input symbol files, and they get propagated to the output symbol files:
include "filename"โ Includes another symbol file. The double quotes are mandatory, bestie. And the included files have to be in the current directory.symbol: equ valueโ Defines a symbol with a value. The value is read as hexadecimal if it begins with0xor0X, as octal if it begins with0, and base 10 otherwise. Default is0x0100.; commentโ Everything between a semi-colon and the end of the line is ignored. ๐ซ
๐ฆ BLOCK FILE ๐ฆ
Block files specify the boundaries between different blocks (aka sections) of binary data in the disassembler's input file. These directives are recognized:
name: [ unlabeled ] [ start | first ] address [ unlabeled ] [ end | last ] address type typeโ Defines a block with a start and end address that holds a certain type of binary data.
Start address is the 16 bit address of the first byte in the block. The keywords start and first mean the exact same thing, synonymous besties. ๐ซถ
If you use the end keyword, the end address is the 16 bit address of the last byte in the block plus one. If you use last, the end address is the 16 bit address of the last byte in the block. Subtle but important, don't mix them up. ๐ญ
Normally labels get defined at the addresses you specified in the block definition. You can suppress that by adding the keyword unlabeled before the address.
; commentโ Everything between a semi-colon and the end of the line is ignored. Same deal as before.
And here are the block types it supports, queen energy only:
codeโ A block containing Z80 machine code. Data in this block gets written as Z80 assembly language. ๐bytedataโ A data block containing separate bytes. Data here gets written withdefbdirectives.worddataโ A data block containing 16 bit words (low order byte first). Data here gets written withdefwdirectives.pointersโ A data block containing 16 bit pointers (low order byte first). This type is equivalent toworddataexcept that values get replaced with labels wherever that's possible. โจ
๐ DIAGNOSTICS ๐
If the disassembly went well, z80dasm returns 0. On error, diagnostic messages get printed to standard error and z80dasm returns 1. That's the vibe check. โ
๐ BUGS ๐
Please report bugs to tomaz.solc@tablix.org โ do not suffer in silence, bestie, tell them everything. ๐
๐ AUTHOR ๐
z80dasm is based largely on dz80, written by Jan Panteltje. Feature enhancements and bug fixes were made by Tomaz Solc. Legends only. ๐
๐ SEE ALSO ๐
Okay that's the whole page, mwah ๐ This one's by Tomaz Solc, dated 2007-06-14, and it lives in the Z80 disassembler User's manual as Z80DASM(1). Go disassemble something iconic. ๐โจ
๐ฆ where this page comes from
- debian bookworm: z80dasm 1.1.6-1 ยท GPL-2.0-or-later
- debian trixie: z80dasm 1.1.6-1 ยท GPL-2.0-or-later
- ubuntu jammy: z80dasm 1.1.6-1 ยท GPL-2.0-or-later
- ubuntu noble: z80dasm 1.1.6-1 ยท GPL-2.0-or-later
- ubuntu questing: z80dasm 1.1.6-1
- ubuntu resolute: z80dasm 1.1.6-1build1 ยท GPL-2.0-or-later
- ubuntu stonking: z80dasm 1.1.6-1build1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms