Difference between revisions of "Assembler:Commands:IDIV"
(Created page with ''''command''' idiv ''operand'' Performs an unsigned division of two operands. Divides (signed) the value in accumulator registers (dividend) by the source operand (divisor) and…') |
|||
(5 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 | + | [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 | ||
− | + | {{AssemblerCommandSeeAlso}} | |
− | |||
− | |||
− | |||
− | + | {{Template:AssemblerCommandExternalLinks}} | |
− | |||
− | |||
− |
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.
Dividend | Divisor | Quotient | Remainder | Maximum Quotient |
---|---|---|---|---|
Word/Byte | AX | r/m8 | AL | AH |
Doubleword/Word | DX:AX | r/m16 | AX | DX |
Quadword/Doubleword | EDX:EAX | r/m32 | EAX | EDX |
Octoword/Quadword | RDX:RAX | r/m64 | RAX | RDX |
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[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