
Instruction Set
4-189
RCR*
Rotate through Carry Right
RCR
What It Does
RCR shifts the bits of a component to the right, copies the Carry Flag (CF) to the highest
bit of the component, and then overwrites CF with the bit shifted out of the component.
S yntax
Desc ription
RCR shifts CF into the top bit and shifts the bottom bit into CF. The second operand (count)
indicates the number of rotations. The operand is either an immediate number or the CL
register contents. The microcontroller does not allow rotation counts greater than 31. If the
count is greater than 31, only the bottom 5 bits of the operand are rotated.
Operation It Performs
* – Rotate immediates were not available on the original 8086/8088 systems.
Form
Opcode
Description
Clocks
Am186 Am188
RCR r/m81
D0 /3
Rotate 9 bits of CF and r/m byte right once
2/15
2/15
RCR r/m8CL
D2 /3
Rotate 9 bits of CF and r/m byte right CL times
5+n17+n
5+n17+n
RCR r/m8,imm8
C0 /3 ib
Rotate 9 bits of CF and r/m byte right imm8 times
5+n17+n
5+n17+n
RCR r/m161
D1 /3
Rotate 17 bits of CF and r/m word right once
2/15
2/15
RCR r/m16CL
D3 /3
Rotate 17 bits of CF and r/m word right CL times
5+n17+n
5+n17+n
RCR r/m16,imm8
C1 /3ib
Rotate 17 bits of CF and r/m word right imm8 times
5+n17+n
5+n17+n
RCR component,count
while (i = count; i != 0; i--)
/* perform shifts */
{
/* save lowest bit */
temp = leastSignificantBit(component);
/* shift right and fill vacancy with carry flag */
component = (component >> 1) + (CF * pow(2, size(component) - 1));
/* replace carry flag with saved bit */
CF = temp;
}
if (count == 1)
/* single shift */
if (mostSignificantBit(component) != nextMostSignificantBit(component))
/* set overflow flag */
OF = 1;
else
/* clear overflow flag */
OF = 0;