x86汇编 - MASM32:乘法和除法的绝对击穿 [英] x86 assembly - masm32: absolute breakdown of multiplication and division
问题描述
我已经看过所有在互联网上有关如何繁殖和MASM32装配鸿沟一个简单易懂的评价。我的问题是:
I have looked all over the internet for a simple-to-understand evaluation of how to multiply and divide in masm32 assembly. My questions are:
-
我应该在哪里放置相乘的数字?
Where should I place the numbers being multiplied?
我应该在哪里放置数字被划分?
Where should I place the numbers being divided?
在哪里,其余的分工去?
Where does the remainder go in the division?
可能有人请我回答这个问题?
Could someone please answer this for me?
谢谢,
Progrmr
推荐答案
在回答这个问题可以通过看的英特尔64和IA-32指令集。在这种情况下,你要寻找的 MUL
和 DIV
的说明(如果你是无符号运算操作)或 IMUL
和 IDIV
指令,用于符号整数乘法和除法。
The answer to this question can be very easily found by looking at the proper page of the Intel 64 and IA-32 Instruction Set Reference. In this case, you're looking for the MUL
and DIV
instructions (in case you're operating on unsigned operands) or IMUL
and IDIV
instructions, which are used for signed integer multiplication and division.
所以,如果你真的不喜欢通过手动寻找:
So, in case you really don't feel like looking through the manual :
- 一个乘法的操作数必须放置在
EAX
如果你使用注册MUL
。这是一个更灵活一点,如果你使用IMUL
指令,它允许您指定的源和目的寄存器。 - 被划分数总是在32位模式中的64位数字。高比特进入
EDX
,而低位进入EAX
。 - 的其余部分始终放在
EDX
。
- One of the operands of the multiplication must be placed in the
EAX
register if you're usingMUL
. This is a bit more flexible if you're using theIMUL
instruction, which allows you to specify the source and destination registers. - The number being divided is always a 64-bit number in 32-bit mode. The high bits go into
EDX
, while the lower bits go intoEAX
. - The remainder is always placed in
EDX
.
这篇关于x86汇编 - MASM32:乘法和除法的绝对击穿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!