Nintendo GAME BOY Programming Manual page 112

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual
SLA
Shifts the contents of operand m to the left. That is, the contents of bit 0 are copied to bit 1 and the
previous contents of bit 1 (the contents before the copy operation) are copied to bit 2. The same
operation is repeated in sequence for the rest of the operand. The content of bit 7 is copied to CY, and
bit 0 is reset.
r and (HL) are used for operand m.
Examples: When D = 80h, (HL) = FFh, and CY = 0,
SLA D ; D ← 00h, CY ← 1, Z ← 1, H ← 0, N ← 0
SLA (HL) ; (HL) ← FEh, CY ← 1, Z ← 0, H ← 0, N ← 0
SRA
m
Shifts the contents of operand m to the right. That is, the contents of bit 7 are copied to bit 6 and the
previous contents of bit 6 (the contents before the copy operation) are copied to bit 5. The same
operation is repeated in sequence for the rest of the operand . The contents of bit 0 are copied to CY,
and the content of bit 7 is unchanged.
r and (HL) are used for operand m.
Example: When A = 8Ah, (HL) = 01h, and CY = 0,
SRA D ; A ← C5h, CY ← 0, Z ← 0, H ← 0, N ← 0
SRA (HL) ; (HL) ← 00h, CY ← 1, Z ← 1, H ← 0, N ← 0
m
7
CY
SLA
r
SLA
(HL)
m
7
SRA
r
SRA
(HL)
CY
m
0
7
m
0
0
CYCL
7 6
5 4 3
2
11
001
00
100
4
11
011
00
100
CY
m
0
0
CY
0
CYCL
7 6
5 4 3
2
11
001
00
101
4
11
001
00
101
112
H
N
Z
CYCL
7 6
0
*
--
--
2 1 0
011
r
011
110
H
N
Z
CYCL
7 6
0
*
--
--
2 1 0
011
r
011
110
5 4 3
2 1 0
--
--
5 4 3
2 1 0
--
--

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents