Z80 and R800 Assembly/Machine Language Op-code Tables



Notes:

Z80/R800 Instruction Table:

Instructions sorted by Z80 mnemonics (compact)
Z80 Assembly Mnemonics (meaning) R800 Assembly Mnemonics (meaning) Operation, Description and Remarks Flags Op-codes B Z R
Binary Hex.
SZ.HP.NC
76543210
adc a,(hl)
(ADd with Carry)
addc .a,[.hl]
(ADD with Carry)
.a << .a + [.hl] + C
**?*o?0*
10001110
8E 172
adc a,(ii+d)addc .a,[ii+d] .a << .a + [ii + d] + C
**?*o?0*
   ii
10001110
d
ii
8E
d
3195
adc a,naddc .a,n .a << .a + n + C
**?*o?0*
11001110
n
CE
n
272
adc a,raddc .a,r .a << .a + r + C
**?*o?0*
10001 r
141
addc .a,p .a << .a + p + C
**?*o?0*
11011101
10001 p

DD
22
addc .a,q .a << .a + q + C
**?*o?0*
11111101
10001 q

FD
22
adc hl,ssaddc .hl,ss .hl << .hl + ss + C
**?*o?0*
11101101
01ss1010
ED 2152
add a,(hl)
(ADD)
add .a,[.hl]
(ADD)
.a << .a + [.hl]
**?*o?0*
10000110
86 172
add a,(ii+d)add .a,[ii+d] .a << .a + [ii + d]
**?*o?0*
   ii
10000110
d
ii
86
d
3195
add a,nadd .a,n .a << .a + n
**?*o?0*
11000110
n
C6
n
272
add a,radd .a,r .a << .a + r
**?*o?0*
10000 r
141
add .a,p .a << .a + p
**?*o?0*
11011101
10000 p
DD 22
add .a,q .a << .a + q
**?*o?0*
11111101
10000 q
FD 22
add hl,ssadd .hl,ss .hl << .hl + ss
**?*o?0*
00ss1001
1111
add ii,ppadd ii,pp ii << ii + pp
**?*o?0*
   ii
00pp1001
ii 2152
and (hl)
(AND)
and .a,[.hl]
(AND)
.a << .a & [.hl]
**?1p?00
10100110
A6 172
and (ii+d)and .a,[ii+d] .a << .a & [ii + d]
**?1p?00
   ii
10100110
d
ii
A6
d
3195
and nand .a,n .a << .a & n
**?1p?00
11100110
n
E6
n
272
and rand .a,r .a << .a & r
**?1p?00
10100 r
141
and .a,p .a << .a & p
**?1p?00
11011101
10100 p
DD 22
and .a,q .a << .a & q
**?1p?00
11111101
10100 q
FD 22
bit b,(hl)
(test BIT)
bit b,[.hl]
(test BIT)
Z << ¬ [.hl]{b}
?*?1??0.
11001011
01 b 110
CB 2123
bit b,(ii+d)bit b,[ii+d] Z << ¬ [ii + d]{b}
?*?1??0.
   ii
11001011
d
01 b 110
ii
CB
d
4205
bit b,rbit b,r Z << ¬ r{b}
?*?1??0.
11001011
01 b r
CB 282
call nn
(CALL)
call nn
(CALL)
[.sp - 2] << .pcl
[.sp - 1] << .pch
.sp << .sp - 2
.pc << nn
........
11001101
nnl
nnh
CD
nnl
nnh
3175
call c,nn
(CALL if Carry)
call c,nn
(CALL if Carry)
if C = 1
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11011100
nnl
nnh
DC
nnl
nnh
317
10 *
5
3 *
call m,nn
(CALL if Minus)
call m,nn
(CALL if Minus)
if S = 1
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11111100
nnl
nnh
FC
nnl
nnh
317
10 *
5
3 *
call nc,nn
(CALL if Not Carry)
call nc,nn
(CALL if Not Carry)
if C = 0
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11010100
nnl
nnh
D4
nnl
nnh
317
10 *
5
3 *
call nz,nn
(CALL if Not Zero)
call nz,nn
(CALL if Not Zero)
if Z = 0
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11000100
nnl
nnh
C4
nnl
nnh
317
10 *
5
3 *
call p,nn
(CALL if Plus)
call p,nn
(CALL if Plus)
if S = 0
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11110100
nnl
nnh
F4
nnl
nnh
317
10 *
5
3 *
call pe,nn
(CALL if Parity is Even)
call pe,nn
(CALL if Parity is Even)
if P = 1
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11101100
nnl
nnh
EC
nnl
nnh
317
10 *
5
3 *
call po,nn
(CALL if Parity is Odd)
call po,nn
(CALL if Parity is Odd)
if P = 0
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11100100
nnl
nnh
E4
nnl
nnh
317
10 *
5
3 *
call z,nn
(CALL if Zero)
call z,nn
(CALL if Zero)
if Z = 1
    [.sp - 2] << .pcl
    [.sp - 1] << .pch
    .sp << .sp - 2
    .pc << nn
