Shop OBEX P1 Docs P2 Docs Learn Events
assembly shift and rotate instructions — Parallax Forums

assembly shift and rotate instructions

nutsonnutson Posts: 242
edited 2006-08-03 05:01 in Propeller 1
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?


·

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-08-03 05:01
    nutson,

    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
Sign In or Register to comment.