|Instruction Name||Rotate Right Through Carry|
|CP1610 Clock Cycles||6 or 8|
|Input Flags||Overflow Flag, Carry Flag|
|Output Flags||Sign Flag, Zero Flag, Overflow Flag, Carry Flag|
The Rotate Right Through Carry (RRC) 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 0, the value is shifted to the right by one bit, and bit 15 becomes the previous value of the Carry Flag. For a double rotate, the Carry Flag is set to the value of bit 0, the Overflow Flag is set to the value of bit 1, the value is shifted to the right by two bits, bit 14 becomes the previous value of the Carry Flag, and bit 15 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.
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