else
    * no operation
........
11001100
nnl
nnh
CC
nnl
nnh
317
10 *
5
3 *
ccf
(Complement Carry Flag)
notc
(NOT Carry)
C << ¬ C
..??.?0*
00111111
3F 141
cp (hl)
(ComPare)
cmp .a,[.hl]
(CoMPare)
.a - [.hl]
**?*o?1*
10111110
BE 172
cp (ii+d)cmp .a,[ii+d] .a - [ii + d]
**?*o?1*
   ii
10111110
d
ii
BE
d
3195
cp ncmp .a,n .a - n
**?*o?1*
11111110
n
FE
n
272
cp rcmp .a,r .a - r
**?*o?1*
10111 r
141
cmp .a,p .a - p
**?*o?1*
11011101
10111 p
DD 22
cmp .a,q .a - q
**?*o?1*
11111101
10111 q
FD 22
cpd
(ComPare and Decrement)
cmp .a,[.hl--] .a - [.hl]
.hl << .hl - 1
.bc << .bc - 1
*%?*$?*.
11101101
10101001
ED
A9
2164
cpdr
(ComPare, Decrement and Repeat)
cmpm .a,[.hl--]
(CoMPare Multiple)

repeat

    .a - [.hl]
    .hl << .hl - 1
    .bc << .bc - 1
until
    .bc = 0 or
    .a = [.hl]

* note: the 1st execution time is for each loop and the 2nd to the final loop.
*%?*$?*.
11101101
10111001
ED
B9
221
16 *
4
4 *
cpi
(ComPare and Increment)
cmp .a,[.hl++] .a - [.hl]
.hl << .hl + 1
.bc << .bc - 1
*%?*$?*.
11101101
10100001
ED
A1
2164
cpir
(ComPare, Increment and Repeat)
cmpm .a,[.hl++]

repeat

    .a - [.hl]
    .hl << .hl + 1
    .bc << .bc - 1
until
    .bc = 0 or
    .a = [.hl]

* note: the 1st execution time is for each loop and the 2nd to the final loop.
*%?*$?*.
11101101
10110001
ED
B1
221
16 *
4
4 *
cpl
(ComPLement accumulator)
not .a
(NOT)
.a << ¬ .a
..?1.?1.
00101111
2F 141
daa
(Decimal Adjust Accumulator)
adj .a
(ADJust)
adjust to decimal
**?*p?.*
00100111
27 141
dec (hl)
(DECrement)
dec [.hl]
(DECrement)
[.hl] << [.hl] - 1
**?*o?0.
00110101
35 1114
dec (ii+d)dec [ii+d] [ii + d] << [ii + d] - 1
**?*o?0.
   ii
00110101
d
ii
35
d
3237
dec rdec r r << r - 1
**?*o?0.
00 r 101
141
dec p p << p - 1
**?*o?0.
11011101
00 p 101
DD 22
dec q q << q - 1
**?*o?0.
11111101
00 q 101
FD 22
dec ssdec ss ss << ss - 1
........
00ss1011
161
dec iidec ii ii << ii - 1
........
   ii
00101011
ii
2B
2102
di
(Disable Interruption)
di
(Disable Interruption)
IFF << 0
........
11110011
F3 142
djnz d
(Decrement and Jump if Not Zero)
dbnz d
(Decrement and Branch if Not Zero)
.b << .b - 1
if .b not zero
    .pc << .pc + d
else
    no operation
........
00010000
d
10
d
213
8
2
2
ei
(Enable Interruption)
ei
(Enable Interruption)
IFF << 1
........
11111011
FB 141
ex (sp),hl
(EXchange)
xch [.sp],.hl
(eXCHange)
.l <=> [.sp]
.h <=> [.sp + 1]
........
11100011
E3 1195
ex (sp),iixch [.sp],ii iil <=> [.sp]
iih <=> [.sp + 1]
........
   ii
11100011
ii
E3
2236
ex af,af'xch .af,.af' .af <=> .af'
........
00001000
08 141
ex de,hlxch .de,.hl .de <=> .hl
........
11101011
EB 141
exx
(EXchange with auXiliar)
xchx
(eXCHange with auXiliar)
.bc <=> .bc'
.de <=> .de'
.hl <=> .hl'
........
11011001
D9 141
halt
(HALT)
halt
(HALT)
halt processor
........
01110110
76 142
im 0
(Interruption Mode 0)
im 0
(Interruption Mode 0)
set interruption mode 0
........
11101101
01000110
ED
46
283
im 1
(Interruption Mode 1)
im 1
(Interruption Mode 1)
set interruption mode 1
........
11101101
01010110
ED
56
283
im 2
(Interruption Mode 2)
im 2
(Interruption Mode 2)
set interruption mode 2
........
11101101
01011110
ED
5E
283
in a,(n)
(INput)
in .a,[n]
(INput)
.a << [n]
........
11011011
n
DB
n
2113
in r,(c)in r,[.c] r << [.c]
**?0p?0.
11101101
01 r 000
ED 2123
*1in .f,[.c]

