ZiLOG Z80 series User manual

ZiLOG Worldwide Headquarters • 532 Race Street • San Jose, CA 95126-3432
Telephone: 408.558.8500 • Fax: 408.558.8300 • www.ZiLOG.com
User Manual
Z80 Family
CPU User Manual
UM008005-0205

Z80 CPU
User’s Manual
UM008005-0205
This publication is subject to replacement by a later edition. To determine whether a later
edition exists, or to request copies of publications, contact:
ZiLOG Worldwide Headquarters
532 Race Street
San Jose, CA 95126-3432
Telephone: 408.558.8500
Fax: 408.558.8300
www.ZiLOG.com
Document Disclaimer
ZiLOG is a registered trademark of ZiLOG Inc. in the United States and in other countries. All other products
and/or service names mentioned herein may be trademarks of the companies with which they are associated.
©2004 by ZiLOG, Inc. All rights reserved. Information in this publication concerning the devices,
applications, or technology described is intended to suggest possible uses and may be superseded. ZiLOG,
INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF
THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZiLOG
ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT
RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY
DESCRIBED HEREIN OR OTHERWISE. Except with the express written approval of ZiLOG, use of
information, devices, or technology as critical components of life support systems is not authorized. No
licenses are conveyed, implicitly or otherwise, by this document under any intellectual property rights.

Z80 CPU
User’s Manual
Chapter Title UM008005-0205
iii
Revision History
Each instance in Table 1 reflects a change to this document from
its previous revision. To see more detail, click the appropriate link
in the table.
Table 1. Revision History of this Document
Date Revision
Level Section Description Page #
December
2004 04 Z80 Instruction
Set Corrected discrepancies in the bit
patterns for IM 0, IM 1 and IM 2
instructions.
176,177,
178
February
2005 05 Z80 Instruction
Set, CPU
Instruction
Description
Corrected illustration for the Rotate and
Shift Group RLCA instruction. Also
corrected the hex code for the RLCA
instruction on page 63.
190, 63

Z80 CPU
User’s Manual
UM008005-0205 PRELIMINARY DRAFT v1.0 Chapter Title
iv

Z80 CPU
User’s Manual
UM008005-0205 Table of Contents
v
Table of Contents
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .iii
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Arithmetic Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Instruction Register and CPU Control. . . . . . . . . . . . . . . . . . . . . . 6
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
Instruction Fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
Memory Read Or Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
Input or Output Cycles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Bus Request/Acknowledge Cycle . . . . . . . . . . . . . . . . . . . . . . . . .15
Interrupt Request/Acknowledge Cycle . . . . . . . . . . . . . . . . . . . . .16
Non-Maskable Interrupt Response . . . . . . . . . . . . . . . . . . . . . . . .17
HALT Exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
Power-Down Acknowledge Cycle. . . . . . . . . . . . . . . . . . . . . . . . 19
Power-Down Release Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
Interrupt Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Interrupt Enable/Disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
CPU Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
Hardware and Software Implementation Examples. . . . .27
Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Minimum System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27

Z80 CPU
User’s Manual
Table of Contents UM008005-0205
vi
Adding RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Memory Speed Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
Interfacing Dynamic Memories . . . . . . . . . . . . . . . . . . . . . . . . . .31
Software Implementation Examples . . . . . . . . . . . . . . . . . . . . . . . . . .33
Overview of Software Features . . . . . . . . . . . . . . . . . . . . . . . . . .33
Examples of Specific Z80 Instructions . . . . . . . . . . . . . . . . . . . . 34
Examples of Programming Tasks . . . . . . . . . . . . . . . . . . . . . . . . 37
Z80 CPU Instruction Description. . . . . . . . . . . . . . . . . . . 41
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
Instruction Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
Instruction Op Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
Z80 Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Z80 Assembly Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Z80 Status Indicator Flags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Add/Subtract Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77
Z80 Instruction Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
8-Bit Load Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
16-Bit Load Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .102
Exchange, Block Transfer, and Search Group . . . . . . . . . . . . . .122
8-Bit Arithmetic Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
General-Purpose Arithmetic and CPU Control Groups . . . . . . .166
16-Bit Arithmetic Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179
Rotate and Shift Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190
Bit Set, Reset, and Test Group . . . . . . . . . . . . . . . . . . . . . . . . . .224
Jump Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Call And Return Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255
Input and Output Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269

