title: How to add two hexadecimal number in assembly language?
body: <p>I am trying to add two hexadecimal number in assembly language.one is 0fh(decimal 15) another is 0eh(decimal 14).I am getting the sum =00011101 which is the  binary of decimal 29.But my expected result was 00101001(where 0010 is the  binary value of 2 and and 1001 is the binary value of 9).Here is my code:</p>
  
  <pre><code>name "add-sub"
  
  org 100h
  
  mov al, 0fh       ; hex=0fh=dec15  
  mov bl, 0eh      ; hex=0eh=dec14
  
  add bl,al
  
  mov cx, 8
  print: mov ah, 2   ; print function. interupt er subfunction
         mov dl, '0'
         test bl, 10000000b  ; test first bit.
         jz zero
         mov dl, '1'
  zero:  int 21h; find interupt  subfunction
         shl bl, 1
  loop print
  
  ; print hexa suffix:
  mov dl, 'h'
  int 21h
  
  ; wait for any key press:
  mov ah, 0
  int 16h
  
  ret
  </code></pre>