1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jenyasd209 [6]
3 years ago
11

Write an assembly language program with a loop and indexed addressing that calculates the sum of all the gaps between successive

array elements. The array elements are DWORDs, sequenced in non-decreasing order. For example, the array [0, 2, 5, 9, 10] has gaps 2, 3, 4, and 1, whose sum equals 10.
Computers and Technology
1 answer:
PSYCHO15rus [73]3 years ago
7 0

Answer:

Description: Write a MASM 32bit program with a loop and indexed addressing that calculates the sum of all thegaps between successive array elements. The array elements are doublewords, sequenced in nondecreasing order.

;Include Irvine32.inc file used with link library for 32 bit applications

.386

.model flat,stdcall

.stack 4096

ExitProcess proto,dwExitCode:dword

INCLUDE Irvine32.inc

.data

myArray DWORD 0,2,5,9,10

arrSize = ($-myArray)/TYPE myArray

gapArr DWORD arrSize-1 DUP(?)

sum DWORD ?

.code

main PROC

;Call the procedure

call Clrscr

;Initialize ESI pointer

mov esi, 0

mov ecx, arrSize

dec ecx

L1:

mov eax, myArray[esi+4]

sub eax, myArray[esi]

mov gapArr[esi], eax

inc esi

loop L1

;Calculate the sum of gaps between array elements

mov sum, 0

mov esi, 0

mov ecx, arrSize

dec ecx

;  move gapArr[esi] to a temporary register and then add that register value to sum

L2:

mov edx, gapArr[esi]  

add sum, edx

inc esi

loop L2

       INVOKE ExitProcess,0

main ENDP

END main

Explanation:

You might be interested in
Which function can be used to insert the current date into a spreadsheet?
VladimirAG [237]

Answer:

im pretty sure it MM/DD/YYYY

Explanation:

3 0
3 years ago
In the 2000s, Venezuelan President Hugo Chàvez instituted economic policies that caused smuggling and hoarding of food. What did
icang [17]
Chavez set a price ceiling on food. This is represented by the letter C - A price ceiling is a control or limit imposed by a government over how high a price can be charged for a product. By doing this, Hugo Chavez made a huge blunder, since it resulted in the quantity of food demanded exceeding the quantity supplied. This in turn resulted in people smuggling and hoarding food.
7 0
4 years ago
What may happen if a large number of computer users are attempting to access a web page
Misha Larkins [42]
If the computers where all trying to access the same website then that website might be slow to load or it could crash all together.
7 0
3 years ago
Before you start creating a database, you should first use paper to plan, test, and revise. True False
Licemer1 [7]
<span>Before you start creating a database, you should first use paper to plan, test, and revise. True or False?
TRUE</span>
8 0
4 years ago
Read 2 more answers
What special skill does a developer need to thelp produce timely solutions for users
Gnom [1K]
All we need is Faith, Trust, and Pixie Dust...
4 0
3 years ago
Other questions:
  • Which of the following answers refers to a system containing mappings of domain names to various types of data, such as for exam
    6·1 answer
  • g c 24-hour time (also known in the U.S. as military time) is widely used around the world. Time is expressed as hours since mid
    7·1 answer
  • Psychographics may also be called A. personality analytics. B. social group dynamics. C. lifestyle analysis. D. opinion insight.
    6·1 answer
  • 1. Assume you're using a three-button mouse. To access shortcut menus, you would
    6·2 answers
  • What will be result of below if statement.
    13·1 answer
  • Identify the problems that computer program bugs can cause. Check all that apply.
    9·2 answers
  • Need the answer ASAP!!! I’ll mark brainliest if correct
    12·2 answers
  • Help with Java, please!
    5·1 answer
  • True or false: If you have a 32-bit CPU architecture, it's recommended to use a 64-bit operating system.
    14·1 answer
  • Silicone rubber and urethane caulks generally give the ____________ overall performance for exterior building envelope applicati
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!