THE
80286
INSTRUCTION SET
AAA
- ASCII Adjust
AL
After Addition
Opcode
Instruction
Clocks
Description
37
AAA
3
ASCII adjust AL after addition
FLAGS MODIFIED
Auxiliary carry, carry
FLAGS UNDEFINED
Overflow, sign, zero, parity
OPERATION
AAA should be executed only after an ADD instruction which leaves a byte result
in
the
AL
register.
The lower nibbles of the operands to the ADD instruction should be
in
the range 0 through 9 (BCD
digits). In this case, the AAA instruction
will
adjust AL to contain the correct decimal digit result.
If
the addition produced a decimal carry, the AH register
is
incremented, and the carry
and
auxiliary
carry flags are set to
1.
If
there
was
no
decimal carry, the carry and auxiliary carry flags are set to
0,
and AH
is
unchanged. In any case, AL
is
left with its top nibble set to
O.
To convert AL
to
an ASCII
result,
you
can follow the AAA instruction with
OR
AL,30H.
The precise definition of AAA
is
as
follows:
if the lower 4 bits of AL are greater than nine, or if the
auxiliary carry flag
is
1,
then increment AL by 6, AH by
1,
and set the carry and auxiliary carry flags.
Otherwise, reset the carry and auxiliary carry flags. In any case, conclude the AAA operation by
setting the upper four bits of AL to zero.
PROTECTED MODE EXCEPTIONS
None
REAL ADDRESS MODE EXCEPTIONS
None
8-15