
THE 80286 INSTRUCTION SET
AAS-ASCII Adjust AL After Subtraction
Opcode Instruction ClocksDescription
3F | AAS | 3 | ASCII adjust AL after subtraction |
FLAGS MODIFIED
Auxiliary carry, carry
FLAGS UNDEFINED
Overflow, sign, zero, parity
OPERATION
AASshould be executed only after a subtraction instruction which left the byte result in the AL register. The lower nibbles of the operands to the SUB instruction should have been in the range 0 through 9 (BCD digits). In this case, the AAS instruction will adjust AL to contain the correct decimal digit result. If the subtraction produced a decimal carry, the AH register is decremented, 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 AAS instruction with OR AL,30H.
The precise definition of AAS is as follows: if the lower four bits of AL are greater than 9, or if the auxiliary carry flag is 1, then decrement AL by 6, AH by I, and set the carry and auxiliary carry flags. Otherwise, reset the carry and auxiliary carry flags. In any case, conclude the AAS operation by setting the upper four bits of AL to zero.
PROTECTED MODE EXCEPTIONS
None
REAL ADDRESS MODE EXCEPTIONS
None