1 2 3 下一页 MUL: 无符号乘 ;影响 OF、CF 标志位 ;指令格式: ;MUL r/m ;参数是乘数 ;如果参数是 r8/m8, 将把 AL 做乘数, 结果放在 AX ;如果参数是 r16/m16, 将把 AX 做乘数, 结果放在 EAX ;如果参数是 r32/m32, 将把 EAX 做乘数, 结果放在 EDX:EAX ; Test27_1.asm .386 .model flat, stdcall include Windows.inc include kernel32.inc include masm32.inc include debug.inc includelib kernel32.lib includelib masm32.lib includelib debug.lib .data val dd 8 .code main proc ;8 位 mov al, 0FFh mul byte ptr val PrintHex ax ;07F8 ;16 位 mov ax, 0FFFFh mul word ptr val PrintHex dx ;0007 PrintHex ax ;FFF8 ;32 位 mov eax, 0FFFFFFFFh mul val PrintHex edx ;00000007 PrintHex eax ;FFFFFFF8 ret main endp end main ;把上面的例子稍作修改(mul -> imul), 得到了不同的结果: ; Test27_2.asm .386 .model flat, stdcall include Windows.inc include kernel32.inc include masm32.inc include debug.inc includelib kernel32.lib includelib masm32.lib includelib debug.lib .data val dd 8 .code main proc ;8 位 mov al, 0FFh imul byte ptr val PrintHex ax ;FFF8 ;16 位 mov ax, 0FFFFh imul word ptr val PrintHex dx ;FFFF PrintHex ax ;FFF8 ;32 位 mov eax, 0FFFFFFFFh imul val PrintHex edx ;FFFFFFFF PrintHex eax ;FFFFFFF8 ret main endp end main (责任编辑:admin)
|