aas
ASCII-adjust AL -> AL
Use aas only after executing the form of an add instruction that stores a two-BCD-digit byte result in the AL register. aas then adjusts AL to contain the correct decimal result. The top nibble of AL is set to 0. To convert AL to an ASCII result, follow the aas instruction with:
or %al, 0x30
Table 2-9 shows how aas handles a carry.
Table 2-9 How aas Handles a Carry
Carry |
Action |
---|---|
decimal carry |
AH - 1; CF and AF set to 1 |
no decimal carry |
AH unchanged; CF and AF cleared to 0 |
Adjust the AL register to contain the correct decimal result after a sub instruction that stores a two-BCD-digit byte
aas