
Instruction Set
4-205
ROL*
Rotate Left
ROL
What It Does
ROL shifts the bits of a component to the left, overwrites the Carry Flag (CF) with the bit
shifted out of the component, and then copies CF to the lowest bit of the component.
Syntax
Description
ROL shifts the bits upward, except for the top bit, which becomes the bottom bit; ROL also
copies the bit to 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
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
ROL
r/m8,1
D0
/0
Rotate 8 bits of r/m byte left once
2/15
2/15
ROL
r/m8,CL
D2
/0
Rotate 8 bits of r/m byte left CL times
5+
n/17+n
5+
n/17+n
ROL
r/m8,imm8
C0
/0 ib
Rotate 8 bits of r/m byte left imm8 times
5+
n/17+n
5+
n/17+n
ROL
r/m16,1
D1
/0
Rotate 16 bits of r/m word left once
2/15
2/15
ROL
r/m16,CL
D3
/0
Rotate 16 bits of r/m word left CL times
5+
n/17+n
5+
n/17+n
ROL
r/m16,imm8
C1
/0 ib
Rotate 16 bits of r/m word left imm8 times
5+
n/17+n
5+
n/17+n
ROL
component,count
while (i =
count; i != 0; i--)
/* perform shifts */
{
/* store highest bit in carry flag */
CF = mostSignificantBit(
component);
/* shift left and fill vacancy with bit shifted out */
component = (component << 1) + CF;
}
if (
count == 1)
/* single shift */
if (mostSignificantBit(
component) != CF)
/* 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...