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), as shown in the following table:
IDIV Results
[header]Operand Size | Dividend | Divisor | Quotient | Remainder | Quotient Range[/header] |
Word/byte | AX | r/m8 | AL | AH | -2^8 to +2^8 - 1 |
Doubleword/word | DX:AX | r/m16 | AX | DX | -2^16 to +2^16 - 1 |
Quadword/doubleword | EDX:EAX | r/m32 | EAX | EDX | -2^31 to +2^32 - 1 |
Non-integral results are truncated (chopped) towards 0. The sign of the remainder is always the same as the sign of the dividend. The absolute value of the remainder is always less than the absolute value of the divisor. Overflow is indicated with the #DE (divide error) exception rather than with the OF (overflow) flag.
|