Difference between revisions of "Assembler:Commands:IDIV"

From Cheat Engine
Jump to navigation Jump to search
Line 100: 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 ==
 
== External links ==

Revision as of 22:08, 19 March 2017

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

x86.renejeschke.de/html/file_module_x86_id_137.html


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