> My question is, how do you rotate a byte or a word on the Coldfire so the bits are not lost?
> I don't see any equivilent opcode to the ROR / ROL so I am assuming you need to do some
> checking of the CCR(C) bit after each bit is shifted.
> Rotate instructions are circular,your example does not seem to be that, sorry,
> 'll 'get it' at some point.
Let register d0 initially contains value 0xA3.
See the below tested code (GNU notation).
/* Rotate left by one bit the least significant byte */
lsl.l #1, %d0 /* d0 = 0x146 */
move.l %d0, %d1 /* d1 = 0x146 */
lsr.l #8, %d1 /* d1 = 0x1 */
or.l %d1, %d0 /* d0 = 0x147 */
andi.l #0xFF, %d0 /* d0 = 0x47 */
Let register d0 initially contains value 0xA3.
See the below tested code (GNU notation).
/* Rotate right by one bit the least significant byte */
move.l %d0, %d1 /* d1 = 0xA3 */
lsl.l #7, %d1 /* d1 = 0x5180 */
lsr.l #1, %d0 /* d0 = 0x51 */
or.l %d1, %d0 /* d0 = 0x51D1 */
andi.l #0xFF, %d0 /* d0 = 0xD1 */