Difference between revisions of "Assembler:Commands:IDIV"

From Cheat Engine
Jump to navigation Jump to search
m
Line 53: Line 53:
 
Divides (signed) the value in the AX, DX:AX, or EDX:EAX registers (dividend) by the source operand (divisor) and stores the result in the AX (AH:AL), DX:AX, or EDX:EAX registers. The source operand can be a general-purpose register or a memory location. The action of this instruction depends on the operand size (dividend/divisor).
 
Divides (signed) the value in the AX, DX:AX, or EDX:EAX registers (dividend) by the source operand (divisor) and stores the result in the AX (AH:AL), DX:AX, or EDX:EAX registers. The source operand can be a general-purpose register or a memory location. The action of this instruction depends on the operand size (dividend/divisor).
  
[http://x86.renejeschke.de/html/file_module_x86_id_137.html x86.renejeschke.de/html/file_module_x86_id_137.html]
 
 
</div>
 
</div>
  
Line 102: Line 101:
 
{{AssemblerCommandSeeAlso}}
 
{{AssemblerCommandSeeAlso}}
  
== 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://x86.renejeschke.de/ x86.renejeschke.de]
 
* [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org]
 
* [http://ref.x86asm.net/ ref.x86asm.net]
 

Revision as of 15:21, 3 January 2018

command idiv operand

Performs an unsigned division of two operands.

Divides (signed) the value in accumulator registers (dividend) by the source operand (divisor) and stores the result in the AX (AH:AL), DX:AX, or EDX:EAX registers. The source operand can be a general-purpose register or a memory location. The action of this instruction depends on the operand size (dividend/divisor).

The CF, OF, SF, ZF, AF, and PF flags are undefined.

AL (r=AH) = AH:AL/operand : byte
AX (r=DX) = DX:AX/operand : WORD
EAX (r=EDX) = EDX:EAX/operand : DWORD
RAX (r=RDX) = RDX:RAX/operand : QWORD


Divides (signed) the value in the AX, DX:AX, or EDX:EAX registers (dividend) by the source operand (divisor) and stores the result in the AX (AH:AL), DX:AX, or EDX:EAX registers. The source operand can be a general-purpose register or a memory location. The action of this instruction depends on the operand size (dividend/divisor).


Command Parameters

Parameter Description
operand The divisor operand


Examples

idiv ecx
mov eax,6
mov edx,0
mov ecx,2
idiv ecx // eax (r=edx) = edx:eax / ecx
// eax = 3, edx = 0
mov eax,9
mov edx,0
mov esi,2
idiv esi // eax (r=edx) = edx:eax / esi
// eax = 4, edx = 1
mov eax,0
mov edx,1
mov esi,0x10
idiv esi // eax (r=edx) = edx:eax / esi
// eax = 0x10000000, edx = 0
mov eax,6
mov edx,0
mov [00123ABC],2
idiv [00123ABC] // eax (r=edx) = edx:eax / [00123ABC]
// eax = 6, edx = 0
mov eax,6
mov edx,0
mov [SomeSymbol],2
idiv [SomeSymbol] // eax (r=edx) = edx:eax / [SomeSymbol]
// eax = 6, edx = 0

See also

External links