© 2000 Scenix Semiconductor, Inc. All rights reserved.
117
SX Users Manual Rev. 3.1
www.scenix.com
Chapter 3 Instruction Set
3.6.47 RR fr
Rotate fr Right through Carry
Operation:
fr = >> fr
Bits affected:
C
Opcode:
0011 001f ffff
Description:
This instruction rotates the bits of the specified file register right using the C bit bit.
The bits inside the register are shifted right by one bit position. C is shifted into the
most significant bit position and the least significant bit is shifted out into C, as
shown in the diagram below.
Cycles:
1
Example 1:
rr $0F
This example rotates the bits of file register 0Fh. If the register initially contains 12h
and the C bit is set to 1, after executing this instruction, the register will contain 89h
and the C bit will be cleared to 0.
Example 2:
clrb
$03.0
;clear carry bit
rr
$0F
;rotate right, reg=reg/2
clrb
$03.0
;clear carry bit
rr
$0F
;rotate right, reg=reg/2
This example divides file register 0Fh by 4. The clrb instructions ensure that 0
will be shifted into the most significant bit positions. The two rr instructions
perform two divide-by-2 operations.
Figure 3-5 Rotate fr Right Through Carry
File Register
Carry Bit