Byte rotation instructions in assembler
Posted: Sat Feb 12, 2005 6:35 am
Hello,
I was re-reading an old assembler programming book when I saw something that I've never really though of before. I saw that the byte rotation instructions (shl, shr, sal, sar, ...) are used in two ways: when the operand is 1 I use 'shr ax,1' and when it is more than 1, I have to use cl 'mov cl,5 / shr ax,cl'. I checked another book and the Intel manuals and saw the same thing.
Why do I have to use the second way when I have the same result using the first one (shr ax,5)?
Thank you in advance.
I was re-reading an old assembler programming book when I saw something that I've never really though of before. I saw that the byte rotation instructions (shl, shr, sal, sar, ...) are used in two ways: when the operand is 1 I use 'shr ax,1' and when it is more than 1, I have to use cl 'mov cl,5 / shr ax,cl'. I checked another book and the Intel manuals and saw the same thing.
Why do I have to use the second way when I have the same result using the first one (shr ax,5)?
Thank you in advance.