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 W R
Binary Hex.
SZ.H.PNC
76543210
adc a,(hl)
(ADd with Carry)
addc .a,[.hl]
(ADD with Carry)
.a << .a + [.hl] + C
**?*?o0*
10001110
8E 1712
adc a,(ii+s)addc .a,[ii+s] .a << .a + [ii + s] + C
**?*?o0*
   ii
10001110
s
ii
8E
s
31925
adc a,naddc .a,n .a << .a + n + C
**?*?o0*
11001110
n
CE
n
2712
adc a,raddc .a,r .a << .a + r + C
**?*?o0*
10001 r
1411
addc .a,p .a << .a + p + C
**?*?o0*
11011101
10001 p

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

FD
22
adc hl,ssaddc .hl,ss .hl << .hl + ss + C
**?*?o0*
11101101
01ss1010
ED 21522
add a,(hl)
(ADD)
add .a,[.hl]
(ADD)
.a << .a + [.hl]
**?*?o0*
10000110
86 1712
add a,(ii+s)add .a,[ii+s] .a << .a + [ii + s]
**?*?o0*
   ii
10000110
s
ii
86
s
31925
add a,nadd .a,n .a << .a + n
**?*?o0*
11000110
n
C6
n
2712
add a,radd .a,r .a << .a + r
**?*?o0*
10000 r
1411
add .a,p .a << .a + p
**?*?o0*
11011101
10000 p
DD 22
add .a,q .a << .a + q
**?*?o0*
11111101
10000 q
FD 22
add hl,ssadd .hl,ss .hl << .hl + ss
**?*?.0*
00ss1001
11111
add ii,ppadd ii,pp ii << ii + pp
**?*?.0*
   ii
00pp1001
ii 21522
and (hl)
(AND)
and .a,[.hl]
(AND)
.a << .a & [.hl]
**?1?p00
10100110
A6 1712
and (ii+s)and .a,[ii+s] .a << .a & [ii + s]
**?1?p00
   ii
10100110
s
ii
A6
s
31925
and nand .a,n .a << .a & n
**?1?p00
11100110
n
E6
n
2712
and rand .a,r .a << .a & r
**?1?p00
10100 r
1411
and .a,p .a << .a & p
**?1?p00
11011101
10100 p
DD 22
and .a,q .a << .a & q
**?1?p00
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 21223
bit b,(ii+s)bit b,[ii+s] Z << ¬ [ii + s]{b}
?*?1??0.
   ii
11001011
s
01 b 110
ii
CB
s
42035
bit b,rbit b,r Z << ¬ r{b}
?*?1??0.
11001011
01 b r
CB 2822
call nn
(CALL)
call nn
(CALL)
[.sp - 2] << .pcl
[.sp - 1] << .pch
.sp << .sp - 2
.pc << nn
........
11001101
nnl
nnh
CD
nnl
nnh
31715
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 *
15
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 *
15
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 *
15
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 *
15
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 *
15
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 *
15
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 *
15
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 *
15
3 *
ccf
(Complement Carry Flag)
notc
(NOT Carry)
C << ¬ C
..???.0*
00111111
3F 1411
cp (hl)
(ComPare)
cmp .a,[.hl]
(CoMPare)
.a - [.hl]
**?*?o1*
10111110
BE 1712
cp (ii+s)cmp .a,[ii+s] .a - [ii + s]
**?*?o1*
   ii
10111110
s
ii
BE
s
31925
cp ncmp .a,n .a - n
**?*?o1*
11111110
n
FE
n
2712
cp rcmp .a,r .a - r
**?*?o1*
10111 r
1411
cmp .a,p .a - p
**?*?o1*
11011101
10111 p
DD 22
cmp .a,q .a - q
**?*?o1*
11111101
10111 q
FD 22
cpd
(ComPare and Decrement)
cmp .a,[.hl--] .a - [.hl]
.hl << .hl - 1
.bc << .bc - 1
*%?*?$*.
11101101
10101001
ED
A9
21624
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 *
2
2 *
4
4 *
cpi
(ComPare and Increment)
cmp .a,[.hl++] .a - [.hl]
.hl << .hl + 1
.bc << .bc - 1
*%?*?$*.
11101101
10100001
ED
A1
21624
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 *
2
2 *
4
4 *
cpl
(ComPLement accumulator)
not .a
(NOT)
.a << ¬ .a
..?1?.1.
00101111
2F 1411
daa
(Decimal Adjust Accumulator)
adj .a
(ADJust)
adjust to decimal
**?*?p.*
00100111
27 1411
dec (hl)
(DECrement)
dec [.hl]
(DECrement)
[.hl] << [.hl] - 1
**?*?o0.
00110101
35 11114
dec (ii+s)dec [ii+s] [ii + s] << [ii + s] - 1
**?*?o0.
   ii
