[Solved] x86 assembly – masm32: absolute breakdown of multiplication and division [closed]


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

5

solved x86 assembly – masm32: absolute breakdown of multiplication and division [closed]