Bit Operations - Nintendo GAME BOY Programming Manual

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual

2.6 Bit Operations

BIT
b,
Copies the complement of the contents of the specified bit in register r to the Z flag of the program status
word (PSW).
The codes for b and r are as follows.
Bit
0
1
2
3
4
5
6
7
Examples: When A = 80h and L = EFh
BIT 7, A ; Z ← 0, H ← 1, N ← 0
BIT 4, L ; Z ← 1, H ← 1, N ← 0
BIT
b,
Copies the complement of the contents of the specified bit in memory specified by the contents of
register pair HL to the Z flag of the program status word (PSW).
Examples: When (HL) = FEh,
BIT 0, (HL) ; Z ← 1, H ← 1, N ← 0
BIT 1, (HL) ; Z ← 0, H ← 1, N ← 0
Z ←
r
rb
b
000
001
010
011
100
101
110
111
Z ← (HL)
(HL)
b
CY
H
--
1
Register
r
A
111
B
000
C
001
D
010
E
011
H
100
L
101
CY
H
--
1
114
N
Z
CYCL
7 6
0
2
11
rb
01
N
Z
CYCL
7 6
5 4 3
0
(
)
3
11
HL
b
01
5 4 3
2 1 0
001
011
b
r
2 1 0
001
011
b
110

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents