problem in understanding mul & imul instructions of Assembly language

后端 未结 5 1531
遥遥无期
遥遥无期 2020-12-09 20:40

I\'m learning 80386 from PC Assembly by paul caurter

  mul source
  • If the operand is byte sized, it is multiplied by
5条回答
  •  时光说笑
    2020-12-09 21:31

    Q1/Q2: The x86 instruction set maintains its 16-bit history. When doing a 16-bit multiply, the answer is stored in DX:AX. That's just the way it is, because that's how it was in 16-bit land.

    Q3: The code you showed has a bug if you try to compute the square of a number larger than 2^16, because the code ignores the high 32 bits of the result stored in edx.

    Q4: I think you may be misreading the table. 8-bit multiplications are stored in a 16-bit result; 16-bit multiplications are stored in a 32-bit result; 32-bit multiplications are stored in a 64-bit result. Which line are you referring to specifically?

提交回复
热议问题