Question: *** DO NOT USE LI INSTRUCTION***** Write a MIPSzy subroutine, fact, that accepts 1 argument n and computes n! (i.e. 1x2x3 ...X(n-1)xn). You can
*** DO NOT USE "LI" INSTRUCTION*****

Write a MIPSzy subroutine, fact, that accepts 1 argument n and computes n! (i.e. 1x2x3 ...X(n-1)xn). You can assume that n is larger than 0. The main program passes the parameter and receives the return value through the program stack. Test your subroutine with the following program: addi $t0, $zero, 5 addi $t1,$t0, 3 sw $t0,($sp) addi $sp,$sp,4 jal fact lw $t0,($sp) addi $sp,$sp, -4 sw $t1, 0(Ssp) addi $sp,$sp, -4 jal fact lw $t1, 0($sp) addi $sp,$sp, -4 j done power: *** Put your subroutine here done: Note that your program will be tested with a main program that is like the above program but uses different registers. Make sure that your subroutine restores the values of all the registers to the that it uses to their original values before returning. Make sure that your program is clearly commented (including the test program above.) There is no
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
