8086 Program - Sum of Two Input Numbers

This is an assembly language program for 8086 microprocessor in which user gives two data as input and the program finds its sum. Here, only one digit data is permitted. What we input here is in ASCII value, so we subtract by 48 before addition; and add by 48 after addition so that we can properly display the value in decimal value.

.model small 
.data
str1 db "Enter first number: $"
str2 db 13,10,"Enter second number: $"
str3 db 13,10,"The sum is: $"
.code
main proc
    mov ax,@data
    mov ds,ax
    lea dx,str1
    mov ah,9
    int 21h
    mov ah,1
    int 21h
    mov bl,al
    lea dx,str2
    mov ah,9
    int 21h
    mov ah,1
    int 21h
    mov bh,al
    sub bh,48
    sub bl,48
    lea dx,str3
    mov ah,9
    int 21h   
    add bh,bl
    add bh,48
    mov dl,bh
    mov ah,2
    int 21h
    mov ah,4Ch
    int 21h
main endp
end

32 comments:

  1. sakib tmi ekta bolod

    ReplyDelete
  2. Habib shobceye boro bolod!

    ReplyDelete
  3. how to modify this? I want to sum numbers over 10

    ReplyDelete
  4. You Could Better Explain The Procedure As Well,So That One Can Understand Properly.

    ReplyDelete
  5. Aong sing nu marma Tui Ki kokono Valo Hobi Nah??????????????

    ReplyDelete
  6. baal dao bujhi nai

    ReplyDelete
  7. <a href = "https://madhink.com></a> go here

    ReplyDelete
  8. chutiya bana diya re

    ReplyDelete