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. As an example, if the program had sorted only the first three numbers in the first array, it would display the message: The largest unsigned value in the array is: FFAABBCC since FFAABBCC is greater than 00030256 and 0C0D12AF. In addition to the largest value message just mentioned, your program must also display the entire region of memory containing both arrays, as hexadecimal doubleword values, three times: once before either array has been sorted, again after the first array (but not the second) has been sorted, and finally after both arrays have been sorted. (This is so I can verify that each call to the sorting procedure sorts all elements of the intended array, but nothing else.) This requirement can most readily be fulfilled by calling Irvines DumpMem procedure at the appropriate places in your program
Also create the flowchart on two separate pages, one for the main procedure and one for the sorting procedure.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started