Decimal arithmetic instructions

In about 15 years of Assembly development and reverse engineering software, I encountered these instructions exactly once, and that was in the college. However, it would be right to mention them, for a few reasons:

  • Instructions like AAM and AAD may sometimes be used as a smaller variant of multiplication and division, since they allow immediate operand. They're smaller as they allow generation of smaller code due to their encoding.
  • Sequences like AAD 0 (which is division by zero) may be used as an exception trigger in certain protection schemes.
  • Not mentioning them would be historically wrong.
Decimal arithmetic instructions are illegal on 64-bit platforms.

First of all, what is BCD? It is Binary coded decimal ...

Get Mastering Assembly Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.