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
Fiesta28 [93]
3 years ago
8

Using a loop and indexed addressing, write assembly language code that rotates the members of a 32-bit integer array forward one

position. The value at the end of the array must wrap to the first position. For example, the array [10, 20, 30, 40] would be transformed into [40, 10, 20, 30]
Computers and Technology
1 answer:
AveGali [126]3 years ago
7 0

Answer:

Here is the code which will rotate the array.

*************************************************************************

.386

.model flat,stdcall

.stack 4096

ExitProcess PROTO, dwExitCode:DWORD

section .data

array DWORD 10,20,30,40 ; Initialising the array  

arrayType DWORD TYPE array

newArray DWORD LENGTHOF array DUP(?)

lastElement DWORD ?

.code

main PROC

 

   ;First Element will be moved to register ESI

   mov ESI, OFFSET array

   ;Next Array Element in EDI

   mov EDI, OFFSET newArray  

   ADD EDI, TYPE newArray

   ;Loop Counter set into register ECX

   mov ECX, LENGTHOF array

L2:

   mov EAX, [ESI]

   mov [EDI], EAX

   ADD ESI, TYPE array

   ADD EDI, TYPE array

   LOOP L2

   ; following will set the last element of array into first position of newArray

   mov EDI,OFFSET newArray

   mov EAX, [ESI]

   mov [EDI], EAX

INVOKE ExitProcess,0

main ENDP

END main

Explanation:

<em>.386 - It will enable assembly of non privileged instruction for 80386 processor. </em>

<em>.model flat, stdcall - It will explain about which memory to use.  </em>

<em>.stack 4096 - It is used to inform assembler to reserver 4096 bytes of uninitialised memory. </em>

<em>.code is a code section. </em>

<em>section .data is used to declare initialized data.</em>

<em>DWORD is a type specified with 4 bytes address. </em>

<em>EAX, EDI, ESI, ECX are Registers </em>

<em>mov- It will move data from one register to another. </em>

<em>ADD- Add two values. </em>

You might be interested in
If you don’t have a paper copy of the FAFSA form, how else can you fill it out?
Ronch [10]
Go on your school computer, and find a copy of the form. Then print it from the school printer.
3 0
3 years ago
Read 2 more answers
The seven basic internal components found in a computer tower
Minchanka [31]
Motherboard, CPU, RAM, PSU, HDDs, GPU, and a Sound card.
8 0
4 years ago
You need to set up a network that needs to span multibple buildings. For this reason, you want to use the cabling that supports
prisoha [69]

Answer:

Extended star topology

Explanation:

The Extended star topology also known as the tree topology comprises of characteristics of the linear bus topology and star topology.

It consist of multiple star connected topologies connected to a linear backbone bus topology. It has a wider communication area than the star topology and uses more cabling length. All the star networks are connected to a central connection which allows to have a full functioning network when others fails.

5 0
4 years ago
At which stage should James, a website designer, gather information about the website he wants to create, and at which stage sho
viva [34]
<h2>Answer: James should gather information in the <u><em>Learning</em></u> phase and begin the site’s coding in the <u><em>Development</em></u> phase.</h2>

8 0
3 years ago
What products use fabric manipulation
Komok [63]
The fabric satin is good for fabric manipulation.
8 0
3 years ago
Other questions:
  • Write a shell (text-based) program, called sum_second.py, that opens a text file called stuff.txt with 2 numbers per line separa
    8·1 answer
  • What was the technology that defined each of the four generations of computers?
    12·1 answer
  • While surfing online, Patricia checks her email and reads the latest messages. She then browsers a website and logs in a comment
    8·1 answer
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • write a C program the prints out the size of variables with the following C data types- int, long, unsigned, long long, double,
    7·1 answer
  • 2 ways to make your computer work faster ( please help asap )
    6·1 answer
  • What is the standard unit used to measure mass?​
    9·1 answer
  • JAVA<br>plzz help...............​
    7·1 answer
  • What are the differences between a cursor, insertion point and mouse pointer?​
    14·1 answer
  • Your program has a loop. You want to exit the loop completely if the user guesses the correct word.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!