Instruction Set
4-207
ROR*
Rotate Right
ROR
What It Does
ROR shifts the bits of a component to the right, overwrites the Carry Flag (CF) with the bit
shifted out of the component, and then copies CF to the highest bit of the component.
Syntax
Description
ROR shifts the bits downward, except for the bottom bit, which becomes the top bit. ROR
also copies the bit to CF. The second operand (
count) indicates the number of rotations to
make. The operand is either an immediate number or the CL register contents. The
processor does not allow rotation counts greater than 31, using only the bottom five bits of
the operand if it is greater than 31.
Operation It Performs
* – Rotate immediates were not available on the original 8086/8088 systems.
Form
Opcode
Description
Clocks
Am186 Am188
ROR
r/m8,1
D0
/1
Rotate 8 bits of r/m byte right once
2/15
2/15
ROR
r/m8,CL
D2
/1
Rotate 8 bits of r/m byte right CL times
5+
n/17+n
5+
n/17+n
ROR
r/m8,imm8
C0
/1 ib
Rotate 8 bits of r/m byte right imm8 times
5+
n/17+n
5+
n/17+n
ROR
r/m16,1
D1
/1
Rotate 16 bits of r/m word right once
2/15
2/15
ROR
r/m16,CL
D3
/1
Rotate 16 bits of r/m word right CL times
5+
n/17+n
5+
n/17+n
ROR
r/m16,imm8
C1
/1 ib
Rotate 16 bits of r/m word right imm8 times
5+
n/17+n
5+
n/17+n
ROR
component,count
while (i =
count; i != 0; i--)
/* perform shifts */
{
/* store lowest bit in carry flag */
CF = leastSignificantBit(
component);
/* shift right and fill vacancy with bit shifted out */
component = (component >> 1) + (CF * pow(2, size(component) - 1));
}
if (
count == 1)
/* single shift */
if (leastSignificantBit(
component) != nextMostSignificantBit(component))
/* set overflow flag */
OF = 1;
else
/* clear overflow flag */
OF = 0;
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...