title: How do ASCII Adjust and Decimal Adjust instructions work?
body: <p>I've been struggling with understanding the ASCII adjust instructions from x86 assembly language.</p>
  
  <p>I see all over the internet information telling me different things, but I guess it's just the same thing explained in a different form that I still don't get.</p>
  
  <p>Can anyone explain why in the pseudo-code of <a href="http://felixcloutier.com/x86/AAA.html" rel="nofollow noreferrer"><code>AAA</code></a>, <a href="http://felixcloutier.com/x86/AAS.html" rel="nofollow noreferrer"><code>AAS</code></a> we have to add, subtract 6 from the low-order nibble in AL?</p>
  
  <p>And can someone explain <code>AAM</code>, <code>AAD</code> and the Decimal adjust instructions pseudo-code <a href="http://felixcloutier.com/x86/AAM.html" rel="nofollow noreferrer">in the Intel instruction set manuals</a> too, why are they like that, what's the logic behind them?</p>
  
  <p>And at last, can someone give examples when these instructions can be useful, or at least in what applications they have been useful in the past.</p>
  
  <p>I know that nowadays these instructions aren't used, but I still want to know how these instructions work, it's good to know.</p>