Create an assembly language program that will have two arrays, of five elements
ID: 3831626 • Letter: C
Question
Create an assembly language program that will have two arrays, of five elements each.Sum the corresponding elements in the two arrays together and store the result in one of the arrays. Do this for each element. In other words:a[0] = a[0] + b[0]a[1] = a[1] + b[1]etc.When this is complete, add all of the values in the array that contains the sums together, and store that value in memory.The values in each array should be: 1, 2, 3, 4, 5.The code that adds the twoarrays togetherand then sums the elements togetheris to be in a separate sub-routine.
Explanation / Answer
DATA SEGMENT
NUM1 DB 36H,55H,27H,42H,33H
NUM2 DB 38H,41H,29H,39H,32H
RESULT DB 5 DUP (0)
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,NUM1
LEA DI,NUM2
LEA BX,RESULT
MOV CX,5
LOOP1:
MOV AL,[SI]
ADD AL,[DI]
MOV [BX],AL
INC BX
INC SI
INC DI
LOOP LOOP1
MOV AH,4CH
INT 21H
ENDS
END START
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.