The Intel 8086 / 8088 / 80186 / 80286 / 80386 / 80486 Instruction Set

This HTML version of the file intel.doc from the PC Game Programmer's guide was produced by Zack T Smith. Fancy HTML modifications are copyright © 2005 by Zack T Smith, all rights reserved. This information is provided in the hope that it will be useful, but without any warranty. It is provided AS-IS, without even the implied warranty of fitness for a particular purpose.

A Instructions

AAA - Ascii Adjust for Addition

        Usage:  AAA
        Modifies flags: AF CF (OF,PF,SF,ZF undefined)

        Changes contents of AL to valid unpacked decimal.  The high order
        nibble is zeroed.

                                 Clocks                 Size
        Operands         808x  286   386   486          Bytes

        none              8     3     4     3             1

AAD - Ascii Adjust for Division

        Usage:  AAD
        Modifies flags: SF ZF PF (AF,CF,OF undefined)

        Used before dividing unpacked decimal numbers.   Multiplies AH by
        10 and the adds result into AL.  Sets AH to zero.  This instruction
        is also known to have an undocumented behavior.

        AL := 10*AH+AL
        AH := 0

                                 Clocks                 Size
        Operands         808x  286   386   486          Bytes

        none              60    14    19    14            2

AAM - Ascii Adjust for Multiplication


        Usage:  AAM
        Modifies flags: PF SF ZF (AF,CF,OF undefined)

        AH := AL / 10
        AL := AL mod 10

        Used after multiplication of two unpacked decimal numbers, this
        instruction adjusts an unpacked decimal number.  The high order
        nibble of each byte must be zeroed before using this instruction.
        This instruction is also known to have an undocumented behavior.

                                 Clocks                 Size
        Operands         808x  286   386   486          Bytes

        none              83    16    17    15            2

AAS - Ascii Adjust for Subtraction

        Usage:  AAS
        Modifies flags: AF CF (OF,PF,SF,ZF undefined)

        Corrects result of a previous unpacked decimal subtraction in AL.
        High order nibble is zeroed.

                                 Clocks                 Size
        Operands         808x  286   386   486          Bytes

        none              8     3     4     3             1

ADC - Add With Carry

        Usage:  ADC     dest,src
        Modifies flags: AF CF OF SF PF ZF

        Sums two binary operands placing the result in the destination.
        If CF is set, a 1 is added to the destination.

                                Clocks                  Size
        Operands         808x  286   386   486          Bytes

        reg,reg           3     2     2     1             2
        mem,reg         16+EA   7     7     3            2-4  (W88=24+EA)
        reg,mem          9+EA   7     6     2            2-4  (W88=13+EA)
        reg,immed         4     3     2     1            3-4
        mem,immed       17+EA   7     7     3            3-6  (W88=23+EA)
        accum,immed       4     3     2     1            2-3

ADD - Arithmetic Addition

        Usage:  ADD     dest,src
        Modifies flags: AF CF OF PF SF ZF

        Adds "src" to "dest" and replacing the original contents of "dest".
        Both operands are binary.

                                 Clocks                 Size
        Operands         808x  286   386   486          Bytes

        reg,reg           3     2     2     1             2
        mem,reg         16+EA   7     7     3            2-4  (W88=24+EA)
        reg,mem          9+EA   7     6     2            2-4  (W88=13+EA)
        reg,immed         4     3     2     1            3-4
        mem,immed       17+EA   7     7     3            3-6  (W88=23+EA)
        accum,immed       4     3     2     1            2-3

AND - Logical And

        Usage:  AND     dest,src
        Modifies flags: CF OF PF SF ZF (AF undefined)

        Performs a logical AND of the two operands replacing the destination
        with the result.

                                Clocks                  Size
        Operands         808x  286   386   486          Bytes

        reg,reg           3     2     2     1             2
        mem,reg         16+EA   7     7     3            2-4  (W88=24+EA)
        reg,mem          9+EA   7     6     1            2-4  (W88=13+EA)
        reg,immed         4     3     2     1            3-4
        mem,immed       17+EA   7     7     3            3-6  (W88=23+EA)
        accum,immed       4     3     2     1            2-3

ARPL - Adjusted Requested Privilege Level of Selector (286+ PM)

        Usage:  ARPL    dest,src
        (286+ protected mode)
        Modifies flags: ZF

        Compares the RPL bits of "dest" against "src".  If the RPL bits
        of "dest" are less than "src", the destination RPL bits are set
        equal to the source RPL bits and the Zero Flag is set.  Otherwise
        the Zero Flag is cleared.

                                Clocks                  Size
        Operands         808x  286   386   486          Bytes

        reg,reg           -     10    20    9             2
        mem,reg           -     11    21    9             4