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;
}