title: Divide overflow in Assembly language
body: <p>I have a simple assembly program, where I want to divide two numbers (two byte sized) and print remainder. Here's my code </p>
  
  <pre><code>  .model small
  .stack 256
  
  .data 
      ten dw 10
  
  .code
  main proc
      mov ax, @data
      mov ds, ax
  
      mov ax, 12 ; divident
      div ten    ; ax/10
  
      mov ah, 9  ; for printing dx
      int 21h
  
      mov ax, 4c00h ; ending program
      int 21h
  main endp
  end main
  </code></pre>
  
  <p>So when I run this code the result is "Divide overflow" and I have no idea why does overflow happens. 
  Any ideas?</p>