k, somene can explain rorm rol this way i'll expain shr
shr eax,n
eax / 2 ^ n
now
rol eax, n
????
ror eax, n
????
tnx in advance
shr eax,n
eax / 2 ^ n
now
rol eax, n
????
ror eax, n
????
tnx in advance
To explain it the easy way, we'll look at ROL EAX, 1. This is very
easy :)
Bits will be ROTATED LEFT. So, it's basically a SHL EAX, 1... except
the leftmost bit will be remembered, the shift will be done , and the
rightmost bit will be set to the remebered value. From here on,
arbitraty values should be easy to understand.
easy :)
Bits will be ROTATED LEFT. So, it's basically a SHL EAX, 1... except
the leftmost bit will be remembered, the shift will be done , and the
rightmost bit will be set to the remebered value. From here on,
arbitraty values should be easy to understand.
f0dder, heads-up this is a classic homework problem. He's looking for the algebraic equation for this... I've seen the assignment before.
Max, You've written almost half of the answer in your original post. this much I'll give you... You've got the remainder to consider (sum in) as well as the quotient, think about how you'd represent them so that the bits align as f0dder said. Try n=1 first & then expand from there.
over & out on this thread.
Max, You've written almost half of the answer in your original post. this much I'll give you... You've got the remainder to consider (sum in) as well as the quotient, think about how you'd represent them so that the bits align as f0dder said. Try n=1 first & then expand from there.
over & out on this thread.
tnx guys but rafe is right im looking for the algebraic equation ....thats the only way i can understand how it works :[
I don't know if we should tell you or not, we can't be doing your homework for you (if rafes right that is) ;)
But, heres rol eax; first part you knew eax = eax * 2^n and then you have to account for the roll over (if thats the right term) which is eax / 2^(32-n)
So in total you get eax = eax * 2^n + eax / 2^(32-n)
It should be easy to figure out ror from this. :)
But, heres rol eax; first part you knew eax = eax * 2^n and then you have to account for the roll over (if thats the right term) which is eax / 2^(32-n)
So in total you get eax = eax * 2^n + eax / 2^(32-n)
It should be easy to figure out ror from this. :)
If you need to understand what an instruction does, use the 16b version in debug.
Anyone know how to divide by 10 using shr? I can multiply easy by adding the results of shl 1 and shl 3.
Thanks
Anyone know how to divide by 10 using shr? I can multiply easy by adding the results of shl 1 and shl 3.
Thanks