00110101
s
ii
35
s
32327
dec rdec r r << r - 1
**?*?o0.
00 r 101
1411
dec p p << p - 1
**?*?o0.
11011101
00 p 101
DD 22
dec q q << q - 1
**?*?o0.
11111101
00 q 101
FD 22
dec ssdec ss ss << ss - 1
........
00ss1011
1611
dec iidec ii ii << ii - 1
........
   ii
00101011
ii
2B
21022
di
(Disable Interruption)
di
(Disable Interruption)
IFF << 0
........
11110011
F3 1412
djnz s
(Decrement and Jump if Not Zero)
dbnz s
(Decrement and Branch if Not Zero)
.b << .b - 1
if .b not zero
    .pc << .pc + s
else
    no operation
........
00010000
s
10
s
213
8
12
2
ei
(Enable Interruption)
ei
(Enable Interruption)
IFF << 1
........
11111011
FB 1411
ex (sp),hl
(EXchange)
xch [.sp],.hl
(eXCHange)
.l <=> [.sp]
.h <=> [.sp + 1]
........
11100011
E3 11915
ex (sp),iixch [.sp],ii iil <=> [.sp]
iih <=> [.sp + 1]
........
   ii
11100011
ii
E3
22326
ex af,af'xch .af,.af' .af <=> .af'
........
00001000
08 1411
ex de,hlxch .de,.hl .de <=> .hl
........
11101011
EB 1411
exx
(EXchange with auXiliar)
xchx
(eXCHange with auXiliar)
.bc <=> .bc'
.de <=> .de'
.hl <=> .hl'
........
11011001
D9 1411
halt
(HALT)
halt
(HALT)
halt processor
........
01110110
76 1412
im 0
(Interruption Mode 0)
im 0
(Interruption Mode 0)
set interruption mode 0
........
11101101
01000110
ED
46
2823
im 1
(Interruption Mode 1)
im 1
(Interruption Mode 1)
set interruption mode 1
........
11101101
01010110
ED
56
2823
im 2
(Interruption Mode 2)
im 2
(Interruption Mode 2)
set interruption mode 2
........
11101101
01011110
ED
5E
2823
in a,(n)
(INput)
in .a,[n]
(INput)
.a << [n]
........
11011011
n
DB
n
21113
in r,(c)in r,[.c] r << [.c]
**?0?p0.
11101101
01 r 000
ED 21223
*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
**?0?p0.
11101101
01110000
ED
70
21223
inc (hl)
(INCrement)
inc [.hl]
(INCrement)
[.hl] << [.hl] + 1
**?*?o0.
00110100
34 11114
inc (ii+s)inc [ii+s] [ii + s] << [ii + s] + 1
**?*?o0.
   ii
00110100
s
ii
34
s
32327
inc rinc r r << r + 1
**?*?o0.
00 r 100
1411
inc p p << p + 1
**?*?o0.
11011101
00 p 100
DD 22
inc q q << q + 1
**?*?o0.
11111101
00 q 100
FD 22
inc ssinc ss ss << ss + 1
........
00ss0011
1611
inc iiinc ii ii << ii + 1
........
   ii
00100011
ii
23
21022
ind
(INput and Decrement)
in [.hl--],[.c]
(INput)
[.hl] << [.c]
.b << .b - 1
.hl << .hl - 1
?!????1.
11101101
10101010
ED
AA
21624
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 *
2
2 *
4
3 *
ini
(INput and Increment)
in [.hl++],[.c]
(INput)
[.hl] << [.c]
.b << .b - 1
.hl << .hl + 1
?!????1.
11101101
10100010
ED
A2
21624
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 *
2
2 *
4
3 *
jp (hl)
(JumP)
br [.hl]
(BRanch)
.pc << [.hl]
........
11101001
E9 1411
jp (ii)br [ii] .pc << [ii]
........
   ii
11101001
ii
E9
2822
jp nnbr nn .pc << nn
........
11000011
nnl
nnh
C3
nnl
nnh
31013
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
310
10 *
1
1 *
3
3 *
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
310
10 *
1
1 *
3
3 *
jp nc,nn
(JumP if Not Carry)
bnc nn
(Branch if Not Carry)
if C = 0
    .pc << nn
else
    * no operation
........
11010010
nnl
nnh
D2
nnl
nnh
310
10 *
1
1 *
3
3 *
jp nz,nn
(JumP if Not Zero)
bnz nn
(Branch if Not Zero)
if Z = 0
    .pc << nn
else
    * no operation
........
11000010
nnl
nnh
C2
nnl
nnh
310
10 *
1
1 *
3
3 *
jp p,nn
(JumP if Plus)
bp nn
(Branch if Plus)
if S = 0
    .pc << nn
else
    * no operation
........
11110010
nnl
nnh
F2
nnl
nnh
310
10 *
1
1 *
3
3 *
jp pe,nn
(JumP if Parity is Even)
bpe nn
(Branch if Parity is Even)
if P = 1
    .pc << nn
else
    * no operation
........
11101010
nnl
nnh
EA
nnl
nnh
310
10 *
1
1 *
3
3 *
jp po,nn
(JumP if Parity is Odd)
bpo nn
(Branch if Parity is Odd)
if P = 0
    .pc << nn
else
    * no operation
........
11100010
nnl
nnh
E2
nnl
nnh
310
10 *
1
1 *
3
3 *
jp z,nn
(JumP if Zero)
bz nn
(Branch if Zero)
if Z = 1
    .pc << nn
else
    * no operation
........
11001010
nnl
nnh
CA
nnl
nnh
310
10 *
1
1 *
3
3 *
jr s
(Jump Relative)
short br s
(SHORT BRanch)
.pc << .pc + s
........
00011000
s
18
s
21213
jr c,s
(Jump Relative if Carry)
short bc s
(SHORT Branch if Carry)
if C = 1
    .pc << .pc + s
else
    * no operation
........
00111000
s
38
s
212
7 *
1
1 *
3
2 *
jr nc,s
(Jump Relative if Not Carry)
short bnc s
(SHORT Branch if Not Carry)
if C = 0
    .pc << .pc + s
else
    * no operation
........
00110000
s
30
s
212
7 *
1
1 *
3
2 *
jr nz,s
(Jump Relative if Not Zero)
short bnz s
(SHORT Branch if Not Zero)
if Z = 0
    .pc << .pc + s
else
    * no operation
........
00100000
s
20
s
212
7 *
1
1 *
3
2 *
jr z,s
(Jump Relative if Zero)
short bz s
(SHORT Branch if Zero)
if Z = 1
    .pc << .pc + s
else
    * no operation
........
00101000
s
28
s
212
7 *
1
1 *
3
2 *
ld (nn),a
(LoaD)
ld [nn],.a
(LoaD)
[nn] << .a
........
00110010
nnl
nnh
32
nnl
nnh
31314
ld (nn),ssld [nn],ss [nn + 1] << ssh
[nn] << ssl
........
11101101
01ss0011
nnl
nnh
ED

nnl
nnh
42026
ld (nn),hlld [nn],.hl [nn + 1] << .h
[nn] << .l
........
00100010
nnl
nnh
22
nnl
nnh
31615
ld (nn),iild [nn],ii [nn + 1] << iih
[nn] << iil
........
   ii
00100010
nnl
nnh
ii
22
nnl
nnh
42026
ld (bc),ald [.bc],.a [.bc] << .a
........
00000010
02 1712
ld (de),ald [.de],.a [.de] << .a
........
00010010
12 1712
ld (hl),nld [.hl],n [.hl] << n
........
00110110
n
36
n
21013
ld (hl),rld [.hl],r [.hl] << r
........
01110 r
1712
ld (ii+s),nld [ii+s],n [ii + s] << n
........
   ii
