assembly shift and rotate instructions
nutson
Posts: 242
The·description·of·shift and rotate instructions in the propeller assembly manual is not completely clear to me.
ROL and ROR are clear: MSB and LSB replace place
SAR is clear: sign bit is extended
RCL and RCR are unclear:·vacated bits are filled with C.·I would call this a "extend with"·instruction.
SHR and SHL are unclear: what replaces the vacated bits?
·
ROL and ROR are clear: MSB and LSB replace place
SAR is clear: sign bit is extended
RCL and RCR are unclear:·vacated bits are filled with C.·I would call this a "extend with"·instruction.
SHR and SHL are unclear: what replaces the vacated bits?
·
Comments
You're right: the RCL and RCR are not really rotate instructions — at least when shifting by more than one bit. If the amount of shift is one bit, however, the net effect is a 33-bit rotate through the carry flag.
The vacated bits in SHR and SHL are replaced by zeroes.
One gotcha with these instructions is that, when the carry flag is written, it's replaced by either bit 0 or bit 31, as it existed before the instruction executed, not as it would have existed "one shift" prior to the final result.
-Phil