You might find the .space
directive useful here, altho you could allocate the array on the stack if you wish to have a cleaner implementation.
Your program should seed the random number generator with the given seed. It should then make n calls to the random number generator. These values should be stored in the array in the order they are generated. The random numbers shold be between 0 and 10,000. Note, there are system calls to generate a random value in a range.
Once your program has generated the specified number of integers, it should print them out, on a single line, separated by a comma and a space. The last integer should not be followed by a comma or a space, but a newline should be printed. For example if the numbers are 1, 2 and 3 the output should be
1, 2, 3\n
You should then sort the array using whatever sorting algorithm you wish to implement. After the array has been sorted, print values in order using the above format.
You should implement at least three function, I suggest PrintArray, Sort, FillArray. These functions must follow the calling convention, and should at miminimum pass the base address of the array and the size of the array. Please pass other paramters as needed. These functions may be leaf functions, but you should still store the old frame pointer, return address and any spilled saved registers.
I may be testing your program with an automated script so it is important that you follow instructions for input and output.
Prompts should be a single line of text that end in a new line.
Please enter the random seed\n 5 Please enter the array size\n 40Please ask for the random seed first then ask for the array size. You may assume all input is valid.
For validation, an input of 3,40 should produce the folowing output
3734, 3660, 4210, 2581, 9128, 7202, 4549, 6564, 7459, 3961 2581, 3660, 3734, 3961, 4210, 4549, 6564, 7202, 7459, 9128