00110110
s
n
ii
36
s
n
41925
ld (ii+s),rld [ii+s],r [ii + s] << r
........
   ii
01110 r
s
ii

s
31925
ld a,(nn)ld .a,[nn] .a << [nn]
........
00111010
nnl
nnh
3A
nnl
nnh
31314
ld a,(bc)ld .a,[.bc] .a << [.bc]
........
00001010
0A 1712
ld a,(de)ld .a,[.de] .a << [.de]
........
00011010
1A 1712
ld a,ild .a,.i .a << .i
**?0?I0*
11101101
01010111
ED
57
2922
ld a,rld .a,.r .a << .r
**?0?I0*
11101101
01011111
ED
5F
2922
ld r,(hl)ld r,[.hl] r << [.hl]
........
01 r 110
1712
ld r,(ii+s)ld r,[ii+s] r << [ii + s]
........
   ii
01 r 110
s
ii

s
31925
ld r,nld r,n r << n
........
00 r 110
n

n
2712
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 r1,r2ld r1,r2 r1 << r2
........
01 r1 r2
1411
ld u1,u2 u1 << u2
........
11011101
01 u1 u2
DD 22
ld v1,v2 v1 << v2
........
11111101
01 v1 v2
FD 22
ld i,ald .i,.a .i << .a
........
11101101
01000111
ED
47
2922
ld r,ald .r,.a .r << .a
........
11101101
01001111
ED
4F
2922
ld ss,(nn)ld ss,[nn] ssh << [nn + 1]
ssl << [nn]
........
11101101
01ss1011
nnl
nnh
ED

nnl
nnh
42026
ld hl,(nn)ld .hl,[nn] .h << [nn + 1]
.l << [nn]
........
00101010
nnl
nnh
2A
nnl
nnh
31615
ld ii,(nn)ld ii,[nn] iih << [nn + 1]
iil << [nn]
........
   ii
00101010
nnl
nnh
ii
2A
nnl
nnh
42026
ld ss,nnld ss,nn ss << nn
........
00ss0001
nnl
nnh

nnl
nnh
31013
ld ii,nnld ii,nn ii << nn
........
   ii
00100001
nnl
nnh
ii
21
nnl
nnh
41424
ld sp,hlld .sp,.hl .sp << .hl
........
11111001
F9 1611
ld sp,iild .sp,ii .sp << ii
........
   ii
11111001
ii
F9
21022
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
21624
lddr
(LoaD, Decrement and Repeat)
movem [.hl--],[.de--]
(MOVE Multiple)

repeat

    [.de] << [.hl]
    .de << .de - 1
    .hl << .hl - 1
    .bc << .bc - 1
until
    .bc = 0

* note: the 1st execution time is for each loop and the 2nd to the final loop
..?0?00.
11101101
10111000
ED
B8
221
16 *
2
2 *
4
4 *
ldi
(LoaD and Increment)
move [.hl++],[.de++] [.de] << [.hl]
.de << .de + 1
.hl << .hl + 1
.bc << .bc - 1
..?0?$0.
11101101
10100000
ED
A0
21624
ldir
(LoaD, Increment and Repeat)
movem [.hl++],[.de++]

repeat

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

* note: the 1st execution time is for each loop and the 2nd to the final loop
..?0?00.
11101101
10110000
ED
B0
221
16 *
2
2 *
4
4 *
mulub .a,r
(MULtiply Unsigned Byte)

.hl << .a * r

* note: using registers .a, .h or .l for r may generate strange results
0*?.?0.*
11101101
11 r 001
ED 214
muluw .hl,ss
(MULtiply Unsigned Word)

.de:.hl<<.hl*ss

* note: using registers .de or .hl for ss may generate strange results
0*?.?0.*
11101101
11ss0011
ED 236
neg
(NEGative)
neg .a
(NEGative)
.a << (¬.a) + 1
**?*?o1*
11101101
01000100
ED
44
2822
nop
(No Operation)
nop
(No Operation)
no operation
........
00000000
00 1411
or (hl)
(OR)
or .a,[.hl]
(OR)
.a << .a # [.hl]
**?1?p00
10110110
B6 1712
or (ii+s)or .a,[ii+s] .a << .a # [ii + s]
**?1?p00
   ii
