Rotate Shift Instructions - Nintendo GAME BOY Programming Manual

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

2.5 Rotate Shift Instructions

RLCA
Rotates the contents of register A 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
register. The contents of bit 7 are placed in both CY and bit 0 of register A..
Example: When A = 85h and CY = 0,
RLCA ; A ← 0Ah, CY ← 1, Z ← 0, H ← 0, N ← 0
RLA
Rotates the contents of register A to the left.
Example: When A = 95h and CY = 1,
RLA ; A ← 2Bh, C ← 1, Z ← 0, H ← 0, N ← 0
RRCA
Rotates the contents of register A to the right.
Example: When A = 3Bh and CY = 0,
RRCA ; A ← 9Dh, CY ← 1, Z ← 0, H ← 0, N ← 0
RRA
Rotates the contents of register A to the right.
Example: When A = 81h and CY = 0,
RRA ; A ← 40h, CY ← 1, Z ← 0, H ← 0, N ← 0
A
7
CY
A
7
CY
A
CY
7
0
A
CY
7
0
109
Chapter 4: CPU Instruction Set
CY
H
N
A
0
0
0
7
0
CY
H
N
A
0
0
0
7
0
CY
H
N
A
0
0
0
0
CY
H
N
A
0
0
0
0
Z
CYCL
7 6
5 4 3
1
00
000
Z
CYCL
7 6
5 4 3
1
00
010
Z
CYCL
7 6
5 4 3
1
00
001
Z
CYCL
7 6
5 4 3
1
00
011
2 1 0
111
2 1 0
111
2 1 0
111
2 1 0
111

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents