Thursday, January 13, 2011

8086 PROGRAM::2.Sum of two single digit number

print macro msg
lea dx,msg
mov ah,09h
int 21h
endm
read macro
mov ah,01h
int 21h
endm

.model small
.stack 100h
.data
msg1 db 10,13,'Enter the 1st number $'
msg2 db 10,13,'Enter the 2nd number $'
msg3 db 10,13,'Sum= $'
.code

mov ax,@data
mov ds,ax
;read first number
print msg1
read
mov bl,al
;read second number
print msg2
read
;find sum
add bl,al
;display sum
print msg3
mov dl,bl
sub dl,30h
mov ah,02
int 21h
mov ah,4ch
int 21h
end

No comments: