Tuesday, October 27, 2009

8086 Assembly Language Program to add elements(word) of an array.Assume result is also a word

data segment
arr dw 10h,20h,30h,40h,50h
res dw 1 dup (0)
data ends

code segment
assume cs:code,ds:data
start:

mov ax,data
mov ds,ax

lea si,arr
mov ax,[si]
mov cl,5

inc si
inc si
dec cl

l1:add ax,[si]
inc si
inc si
dec cl
jnz l1

mov res, ax

mov ah,4ch
int 21h

code ends
end start

No comments:

Post a Comment