title: Microsoft ASM interview question?
body: <p>I was looking online through samples of interview questions asked in the past by Microsoft and came across this one:</p>
  
  <blockquote>
    <p>The following asm block performs a
    common math function, what is it?</p>
  
  <pre><code>cwd xor ax, dx
  sub ax, dx
  </code></pre>
  </blockquote>
  
  <p>Can somebody please answer this and explain the answer to me?  Thanks!!</p>
  
  <p><strong>Update</strong> : okay, so its computes the absolute value.  Can somebody please explain step by step how it does this? I.e. explain what gets put in which register in each instruction and the alu operation that is performed on which registers etc..Thanks!</p>