Z80 Instruction Set
By ???

Z80 Instruction set summary

Table A-3. Z80 Mnemonics and Operations in Alphabetical Order
 

    Click to return to the site's menu... or here to get back to the tutorial's menu.

Mnemonic Operation CZPSNH Len Tim Comments
ADC A,r
ADC A,(HL)
ADC A,n
ADC A,(ii+n)
ADC HL,rr
A:=A+r+CY
A:=A+(HL)+CY
A:=A+n+CY
A:=A+(ii+n)+CY
HL:=HL+rr+CY
**V*0*



**V*0*
1
1
2
3
2
4
7
7
19
15
r - A,B,C,D,E,H,L

n - byte (0..FF)
ii - IX,IY
rr - BC,DE,HL,SP
ADC A,r
ADC A,(HL)
ADC A,n
ADC A,(ii+n)
ADC HL,rr
ADD IX,ry
ADD IY,rx
A:=A+r
A:=A+(HL)
A:=A+n
A:=A+(ii+n)
HL:=HL+rr
X:=IX+px
IY:=IY+py
**V*0*



*...0x

 
1
1
2
3
1
2
2
4
7
7
19
11
15
15




ry - BC,DE,SP,IY
rx - BC,DE,SP,IX
AND r
AND (HL)
AND n
AND (ii+n)
A:=A and r
A:=A and (HL)
A:=A and n
A:=A and (ii+n)
0*P*01


 
1
1
2
3
4
7
7
19
 
BIT b,r
BIT b,(HL)
BIT b,(ii+n)
Z:=not rb
Z:=not (HL)b
Z:=not (ii+n)b
.*xx01

 
2
2
4
8
12
20
b - bit number (0..7)
xb - bit b of
   location x
CALL nn
CALL cc,nn
 
PUSH PC;PC:=nn
If cc then CALL nn
 else continue
......

 
3
3
 
17
17
10
nn - word (0..FFFF)
cc - C,NC,Z,NZ,M,P,PE,PO
 
CCF CY:=not CY *...0x 1 4  
CP r
CP (HL)
CP n
CP (ii+n)
A-r
A-(HL)
A-n
A-(ii+n)
**V*1*


 
1
1
2
3
4
7
7
19
 
CDP A-(HL);dec HL;dec BC .***1* 2 16 PV=0 if BC=0,else PV=1
CPDR
 
Repeat CPD
until Z=1 or BC=0
.***1*
 
2
 
21
16
 
CPI A-(HL);inc HL;dec BC .***1* 2 16 PV=0 if BC=0,else PV=1
CPIR
 
Repeat CPI
 
.***1*
 
2
 
21
16
 
CPL A:=A xor 255 ....11 1 4  
DAA Decimal adjust Acc. **P*.* 1 4  
DEC r
DEC (HL)
DEC (ii+n)
DEC rr
DEC ii
r:=r-1
(HL):=(HL)-1
(ii+n):=(ii+n)-1
rr:=rr-1
ii:=ii-1
.*V*1*


......
 
1
1
3
1
2
4
11
23
6
10
 
DI IFF:=0 ...... 1 4  
DJNZ e
 
dec B;if B 0 JR e
 if B=0 continue
......
 
2
 
13
8
e - adresse relative
 
EI IFF:=1 ...... 1 4  
EX AF,AF'
EX DE,HL
EX (SP),HL
EX (SP),ii
AF<->AF'
DE<->HL
(SP)<->HL
(SP)<->ii
......


 
1
1
1
2
4
4
4
23
 
EXX
 
BC<->BC';DE<->DE';
HL<->HL'
......
 
1
 
4
 
 
Halt Halte le processeur ...... 1 4  
IM 1
IM 2
IM 3
Interrupt mode 1
Interrupt mode 2
Interrupt mode 3
......

 
2

 
8

 
 
IN A,(n)
IN r,(C)
IN ?,(C)
 
A:=port(n)
r:=port(C)
only set flags as
 as IN r,(C) does
......


 
2
2
2
 
11
12
12
 


can't be entered as a
command;code is ED 70
INC r
INC (HL)
NC (ii+n)
INC rr
INC ii
r:=r+1
(HL):=(HL)+1
(ii+n):=(ii+n)+1
rr:=rr+1
ii:=ii+1
.*V*0*


......
 
1
1
3
1
2
4
11
23
6
10
 
IND
 
(HL):=port(C);
dec HL;dec B
x*xx1x
 
2
 
16
 
Z=1 if B=0,else Z=0
 
INDR
 
Repeat IND
 until B=0
x1xx1x
 
2
 
21
16
 
INI
 
(HL):=port(C);
inc HL;dec B
x*xx1x
 
2
 
16
 
Z=1 if B=0,else Z=0
 
INIR
 
Repeat INI
 until B=0
x1xx1x
 
2
 
21
16
 
JP nn
JP cc,nn
JP (HL)
JP (ii)
PC:=nn
If cc then JP nn
PC:=HL
PC:=ii
......
......

 
3
3
1
2
10
10
4
8
 
JR e
JR cond,e
 
PC:=PC+e
If cond then JR e
 else NOP
......

 
2
2
 
12
12
7
cond - C,NC,Z,NZ
LD r,r
LD r,(HL)
LD r,n
LD r,(ii+n)
LD (HL),r
LD (ii+n),r
LD (HL),n
LD (ii+n),n
LD A,(BC)
LD A,(DE)
LD A,(nn)
LD (BC),A
LD (DE),A
LD (nn),A
LD A,I
LD A,R
LD I,A
LD R,A
LD rr,nn
LD ii,nn
LD HL,(nn)
LD rr,(nn)
LD ii,(nn)
LD (nn),HL
LD (nn),rr
LD (nn),ii
LD SP,HL
LD SP,ii
r:=r
r:=(HL)
r:=n
r:=(ii+n)
(HL):=r
(ii+n):=r
(HL):=n
(ii+n):=n
A:=(BC)
A:=(DE)
A:=(nn)
(BC):=A
(DE):=A
(nn):=A
A:=I
A:=R
I:=A
R:=A
rr:=nn
ii:=nn
HL:=(nn)
rr:=(nn)
ii:=(nn)
(nn):=HL
(nn):=rr
(nn):=ii
SP:=HL
SP:=ii
......













.***00

......









 
1
1
2
3
1
3
2
4
1
1
3
1
1
3
2
2
2
2
3
4
3
4
4
3
4
4
1
1
4
7
7
19
7
19
10
19
7
7
13
7
7
13
9
9
9
9
10
14
16
20
20
16
20
20
6
10












PV=IFF
PV=IFF











 
LDD
 
(DE):=(HL);
dec DE,HL,BC
..*.00
 
2
 
16
 
PV=0 if BC=0,else PV=1
 
LDDR
 
Repeat LDD
 
..0.00
 
2
 
21
16
 
LDI
 
(DE):=(HL);
inc DE,HL;dec BC
..*.00
 
2
 
16
 
PV=0 if BC=0,else PV=1
 
LDIR
 
Repeat LDI
 until Z=1 or BC=0
..0.00
 
2
 
21
16
 
NEG A:=0-A **V*1* 2 8  
NOP No operation ...... 1 4  
OR r
OR (HL)
OR n
OR (ii+n)
A:=A or r
A:=A or (HL)
A:=A or n
A:=A or (ii+n)
0*P*00


 
1
1
2
3
4
7
7
19
 
OTDR
 
Repeat OUTD
 until B=0
x1xx1x
 
2
 
21
16
OTIR
 
Repeat OUTI
 until B=0
x1xx1x
 
2
 
21
16
 
OUT (n),A
OUT (C),r
port(n):=A
port(C):=r
......
 
2
2
11
12
 
OUTD
 
port(C):=(HL);
dec HL;dec B
x*xx1x
 
2
 
16
 
Z=1 if B=0,else Z=0
 
OUTI
 
port(C):=(HL);
inc HL;dec B
x*xx1x
 
