Nintendo GAME BOY Programming Manual page 106

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual
Examples: When A = 3Ch, B = 2Fh, and (HL) = 40h,
; Z ← 0, H ← 1, N ← 1, CY ← 0
CP B
CP 3Ch ; Z ← 1, H ← 0, N ← 1, CY ← 0
CP (HL) ; Z ← 0, H ← 0, N ← 1, CY ← 1
CY
H
INC
Increments the contents of register r by 1.
Example: When A = FFh,
INC A ; A ← 0, Z ← 1, H ← 1, N ← 0
INC
(HL)
Increments by 1 the contents of memory specified by register pair HL.
Example: When (HL) = 0x50,
INC (HL) ; (HL) ← 0x51, Z ← 0, H ← 0, N ← 0
DEC
Subtract 1 from the contents of register r by 1.
Example: When L = 01h,
DEC L ; L ← 0, Z ← 1, H ← 0, N ← 1
DEC
(HL)
Decrements by 1 the contents of memory specified by register pair HL.
Example: When (HL) = 00h,
DEC (HL) ; (HL) ← FFh, Z ← 0, H ← 1, N ← 1
CP
r
CP
n
CP
(HL)
N
Z
CYCL
r ← r + 1
r
(HL) ← (HL) + 1
r ← r - 1
r
(HL) ← (HL) - 1
CYCL
7
6
5
4
3
1
10
111
2
11
111
110
n
2
10
111
110
7 6
5 4 3
2 1 0
--
*
CY
H
--
*
CY
H
--
*
CY
H
--
*
106
2
1
0
r
0
*
1
00
N
Z
CYCL
7 6
0
*
3
00
N
Z
CYCL
7 6
1
*
1
00
N
Z
CYCL
7 6
1
*
3
00
r
100
5 4 3
2 1 0
110
100
5 4 3
2 1 0
r
101
5 4 3
2 1 0
110
101

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents