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.
Byte rotation instructions in assembler
Re:Byte rotation instructions in assembler
an XT ism, didnt let you shift beyond 1
but a a 286 or 386 instruction, let you shift by any number..
unless you want compatability with xt/286, use the shift CL method. if you dont think anyone with a PCjr is gonna run it, use the shift ax, 15 method......
but a a 286 or 386 instruction, let you shift by any number..
unless you want compatability with xt/286, use the shift CL method. if you dont think anyone with a PCjr is gonna run it, use the shift ax, 15 method......
-- Stu --