2
 
16
 
Z=1 if B=0,else Z=0
 
POP qq
POP ii
qq:=(SP);SP:=SP+2
ii:=(SP);SP:=SP+2
......
 
1
2
10
14
qq - AF,BC,DE,HL
 
PUSH qq
PUSH ii
SP:=SP-2;(SP):=qq
SP:=SP-2;(SP):=ii
...... 1
2
11
15
 
RES b,r
RES b,(HL)
RES b,(ii+n)
rb:=0
(HL)b:=0
(ii+n)b:=0
......

 
2
2
4
8
15
23
 
RET
RET cc
 
POP PC
If cc then RET
 else NOP
......
......
 
1
1
 
10
11
 
 
RETI Return from interr. ...... 2 14  
RETN Return from NMI ...... 2 14  
RL r
RL (HL)
RL (ii+n)
 
+------->------+
|+--+ +-------+|
++CY+<+7 <-- 0++

+--+ +-------+
 
**P*00


 
2
2
4
 
8
15
23
 
 
RLA *...00 1 4  
RLC r
RLC (HL)
RLC (ii+n)
+---->----+
+--+ |+-------+|
|CY+<++7 <-- 0++
+--+ +-------+
 
**P*00

 
2
2
4
8
15
23
 
RLCA *...00 1 4  
RLD



 
A +---->---+(HL)
+---+-+-++---+-+-+
|7 4|3 0||7 4|3 0|
+---+-+-++++-+-+-+
 +-<-++-<-+ |
.*P*00



 
2



 
18



 
 
RR r
RR (HL)
RR (ii+n)
+------<-------+
|+-------+ +--+|
++7 --> 0+>+CY++
+-------+ +--+
 
**P*00

 
2
2
4
8
15
23
 
RRA *...00 1 4  
RRC r
RRC (HL)
RRC (ii+n)
 
+---<-----+
|+-------+| +--+ |
++7 --> 0++>+CY|
+-------+ +--+
 
**P*00


 
2
2
4
 
8
15
23
 
 
RRCA *...00 1 4  
RRD



 
A +---<----+(HL)
+---+-+-++---+-+-+
|7 4|3 0||7 4|3 0|
+---+-+-++++-+-+-+
 +->-++->-+
.*P*00



 
2



 
18



 
 
RST adr CALL adr ...... 1 11 adr - byte (000xxx00b)
SBC A,r
SBC A,(HL)
SBC A,n
SBC A,(ii+n)
SBC HL,rr
A:=A-r-CY
A:=A-(HL)-CY
A:=A-n-CY
A:=A-(ii+n)-CY
HL:=HL-rr-CY
**V*1*



**V*1x
1
1
2
3
2
4
7
7
19
15
 
SCF CY:=1 1...00 1 4  
SET b,r
SET b,(HL)
SET b,(ii+n)
rb:=1
(HL)b:=1
(ii+n)b:=1
......
 
2
2
4
8
15
23
 
SLA r
SLA (HL)
SLA (ii+n)
+--+ +-------+
|CY+<+7 <-- 0+<0
+--+ +-------+
**P*00

 
2
2
4
8
15
23
 
SRA r
SRA (HL)
SRA (ii+n)
 +-------+ +--+
+>+7 --> 0+>+CY|
+-+-------+ +--+
**P*00

 
2
2
4
8
15
23
SRL r
SRL (HL)
SRL (ii+n)
 +-------+ +--+
 0>+7 --> 0+>+CY|
 +-------+ +--+
**P*00

 
2
2
4
8
15
23
 
SUB r
SUB (HL)
SUB n
SUB (ii+n)
A:=A-r
A:=A-(HL)
A:=A-n
A:=A-(ii+n)
**V*0*


 
1
1
2
3
4
7
7
19
 
XOR r
XOR (HL)
XOR n
XOR (ii+n)
A:=A xor r
A:=A xor (HL)
A:=A xor n
A:=A xor (ii+n)
0*P*00


 
1
1
2
3
4
7
7
19