Difference between revisions of "Assembler:Commands:MUL"
Line 3: | Line 3: | ||
Multiplies the operand by the data register | Multiplies the operand by the data register | ||
Placing the high value in the data register and the low value in the accumulator register. | Placing the high value in the data register and the low value in the accumulator register. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="gallery" style="background-color:#f4f4f4" | {| class="gallery" style="background-color:#f4f4f4" | ||
Line 39: | Line 31: | ||
|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; | ||
otherwise, they are set to 1. The '''SF''', '''ZF''', '''AF''', and '''PF''' flags are undefined. | otherwise, they are set to 1. The '''SF''', '''ZF''', '''AF''', and '''PF''' flags are undefined. | ||
− | |||
AH:AL = AL * operand : byte | AH:AL = AL * operand : byte | ||
Line 49: | Line 39: | ||
EDX:EAX = EAX * operand : DWORD | EDX:EAX = EAX * operand : DWORD | ||
RDX:RAX = RAX * operand : QWORD | RDX:RAX = RAX * operand : QWORD | ||
+ | |||
+ | |||
+ | <div style="padding:2px;border:1px dashed #2f6fab;background-color:#f4f4f4;"> | ||
+ | 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. | ||
+ | |||
+ | [http://x86.renejeschke.de/html/file_module_x86_id_210.html x86.renejeschke.de/html/file_module_x86_id_210.html] | ||
+ | </div> | ||
Line 98: | Line 100: | ||
* [https://wikibooks.org/wiki/X86_Assembly/Other_Instructions wikibooks.org/wiki/X86_Assembly/Other_Instructions] | * [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://www.asmpedia.org/index.php?title=Main_Page asmpedia.org] | ||
− |
Revision as of 07:59, 14 March 2017
command mul operand
Multiplies the operand by the data register Placing the high value in the data register and the low value in the accumulator register.
Operand Size | Source 1 | Source 2 | Destination |
---|---|---|---|
Byte | AL | r/m8 | AX |
Word | AX | r/m16 | DX:AX |
Doubleword | EAX | r/m32 | EDX:EAX |
Quadword | RAX | r/m64 | RDX:RAX |
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.
AH:AL = AL * operand : byte DX:AX = AX * operand : WORD EDX:EAX = EAX * operand : DWORD RDX:RAX = RAX * operand : QWORD
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.
Command Parameters
Parameter | Description |
---|---|
operand | The multiplier operand |
Examples
mul edx
mov eax,2 mov edx,3 mul edx // edx = 0, eax = 6, edx:eax = 6
mov eax,2 mov ecx,3 mul ecx // edx = 0, eax = 6, edx:eax = 6
mov eax,0x10000000 mov edx,0x10 mul edx // edx = 1, eax = 0, edx:eax = 0x100000000
mov eax,2 mov [00123ABC],3 mul [00123ABC] // edx = 0, eax = 6, edx:eax = 6
mov eax,2 mov [SomeSymbol],3 mul [SomeSymbol] // edx = 0, eax = 6, edx:eax = 6