Thursday, October 29, 2009

8086 Assembly Language Program to add the elements(byte) of 2 arrays and store the result(byte) in another array

data segment
arr1 db 10h,20h,30h,40h,50h
arr2 db 10h,20h,30h,40h,50h
arr3 db 5 dup (0)
data ends

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

mov ax,data
mov ds,ax

lea si,arr1
lea di,arr2
lea bx,arr3

mov cl,5

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

mov ah,4ch
int 21h
code ends
end start

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. mov ax,0
    mov bx,0
    mov cx,0
    mov ax,[arr1+bx]
    add ax,[arr2+bx]
    mov cx,[arr3+bx]
    mov cx,ax
    inc bx
    dec cl......is this code right ???

    ReplyDelete
    Replies
    1. Kindly someone help me to solve a program
      Sum of array element in assembly language 8086 microprocessor

      Delete