Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is in ASSEMBLY LANGUAGE x86 MASM. Type in the code SumArray.asm shown in your textbook Section 4.5.4. Modify the code so that it takes

This is in ASSEMBLY LANGUAGE x86 MASM. Type in the code SumArray.asm shown in your textbook Section 4.5.4. Modify the code so that it takes the following array

intarray DWORD 090000h,0A0000h, 0B0000h,0D0000h, 020000h,080000h, 300000h,400000h

The main program

There are there parts that you have to code:

Part 1: Use the existing code from SumArray.asm to add all the array elements.

This means that you code as to perform the following operation:

a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7

where with a0, a1, etc. I noted the array elements.

Part 2: Besides the sum of the array elements, add code to perform the following operation:

a0 - a1 - a2 - a3 - a4 + a5 + a6 + a7

Part 3: Use WriteInt to display the sum of the array and the operation shown above with appropriate messages to the console. The messages can be "The sum of the array elements is:" and "a0 - a1 - a2 - a3 - a4 + a5 + a6 + a7 equals: "

Requirements:

Use a loop to add all array elements as shown in SumArray.asm

In part 2 of this project, use a loop to subtract a1 ... a4. Also, use a loop to add a5 ... a7.

Do not just display numbers on your console. You have to have messages to tell the user of your program what that number is about.

Read the text and make sure you understand the textbook code. Write a comment for each line of code you add to the project.

HERE IS THE CODE I HAVE SO FAR:

INCLUDE c:\Irvine\Irvine32.inc

;// .386

;// .model flat,stdcall

;// .stack 4096

ExitProcess proto,dwExitCode:dword

.data ;// write your data in this section

intarray DWORD 10000h, 20000h, 30000h, 40000h

.code ;// write your program here

main proc

mov edi, OFFSET intarray

mov ecx, LENGTHOF intarray

mov eax, 0

L1:

add eax, [edi]

add edi, TYPE intarray

loop L1

invoke ExitProcess,0

main endp

end main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

User Defined Tensor Data Analysis

Authors: Bin Dong ,Kesheng Wu ,Suren Byna

1st Edition

3030707490, 978-3030707491

More Books

Students also viewed these Databases questions