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://c9x.me/x86/html/file_module_x86_id_137.html c9x.me/x86/html/file_module_x86_id_137.html]
 
</div>
 
</div>
  

Latest revision as of 11: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]