Nintendo GAME BOY Programming Manual page 103

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Examples: When A = E1h, E = 0Fh, (HL) = 1Eh, and CY = 1,
ADC A, E ; A ← F1h, Z ← 0, H ← 1, CY ← 0
ADC A, 3Bh ; A ← 1Dh, Z ← 0, H ← 0, CY ← -1
ADC A, (HL) ; A ← 00h, Z ← 1, H ← 1, CY ← 1
SUB
Subtracts the contents of operand s from the contents of register A and stores the results in register A.
r, n, and (HL) are used for operand s.
Flag
Z: Set if result is 0; otherwise reset.
H: Set if there is a borrow from bit 4; otherwise reset.
N: Set
CY: Set if there is a borrow; otherwise reset.
Examples: When A = 3Eh, E = 3Eh, and (HL) = 40h,
SUB E
SUB 0Fh ;
SUB (HL) ;
SBC
A,
Subtracts the contents of operand s and CY from the contents of register A and stores the results in
register A.
r, n, and (HL) are used for operand s.
ADC
A,
r
ADC
A,
n
ADC
A,
(HL)
A ← A-s
s
SUB
r
SUB
n
SUB
(HL)
A ← 00h, Z ← 1, H ← 0, N ← 1 CY ← 0
;
A ← 2Fh, Z ← 0, H ← 1, N ← 1 CY← 0
A ← FEh, Z ← 0, H ← 0, N ← 1 CY ← 1
A ← A-s-CY
s
CYCL
7
6
5
4 3
2
1
10
001
2
11
001
110
n
2
10
001
110
CY
H
*
*
1
CYCL
7 6
5
4
3
2
1
10
010
2
11
010
110
n
10
010
110
2
CY
H
*
*
1
103
Chapter 4: CPU Instruction Set
1
0
r
N
Z
CYCL
7 6
5 4 3
*
--
--
1
0
r
N
Z
CYCL
7 6
5 4 3
*
--
--
2 1 0
--
--
2 1 0
--
--

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents