RLD ACTION
7
4
3
A UNCHANGED
RRD ACTION
7
4
3
A UNCHANGED
4 BITS
0 7 4-T-1 0
MEMORY OPERAND
_j
L-4-i
4BITS 4BITS
4 BITS
0
7
4
3
0
I MEMORY OPERAND
4 B ITS 4 B ITS
Fig. 5-16 . RLD and RRD instructions.
RLCA, RLA, RRCA, and RRA rotate the A register only. The first
letter of the mnemonic stands for Rotate, the last Accumulator, and
the second the direction of the rotate, left or right. RLCA rotates
left with the most significant bit going into the carry (CY) and the
least significant bit position. RRCA performs a similar operation
with a right shift. RLA and RRA perform a nine-bit shift with the
previous contents of the carry shifting into the A register and the
bit shifted out from the A register going into the carry. All four
shifts are shown in Fig. 5-15.
Two shifts of this group RLD and RRD operate on the contents
of a memory location, addressed by register indirect addressing HL,
and the A register, and shifts four bits at a time. These two shifts
are implemented to facilitate bcd operations, where each bcd digit
is made up of four bits. If the reader considers bits 7-4 of the A
register or memory location bed digit position 0 and bits 3-0 bed
digit position 1, then these shifts are somewhat easier to follow.
RLD shifts the memory operandBCDI into memory operand BCDO and
memory operandBCno into ABCDI. The previous contents of memory
operandBCI)l are replaced by ABCDI as shown in Fig. 5-16. Instruc-
SRA S
OPERAND
SLA S
SRL M
SHIFT LEFT ONE I•--0 OPERAND
7
0
O IL SH ir'i R IGHT ONE ^cY
Fig. 5-17 . SRA, SLA, SRL instructions.
80
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers