You are here: Articles > Programming > Programming

 See more articles about "Programming "

Assembly: Bit Rotating

 

Shift bits left or right by a desired numebr of places, with a wrap around to the other side

This method saves all bits.

Say you shifted AX by 8, in either direction the new AX value would hold AH as the old AL and 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 8):



shld AX,8



or to Shift right (in this case by 8):



shrd AX,8



you simply provide the 2 operands:

1) the register to shift

2) the number of places to shift





Questions/Comments: william_a_wilson@hotmail.com

-William. (marvin_gohan)

 

Also see ...

Assembly: Bit Rotating (carry flag)
H3Shift bits left or right by a desired numebr of places, with a wrap around to the other side through the carry flag/H3PThis method saves all bits. br /Say you shifted AX by 8, in either direction the new AX value would hold AH as the old AL and AL would become the old AH. br /This method

Using Ascii Text to Help Section Code
H3When coding in a plain text environment, it is difficult to set off sections and comments. The use of ascii generated text can make your life easier./H3PCoding in a plain text environment can be difficult because it is often hard to identify and set off areas of code. The generation of lar

Windows Batch File (.bat) to get current date in MMDDYYYY format.
H3This is a recipe I discovered while working on a few old skool dos batch files. This is a quick .bat file to create a folder based on the current date however, this sets it up in the MMDDYYYY format. Useful for those .bat scripters who need to use the current date variable in such a format./H3

Subversion: Add your project into Source Control
H3A very common bit of confusion for newbies to Subversion is how to get your project into source control properly. This recipe should get you rolling./H3PWe're developing a killer application called MySuperTestApp that can make your coffee telepathically, but we need to make sure that we've g

Scheme - using cdr
H3In Scheme, cdr simply displays all but the first element of a list, no matter what it is, be it a character, symbol, int, or even several lists or any combination. This is also useful for streams later on. This Tech Recipe shows a simple demostration of the cdr feature in scheme./H3Pdiv c