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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.