Tuesday, October 27, 2009

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

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

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

mov ax,data
mov ds,ax

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

inc si
dec cl

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

mov res, al

mov ah, 4ch
int 21h

code ends
end start

No comments:

Post a Comment