Description

The IDIV instruction performs a signed division. The dividend, quotient, and remainder are implicitly allocated to fixed registers. Only the divisor is given as an explicit r/m operand. The type of the divisor determines which registers to use as follows:

┌─────────┬───────────┬─────────┬──────────┬───────────┐
│  SIZE   │ DIVIDEND  │ DIVISOR │ QUOTIENT │ REMAINDER │
├─────────┼───────────┼─────────┼──────────┼───────────┤
│  byte   │  AX       │  r/m8   │   AL     │    AH     │
├─────────┼───────────┼─────────┼──────────┼───────────┤
│  word   │  DX:AX    │  r/m16  │   AX     │    DX     │
├─────────┼───────────┼─────────┼──────────┼───────────┤
│  dword  │  EDX:EAX  │  r/m32  │   EAX    │    EDX    │
└─────────┴───────────┴─────────┴──────────┴───────────┘

If the resulting quotient is too large to fit in the destination, or if the divisor is 0, an Interrupt 0 is generated. Nonintegral quotients are truncated toward 0. The remainder has the same sign as the dividend and the absolute value of the remainder is always less than the absolute value of the divisor.


[Back: Details Table]
[Next: Operation]