AAM: ASCII Adjust AX After Multiplication

info-signFor information about interpreting this page, see the help page.
Opcode and MnemonicEncoding16 and 32 bit Mode64 bit ModeDescription
D4 0A
ZOValidInvalidASCII adjust AX after multiply.
D4 ib
AAM imm8
IValidInvalidASCII adjust AX after multiply to number base imm8.


ZONone (implicitly 10)

Bit Encoding

implicit 10
1101 0100 : 0000 1010
1101 0100 : immediate


The AAM instruction converts the result of a multiplication of two BCD digits to a valid 2-digit BCD number.

This instruction will not be useful unless it immediately follows an MUL instruction.

Traditionally, this instruction is called "ASCII Adjust After Multiplication". This would lead one to believe that it works on ASCII digits (030h (0) through 039h (9)), however this would be incorrect. This instruction actually operates on BCD digits (00h (0) through 09h (9)).

Due to a quirk of history, this instruction encodes the base of the result in the instruction (the second byte). As such, it is possible to have this instruction work on other bases through an immediate 8 bit operand. Such methods are not guaranteed to be supported by your assembler, and in such situations, one must encode the instruction directly.

This instruction is not valid in 64 bit mode, and if encountered, the processor will raise a #UD exception.


info-signThis pseudo-code uses a Rust-like syntax. A list of the types used is available here.
pub fn aam(imm8: u8) {
  if MODE == 64 {
  } else {
    AH = AL / imm8;
    AL = AL % imm8;

Flags Affected

The SF, ZF, and PF flags are set according to the resulting binary value in the AL register. The OF, AF, and CF flags are undefined.


Protected Mode

If an immediate value of 0 is used.
If the LOCK prefix is used.

Real-Address Mode

Same exceptions as protected mode.

Virtual-8086 Mode

Same exceptions as protected mode.

Compatibility Mode

Same exceptions as protected mode.

Long Mode

If in 64 bit mode.