0

I am trying to understand SHR and ROR registers, the professor gave us some examples that I can't understand so I will make my own and hope I understand it better.

If I had 1234h in the eax register for example, how do I know what the number would be after 6 SHR instructions or after 6 ROR instructions?

Also, quick question on initialization. If I had a number, like 1155 or something, how can I initialize a variable in the data segment with ten copies of the number?

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by Duoas
0

Shift "forgets" the bits shifted out.
Roll takes the bit shifted out and sticks it back in on the other end.

Examples:

01101010 start (one byte)
11010100 shifted left by one
10101000 shifted left by one
01010000 shifted left by one
etc.

01101010 start (one byte)
[B]1[/B]1010100 rolled left by one (red bit goes out left and back in right side)
[B]1[/B]010100[B]1[/B] rolled left by one (green bit ...)
0101001[B]1[/B] rolled left by one (black bit ...)
10100110 rolled left by one (etc.)
etc.

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.