I am writing code using nasm in x86 assembly. I would like to be able to do this(in EAX is number of rotations, or under [EBP + 12]):
ror ESI, EAX ;count- register
ror ESI, DWORD [EBP + 12] ;count- memory
but it is impossible. ror only accept immediate constants like
ror ESI, 4 ; four right rotations
I don’t like to do loop:
loop:
ror ESI, 1
sub EAX, 1
cmp EAX, 0
jg loop
Probably there is a better solution of this problem.
I have found that ROR only works with CL register, for example: