Question: CMPS 290 (Computer Organization - Assembly Language); Program 2 Procedure calls; 100 points Use the MARS assembler, or equivalent, to develop a program that will

CMPS 290 (Computer Organization - Assembly Language); Program 2 Procedure calls; 100 points

Use the MARS assembler, or equivalent, to develop a program that will do the following:

1. Write a program that calculates the summation of a number using a loop (iterative). For example if the input is 10, your program will add the numbers 10, 9, 8, .., 2, and 1 and return a result of 55.

2. Now create a subprogram that iteratively finds the factorial of a number. Make sure and follow all saving and restoring conventions regarding registers of the series $s, $sp, $ra, etc.

3. Create a subprogram that calculates the summation of a number using recursion. Make sure and follow all saving and restoring conventions regarding registers of the series $s, $sp, $ra, etc.

4. Write a program that allocates enough memory to hold 20 integers. Load that memory with consecutive integers from 1 to 20. Generate a sum of those integers by adding the numbers in pairs to the sum using the following pairing scheme. Add the first number in the array to the last number, add the second number in the array to the second to last and so forth. When all 10 number pairs have been added, divide the sum by 2 and print out the result.

Again, remember to preserve $s registers for your non recursive calls, and $s, $sp, and $ra registers for the recursive calls.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!