Difference between revisions of "Assembler:Commands:MUL"

From Cheat Engine
Jump to navigation Jump to search
(Examples)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Assembler]]
 
'''command''' mul ''operand''
 
'''command''' mul ''operand''
  
Multiplies the operand by the data register
+
Performs an unsigned multiplication of two operands.
Placing the high value in the data register and the low value in the accumulator register.
 
 
 
Performs an unsigned multiplication of the first operand (destination operand) and
 
the second operand (source operand) and stores the result in the destination operand.
 
The destination operand is an implied operand located in register AL, AX or EAX (depending on the size of the operand);
 
the source operand is located in a general-purpose register or a memory location.
 
The action of this instruction and the location of the result depends on the opcode and the operand
 
size as shown in the following table.
 
 
 
  
 +
Multiplies the operand by the accumulator register. Placing the high value in the data register and the low value in the accumulator register.
 +
AH:AL = AL * operand : byte
 +
DX:AX = AX * operand : WORD
 +
EDX:EAX = EAX * operand : DWORD
 +
RDX:RAX = RAX * operand : QWORD
 
{| class="gallery" style="background-color:#f4f4f4"
 
{| class="gallery" style="background-color:#f4f4f4"
|+ Results
+
!align="left"|Operand Size  
!align="left"|Operand Size
+
!align="left"|Accumulator  
!align="left"|Source 1
+
!align="left"|Operand  
!align="left"|Source 2
+
!align="left"|Destination  
!align="left"|Destination
 
 
|-
 
|-
 
|Byte
 
|Byte
Line 39: Line 35:
 
|RDX:RAX
 
|RDX:RAX
 
|}
 
|}
 
  
 
The '''OF''' and '''CF''' flags are set to 0 if the upper half of the result is 0;  
 
The '''OF''' and '''CF''' flags are set to 0 if the upper half of the result is 0;  
Line 45: Line 40:
  
  
AH:AL = AL * operand : byte
+
<div style="padding:2px;border:1px dashed #2f6fab;background-color:#f4f4f4;">
DX:AX = AX * operand : WORD
+
Performs an unsigned multiplication of the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. The destination operand is an implied operand located in register AL, AX or EAX (depending on the size of the operand); the source operand is located in a general-purpose register or a memory location. The action of this instruction and the location of the result depends on the opcode and the operand size as shown in the following table.
EDX:EAX = EAX * operand : DWORD
+
 
RDX:RAX = RAX * operand : QWORD
+
[http://c9x.me/x86/html/file_module_x86_id_210.html c9x.me/x86/html/file_module_x86_id_210.html]
 +
</div>
  
  
Line 66: Line 62:
 
  mov eax,2
 
  mov eax,2
 
  mov edx,3
 
  mov edx,3
  mul edx
+
  mul edx // eax = eax * edx
 
  // edx = 0, eax = 6, edx:eax = 6
 
  // edx = 0, eax = 6, edx:eax = 6
  
 
  mov eax,2
 
  mov eax,2
 
  mov ecx,3
 
  mov ecx,3
  mul ecx
+
  mul ecx // eax = eax * ecx
 
  // edx = 0, eax = 6, edx:eax = 6
 
  // edx = 0, eax = 6, edx:eax = 6
  
 
  mov eax,0x10000000
 
  mov eax,0x10000000
 
  mov edx,0x10
 
  mov edx,0x10
  mul edx
+
  mul edx // eax = eax * edx
 
  // edx = 1, eax = 0, edx:eax = 0x100000000
 
  // edx = 1, eax = 0, edx:eax = 0x100000000
  
 
  mov eax,2
 
  mov eax,2
 
  mov [00123ABC],3
 
  mov [00123ABC],3
  mul [00123ABC]
+
  mul [00123ABC] // eax = eax * [00123ABC]
 
  // edx = 0, eax = 6, edx:eax = 6
 
  // edx = 0, eax = 6, edx:eax = 6
  
 
  mov eax,2
 
  mov eax,2
 
  mov [SomeSymbol],3
 
  mov [SomeSymbol],3
  mul [SomeSymbol]
+
  mul [SomeSymbol] // eax = eax * [SomeSymbol]
 
  // edx = 0, eax = 6, edx:eax = 6
 
  // edx = 0, eax = 6, edx:eax = 6
  
== See also ==
+
{{AssemblerCommandSeeAlso}}
* [[Assembler]]
 
* [[Cheat_Engine:Auto Assembler|Auto Assembler]]
 
* [[Assembler:Commands|Assembler Commands]]
 
  
== External links ==
+
{{Template:AssemblerCommandExternalLinks}}
* [https://wikipedia.org/wiki/X86_instruction_listings wikipedia.org/wiki/X86_instruction_listings]
 
* [https://wikibooks.org/wiki/X86_Assembly/Other_Instructions wikibooks.org/wiki/X86_Assembly/Other_Instructions]
 
* [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org]
 
* [http://x86.renejeschke.de/html/file_module_x86_id_210.html x86.renejeschke.de/html/file_module_x86_id_210.html]
 

Latest revision as of 15:52, 3 January 2018

command mul operand

Performs an unsigned multiplication of two operands.

Multiplies the operand by the accumulator register. Placing the high value in the data register and the low value in the accumulator register.

AH:AL = AL * operand : byte
DX:AX = AX * operand : WORD
EDX:EAX = EAX * operand : DWORD
RDX:RAX = RAX * operand : QWORD

The OF and CF flags are set to 0 if the upper half of the result is 0; otherwise, they are set to 1. The SF, ZF, AF, and PF flags are undefined.


Performs an unsigned multiplication of the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. The destination operand is an implied operand located in register AL, AX or EAX (depending on the size of the operand); the source operand is located in a general-purpose register or a memory location. The action of this instruction and the location of the result depends on the opcode and the operand size as shown in the following table.

c9x.me/x86/html/file_module_x86_id_210.html


Command Parameters[edit]

Parameter Description
operand The multiplier operand


Examples[edit]

mul edx
mov eax,2
mov edx,3
mul edx // eax = eax * edx
// edx = 0, eax = 6, edx:eax = 6
mov eax,2
mov ecx,3
mul ecx // eax = eax * ecx
// edx = 0, eax = 6, edx:eax = 6
mov eax,0x10000000
mov edx,0x10
mul edx // eax = eax * edx
// edx = 1, eax = 0, edx:eax = 0x100000000
mov eax,2
mov [00123ABC],3
mul [00123ABC] // eax = eax * [00123ABC]
// edx = 0, eax = 6, edx:eax = 6
mov eax,2
mov [SomeSymbol],3
mul [SomeSymbol] // eax = eax * [SomeSymbol]
// edx = 0, eax = 6, edx:eax = 6

See also[edit]

External links[edit]