Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Build a software project made of individual modules as shown in the diagram on one of the following pages. The diagram shows the calling hierarchy. It does not show the sequence of calls. The sequence (ordering) of execution can be derived from the sample execution on the next page.


Sample execution

This driver program will start the main assembly function.

Welcome to Array Processing programmed by Jennifer Wang.

Please enter quadword floats for storage in an array. Separate inputs with white space. Press enter followed by control+D to terminate.
3.0
9.0
1.0
2.0
<Cntl+D>

Thank you. This is the array:

Index Physical address Decimal value
0 000FFF4085108438 3.00000000000
1 000FFF4085108440 9.00000000000
2 000FFF4085108448 1.00000000000
3 000FFF4085108450 2.00000000000

Next the array will sorted by pointers.

The array after sorting by pointers is:
Index Physical address Decimal value
2 000FFF4085108448 1.00000000000
3 000FFF4085108450 2.00000000000
0 000FFF4085108438 3.00000000000
1 000FFF4085108440 9.00000000000

The array without sorting by pointers is still present:
Index Physical address Decimal value
0 000FFF4085108438 3.00000000000
1 000FFF4085108440 9.00000000000
2 000FFF4085108448 1.00000000000
3 000FFF4085108450 2.00000000000

The driver received this number:
3.0000000

Have a nice day. This driver will return 0 to the operating system. Bye.


Use at least 8 decimal digits on the right side of the point.



use “C language and “C++ language” interchangeably. They both compile into indistinguishable object files. You decide which compiler you wish to use.

The driver program. This module initiates the run. It calls the main X86 program. It sends no data to the main X86 program, but when the main assembly program terminates the driver receives the number in slot 0 of the original array.


The main assembly program. This program module calls each of the modules on the third lever of the hierarchy diagram. This modules passes data to the called modules according to the universal standard for passing data. [This is one of the key concepts you should take away fro this course.]


The inputqarray program. This program iterates asking the user if he or she has more data to enter. When this program has finished collecting data from the human user then it “sends back” an array containing the inputted data, and it sends back an integer which is the count of the number of elements entered into the array.


The outputarray program. This program outputs all the numbers of the array in three columns. There are brief descriptive headings above each column. Be cautious. This program does not receive the data array itself, but rather, it receives the array of pointers to the data array.


The sort module is written in a conventional language. Go copy a sort program from a textbook. In that manner you will know that the sort function itself is fully debugged. You may pick any sort algorithm that you like.


Miscellaneous

Float numbers may be outputted with 8 digits on the right of the point. There is no need to test extreme data values. This assignment is about calling subprograms and passing parameters.

When developing your program you can view data stored in an array by using the dumpstack subprogram. Suppose 'testscores' is the name of an array that currently hold 14 quadwords. Then the following two instructions will display that array.
mov rbp, testscores
dumpstack 50, 0, 14
It is often useful to see the contents of an array.



Suggested test data

Run #1: Begin with the data from the sample execution shown elsewhere in this document.
3.0
9.0
1.0
2.0


Run #2: Another simple case that can be verified manually
5.5
1.5


Run #3
1.8
2.6
4.3
-5.1
8.7


Run #4
The array is empty: Simply input Cntl+D


Run #5: A single number.
16.6


Run #6
309.6
0.0
0.0
0.0
0.0
300.8


Run #7
30000000.3
0.00000003
0.00000009
0.00000004
20000000.1


Run #8 A bigger array
1000000.048
1000000.036
1000000.077
1000000.071
1000000.058
1000000.062
1000000.043
1000000.029
1000000.039
1000000.061
1000000.053
1000000.049
1000000.050
1000000.026
1000000.088
1000000.033


[End of suggested test data]


What to do when you are finished.

These are you choices.

1. Do nothing. Don’t show your program to anyone. Keep it in your computer for reference on the day of the final exam.

2. Demonstrate a run of the program to the instructor. On any class meeting after the lecture has finished go to the front of the room and tell me you have worked on sorting program. I will like to see you run it.

3. You can email me a copy of your source files. Please include the script file for compiling and linking. I will be very happy to run your program on my machine. I will reply to you via email with any helpful comments. The negative side of this approach is that I am very swamped with a myriad of things to do, and probably you will not receive a rapid response. But I am still delighted if you send me anything.

What I have tried:

Brain bomb

question solve should be c++ file and .asm file

cpp:
#include <stdio.h>

extern "C" double Arrayprocessing();                      

int main(){

  double return_code = -99.99;                              
  return_code =Arrayprocessing();
  printf("%s%1.18lf%s\n","The driver received return code ",return_code, ".  The driver will now return 0 to the OS.  Bye.");

  return 0;                                    

}
Posted
Updated 16-May-18 20:58pm

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
And 3 lines of C code does not count as "What you have tried"!

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
Quote:
X86 assembly sorting problem

What problem do you have on this HomeWork ?

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900