CPSC2320 Computer Org & Assembly Language

Homework #4

Assigned:  October  23, 2008

Due: midnight October 28, 2008

 

The objective of this assignment is to gain practice in writing functions using register conventions, and to utilize indexed addressing modes of the MIPS processor.

 

Write a function fib( int n, int &arr) to store the first n elements of the Fibonacci sequence into an array in memory.  The value of n is passed in register $a0, and the address of the array is passed in register $a1. 

 

Your main program will request values of n from the user in a loop until a value of zero is received.  In each iteration of the loop, print the Fibonacci sequence calculated.  Include appropriate prompts and error messages.  For this assignment, the value of n must be a positive integer no greater than 25.