[.c]

* note 1: this instruction has no mnemonic for Z80, so its op-code must be directly defined when necessary (in pseudo-code: db 0edh,070h)

* note 2: the R800 mnemonic implies, but doesn't mean, that the datum is stored in .f; the mnemonic only indicates the instruction affects .f
**?0p?0.
11101101
01110000
ED
70
2123
inc (hl)
(INCrement)
inc [.hl]
(INCrement)
[.hl] << [.hl] + 1
**?*o?0.
00110100
34 1114
inc (ii+d)inc [ii+d] [ii + d] << [ii + d] + 1
**?*o?0.
   ii
00110100
d
ii
34
d
3237
inc rinc r r << r + 1
**?*o?0.
00 r 100
141
inc p p << p + 1
**?*o?0.
11011101
00 p 100
DD 22
inc q q << q + 1
**?*o?0.
11111101
00 q 100
FD 22
inc ssinc ss ss << ss + 1
........
00ss0011
161
inc iiinc ii ii << ii + 1
........
   ii
00100011
ii
23
2102
ind
(INput and Decrement)
in [.hl--],[.c]
(INput)
[.hl] << [.c]
.b << .b - 1
.hl << .hl - 1
?!????1.
11101101
10101010
ED
AA
2164
indr
(INput, Decrement and Repeat)
inm [.hl--],[.c]
(INput Multiple)

repeat

    [.hl] << [.c]
    .b << .b - 1
    .hl << .hl - 1
until
    .b = 0

* note: the 1st execution time is for each loop and the 2nd to the final loop
?1????1.
11101101
10111010
ED
BA
221
16 *
4
3 *
ini
(INput and Increment)
in [.hl++],[.c]
(INput)
[.hl] << [.c]
.b << .b - 1
.hl << .hl + 1
?!????1.
11101101
10100010
ED
A2
2164
inir
(INput, Increment and Repeat)
inm [.hl++],[.c]

repeat

    [.hl] << [.c]
    .b << .b - 1
    .hl << .hl + 1
until
    .b = 0

* note: the 1st execution time is for each loop and the 2nd to the final loop
?1????1.
11101101
10110010
ED
B2
221
16 *
4
3 *
jp (hl)
(JumP)
br [.hl]
(BRanch)
.pc << [.hl]
........
11101001
E9 141
jp (ii)br [ii] .pc << [ii]
........
   ii
11101001
ii
E9
282
jp nnbr nn .pc << nn
........
11000011
nnl
nnh
C3
nnl
nnh
3103
jp c,nn
(JumP if Carry)
bc nn
(Branch if Carry)
if C = 1
    .pc << nn
else
    no operation
........
11011010
nnl
nnh
DA
nnl
nnh
3103
jp m,nn
(JumP if Minus)
bm nn
(Branch if Minus)
if S = 1
    .pc << nn
else
    no operation
........
11111010
nnl
nnh
FA
nnl
nnh
3103
jp nc,nn
(JumP if Not Carry)
bnc nn
(Branch if Not Carry)
if C = 0
    .pc << nn
........
11010010
nnl
nnh
D2
nnl
nnh
3103
jp nz,nn
(JumP if Not Zero)
bnz nn
(Branch if Not Zero)
if Z = 0
    .pc << nn
........
11000010
nnl
nnh
C2
nnl
nnh
3103
jp p,nn
(JumP if Plus)
bp nn
(Branch if Plus)
if S = 0
    .pc << nn
........
11110010
nnl
nnh
F2
nnl
nnh
3103
jp pe,nn
(JumP if Parity is Even)
bpe nn
(Branch if Parity is Even)
if P = 1
    .pc << nn
........
11101010
nnl
nnh
EA
nnl
nnh
3103
jp po,nn
(JumP if Parity is Odd)
bpo nn
(Branch if Parity is Odd)
if P = 0
    .pc << nn
........
11100010
nnl
nnh
E2
nnl
nnh
3103
jp z,nn
(JumP if Zero)
bz nn
(Branch if Zero)
if Z = 1
    .pc << nn
........
11001010
nnl
nnh
CA
nnl
nnh
3103
jr d
(Jump Relative)
short br d
(SHORT BRanch)
.pc << .pc + d
........
00011000
d
18
d
2123
jr c,d
(Jump Relative if Carry)
short bc d
(SHORT Branch if Carry)
if C = 1
    .pc << .pc + d
