Zilog Z80
The 8-bit processor that defined British home computing
The Zilog Z80, designed by Federico Faggin after he left Intel, became the dominant 8-bit CPU of European home computing — powering the ZX Spectrum, Amstrad CPC, MSX, Game Boy, Sega Master System, and countless arcade machines. An 8080-compatible superset with shadow registers, block operations, and an instruction set rich enough to feel almost mid-range for a 1976 chip.
Overview
The Zilog Z80 is an 8-bit microprocessor designed by Federico Faggin — the engineer who led the Intel 4004 and 8080 projects before leaving Intel in 1974 to co-found Zilog. The Z80 launched in 1976 as a deliberate improvement on the 8080: binary-compatible at the opcode level, but with a richer register file, more addressing modes, simpler interface logic (single 5V supply, single-phase clock), and integrated DRAM refresh — features that, combined with aggressive pricing, made the chip the default choice for European 8-bit home computers and a major presence in 1980s arcades.
The Z80 powered the ZX Spectrum, Amstrad CPC, MSX, Sega Master System, Game Gear, the original Game Boy (Sharp LR35902 — a Z80 variant), TRS-80, and a generation of CP/M business machines. For most British and European bedroom coders of the 1980s, "learning machine code" meant learning Z80.
Fast facts
- Designer: Federico Faggin / Masatoshi Shima / Ralph Ungermann at Zilog, 1974-1976.
- Launched: July 1976.
- Clock speed (original NMOS): 2.5 MHz (Z80), 4 MHz (Z80A), 6 MHz (Z80B), 8 MHz (Z80H). CMOS Z84C00 variants run up to 20 MHz.
- Data bus: 8-bit.
- Address bus: 16-bit (64 KB addressable).
- Process: NMOS (original), CMOS (later Z84C00 series).
- Package: 40-pin DIP for the original; smaller packages for embedded variants.
- 8080 compatibility: binary-compatible superset — most 8080 code runs unmodified.
Register architecture
The Z80's register file was generous for a 1976 8-bit chip — and notably richer than the contemporary 6502:
| Register set | Purpose |
|---|---|
| A, F | Accumulator and flags (combined pair: AF) |
| B, C, D, E, H, L | General-purpose 8-bit; paired as BC, DE, HL for 16-bit address arithmetic |
| A', F', B', C', D', E', H', L' | Shadow registers — swapped in/out via EX AF,AF' and EXX |
| IX, IY | 16-bit index registers with signed displacement: (IX+d), (IY+d) |
| SP | Stack pointer (16-bit) |
| PC | Program counter (16-bit) |
| I | Interrupt vector base (mode 2) |
| R | DRAM refresh counter (bits 0-6 auto-increment; bit 7 writable) |
The shadow set is the Z80's most distinctive architectural feature. A single-instruction context switch — EXX swaps BC/DE/HL with BC'/DE'/HL' in 4 T-states — lets interrupt handlers preserve state without a single push/pop. Many Spectrum games and the BASIC ROM use the shadow set for the interrupt routine that maintains the system clock (FRAMES at $5C78, three bytes incremented every frame).
Key instruction families
| Family | Examples | What's notable |
|---|---|---|
| Block operations | LDIR, LDDR, CPIR, OTIR | Repeating instruction prefix — one opcode copies up to 64 KB of memory |
| Bit manipulation | BIT n,r, SET n,r, RES n,r | Single-instruction bit-test on any register or memory location |
| Relative jumps | JR, JR cc, DJNZ | Signed 8-bit displacement; smaller, faster than absolute JP |
| Index modes | LD A,(IX+d), INC (IY+d) | Structure-style access via signed 8-bit offset |
| I/O | IN, OUT, IN A,(C), OUT (C),A | Separate I/O address space (256 ports addressed by low 8 bits) |
| Conditional return | RET cc | One-byte conditional return — denser than testing-then-RET |
For Spectrum work the most-used are DJNZ (16-bit loop counters in 13 T-states, no flag side effects on B), LDIR (the screen-clear primitive), BIT n,(HL) (collision testing against attribute bytes), and the index registers (sprite structures).
Undocumented features
The real silicon supports several instructions that don't appear in Zilog's official manual but are universally accepted by assemblers and modelled by accurate emulators:
- Half-registers of IX and IY.
IXH,IXL,IYH,IYLare usable as 8-bit operands in any DD- or FD-prefixed opcode.LD IXH, 5works. This applies only to register operands —LD (IX+d), Hstill references the realH, notIXH. SLL(Shift Left Logical). LikeSLAbut shifts a1into bit 0 instead of0. Useful occasionally for clean ANDed shifts.- Undocumented flag effects. Bits 3 and 5 of
F(XandYflags) take their values from various source bytes in ways the official manual doesn't document. Demo-scene code occasionally relies on these.
The most notorious CPU-family quirk: OUT (C),0 outputs the literal value 0 on NMOS Z80, but outputs 0xFF on the CMOS Z84C00. Software written assuming the NMOS behaviour breaks on CMOS parts and on emulators that model the CMOS variant.
Z80 vs 6502 — temperament
The two dominant 8-bit CPUs of the era have very different personalities:
| Feature | Z80 | 6502 |
|---|---|---|
| Register count | Many (with shadows + index) | Few (A, X, Y) |
| Addressing modes | Fewer kinds, but more flexible | Many kinds, all clever |
| Block operations | Built-in (LDIR) | Must be hand-coded |
| Code density | More verbose; bigger opcodes | Tighter; smaller routines |
| Clock per instruction | Higher T-state counts but higher clock | Lower cycle counts at lower clock |
| Typical Spectrum vs C64 | 3.5 MHz Z80 | 1 MHz 6510 |
| Learning curve | Steeper, more to remember | Gentler, easier to fit in your head |
Neither was objectively better; the 6502 won on density and elegant addressing, the Z80 won on register richness and useful block instructions. The platform-architecture debate of the 1980s often reduced to a CPU-camp argument.
Systems powered
- Home computers: ZX Spectrum (3.5 MHz), Amstrad CPC (4 MHz), MSX (3.58 MHz), TRS-80 (1.77-4 MHz), Sharp MZ series, Jupiter Ace.
- Consoles: Sega Master System and Game Gear (Z80A at 3.58 MHz); Game Boy (Sharp LR35902 — a Z80 derivative); ColecoVision; Sega Mega Drive (Z80 as audio co-processor for backwards compatibility).
- Arcade: Pac-Man, Galaga, Donkey Kong's audio sub-board, countless others.
- Business / CP/M: Kaypro, Osborne 1, Amstrad PCW.
Cultural impact
For European bedroom coders, the Z80 was assembly language. British schoolchildren in 1985 learning Hewson's Hints & Tips for the ZX Spectrum were learning Z80; the Sinclair User "Andrew Hewson's Helpline" column was a Z80 column under another name. The chip's instruction set was the entry-level apprenticeship for a generation of UK developers — many of whom went on to ship 16-bit games, then PC games, then triple-A titles, all built on muscle memory first acquired by writing DJNZ loops on a rubber-keyed Spectrum.
Why the Z80 matters for Code Like It's 198x
Every line of Shadowkeep's assembly is Z80. The Project teaches the Z80 instruction set not as historical curiosity but as the live language of the Spectrum platform: LDIR for screen clears, BIT n,(HL) for attribute-based collision, DJNZ for tight loops, port I/O via IN A,(C) / OUT (C),A for ULA communication. The chip's design choices — shadow registers, block operations, relative jumps — shape what idiomatic Spectrum code looks like.
See also
- Federico Faggin — Designer.
- Zilog — Manufacturer.
- ZX Spectrum
- Amstrad CPC
- 6502 — Z80's rival.
- ULA — The Spectrum's other key chip.