Program
assume cs:code,ds:data
data segment
v1 db 0ah,0dh,"Enter the first num:$"
v2 db 0ah,0dh,"Enter the second num:$"
arr1 db 04h dup(?)
arr2 db 04h dup(?)
r db 0ah,0dh,"The result is:$"
data ends
code segment
READ macro
mov ah,01h
int 21h
endm
WRITE macro
mov ah,02h
int 21h
endm
start:mov ax,data
mov ds,ax
lea dx,v1
mov ah,09h
int 21h
mov cl,04h
mov si,offset arr1
l1:READ
sub al,30h
mov [si],al
inc si
dec cl
jnz l1
lea dx,v2
mov ah,09h
int 21h
mov cl,04h
mov di,offset arr2
l2:READ
sub al,30h
mov [di],al
inc di
dec cl
jnz l2
clc
mov cl,04h
l3:dec si
dec di
mov bl,[si]
mov al,[di]
adc al,bl
mov ah,00h
aaa
mov [di],al
dec cl
jnz l3
mov ch,00h
jnc l5
mov ch,01h
l5:lea dx,r
mov ah,09h
int 21h
mov dl,ch
add dl,30h
mov ah,02h
int 21h
mov cl,04h
l4:mov dl,[di]
add dl,30h
WRITE
inc di
dec cl
jnz l4
mov ah,4ch
int 21h
code ends
end start
data segment
v1 db 0ah,0dh,"Enter the first num:$"
v2 db 0ah,0dh,"Enter the second num:$"
arr1 db 04h dup(?)
arr2 db 04h dup(?)
r db 0ah,0dh,"The result is:$"
data ends
code segment
READ macro
mov ah,01h
int 21h
endm
WRITE macro
mov ah,02h
int 21h
endm
start:mov ax,data
mov ds,ax
lea dx,v1
mov ah,09h
int 21h
mov cl,04h
mov si,offset arr1
l1:READ
sub al,30h
mov [si],al
inc si
dec cl
jnz l1
lea dx,v2
mov ah,09h
int 21h
mov cl,04h
mov di,offset arr2
l2:READ
sub al,30h
mov [di],al
inc di
dec cl
jnz l2
clc
mov cl,04h
l3:dec si
dec di
mov bl,[si]
mov al,[di]
adc al,bl
mov ah,00h
aaa
mov [di],al
dec cl
jnz l3
mov ch,00h
jnc l5
mov ch,01h
l5:lea dx,r
mov ah,09h
int 21h
mov dl,ch
add dl,30h
mov ah,02h
int 21h
mov cl,04h
l4:mov dl,[di]
add dl,30h
WRITE
inc di
dec cl
jnz l4
mov ah,4ch
int 21h
code ends
end start
burr.. thank you.. :)
ReplyDelete