Skip to main content

ADL-aware Z80/eZ80 disassembler

Project description

ez80dis — eZ80 disassembler

A Python disassembler for the Zilog eZ80 CPU, extending z80dis with full eZ80 instruction set support.

Features

  • All standard Z80 instructions
  • All eZ80 additions: LEA, PEA, MLT, TST, TSTIO, IN0, OUT0, SLP, STMIX, RSMIX, extended block I/O (INIM/OTIM/INI2/… families)
  • eZ80 16-bit LD variants
  • ADL mode: 24-bit immediates and addresses
  • .lil/.lis/.sil/.sis prefixes

Installation

pip install ez80dis

API

from ez80dis import decode, disasm, Decoded, DECODE_STATUS

# Quick string — one call
print(disasm(bytes([0xDD, 0x54])))          # ld D,IXH

# Structured result
dec = decode(bytes([0x5B, 0xCD, 0x00, 0x10, 0x00]), addr=0x1000, adl=True)
print(dec.status)       # DECODE_STATUS.OK
print(dec.len)          # 5  (mode-prefix byte + CALL Opcode + 3-byte CALL target)
print(disasm(dec))      # call.lil 0x001000

# ADL mode active by default
dec = decode(bytes([0xC3, 0x00, 0x10, 0x00]), adl=True)
print(disasm(dec))      # jp 0x001000

decode(data, addr=0, adl=False) -> Decoded

Decodes one instruction from data (bytes or list of ints).

Field Type Description
status DECODE_STATUS OK, INVALID_INSTRUCTION, or ERROR
len int Number of bytes consumed
op OP Opcode enum value
operands list List of (OPER_TYPE, value) tuples
typ INSTRTYPE Instruction category
mode_suffix str '.lil' / '.lis' / '.sil' / '.sis' / ''
long_op bool True when 24-bit operands are active

disasm(data_or_decoded, pc=0, adl=False) -> str

Convenience wrapper — accepts raw bytes or an already-decoded Decoded object.

FLAGS — F-register decoder

FLAGS is an IntFlag enum for unpacking the Z80/eZ80 flags register:

Bit Name Meaning
0 C Carry
1 N Add/subtract (set after SUB, cleared after ADD; used by DAA)
2 PV Parity / Overflow
3 F3 Undocumented copy of result bit 3
4 H Half-carry (carry from bit 3 to 4)
5 F5 Undocumented copy of result bit 5
6 Z Zero
7 S Sign (MSB of A)
from ez80dis import FLAGS

f = FLAGS(0x45)          # e.g. value read from the F register
print(f.name)            # 'C|PV|Z'
print(FLAGS.Z in f)      # True
print(f & FLAGS.C)       # FLAGS.C

License

Based on z80dis by lwerdna.
z80dis was released under The Unlicense. I decided to use the same for ez80dis.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ez80dis-1.0.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ez80dis-1.0.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file ez80dis-1.0.1.tar.gz.

File metadata

  • Download URL: ez80dis-1.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ez80dis-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f5916e15ec57ab7bf30ab74837d263e684f9bfe6189352767c1c83214b187047
MD5 e12416a8db02438046af17274919449d
BLAKE2b-256 aaf14dda3ff596d8b8e30927874d8bf565a84c0d22a91b42dfd04d39a728c51a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ez80dis-1.0.1.tar.gz:

Publisher: publish.yml on Matze584/ez80dis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ez80dis-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ez80dis-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ez80dis-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ddf7a57350dd61a40a51a2d567d84917aaa4b92ef053b5885963b6116c5dff3
MD5 c8864af6bb6ae8e6673197ea587ed041
BLAKE2b-256 ab2e7a69ac91246ed28a36448b417d05ba0d5b83546db9436fb9246e7479cfe6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ez80dis-1.0.1-py3-none-any.whl:

Publisher: publish.yml on Matze584/ez80dis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page