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
What is the key to satisfaction and success when choosing a career
ELEN [110]

Answer:

be yourself

Explanation:

3 0
3 years ago
Read 2 more answers
• The technical support department at your company has informed you that you will be receiving a new computer within the next we
alexdok [17]
1) back up your data
2) delete any personal information
3) clear cookies, browsing data, and saved passwords
4) restore any settings you may have changed to original settings
6 0
3 years ago
Convert to binary 140
Ber [7]

00110001 00110100 00110000

5 0
3 years ago
What is the difference between a function with parameters, and a function<br> without parameters? *
Romashka [77]

Answer:

A function with out parameters cannot take any arguments or perform operations on variables passed in. A function with parameters can.

8 0
2 years ago
La energía se mide en:<br><br>A. ? julios<br>B. ? vatios<br>C. ? newton<br><br>​
joja [24]
La unidad de medida de energía oficial es el Joule (J). El kilovatio / hora (kWh), utilizado especialmente para la energía eléctrica, debe figurar entre las unidades más comunes de medición de energía (de hecho, se utiliza para calcular las facturas de electricidad). Entonces es B.
7 0
3 years ago
Read 2 more answers
Other questions:
  • What is malware short for?
    13·2 answers
  • You are asked to optimize a cache design for the given references. Th ere are three direct-mapped cache designs possible, all wi
    7·1 answer
  • What are some characteristics of filtering junk email in Outlook 2016? Check all that apply.
    9·2 answers
  • An enterprise system is a packaged software application that helps integrate various ___________ in a company.
    15·2 answers
  • Which of the following illustrations is depicted in the icon that's used to access Windows Help and Support files?
    13·1 answer
  • Is the following statement TRUE or FALSE?
    9·1 answer
  • 5. How would you describe the relationship between blocks of code and commands?​
    14·2 answers
  • D. DROP
    6·1 answer
  • A company is developing a smart TV that connects to a wireless home network. Which technology can best help to establish this co
    11·2 answers
  • Can able to Computer decide its input by itself? How ?​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!