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
One condition for deadlocks is the circular-wait condition. One way to ensure that this condition never holds is to impose a tot
Artyom0805 [142]
<h2>Dead lock is possible in Bank Transactions</h2>

Explanation:

Let us understand the term "Dead lock"

A deadlock is a situation where whole set of process is locked, since each of the process is waiting or holding the resource of another process. Each process will be interdependent and waiting for the same resource.

Deadlock is possible during bank transaction in the following situation:

A & B are two accounts where A tries to transfer funds to B and B tries to transfer fund to A.

When both tries to transfer funds at the same time, deadlock occurs.

A deadlock can be avoided by any one of the four methods.

They are: Mutual exclusion, No preemption, circular wait, hold and wait.

4 0
4 years ago
Read 2 more answers
To carry computer data over the long haul, wans need to have a(n) ________ in multiple towns and cities.
nika2105 [10]
<span>To carry computer data over the long haul, wan need to have a </span>POP (point of presence) <span>in multiple towns and cities. It is a</span><span>n artificial demarcation point OR interface point between communicating entities</span>


3 0
4 years ago
When you move into a new home or apartment, the first thing on your checklist should be to have the ____________ changed. (5 Let
Lynna [10]

Answer:

When you move into a new home or apartment, the first thing on your checklist should be to have the <u>locks</u> changed

Explanation:

Changing the locks

Given that the way the previous owners of the new home or apartment made use of the locks and the keys are usually not completely known to the new owners, one may never know all those that have a key or a means to gain access into the apartment or home. Therefore, in order to guarantee proper security, it is a good practice to have as one of the first thing on the checklist, the changing of the locks of the entrance doors and windows of the new home or apartment.

5 0
3 years ago
A keyboard shortcut to pasting in a document is to key _____.
m_a_m_a [10]
(Ctrl + V) is the shortcut for pasting.

Similarly, (Ctrl + C) is the shortcut for copying.
6 0
3 years ago
It is important to ____ the line in the code editing window in the exact location where you want to insert a code snippet to pro
stepan [7]

Answer:

right -click

Explanation:

<h2><u>Fill in the blanks </u></h2>

It is important to <u>right - click</u>  the line in the code editing window in the exact location where you want to insert a code snippet to produce the shortcut menu with the Insert Snippet command.

8 0
3 years ago
Other questions:
  • You work for a large enterprise company that handles time-sensitive information. Your supervisor has asked that you set up a con
    8·1 answer
  • Who is involved in helping shape the emotional impact of a film? (Select all that apply.)
    8·2 answers
  • Database software lets the user sort information alphabetically, chronologically, or numerically. Which is NOT a commonly used d
    7·1 answer
  • There is only one way to change line spacing in Word.
    14·1 answer
  • What section in an ethernet frame will you find a Virtual Local Area Network (VLAN) header?
    6·1 answer
  • Anyone want to talk? it can honestly be about any subject :)
    5·1 answer
  • What are the common uses of joysticks? ​
    12·1 answer
  • A workstation is out of compliance with the group policy standards set by the domain what command prompt would you use to ensure
    5·1 answer
  • Chris is working with other employees on a worksheet. the other employees have made comments, but they are not visible.
    11·1 answer
  • Question # 5
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!