Hubbry Logo
search
logo

Z80 instruction set

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Z80 instruction set

The Zilog Z80 is an 8-bit microprocessor introduced in 1976. The instruction set was designed to be upward binary compatible with the Intel 8080. Intel 8080 instructions are one to three bytes long whereas the Z80 requires up to four bytes per instruction.

Zilog continued to expand the instruction set of the Z80 with several successors including the Z180, Z280, and Z380. The latest iteration, the eZ80, was introduced in 2001 and was available for purchase as of 2025. The instruction set also appears on non-Zilog CPUs such as the Hitachi HD64180, Mitsui R800, and the Eastern Bloc U880.

The Z80 uses 252 out of the available 256 codes as single byte opcodes (the "root instructions"), most of which are inherited from the 8080. The four remaining codes are used extensively as opcode prefixes: CB and ED enable extra instructions, and DD or FD select IX or IY respectively in place of HL. This scheme gives the Z80 a large number of permutations of instructions and registers. Zilog categorizes these into 158 different "instruction types", 78 of which are the same as those of the Intel 8080. This allows operation of all 8080 programs on a Z80. The Zilog documentation further groups instructions into categories. Most are from the 8080, others are entirely new like the block and bit instructions, and other 8080 instructions with more versatile addressing modes, like the 16-bit loads, I/O, rotates/shifts, and relative jumps. The categories are:

To expand on the 8080 instruction set, Z80 instructions may require a IX/IY override, an opcode prefix, or both. Any one instruction may contain up to four components. The components of the instruction are assembled in the following order:

The root opcodes include all the 8080 opcodes. The Z80 adds eight new one-byte instructions, two opcode prefixes, and the IX and IY overrides. Colored rows indicate new Z80 instructions.

The ED-prefixed opcodes are a catch-all of new Z80 instructions that could not be encoded in one byte. This group encompasses only 60 of 256 available opcodes.

The CB-prefixed opcodes cover shifts and rotates plus the bit test, clear, and set instructions. All of these instructions can be used with any register or memory. The (HL) form of these instructions can be combined with an IX or IY opcode prefix to operate on (IX+d) or (IY+d). This group encompasses 248 of 256 available opcodes.

Two opcode prefixes expand the number of Z80 addressing modes to access the new IX and IY index registers:

See all
User Avatar
No comments yet.