AAD is the opposite of AAM. It takes two unpacked BCD digits, tens in AH and ones in AL, and combines them into a single binary number: AL becomes AH × 10 + AL, and AH becomes 0. SF, ZF and PF are set from the result in AL; OF, AF and CF are undefined.
Unlike the other ASCII adjustments, AAD goes before the arithmetic. Once the two digits are one binary value in AX, an ordinary DIV by a single digit can follow, and its quotient (at most 99 ÷ 1) and remainder are ordinary binary numbers.
MOV AX, 0703h ; unpacked 73: AH = 7, AL = 3AAD ; AX = 73 (0049h)MOV BL, 5DIV BL ; AL = 14, AH = 3AAM ; AH = tens, AL = onesOR AX, 3030h ; both digits -> charactersMOV BX, AXMOV DL, BHMOV AH, 02h ; DOS: print DLINT 21hMOV DL, BLMOV AH, 02hINT 21h
Converting typed digits
It is also a short way to turn two typed ASCII digits into a number. With the tens character in AH and the ones character in AL, strip the 30h from both, then AAD:
AND AX, 0F0Fh ; '4','2' -> 04h, 02hAAD ; AX = 42
Pitfalls
Both digits must already be unpacked, 0–9 each, with the ASCII 30h removed; otherwise the result is not what you expect. Only two digits fit: for longer numbers, multiply and add in a loop yourself. A DIV by a byte after AAD puts the remainder in AH, so call AAM on the quotient, as above, to see it as digits again.
Encoding and later CPUs
AAD is the bytes D5h 0Ah; the second byte is the multiplier, and Intel CPUs honour other values (DB 0D5h, 16 combines two hex digits), though 8086-era assemblers only write the plain form. AAD is not available in 64-bit mode.