BASIC INSTRUCTION SET
1
1
1
o 1
1
l'
1
1
o 1
o 1
1
1
o 1
1
1
1 1
1 1
o I o I
o I
0
BEFORE
RDR
[I
o I 1 I I 0 1 I
1111010rrG
1
1 1
I
o I o I
1
o I
1
I
AFTER
RDR
BY
1
BIT
rl1
o 1
l'
o 1
111101°'TD
1
I
1
o 1
o 1
1 1
1
o 1
1
1
AFTER
RCR
BY
8
BITS_
OPERAND
CF
ROR
shifts
the
bits
In
the
memory
or
register
operand
to
the
right
by
the
specified
number
of
bit
positions.
It
caples
each
bit
shifted
out
of
the
right
of
the
operand
Into the
left
of
the
operand. The
last
bit
shifted
Into
the
most
significant
bit
of
the
operand also
appears
In
CF. This instruction also operates
on
byte operands.
G30108
Figure 3-10.
ROR
Example:
ROR
WORDOPRND,
CL.
Rotates
the
contents
of
the
memory word
labeled
WORDOPRND
by
the number of bits specified by the value contained in CL.
CF
reflects
the value of the last bit rotated from the right to the left side of the operand.
RCL
(Rotate Through Carry Left) rotates bits in the byte or word destination operand left by one or
by the number of bits specified in the count operand (an immediate value or the value contained in
CL).
This instruction differs from
ROL
in that it treats
CF
as
a high-order I-bit extension of the destination
operand. Each high-order bit
that
exits from the left side of the operand moves to CF before
it
returns
to the operand
as
the low-order bit
on
the next rotation cycle. See figure 3-11.
Example:
RCL
BX,l. Rotates the contents of BX left by one bit. The high-order bit of the operand
moves
to
CF, the remaining
15
bits move left one position, and the original value of CF
becomes the
new
low-order bit.
RCR
(Rotate Through Carry Right) rotates bits in the byte
or
word destination operand right by one
or by the number of bits specified in the count operand (an immediate value or the value contained in
CL).
This instruction differs from
ROR
in that it treats CF
as
a low-order I-bit extension of the destination
operand. Each low-order bit that exits from the right side of the operand moves to
CF
before
it
returns
to the operand
as
the high-order bit
on
the next rotation cycle. See figure 3-12.
Example:
RCR
BYTEOPRND,3. Rotates the contents of the memory byte labeled BYTEOPRND
to the right by 3 bits. Following the execution of this instruction, CF reflects the original
value of bit number 5 of BYTEOPRND, and the original value of CF becomes bit
2.
3-14