Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Assembly Language - <b>idiv integer divide, signed flags: o d i t s z a p c</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
IDIV             Integer Divide, Signed              Flags: O D I T S Z A P C
                                                            ?       ? ? ? ? ?
IDIV source

          Logic:    AL . AX / source                 ; Byte source
                    AH . remainder
               or
                    AX . DX:AX / source              ; Word source
                    DX . remainder

    IDIV performs signed division. If source is a byte, IDIV divides the
    word value in AX by source, returning the quotient in AL and the
    remainder in AH. If source is a word, IDIV divides the double-word
    value in DX:AX by source, returning the quotient in AX and the
    remainder in DX.

  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
   reg8                     101-112       -        2     IDIV CL
   reg16                    165-184       -        2     IDIV DX
   mem8                  (107-118) + EA   1       2-4    IDIV BYTE[SI]
   mem16                 (175-194) + EA   1       2-4    IDIV [BX].WORD_ARRAY
  --------------------------------------------------------------------------

       Notes:         If the result is too large to fit in the destination
                      (AL or AX), an INT 0 (Divide by Zero) is generated,
                      and the quotient and remainder are undefined.

                      The 80286 and 80386 microprocessors are able to
                      generate the largest negative number (80h or 8000h)
                      as a quotient for this instruction, but the
                      8088/8086 will generate an Interrupt 0 (Divide by
                      Zero) if this situation occurs.

                      When an Interrupt 0 (Divide by Zero) is generated,
                      the saved CS:IP value on the 80286 and 80386 points
                      to the instruction that failed (the IDIV
                      instruction).  On the 8088/8086, however, CS:IP
                      points to the instruction following the failed IDIV
                      instruction.

See Also: DIV SAR AAD CBW CWD INT 00h EA Flags

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson