SX Users Manual Rev. 3.1
116
© 2000 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com
Chapter 3 Instruction Set
3.6.46 RL fr
Rotate fr Left through Carry
Operation:
fr = << fr
Bits affected:
C
Opcode:
0011 011f ffff
Description:
This instruction rotates the bits of the specified file register left using the C bit. The
bits inside the register are shifted left by one bit position. C is shifted into the least
significant bit position and the most significant bit is shifted out into C, as shown in
the diagram below.
Cycles:
1
Example 1:
rl $18
This example rotates the bits of file register 18h. If the register initially contains 14h
and the C bit is set to 1, after executing this instruction, the register will contain 29h
and the C bit will be cleared to 0.
Example 2:
clrb
$03.0
;clear carry bit
rl
$18
;rotate left, reg=reg*2
rl
$18
;rotate left, reg=reg*2
This example multiplies file register 18h by 4. The initial clrb instruction clears
the C bit, which ensures that 0 will be shifted into the least significant bit position.
The two rl instructions perform two successive multiply-by-2 operations.
Figure 3-4 Rotate fr Left Through Carry
File Register
Carry Bit