title: DOS assembly Simple math
body: <p>I have a number stored in dl, and I need this to work for numbers up to three digits? Here is the working code for digits 0-9. </p>
  
  <pre><code>WriteNumber:
  ;; print out number in dl
  push ax
  push dx
  add dl,"0"
  mov ah,02h ; printing one char
  int 21h
  pop dx
  pop ax
  ret
  </code></pre>
  
  <p>For example, for two digits. I could take dl/10. And then print out the result and the rest as to different chars. But I got an error, because the number needs to be in AX register for the DIV. </p>
  
  <p>I need to do this: </p>
  
  <p>mov ax,dl</p>
  
  <p>But that won't work? </p>