Question
Write and test a MASM program to perform the following tasks (check the Requirements section for specifics on program modularization): Introduce the program. Generate ARRAYSIZE
Write and test a MASM program to perform the following tasks (check the Requirements section for specifics on program modularization): Introduce the program. Generate ARRAYSIZE random integers in the range [LO = 10 ... HI = 29], storing them in consecutive elements of an array randArray. ARRAYSIZE should be set to 200. HINT: Use Irvines RandomRange and Randomize procedures to generate each random number. Display the list of integers before sorting, 20 numbers per line with one space between each value. Sort the list in ascending order (i.e., smallest first). Calculate and display the median value of randArray, rounded to the nearest integer. (Using Round Half Up (Links to an external site.) rounding) Display the sorted randArray, 20 numbers per line with one space between each value. Generate an array counts which holds the number of times each value [10, 29] is seen in randArray. For example, counts[0] should equal the number instances of the value `10` in array. counts[14] should equal the number of instances of the value `24` in randArray. Display the array counts, 20 numbers per line with one space between each value. Program Requirements The programmers name and program title, and a description of program functionality (in student's own words) to the user must appear in the output. LO, HI, and ARRAYSIZE must be declared as constants. NOTE: We will be changing these constant value to ensure they are implemented correctly. Expect ranges as follows LO: 7 to 12 HI: 27 to 32 ARRAYSIZE: 180 to 220 Strings must be passed by reference. The program must use Register Indirect addressing for array elements, and Base+Offset addressing for accessing parameters on the runtime stack. The program must be constructed using procedures. At least the following procedures/parameters are required: NOTE: Regarding the syntax used below... procName {parameters: varA (value, input), varB (reference, output) indicates that procedure procName must be passed varA as a value and varB as a reference, and that varA is an input parameter and varB is an output parameter. You may use more parameters than those specified but try to only use them if you need them. main introduction {parameters: intro1 (reference, input), intro2 (reference, input), ...) fillArray {parameters: someArray (reference, output), LO (value, input), HI (value, input), ARRAYSIZE (value, input)} sortList {parameters: someArray (reference, input/output), ARRAYSIZE (value, input)} exchangeElements (if your sorting algorithm exchanges element positions): {parameters: someArray[i] (reference. input/output), someArray[j] (reference, input/output), where i and j are the indexes of elements to be exchanged} displayMedian {parameters: someTitle (reference, input), someArray (reference, input), ARRAYSIZE (value, input)} displayList {parameters: someTitle (reference, input), someArray (reference, input), ARRAYSIZE (value, input)} countList {parameters: someArray1 (reference, input), ARRAYSIZE (value, input), someArray2 (reference, output), LO (value, input), HI (value, input)} Parameters must be passed on the system stack, by value or by reference (as noted above). There must be just one procedure to display arrays. This procedure must be called three times: to display the unsorted array to display the sorted array to display the counts array All lists must be identified when they are displayed (use the someTitle parameter for the displayList procedure). Procedures (except main) must not reference data segment variables or constants by name. randArray, counts, titles for the sorted/unsorted lists, etc... should be declared in the .data section, but must be passed to procedures on the stack. Procedures may use local variables when appropriate. The program must be fully documented and laid out according to the CS271 Style Guide. This includes a complete header block for identification, description, etc., a comment outline to explain each section of code, and proper procedure headers/documentation. Notes
I would seriously appreciate anyone who could solve this for me.
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