else
    * no operation
........
00111000
d
38
d
212
7 *
3
2 *
jr nc,d
(Jump Relative if Not Carry)
short bnc d
(SHORT Branch if Not Carry)
if C = 0
    .pc << .pc + d
else
    * no operation
........
00110000
d
30
d
212
7 *
3
2 *
jr nz,d
(Jump Relative if Not Zero)
short bnz d
(SHORT Branch if Not Zero)
if Z = 0
    .pc << .pc + d
else
    * no operation
........
00100000
d
20
d
212
7 *
3
2 *
jr z,d
(Jump Relative if Zero)
short bz d
(SHORT Branch if Zero)
if Z = 1
    .pc << .pc + d
else
    * no operation
........
00101000
d
28
d
212
7 *
3
2 *
ld (nn),a
(LoaD)
ld [nn],.a
(LoaD)
[nn] << .a
........
00110010
nnl
nnh
32
nnl
nnh
3134
ld (nn),ssld [nn],ss [nn + 1] << ssh
[nn] << ssl
........
11101101
01ss0011
nnl
nnh
ED

nnl
nnh
4206
ld (nn),hlld [nn],.hl [nn + 1] << .h
[nn] << .l
........
00100010
nnl
nnh
22
nnl
nnh
3165
ld (nn),iild [nn],ii [nn + 1] << iih
[nn] << iil
........
   ii
00100010
nnl
nnh
ii
22
nnl
nnh
4206
ld (bc),ald [.bc],.a [.bc] << .a
........
00000010
02 172
ld (de),ald [.de],.a [.de] << .a
........
00010010
12 172
ld (hl),nld [.hl],n [.hl] << n
........
00110110
n
36
n
2103
ld (hl),rld [.hl],r [.hl] << r
........
01110 r
172
ld (ii+d),nld [ii+d],n [ii + d] << n
........
   ii
00110110
d
n
ii
36
d
n
4195
ld (ii+d),rld [ii+d],r [ii + d] << r
........
   ii
01110 r
d
ii

d
3195
ld a,(nn)ld .a,[nn] .a << [nn]
........
00111010
nnl
nnh
3A
nnl
nnh
3134
ld a,(bc)ld .a,[.bc] .a << [.bc]
........
00001010
0A 172
ld a,(de)ld .a,[.de] .a << [.de]
........
00011010
1A 172
ld a,ild .a,.i .a << .i
**?0I?0*
11101101
01010111
ED
57
292
ld a,rld .a,.r .a << .r
**?0I?0*
11101101
01011111
ED
5F
292
ld r,(hl)ld r,[.hl] r << [.hl]
........
01 r 110
172
ld r,(ii+d)ld r,[ii+d] r << [ii + d]
........
   ii
01 r 110
d
ii

d
3195
ld r,nld r,n r << n
........
00 r 110
n

n
272
ld u,n u << n
........
11011101
00 u 110
n
DD

n
33
ld v,n v << n
........
11111101
00 v 110
n
FD

n
33
ld i,ald .i,.a .i << .a
........
11101101
01000111
ED
47
292
ld r1,r2ld r1,r2 r1 << r2
........
01 r1 r2
141
ld u1,u2 u1 << u2
........
11011101
01 u1 u2
DD 22
ld v1,v2 v1 << v2
........
11111101
01 v1 v2
FD 22
ld ss,(nn)ld ss,[nn] ssh << [nn + 1]
ssl << [nn]
........
11101101
01ss1011
nnl
nnh
ED

nnl
nnh
4206
ld ss,nnld ss,nn ss << nn
........
00ss0001
nnl
nnh

nnl
nnh
3103
ld hl,(nn)ld .hl,[nn] .h << [nn + 1]
.l << [nn]
........
00101010
nnl
nnh
2A
nnl
nnh
3165
ld ii,(nn)ld ii,[nn] iih << [nn + 1]
iil << [nn]
........
   ii
00101010
nnl
nnh
ii
2A
nnl
nnh
4206
ld ii,nnld ii,nn ii << nn
........
   ii
00100001
nnl
nnh
ii
21
nnl
nnh
4144
ld r,ald .r,.a .r << .a
........
11101101
01001111
ED
4F
292
ld sp,hlld .sp,.hl .sp << .hl
........
11111001
F9 161
ld sp,iild .sp,ii .sp << ii
........
   ii
11111001
ii
F9
2102
ldd
(LoaD and Decrement)
move [.hl--],[.de--]
(MOVE)
[.de] << [.hl]
.de << .de - 1
.hl << .hl - 1
.bc << .bc - 1
..?0$?0.
11101101
10101000
ED
A8
2164
lddr
(LoaD, Decrement and Repeat)
movem [.hl--],[.de--]
(MOVE Multiple)