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
kondor19780726 [428]
3 years ago
14

Write an x86_64 Assembly program that sorts a programmer-defined array. The size of the array and the address of the array shoul

d be passed to the called sort function via registers. You can choose the sorting algorithm to be implemented. A simple example would be Bubble Sort. Test using 5 or 10 elements. You know know how to print character digits, you may print the array before and/or after sorting to look at the contents of your array.
Computers and Technology
1 answer:
sashaice [31]3 years ago
5 0

Answer:

Check the explanation

Explanation:

Algorithm –

Load data from offset 500 to register CL (for count).

Travel from opening memory position to last and evaluate the two numbers if first number is bigger than second number then we will have to swap them.

First pass fix the position for last number.

Decrease the count by 1.

Again travel from opening memory position to (last-1, by help of count) and compare 2 numbers if second number is smaller than that of the first number then swap them.

Second pass fix the position for last two numbers.

Repeate.

Step by step Explanation –

MOV SI, 500: set the value of SI to 500.

MOV CL, [SI]: load data from offset SI to register CL.

DEC CL: decrease value of register CL BY 1.

MOV SI, 500: set the value of SI to 500.

MOV CH, [SI]: load data from offset SI to register CH.

DEC CH: decrease value of register CH BY 1.

INC SI: increase value of SI BY 1.

MOV AL, [SI]: load value from offset SI to register AL.

INC SI: increase value of SI BY 1.

CMP AL, [SI]: compares value of register AL and [SI] (AL-[SI]).

JC 41C: jump to address 41C if carry generated.

XCHG AL, [SI]: exchange the contents of register AL and SI.

DEC SI: decrease value of SI by 1.

XCHG AL, [SI]: exchange the contents of register AL and SI.

INC SI: increase value of SI by 1.

DEC CH: decrease value of register CH by 1.

JNZ 40F: jump to address 40F if zero flat reset.

DEC CL: decrease value of register CL by 1.

JNZ 407: jump to address 407 if zero flat reset.

HLT: stop.

You might be interested in
In order to avoid slipping in the shop, your footwear should ___________.
Arisa [49]

Answer:

b

Explanation:

has traction so it can grip

4 0
3 years ago
Write a program and flowchart. The program should ask the user for the average temperature in each of the last 12 months. After
Afina-wow [57]

#First we define the variables to house the temperatures

#temp is an empty array that will be used to store the temperature

Temp = []

#The months is defined as stated below

months = 12

#Ask the user for the temperature input and unit if possible

print("Kindly enter the temperature here")

#the program enter loop to get the temperatures.

for x in range(months):  

   InitTemp = str(input("Kindly add the unit behind the number .eg C for celcius"))

   Temp.append(InitTemp)

j=0

for x in range(len(Temp)):  

   j=j+1

   print("The Temperature is", " ", Temp[x], "for the ", j, "Month" )

#there is an attached photo for the flowchart

5 0
3 years ago
Python comes with ________ functions that have been already prewritten for the programmer.
Gnoma [55]
Python comes with built-in functions...
6 0
3 years ago
A group of computers that are interconnected in order to share information or documents is called what?
Rufina [12.5K]
It is a type of network . and the network's name is computer network
4 0
3 years ago
What are the advantages and drawbacks of using solar energy
Ray Of Light [21]

upfront price, but dependent on how long you use it you will save money, also the power it provides per square inch is low but that will be solved with time.

5 0
3 years ago
Other questions:
  • You manage the IT department at a small startup Internet advertiser. You need to set up an inexpensive system that allows custom
    14·1 answer
  • Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate
    10·2 answers
  • Which of the following statements is TRUE?
    11·2 answers
  • Which printout will result from the snippet of code?
    9·1 answer
  • Write one for loop to print out each element of the list several things. then write another for loop
    5·1 answer
  • Which of the following statement is true? Single choice. (2 Points) Views are virtual tables that are compiled at run time All o
    12·1 answer
  • After turning volume all the way up on your computer speaker you still can’t hear any sound. What should be done next
    15·1 answer
  • There are ______ type of accounts
    14·2 answers
  • Abdul wants to create a header for a webpage and enters this line: Welcome to Abdul’s webpage! , but the title is smaller than w
    12·1 answer
  • For a single CPU core system equipped wiith addditional hardware modes (besides user and kernel), choose those items that are ex
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!