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

- Advertisment -

Most Popular

Recent Comments

Cleveland Furia on How to Clear Google Activity
Sid Wohlfarth on How to Clear Google Activity
Riley Magsayo on How to Clear Google Activity
สมัครรับเครดิตฟรี ทันที on How to improve Remote Desktop Protocol Performance
Neal Wangstad on How to Clear Google Activity
Slavcho Andov on How to install Ubuntu
Slavcho Andov on How to fix bad sectors
Sheraz Ali on How to Backup Android