10110110
s
ii
B6
s
31925
or nor .a,n .a << .a # n
**?1?p00
11110110
n
F6
n
2712
or ror .a,r .a << .a # r
**?1?p00
10110 r
1411
or .a,p .a << .a # p
**?1?p00
11011101
10110 p
DD 22
or .a,q .a << .a # q
**?1?p00
11111101
10110 q
FD 22
otdr
(OuTput, Decrement and Repeat)
outm [.c],[.hl--]
(OUTput Multiple)
repeat
    [.c] << [.hl]
    .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
10111011
ED
BB
221
16 *
2
2 *
4
3 *
otir
(OuTput, Increment and Repeat)
outm [.c],[.hl++]
(OUTput Multiple)
repeat
    [.c] << [.hl]
    .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
10110011
ED
B3
221
16 *
2
2 *
4
3 *
out (n),a
(OUTput)
out [n],.a
(OUTput)
[n] << .a
........
11010011
n
D3
n
21113
out (c),rout [.c],r [.c] << .a
........
11101101
01 r 001
ED 21223
outd
(OUTput and Decrement)
out [.c],[.hl--]
(OUTput)
[.c] << [.hl]
.b << .b - 1
.hl << .hl - 1
?!????1.
11101101
10101011
ED
AB
21624
outi
(OUTput and Increment)
out [.c],[.hl++]
(OUTput)
[.c] << [.hl]
.b << .b - 1
.hl << .hl + 1
?!????1.
11101101
10100011
ED
A3
21624
pop rr
(POP)
pop rr
(POP)
rrl << [.sp]
rrh << [.sp + 1]
.sp << .sp + 2
........
11rr0001
11013
pop iipop ii iil << [.sp]
iih << [.sp + 1]
.sp << .sp + 2
........
   ii
11100001
ii
E1
21424
push rr
(PUSH)
push rr
(PUSH)
[.sp - 2] << rrl
[.sp - 1] << rrh
.sp << .sp - 2
........
11rr0101
11114
push iipush ii [.sp - 2] << iil
[.sp - 1] << iih
.sp << .sp - 2
........
   ii
11100101
ii
E5
21525
res b,(hl)
(RESet bit)
clr b,[.hl]
(CLeaR bit)
[.hl]{b} << 0
?*?1??0.
11001011
10 b 110
CB 21525
res b,(ii+s)clr b,[ii+s] [ii + s]{b} << 0
?*?1??0.
   ii
11001011
s
10 b 110
ii
CB
s
42337
res b,rclr b,r r{b} << 0
?*?1??0.
11001011
10 b r
CB 2822
ret
(RETurn)
ret
(RETurn)
.pcl << [.sp]
.pch << [.sp + 1]
.sp << .sp + 2
........
11001001
C9 11013
ret c
(RETurn if Carry)
ret c
(RETurn if Carry)
if C = 1
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11011000
D8 111
5 *
1
1 *
3
1 *
ret m
(RETurn if Minus)
ret m
(RETurn if Minus)
if S = 1
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11111000
F8 111
5 *
1
1 *
3
1 *
ret nc
(RETurn if Not Carry)
ret nc
(RETurn if Not Carry)
if C = 0
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11010000
D0 111
5 *
1
1 *
3 *
1
ret nz
(RETurn if Not Zero)
ret nz
(RETurn if Not Zero)
if Z = 0
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11000000
C0 111
5 *
1
1 *
3
1 *
ret p
(RETurn if Plus)
ret p
(RETurn if Plus)
if S = 0
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11110000
F0 111
5 *
1
1 *
3
1 *
ret pe
(RETurn if Parity is Even)
ret pe
(RETurn if Parity is Even)
if P = 1
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11101000
E8 111
5 *
1
1 *
3
1 *
ret po
(RETurn if Parity is Odd)
ret po
(RETurn if Parity is Odd)
if P = 0
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11100000
E0 111
5 *
1
1 *
3
1 *
ret z
(RETurn if Zero)
ret z
(RETurn if Zero)
if Z = 1
    .pcl << [.sp]
    .pch << [.sp + 1]
    .sp << .sp + 2
else
    * no operation
........
11001000
C8 111
5 *
1
1 *
3
1 *
reti
(RETurn from Interruption)
reti
(RETurn from Interruption)

