Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Code an assembly language program that has 2 arrays. In each array there will be

ID: 664244 • Letter: C

Question

Code an assembly language program that has 2 arrays. In each array there will be 5 elements.

The program must sum the elements from the 2 arrays and store the result in only one of the arrays. This process must be done for each element.

EX:

a[0] = a[0] + b[0]

a[1] = a[1] + b[1]

In the end, you must add all of the values in the array that contains the sums together, and store that

value in memory.The code that adds the two arrays together is to be in a separate sub-routine.

This program must work with the Arc Tools Simulator from the following link:

http://bcs.wiley.com/he-bcs/Books?action=weblinks&bcsId=3800&itemId=0471733881&webLinkURL=http://higheredbcs.wiley.com/legacy/college/murdocca/0471733881/arctools/arctools.htm

.

Explanation / Answer

when I try to install tools given by your link.it was faling... Any how here is code

segment .bss
;
segment .data
summessage db "The Calculated Sum is: ", 0
segment .text
extern readdouble,print_string, read_int, write, print
global addarray
addarray:
pusha
mov edi, 0 ;counter starting with zero value
mov ecx, 0 ;increment decrement operators
mov edx, 0

mov ebx, [esp+48] ;star accesing first array contents
mov edi, [ebp+40] ;moving data
mov ebp, [esp+60] ;loading second array data

mov esi, [esi] ;moving to third resultant array at start location

;mov ecx, [ebp]
;mov edx, [ebp+4]
;call write
;call print

add_loop:

fld qword [ebx] ;
fld qword [ebp]

fadd ;added both araays first elemetns and storing
;

fstp qword [esi] ;top of stack copyting here
mov ecx,[ecx]
mov edx,[edx+4]

mov [esi], ecx
mov [esi+4], ecx
add esi, 8 ;increment to the next loaction of esi

add ebx,8 ;incrementing to point to next element in first array
add ebp,8 ;incrementing to point to next element in second array

dec edi ;
jnz add_loop
add_done:
popa
ret