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]
2 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]2 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
Jasmine plays a game on her computer screen. A moving balloon appears on the screen, and she has to pop the balloon by clicking
Elena-2011 [213]
Please find the answer as attachment.

4 0
2 years ago
Use the drop-down menus to complete the steps to share a presentation through OneDrive.
charle [14.2K]

Answer:

Share

OneDrive

In real time

Send

Explanation:

5 0
3 years ago
TODAYS ATTENDANCE QUESTION: Why do you think it is important to be able to measure using a ruler in Technology & Engineering
Vaselesa [24]

Answer:

Because it takes precision to a lot of things in tech and Eng. We need to measure all kinds of things, like wood, metal/etc. for computers and things that we use everyday, Because our world goes around being precise about things that we need everyday, like tables and things.

Explanation:

3 0
3 years ago
What ip class is this address: 128-191.255.255.255?
defon
Class B would be the correct answer.
4 0
3 years ago
What is the command to disable any Processes in linix??
stiks02 [169]

Answer: killall[process_name]  or kill[PID]

Explanation:

Killall is a tool for disabling running processes on the system. It will disable all programs that matches the name mentioned.

kill disables processes based on process id numbers. it does not disable the process directly. The process recieves a signal where the process will follow instructions which it has to follow if it receives the signal.

7 0
2 years ago
Other questions:
  • Copy the 10 statements as they appear below into your journal.
    6·2 answers
  • The first character of the VIN designates which of the following? 
    15·2 answers
  • Which of following allows you to share a file with someone that is too large to send via e-mail?
    5·1 answer
  • . Why should we favor programming to interfaces over implementations?
    6·1 answer
  • Can you please help on number 1 and 2?
    13·1 answer
  • Which is a value of the Scrum Manifesto?
    9·1 answer
  • On the server side, the database environment must be properly configured to respond to clients' requests in the fastest way poss
    12·1 answer
  • Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write yo
    8·1 answer
  • Can somebody help me out
    15·1 answer
  • What technology does kroger’s edge technology and amazon’s just walk out technology leverage?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!