x86汇编 - MASM32:乘法和除法的绝对击穿 [英] x86 assembly - masm32: absolute breakdown of multiplication and division

查看:635
本文介绍了x86汇编 - MASM32:乘法和除法的绝对击穿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看过所有在互联网上有关如何繁殖和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:


  1. 我应该在哪里放置相乘的数字?

  1. 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 :


  1. 一个乘法的操作数必须放置在 EAX 如果你使用注册 MUL 。这是一个更灵活一点,如果你使用 IMUL 指令,它允许您指定的源和目的寄存器。

  2. 被划分数总是在32位模式中的64位数字。高比特进入 EDX ,而低位进入 EAX

  3. 的其余部分始终放在 EDX

  1. One of the operands of the multiplication must be placed in the EAX register if you're using MUL. This is a bit more flexible if you're using the IMUL instruction, which allows you to specify the source and destination registers.
  2. 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 into EAX.
  3. The remainder is always placed in EDX.

这篇关于x86汇编 - MASM32:乘法和除法的绝对击穿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