Question: Write an Intel x86 assembly language program which will sort arrays of unsigned doubleword (32-bit) integers into ascending order and output the largest (most positive)
Write an Intel x86 assembly language program which will sort arrays of unsigned doubleword (32-bit) integers into ascending order and output the largest (most positive) element of each array to the standard output device. Your program must make use of a sorting procedure that does the following:
Sort (in its place in memory, without making a copy elsewhere in memory) an array of n unsigned doubleword integers starting at address m into ascending numerical order. The smallest (closest to 0) number must be put into the first location in the array, the next smallest in the second location, and so on ... until the largest (most positive) number is placed in the last location. The number of array elements n and array starting address m are the two (and only two) arguments that must be passed to the procedure in registers. (No other information may be passed into or used by the procedure, nor may the procedure refer by name to the array being sorted.) The value of the largest (last) element in the sorted array must be returned to the calling program in a register. Your procedure may use any sorting algorithm (insertion sort, bubble sort, quick sort, etc.) to perform its task, but may not use any information other than the two values specified above to be passed from the calling program.
Your program must use assembler directives to define two arrays (one of 8 elements and one of 15 elements) and initialize them to contain the following data (given here in order from first to last, in hexadecimal): Array 1 initial contents: 0C0D12AF, 00030256, FFAABBCC, 0F700F70, 00000000, E222111F, ABCDEF01, 01234567. Array 2 initial contents: 61A80000, 024F4A37, EC010203, FAEEDDCC, 2C030175, 84728371, 63AA5678, CD454443, 22222222, 61B1C2D3, 7A4E96C2, 81002346, FDB2726E, 65432100, FFFFFFFF.
The sorting procedure must be called from your main program twice. The first time, it should be used to sort only the first array of integers; the second time, it should sort only the second array. After each time the procedure is called, the main program must output to the screen the message The largest unsigned value in the array is: followed by the value just returned to main by the procedure, displayed in hexadecimal format.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
