ABSTRACT

A shift function moves the bits in a register to the right or to the left. A rotate function, like a shift function, shifts data to the right or left; but instead of losing the shift-out bit, this bit becomes the shift-in bit at the other end of the register (rotated bit). The following Shift and Rotate macros are described in this chapter: Ashift_R (Arithmetic Shift Right the 8-bit register Rin), Ashift_R_16 (Arithmetic Shift Right the 16-bit register Rin), Lshift_R (Logical Shift Right the 8-bit register Rin), Lshift_R_16 (Logical Shift Right the 16-bit register Rin), Lshift_L (Logical Shift Left the 8-bit register Rin), Lshift_L_16 (Logical Shift Left the 16-bit register Rin), shift_R (Shift Right the 8-bit register Rin), shift_R_16 (Shift Right the 16-bit register Rin), shift_L (Shift Left the 8-bit register Rin), shift_L_16 (Shift Left the 16-bit register Rin), rotate_R (Rotate Right the 8-bit register Rin), rotate_R_16 (Rotate Right the 16-bit register Rin), rotate_L (Rotate Left the 8-bit register Rin), rotate_L_16 (Rotate Left the 16-bit register Rin), Swap (Swap the nibbles of the 8-bit register Rin). Seven examples are considered to show the application of shift and rotate macros presented in this chapter.