简体   繁体   English

由于汇编语言中的mul命令未设置Zf

[英]Zf not set as a result of mul command in assembly language

I am using masm615 assembler and textpad as an editor. 我正在使用masm615汇编器和文本板作为编辑器。 I am writing 32 bit assembly program. 我正在编写32位汇编程序。 In the program I am trying to set zero flag as a result of mul instruction but it is not working. 在程序中,由于mul指令,我试图设置零标志,但是它不起作用。 Can anyone tell me why the zero flag is clear while the result in eax register is zero. 谁能告诉我为什么eax寄存器中的结果为零时清除零标志的原因。 I am trying the following code 我正在尝试以下代码

    include irvine32.inc
    .data
    .code
    main proc
    xor eax,eax
    call dumpregs
    xor ebx,ebx
    call dumpregs
    mov eax,2
    call dumpregs
    mov ebx,3
    call dumpregs
    sub eax,2
    call dumpregs
    mul ebx
    call dumpregs
    exit
    main endp
    end main

In the program i am trying to set zero flag as a result of mul instruction 在程序中,由于mul指令,我试图设置零标志

The mul instruction does not affect the zero flag, see Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 2 page 3-594: mul指令不会影响零标志,请参阅英特尔 ®64 和IA-32体系结构软件开发人员手册第2卷第3-594页:

MUL—Unsigned Multiply MUL-无符号乘法

... ...

Flags Affected 受影响的标志

The OF and CF flags are set to 0 if the upper half of the result is 0; 如果结果的上半部分为0,则将OF和CF标志设置为0;否则将其设置为0。 otherwise, they are set to 1. The SF, ZF, AF, and PF flags are undefined. 否则,它们设置为1。SF,ZF,AF和PF标志未定义。

If in doubt, always check the instruction documentation in the developers manual. 如有疑问,请始终查看开发人员手册中的说明文档。 Not all instructions affect the flags which one might expect. 并非所有指令都会影响人们可能期望的标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM