title: Assembly,add function
body: <p>I've a problem in my assembly code.I want to add user input two numbers  after the swapping the numbers but when i add those numbers add function did not work well.Thanks</p>
  
  <p>This the code</p>
  
  <pre><code>.model small 
  .stack 100h
  .data
          msg1 db 'Enter the number1:$'
          msg2 db 'Enter the number2:$'
          msg3 db 'After swap numbers are:$'
          msg4 db 'Sum is:$'
          num1 db ?
          num2 db ?
          sum db ?
          diff db ?
  .code
  MAIN PROC
          mov ax,@data
          mov ds,ax
  
          mov ah,09h         ;display first msg
          mov dx,offset msg1
          mov ah,01h         ;taking input
          int 21h
          mov num1,al
  
  
          mov ah,09h         ;display second msg
          mov dx,offset msg2
          int 21h
          mov ah,01h         ;taking input
          int 21h
          mov num2,al
  
          mov bl,num1
          mov cl,num2
          mov num1,cl
          mov num2,bl
  
          mov ah,09h         ;display third msg
          mov dx,offset msg3
          int 21h
          mov ah,02h
          mov dl,num1
          int 21h
          mov ah,02h
          mov dl,num2
          int 21h
  
          mov bl,num1
          add bl,num2
          mov sum,bl
  
          mov ah,09h       ;display fourth msg
          mov dx,offset msg4
          int 21h
          mov ah,02h
          mov dl,sum
          int 21h
  
          mov ah,4ch
          int 21h
  MAIN ENDP 
  
  END MAIN
  </code></pre>