Z80 CPU
User’s Manual
UM008005-0205 List of Instructions
ix
List of Instructions
ADC A, s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146
ADC HL, ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180
ADD A, (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
ADD A, (IX + d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
ADD A, (IY + d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145
ADD A, n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
ADD A, r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
ADD HL, ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179
ADD IX, pp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182
ADD IY, rr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183
AND s 152
BIT b, (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226
BIT b, (IX+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228
BIT b, (IY+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .230
BIT b, r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224
CALL cc, nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257
CALL nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255
CCF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170
CP s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158
CPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137
CPDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138
CPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .134
CPIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135
CPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168
DAA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166
DEC IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188
DEC IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
DEC m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
DEC ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187
DI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
DJNZ, e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253

Z80 CPU
User’s Manual
List of Instructions UM008005-0205
x
EI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
EX (SP), HL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
EX (SP), IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
EX (SP), IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
EX AF, AF' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
EX DE, HL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
EXX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
HALT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
IM 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
IM 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
IM 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
IN A, (n). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
IN r (C). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
INC (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
INC (IX+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
INC (IY+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
INC IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
INC IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
INC r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
INC ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
IND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
INDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
INI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
INIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
JP (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
JP (IX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
JP (IY) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
JP cc, nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
JP nn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
JR C, e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
JR e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
JR NC, e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
JR NZ, e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
JR Z, e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

Z80 CPU
User’s Manual
UM008005-0205 List of Instructions
xi
LD (BC), A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
LD (DE), A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96
LD (HL), n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
LD (HL), r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
LD (IX+d), n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90
LD (IX+d), r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
LD (IY+d), n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91
LD (IY+d), r. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
LD (nn), A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
LD (nn), dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
LD (nn), HL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
LD (nn), IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
LD (nn), IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
LD A, (BC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92
LD A, (DE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93
LD A, (nn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
LD A, I. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
LD A, R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99
LD dd, (nn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106
LD dd, nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .102
LD HL, (nn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
LD I,A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .100
LD IX, (nn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
LD IX, nn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
LD IY, (nn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
LD IY, nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
LD r, (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
LD r, (IX+d). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
LD r, (IY+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
LD R, A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101
LD r, r' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
LD r,n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
LD SP, HL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113
LD SP, IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

Z80 CPU
User’s Manual
List of Instructions UM008005-0205
xii
LD SP, IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
LDD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
LDDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
LDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
LDIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
NEG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
NOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
OR s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
OTDR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
OTIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
OUT (C), r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
OUT (n), A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
OUTD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
OUTI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
POP IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
POP IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
POP qq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
PUSH IX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
PUSH IY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
PUSH qq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
RES b, m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
RET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
RET cc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
RETI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
RETN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
RL m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
RLA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
RLC (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
RLC (IX+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
RLC (IY+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
RLC r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
RLCA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
RLD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
RR m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

Z80 CPU
User’s Manual
UM008005-0205 List of Instructions
xiii
RRA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
RRC m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205
RRCA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192
RRD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
RST p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267
SBC A, s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150
SBC HL, ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
SCF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
SET b, (HL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
SET b, (IX+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
SET b, (IY+d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
SET b, r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232
SLA m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211
SRA m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
SRL m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217
SUB s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148
XOR s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156

Z80 CPU
User’s Manual
List of Instructions UM008005-0205
xiv

Z80 CPU
User’s Manual
UM008005-0205 List of Figures
xv
List of Figures
Figure 1. Z80 CPU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2
Figure 2. Z80 CPU Register Configuration . . . . . . . . . . . . . . . . . . . . . . .3
Figure 3. Z80 I/O Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
Figure 4. Basic CPU Timing Example . . . . . . . . . . . . . . . . . . . . . . . . . .12
Figure 5. Instruction Op Code Fetch . . . . . . . . . . . . . . . . . . . . . . . . . . .13
Figure 6. Memory Read or Write Cycle . . . . . . . . . . . . . . . . . . . . . . . . .14
Figure 7. Input or Output Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
Figure 8. Bus Request/Acknowledge Cycle . . . . . . . . . . . . . . . . . . . . . .16
Figure 9. Interrupt Request/Acknowledge Cycle . . . . . . . . . . . . . . . . . .17
Figure 10. Non-Maskable Interrupt Request Operation . . . . . . . . . . . . .18
Figure 11. HALT Exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Figure 12. Power-Down Acknowledge . . . . . . . . . . . . . . . . . . . . . . . . .19
Figure 13. Power-Down Release Cycle No. 1 . . . . . . . . . . . . . . . . . . . .20
Figure 14. Power-Down Release Cycle No. 2 . . . . . . . . . . . . . . . . . . . .20
Figure 15. Power-Down Release Cycle No. 3 . . . . . . . . . . . . . . . . . . . .21
Figure 16. Mode 2 Interrupt Response Mode . . . . . . . . . . . . . . . . . . . . .26
Figure 17. Minimum Z80 Computer System . . . . . . . . . . . . . . . . . . . . .28
Figure 18. ROM and RAM Implementation . . . . . . . . . . . . . . . . . . . . . .29
Figure 19. Adding One Wait State to an M1 Cycle . . . . . . . . . . . . . . . .30
Figure 20. Adding One Wait State to Any Memory Cycle . . . . . . . . . .31
Figure 21. Interfacing Dynamic RAMs . . . . . . . . . . . . . . . . . . . . . . . . .32
Figure 22. Shifting of BCD Digits/Bytes . . . . . . . . . . . . . . . . . . . . . . . .36

Z80 CPU
User’s Manual
List of Figures UM008005-0205
xvi

Z80 CPU
User’s Manual
UM008005-0205 List of Tables
xvii
List of Tables
Table 1. Revision History of this Document . . . . . . . . . . . . . . . . . . . . .iii
Table 2. Interrupt Enable/Disable, Flip-Flops. . . . . . . . . . . . . . . . . . . . 23
Table 3. Bubble Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Table 4. Multiply Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
Table 5. Hex, Binary, Decimal Conversion Table . . . . . . . . . . . . . . . . .49
Table 6. 8-Bit Load Group LD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Table 7. 16-Bit Load Group LD, PUSH and POP. . . . . . . . . . . . . . . . . 55
Table 8. Exchanges EX and EXX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
Table 9. Block Transfer Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
Table 10. Block Search Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
Table 11. 8-Bit Arithmetic and Logic . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Table 12. General-Purpose AF Operation . . . . . . . . . . . . . . . . . . . . . . .61
Table 13. 16-Bit Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
Table 14. Rotates and Shifts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
Table 15. Bit Manipulation Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
Table 16. Jump, Call, and Return Group. . . . . . . . . . . . . . . . . . . . . . . . 69
Table 17. Restart Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70
Table 18. Input Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72
Table 19. 8-Bit Arithmetic and Logic . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Table 20. Miscellaneous CPU Control . . . . . . . . . . . . . . . . . . . . . . . . . .73

Z80 CPU
User’s Manual
List of Tables UM008005-0205
xviii

Z80 CPU
User’s Manual
UM008005-0205 Manual Objectives
xix
Manual Objectives
This user manual describes the architecture and instruction set of the Z80
CPU.
About This Manual
ZiLOG recommends that the user read and understand everything in this
manual before setting up and using the product. However, we recognize
that users have different styles of learning: some will want to set up and
use their new evaluation kit while they read about it; others will open
these pages only to check on a particular specification. Therefore, we
have designed this manual to be used either as a how to procedural
manual or a reference guide to important data.
Intended Audience
This document is written for ZiLOG customers who are experienced at
working with microprocessors or in writing assembly code or compilers.
Manual Organization
The Z80 CPU User’s Manual is divided into four chapters.
Overview
Presents an overview of the User’s Manual Architecture, Pin descriptions,
timing and Interrupt Response.
Hardware and Software Implementation
Presents examples of the User’s Manual hardware and software.

User’s Manual
Z80 CPU
UM008005-0205 Manual Objectives
xx
Z80 CPU Instruction Description
Presents the User’s Manual instruction types, addressing modes and
instruction Op Codes.
Z80 Instruction Set
Presents an overview of the User’s Manual assenbly language, status
indicator flags and the Z80 instructions.
Related Documents
Manual Conventions
The following assumptions and conventions are adopted to provide clarity
and ease of use:
Use of the Words Set and Clear
The words set and clear imply that a register bit or a condition contains
the values logical 1 and logical 0, respectively. When either of these
terms is followed by a number, the word logical may not be included, but
it is implied.
Notation for Bits and Similar Registers
A field of bits within a register is designated as: Register (n–n). For
example: PWM_CR (31–20). A field of bits within a bus is designated as:
Busn–n. For example: PCntl7–4. A range of similar (whole) registers is
designated as: Registern–Registern. For example: OPBCS5–OPBCS0.
Part Number Title DC number
Part Number Title DC number
Part Number Title DC number

Z80 CPU
User’s Manual
Manual Objectives UM008005-0205
xxi
Use of the Terms LSB and MSB
In this document, the terms LSB and MSB, when appearing in upper case,
mean least significant byte and most significant byte, respectively. The
lowercase forms, msb and lsb, mean least significant bit and most
significant bit, respectively.
Courier Font
Commands, code lines and fragments, register (and other) mnemonics,
values, equations, and various executable items are distinguished from
general text by the use of the Courier font. This convention is not used
within tables. For example: The STP bit in the CNTR register must be 1.
Where the use of the font is not possible, as in the Index, the name of the
entity is presented in upper case.
Hexadecimal Values Designated by H
Hexadecimal values are designated by a uppercase Hand appear in the
Courier typeface. For example: STAT is set to F8H.
Use of All Uppercase Letters
The use of all uppercase letters designates the names of states and
commands. For example: The receiver can force the SCL line to Low to
force the transmitter into a WAIT state. The bus is considered BUSY after
the Start condition. A START command triggers the processing of the
initialization sequence.
Use of Initial Uppercase Letters
Initial uppercase letters designate settings, modes, and conditions in
general text. For example: The Slave receiver leaves the data line High. In
Transmit mode, the byte is sent most significant bit first. The Master can
generate a Stop condition to abort the transfer.

User’s Manual
Z80 CPU
UM008005-0205 Manual Objectives
xxii
Register Access Abbreviations
Register access is designated by the following abbreviations:
Trademarks
Z80, Z180, Z380 and Z80382 are trademarks of ZiLOG, Inc.
Designation Description
R Read Only
R/W Read/Write
W Write Only
– Unspecified or indeterminate
Other manuals for Z80 series
3
Table of contents
Other ZiLOG Processor manuals
Popular Processor manuals by other brands

at professional
at professional DSP 2.4 owner's manual

Acurus
Acurus ACT 4 user guide

NAIM
NAIM AV2 owner's manual

Inovonics
Inovonics DAVID-III 718 Operating and maintenance instruction manual

Extron electronics
Extron electronics DMP 64 user guide

Global American Inc.
Global American Inc. 3301520 user manual