Nintendo GAME BOY Programming Manual page 113

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

SRL
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 bit 7 is reset.
r and (HL) are used for operand m.
Examples: When A = 01h, (HL) = FFh, CY + 0,
SRL A ; A ← 00h, CY ← 1, Z ← 1, H ← 0, N ← 0
SRL (HL) ; (HL) ← 7Fh, CY ← 1, Z ← 0, H ← 0, N ← 0
SWAP
Shifts the contents of the lower-order 4 bits (0-3) of operand m unmodified to the higher-order 4 bits (4-7)
of that operand and shifts the contents of the higher-order 4 bits to the lower-order 4 bits.
r and (HL) are used for operand m.
Examples: When A = 00h and (HL) = F0h,
SWAP A ; A ← 00h, Z ← 1, H ← 0, N ← 0, CY ← 0
SWAP (HL) ; (HL) ← 0Fh, Z ← 0, H ← 0, N ← 0, CY ← 0
m
0
7
SRL
r
SRL
(HL)
m
7
SWAP
r
SWAP
(HL)
m
m
CY
0
 5 4 3
CYCL
7 6
2
11
001
00
111
4
11
001
00
111
0
4
3
0
 5 4 3
CYCL
7 6
2
11
001
00
110
4
11
001
00
110
113
Chapter 4: CPU Instruction Set
CY
H
N
Z
CYCL
0
0
*
--
0
 2 1 0
011
r
011
110
CY
H
N
Z
CYCL
0
0
*
--
 2 1 0
011
r
011
110
7 6
5 4 3
2 1 0
--
--
--
7 6
5 4 3
2 1 0
--
--
--

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents