IA-32 Assembly Language Reference Manual

ASCII Adjust AX after Multiply (aam)

aam

Operation

AL 10 -> AH mod 10 AL -> AL

Description

You use aam only after executing a mul instruction between two BCD digits (unpacked). mul stores the result in the AX register. The result is less than 100 so it can be contained in the AL register (the low byte of the AX register). aam unpacks the AL result by dividing AL by 10, stores the quotient (most-significant digit) in AH, and stores the remainder (least-significant digit) in AL.

Example

Adjust the AL register to contain the correct decimal result after a mul instruction between two BCD digits:

aam