.pcl << [.sp]
.pch << [.sp + 1]
.sp << .sp + 2

* note: interruptions are not enabled by this instruction
........
11101101
01001101
ED
4D
21425
retn
(RETurn from Non-maskable interruption)
retn
(RETurn from Non-maskable interruption)

.pcl << [.sp]
.pch << [.sp + 1]
.sp << .sp + 2

* note: non-maskable interruptions are enabled by this instruction
........
11101101
01000101
ED
45
21425
rl (hl)
(Rotate Left through carry)
rolc [.hl]
(ROtate Left through Carry)

tmp << C
C << [.hl]{7}
[.hl] << [.hl] * 2
[.hl]{0} << tmp

+--> Carry >---+
|              |
+-<[|||||||]<--+
  {7}[.hl]{0}
**?0?p0*
11001011
00010110
CB
16
21525
rl (ii+s)rolc [ii+s]

tmp << C
C << [ii + s]{7}
[ii + s] << [ii + s] * 2
[ii + s]{0} << tmp

+--> Carry >---+
|              |
+-<[|||||||]<--+
 {7}[ii+s]{0}
**?0?p0*
   ii
11001011
s
00010110
ii
CB
s
16
42337
rl rrolc r

tmp << C
C << r{7}
r << r * 2
r{0} << tmp

+--> Carry >---+
|              |
+-<[|||||||]<--+
  {7}  r  {0}
**?0?p0*
11001011
00010 r
CB 2822
rla
(Rotate Left through carry Accumulator)
rolca
(ROtate Left through Carry Accumulator)

tmp << C
C << .a{7}
.a << .a * 2
.a{0} << tmp

+--> Carry >---+
|              |
+-<[|||||||]<--+
  {7} .a  {0}
..?0?.0*
00010111
17 1411
rlc (hl)
(Rotate Left with branch Carry)

rol [.hl]
(ROtate Left)

C << [.hl]{7}
[.hl] << [.hl] * 2
[.hl]{0} << C

+--> Carry
|
+------>-------+
|              |
+-<[|||||||]<--+
  {7}[.hl]{0}
**?0?p0*
11001011
00000110
CB
06
21525
rlc (ii+s)rol [ii+s]

C << [ii + s]{7}
[ii + s] << [ii + s] * 2
[ii + s]{0} << C

+--> Carry
|
+------>-------+
|              |
+-<[|||||||]<--+
  {7}[ii+s]{0}
**?0?p0*
   ii
11001011
s
00000110
ii
CB
s
06
42337
rlc rrol r

C << r{7}
r << r * 2
r{0} << C

+--> Carry
|
+------>-------+
|              |
+-<[|||||||]<--+
  {7}  r  {0}
**?0?p0*
11001011
00000 r
CB 2822
rlca
(Rotate Left with branch Carry Accumulator)
rola
(ROtate Left Accumulator)

C << .a{7}
.a << .a * 2
.a{0} << C

+--> Carry
|
+------>-------+
|              |
+-<[|||||||]<--+
  {7} .a  {0}
..?0?.0*
00000111
07 1411
rld
(Rotate Left Decimal)
rol4 [.hl]
(ROtate Left 4 bits)

tmp << .a{0..3}
.a{0..3} << [.hl]{4..7}
[.hl]{4..7} << [.hl]{0..3}
[.hl]{0..3} << tmp

[7..4|3..0]>---+
    .a  ^      |
        |      v
+--->---+      |
|              |
+-[7..4|3..0]<-+
     [.hl]
..?0?.0*
11101101
01101111
ED
6F
21825
rr (hl)
(Rotate Right through carry)
rorc [.hl]
(ROtate Right through Carry)

tmp << C
C << [.hl]{0}
[.hl] << [.hl] / 2
[.hl]{7} << tmp

+--< Carry <---+
|              |
+->[|||||||]>--+
  {7}[.hl]{0}
**?0?p0*
11001011
00011110
CB
1E
21525
rr (ii+s)rorc [ii+s]

tmp << C
C << [ii + s]{0}
[ii + s] << [ii + s] / 2
[ii + s]{7} << tmp

+--< Carry <---+
|              |
+->[|||||||]>--+
 {7}[ii+s]{0}
