AAA ASCII Adjust after Addition Flags: O D I T S Z A P C ? - - - ? ? * ? * AAA
Logic if ((AL AND 0Fh) > 9) OR (AF = 1) AL ← AL + 6 ; See note AH ← AH + 1 AF ← 1; CF ← 1 else AF ← 0; CF ← 0 endif AL ← AL AND 0Fh
Execute AAA following an ADD or ADC operation on two unpacked BCD digits that leaves a byte result in the AL register. AAA converts the number in the lower 4 bits (nibble) of AL to an unpacked BCD number (high-order nibble of AL is zeroed). If the addition produced a decimal carry, the AH register is incremented, and the carry and auxiliary carry flags are set to 1. If the addition produced no decimal carry, the carry and auxiliary carry flags are set to 0 and AH is unchanged.
Note The 8086/88 processors will not add a carry out of AL into AH if an invalid operand is in AL. The newer processors will, yielding different results for the same _invalid_ operand (AX = AX + 6 in 2nd line of description). Execution is the same when valid operands are loaded.