Question: With gcc , at&t syntax, we have a debian, 6 4 - bit server with the current problem to solve this in assembly language: Program
With gcc at&t syntax, we have a debian, bit server with the current problem to solve this in assembly language:
Program : Quicksort Assembler
Quicksort
In this program, you will implement the quicksort routine in assembler to sort numbers again using AT&T syntax on the Debian bit system. You will generate the numbers by calling the random number generator using call rand You will need to scale the numbers using the mod function to provide numbers between Remember that the mod function in assembler is really using thedivq instruction and using the remainder. Dividing by will produce remainders between How do you get the numbers to be between
Requirements:
In assembler, store the numbers in a contiguous space in memory that will enable you to use an array implementation of quicksort.
While testingwriting your program, initially implement Quicksort by generating between random numbers.
Write a function to print out the numbers numbers on a line in neat columns Only print the numbers if you are sorting the smaller set of numbers and not the number set Write a check routine and print out an Unsorted or Sorted message.
Implement the Quicksort. The quicksort is recursive so you must use the system stack. You will need to push values such as High and Low and possibly the pivot on the stack. You will need to manage the base pointer register rbp and the stack pointer register rsp
Note that the partition function is not recursive so it is not required that you utilize the system stack for that function, although you certainly may use it in a similar way as the quicksort function, managingrsp and rbp
You should be able to run the program for numbers and for the full set of numbers. Only print the numbers out if you are sorting the smaller set of numbers.
Hand in your final program. Be sure to run the program for numbers and for the full set of numbers.
Also call your check routine after sorting the numbers.
Summary Notes
You should request the number of random numbers to generate from the user. That will be helpful in testing since you should test your program using a small number of numbers eg You should show that your program works for a small number of values by printing out the UNSORTED AND the SORTED numbers and handing in the output when you hand in your program. Be sure to print numbers on a line to minimize the number of lines of output that you generate. DO NOT print the numbers when you run the program for more than numbers. Instead, you should verify that you have sorted the array correctly by executing a 'check' routine to verify that the array is sorted. Note that you should not need to reassemble your program to handle and fewer numbers and more than numbers. Your program logic should handle whether or not you print the numbers.
Use either the C srand or rand functions.
It is very important that you spend considerable time and effort performing quicksort by hand on a small example so that you are able to identify the steps that you will follow as you implement the routines. Use your quicksort program from CS and the C program as templates for writing the program.
As a guideline, in implementing the sort you should partition the memory inplace", ie you should not use additional space than that needed to store your numbers while you are executing your sort. For example, if you are sorting integers, you should only use words of memory plus possibly some small amount of "utility" memory space
After you have read the numbers, your call to quicksort should partition the numbers using a partition algorithm. The key to performing the quicksort recursively in assembler will be making the correct use of the stack and registers. We will discuss the use of the stack in more depth in class.
Optional Extra Credit Opportunities: The following extra credit opportunities are available for this program. You will receive extra credit points for each extra credit item that you choose to implement if you implement it correctly and successfully in the program.
Utilize macros correctly and appropriately in your program for sets of instructions that are performed numerous times. Because the purpose of macros is different than for functions, macros would not replace your calls to functions. For examples of macros, see the macroexs and macrolibrary.s files.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
