Difference between revisions of "Assembler:Commands:IDIV"

From Cheat Engine
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Assembler]]
 
'''command''' idiv ''operand''
 
'''command''' idiv ''operand''
  
Line 52: 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]
+
[http://c9x.me/x86/html/file_module_x86_id_137.html c9x.me/x86/html/file_module_x86_id_137.html]
 
</div>
 
</div>
  
Line 99: Line 100:
 
  // eax = 6, edx = 0
 
  // eax = 6, edx = 0
  
== 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://x86.renejeschke.de/ x86.renejeschke.de]
 
* [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org]
 

Latest revision as of 15:45, 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).

c9x.me/x86/html/file_module_x86_id_137.html


Command Parameters[edit]

Parameter Description
operand The divisor operand


Examples[edit]

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[edit]

External links[edit]