SHL、SHR、SAL、SAR: 移位指令
;SHL(Shift Left):逻辑左移;SHR(Shift Right): 逻辑右移;SAL(Shift Arithmetic Left): 算术左移;SAR(Shift Arithmetic Right): 算术右移;其中的 SHL 和 SAL 相同, 但 SHR 和 SAR 不同.;SHL、SAL: 每位左移, 低位补 0, 高位进 CF;SHR : 每位右移, 低位进 CF, 高位补 0;SAR : 每位右移, 低位进 CF, 高位不变;它们的结果影响 OF、SF、ZF、PF、CF;它们的指令格式相同:SHLr/m, i8SHLr/m,CL; Test24_1.asm.386.modelflat,stdcallincludewindows.incincludekernel32.incincludemasm32.incincludedebug.incincludelibkernel32.libincludelibmasm32.libincludelibdebug.lib.codemainproc;SHL、ALmoval, 11100111bshlal, 1PrintHexal;CE - 11001110bsalal, 2PrintHexal;38 - 00111000bmoval, 11100111bmovcl, 2shlal,clPrintHexal;9C - 10011100b ;SHRmoval, 11100111bshral, 2PrintHexal;39 - 00111001b ;SARmoval, 11100111bsaral, 2PrintHexal;F9 - 11111001bretmainendpendmain
ROL、ROR、RCL、RCR: 循环移位指令
;ROL(Rotate Left): 循环左移;ROR(Rotate Right): 循环右移;RCL(Rotate through Carry Left): 带进位循环左移;RCR(Rotate through Carry Right): 带进位循环右移;ROL: 循环左移, 高位到低位并送 CF;ROR: 循环右移, 低位到高位并送 CF;RCL: 循环左移, 进位值(原CF)到低位, 高位进 CF;RCR: 循环右移, 进位值(原CF)到高位, 低位进 CF;它们的结果影响 OF、CF;它们的指令格式相同:SHLr/m, i8SHLr/m,CL; Test24_2.asm.386.modelflat,stdcallincludewindows.incincludekernel32.incincludemasm32.incincludedebug.incincludelibkernel32.libincludelibmasm32.libincludelibdebug.lib.codemainproc;ROLmoval, 11000011brolal, 1PrintHexal;87 - 010000111b ;RORmoval, 11000011broral, 1PrintHexal;E1 - 11100001b ;RCLclcmoval, 10101111brclal, 1PrintHexal;5E - 01011110bstcmoval, 10101111brclal, 1PrintHexal;5F - 01011111bclcmoval, 10101111brclal, 2PrintHexal;BD - 10111101b ;RCRclcmoval, 11101011brcral, 2PrintHexal;BA - 10111010bretmainendpendmain
SHLD、SHRD: 双精度移位
;SHLD(Double-Precision Shift Left): 双精度左移;SHRD(Double-Precision Shift Right): 双精度右移;SHLD 和 SHRD 有三个操作数;操作数三: 是移位数目;操作数一: 是目的操作数;SHLD 左边被移出的位由操作数二相同数目的高位填充;SHRD 右边被移出的位由操作数二相同数目的低位填充;操作数二不变, 且须是寄存器;它们的结果影响 OF、SF、ZF、PF、CF;它们的指令格式相同:SHLDr16/32/m16/m32, r16/32, i8SHLDr16/32/m16/m32, r16/32,CL; Test25_3.asm.386.modelflat,stdcallincludewindows.incincludekernel32.incincludemasm32.incincludedebug.incincludelibkernel32.libincludelibmasm32.libincludelibdebug.lib.codemainproc;SHLDmovax, 1100110011110000bmovdx, 1111111100000000bshldax,dx, 2PrintHexax;33C3 - 0011001111000011b ;SHRDmovax, 0000111100110011bmovdx, 0000000011111111bshrdax,dx, 2PrintHexax;C3CC - 1100001111001100bretmainendpendmain