Saturday, May 18, 2024
HomeComputer programmingAssembly: Bit Rotating

Assembly: Bit Rotating

This tutorial describes shifting bits left or right by a desired number of places with a wrap around to the other side.


This method saves all bits.
For instance, if you shifted AX by eight, in either direction, the new AX value would hold AH as the old AL. AL would become the old AH. This is done with a temporary copy of the register which is then shifted into the blank slots as the shift occurs.

Shift left (in this case, by eight):

shld AX,8

Shift right (in this case, by eight):

shrd AX,8

You simply provide the two operands:
1) the register to shift
2) the number of places to shift

Questions/Comments: [email protected]
-William. § (marvin_gohan)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!