RLC

From Intellivision Wiki
Revision as of 23:30, 14 January 2005 by Arnauld (talk | contribs)
Jump to: navigation, search
Instruction NameRotate Left Through Carry
MnemonicRLC
CP1610 Clock Cycles6 or 8
InterruptibleNo
Opcode Range$0050-$0057
Input FlagsOverflow Flag, Carry Flag
Output FlagsSign Flag, Zero Flag, Overflow Flag, Carry Flag

The Rotate Left Through Carry (RLC) instruction rotates the bits in the specified register by one or two bits. For a single rotate, the Carry Flag is set to the value of bit 15, the value is shifted to the left by one bit, and bit 0 becomes the previous value of the Carry Flag. For a double rotate, the Carry Flag is set to the value of bit 15, the Overflow Flag is set to the value of bit 14, the value is shifted to the left by two bits, bit 1 becomes the previous value of the Carry Flag, and bit 0 becomes the previous value of the Overflow Flag. The resulting value is stored back to the specified register, and the Sign Flag and Zero Flag are set or cleared according to the new value in the register. The number of clock cycles used depends on the number of shifts specified. A single rotate will use 6 clock cycles and a double rotate will use 8 clock cycles. The opcode format is as follows.

   0000:0000:0101:1srr
where: s indicates the number of places to rotate such that: s == 0 indicates to rotate once s == 1 indicates to rotate twice
rr indicates the target register such that: rrr == 000 indicates register R0 rrr == 001 indicates register R1 rrr == 010 indicates register R2 rrr == 011 indicates register R3