**?0?p0*
   ii
11001011
s
00011110
ii
CB
s
1E
42337
rr rrorc r

tmp << C
C << r{0}
r << r / 2
r{7} << tmp

+--< Carry <---+
|              |
+->[|||||||]>--+
  {7}  r  {0}
**?0?p0*
11001011
00011 r
CB 2822
rra
(Rotate Right through carry Accumulator)
rorca
(ROtate Right through Carry Accumulator)

tmp << C
C << .a{7}
.a << .a * 2
.a{0} << tmp

+--< Carry <---+
|              |
+->[|||||||]>--+
  {7} .a  {0}
..?0?.0*
00011111
1F 1411
rrc (hl)
(Rotate Right with branch Carry)
ror [.hl]
(ROtate Right)

C << [.hl]{0}
[.hl] << [.hl] / 2
[.hl]{7} << C

     Carry <---+
               |
+------<-------+
|              |
+->[|||||||]>--+
  {7}[.hl]{0}
**?0?p0*
11001011
00001110
CB
0E
21525
rrc (ii+s)ror [ii+s]

C << [ii + s]{0}
[ii + s] << [ii + s] / 2
[ii + s]{7} << C

     Carry <---+
               |
+------<-------+
|              |
+->[|||||||]>--+
 {7}[ii+s]{0}
**?0?p0*
   ii
11001011
s
00001110
ii
CB
s
0E
42337
rrc rror r

C << r{0}
r << r / 2
r{7} << C

     Carry <---+
               |
+------<-------+
|              |
+->[|||||||]>--+
  {7}  r  {0}
**?0?p0*
11001011
00001 r
CB 2822
rrca
(Rotate Right with branch Carry Accumulator)
rora
(ROtate Right Accumulator)

C << .a{0}
.a << .a / 2
.a{7} << C

     Carry <---+
               |
+------<-------+
|              |
+->[|||||||]>--+
  {7} .a  {0}
..?0?.0*
00001111
0F 1411
rrd
(Rotate Right Decimal)
rol4 [.hl]
(ROtate Right 4 bits)

tmp << .a{0..3}
.a{0..3} << [.hl]{0..3}
[.hl]{0..3} << [.hl]{4..7}
[.hl]{4..7} << tmp

[7..4|3..0]<---+
    .a  v      |
        |      ^
+---<---+      |
|              |
+->[7..4|3..0]-+
      [.hl]
..?0?.0*
11101101
01100111
ED
67
21825
rst k
(ReSeT)
brk k
(BReaK)
[.sp - 2] << .pcl
[.sp - 1] << .pch
.sp << .sp - 2
.pcl << k
.pch << 0
........
11 k 111
11114
sbc a,(hl)
(SuBtract with Carry)
subc .a,[.hl]
(SUBtract with Carry)
.a << .a - [.hl] - C
**?*?o0*
10011110
9E 1712
sbc a,(ii+s)subc .a,[ii+s] .a << .a - [ii + s] - C
**?*?o0*
   ii
10011110
s
ii
9E
s
31925
sbc a,nsubc .a,n .a << .a - n - C
**?*?o0*
11011110
n
DE
n
2712
sbc a,rsubc .a,r .a << .a - r - C
**?*?o0*
10011 r
1411
subc .a,p .a << .a - p - C
**?*?o0*
11011101
10011 p
DD 22
subc .a,q .a << .a - q - C
**?*?o0*
11111101
10011 q
FD 22
sbc hl,sssubc .hl,ss .hl << .hl - ss - C
**?*?o0*
11101101
01ss0010
ED 21522
scf
(Set Carry Flag)
setc
(SET Carry)
C << 1
..?0?.01
00110111
37 1411
set b,(hl)
(SET bit)
set b,[.hl]
(SET bit)
[.hl]{b} << 1
?*?1??0.
11001011
11 b 110
CB 21525
set b,(ii+s)set b,[ii+s] [ii + s]{b} << 1
?*?1??0.
   ii
11001011
s
11 b 110
ii
CB
s
42337
set b,rset b,r r{b} << 1
?*?1??0.
11001011
11 b r
CB 2822
sla (hl)
(Shift Left And clear least significant bit)
shl [.hl]
shla [.hl]
(SHift Left [And clear least significant bit])

