Read and perform the lab guide posted on the course website. Answer the questions in the lab guide as you get to them in the spaces below. The numbers below refer to steps in the lab guide.
[3.5] What output do you expect when you run
[3.6] Is the actual output what you expected?
[3.8] What output do you expect when you run
[3.9] Is the actual output what you expected?
SwapMaxWithLastneeded to return a value how would that be accomplished?
[3.12] What changes would you need to make if
SwapMaxWithLastneeded more than 4 arguments?
[3.13] What changes would you need to make if
SwapMaxWithLastcalled another procedure?
[3.14] The code in
p7-loop.asmworks almost like a procedure. Describe the changes you would make to convert the
p7-loop.asmcode into a
sortprocedure which is called and which in turn calls SwapMaxWithLast.
sregisters to store both
fib(n ? 1). Could
tregisters be used? Which would you choose?
[4.4] While calculating
fib(4), how many times is
[4.5] In your
fibcode, you should have two internal calls to
fib. Set a breakpoint at the line AFTER the first internal call to
fib. Then, while calculating
fib(4), observe the state of the stack when the breakpoint is hit (e.g. when recursion using the first
jal fibis complete). Then, draw the state of your stack on the next page. Draw the stack as a rectangle, indicate each stack frame, and what register and value is present in each word.
[4.5] What happens if
fibdoes not restore the return address before using
Draw your stack here: