A disassembler is often the first step in a larger pipeline: to a high-level intermediate representation (IR), or reassembling a modified binary.
Implementation approach: after reading 0xDD , set a flag ix_mode = true . The next opcode’s decoder checks this flag and substitutes IX for HL , and the displacement byte for (HL) .
Z80 opcodes follow a tiered structure:
struct z80_insn char *mnemonic; // "LD A, B" int length; // bytes consumed int (*decoder)(uint8_t *bytes, char *out_buf); ;