C << [.hl]{7}
[.hl] << [.hl] * 2

+---> Carry
|
+--<[|||||||]<-0
   {7}[.hl]{0}
**?*?o0*
11001011
00100110
CB
26
21525
sla (ii+s)shl [ii+s]
shla [ii+s]

C << [ii + s]{7}
[ii + s] << [ii + s] * 2

+---> Carry
|
+--<[|||||||]<-0
  {7}[ii+s]{0}
**?*?o0*
   ii
11001011
s
00100110
ii
CB
s
26
42337
sla rshl r
shla r

C << r{7}
r << r * 2

+---> Carry
|
+--<[|||||||]<-0
   {7}  r  {0}
**?*?o0*
11001011
00100 r
CB 2822
sra (hl)
(Shift Right And preserv most significant bit)
shra [.hl]
(SHift Right And preserv most significant bit)

tmp << [.hl]{7}
C << [.hl]{0}
[.hl] << [.hl] / 2
[.hl]{7} << tmp

{7}
+--+
|  |  Carry <--+
|  ^           |
+->[|||||||]>--+
  {7}[.hl]{0}
**?*?o0*
11001011
00101110
CB
2E
21525
sra (ii+s)shra [ii+s]

tmp << [ii + s]{7}
C << [ii + s]{0}
[ii + s] << [ii + s] * 2
[ii + s]{7} << tmp

{7}
+--+
|  |  Carry <--+
|  ^           |
+->[|||||||]>--+
 {7}[ii+s]{0}
**?*?o0*
   ii
11001011
s
00101110
ii
CB
s
2E
42337
sra rshra r

tmp << r{7}
C << r{0}
r << r / 2
r{7} << tmp

{7}
+--+
|  |  Carry <--+
|  ^           |
+->[|||||||]>--+
  {7}  r  {0}
**?*?o0*
11001011
00101 r
CB 2822
srl (hl)
(Shift Right and cLear most significant bit)
shr [.hl]
(SHift Right)

C << [.hl]{0}
[.hl] << [.hl] / 2

{7}
+--+
|  |  Carry <--+
|  ^           |
+->[|||||||]>--+
  {7}[.hl]{0}
**?*?o0*
11001011
00111110
CB
3E
21525
srl (ii+s)shr [ii+s]

C << [ii + s]{0}
[ii + s] << [ii + s] / 2

     Carry <---+
               |
0->[|||||||]>--+
 {7}[ii+s]{0}
**?*?o0*
   ii
11001011
s
00111110
ii
CB
s
3E
42337
srl rshr r

C << r{0}
r << r / 2

     Carry <---+
               |
0->[|||||||]>--+
  {7}  r  {0}
**?*?o0*
11001011
00111 r
CB 2822
sub (hl)
(SUBtract)
sub .a,[.hl]
(SUBtract)
.a << .a - [.hl]
**?*?o0*
10010110
96 1712
sub (ii+s)sub .a,[ii+s] .a << .a - [ii + s]
**?*?o0*
   ii
10010110
s
ii
96
s
31925
sub nsub .a,n .a << .a - n
**?*?o0*
11010110
n
D6
n
2712
sub rsub .a,r .a << .a - r
**?*?o0*
10010 r
1411
sub .a,p .a << .a - p
**?*?o0*
11011101
10010 p
DD 22
sub .a,q .a << .a - q
**?*?o0*
11111101
10010 q
FD 22
xor (hl)
(eXclusive OR)
xor .a,[.hl]
(eXclusive OR)
.a << .a ^ [.hl]
**?1?p00
10101110
AE 1712
xor (ii+s)xor .a,[ii+s] .a << .a ^ [ii + s]
**?1?p00
   ii
10101110
s
ii
AE
s
31925
xor nxor .a,n .a << .a ^ n
**?1?p00
11101110
n
EE
n
2712
xor rxor .a,r .a << .a ^ r
**?1?p00
10101 r
1411
xor .a,p .a << .a ^ p
**?1?p00
11011101
10101 p
DD 22
xor .a,q .a << .a ^ q
**?1?p00
11111101
10101 q
FD 22

[MSX Page] [Cyberknight Home Page]