CSE/EEE 230 Project 2

Due March 3, 2011.   11:59 pm

 

Part I: Assignment

 

Problem 1: Write a program that works as below:

1.      Declare and initialize an array A of 10 integers, with the elements have the values 10, 11, 12…19 (decimal).

2.      Write a routine that takes the address of an array of integers and the size of the array and returns the sum of the elements.

3.      Main program calls the function with the address of A and size of A, and prints the final sum.

 

Problem 2: Write a function that uses recursion to compute the Fibonacci number of its argument. The function prints the value of n and the Fibonacci number corresponding to n every time it is called.

 

The function written in C would look like:

fibo (int n)
{int i;
   if (n<=1) {return(n);}
   else
   {
     i = fibo(n-1) + fibo(n-2);
     printf("%d -> %d\n", n, i);}; // same thing as cout << i << "->" << n << endl;
     return (i);
};

 

Then call the above function with an argument of 10 (from a main program).

Note:

A] The Fibonacci sequence looks like 1 1 2 3 5 8 13 …

B] You are encouraged to run the fibo function in C before writing assembly code.

Part II: Submission instruction

Save your program files (one for each problem) with extension .s or .asm. Comment your code well and include your name and email in each source file. Zip all files into one file and send it to teaching assistant’s email. Please keep the following file naming rules.

 

            Source file: Problem1.asm, Problem2.asm

Zip file: LastName_FirstName_ASUID.zip

 

Attention:

Only last submission will be graded if multiple submissions are found.

The last time to submit is March 3rd 11:59 PM.

Late submission is rarely accepted, and may carry penalties.

 

Grading Critea:

Program should work correctly (70%) – if the program results a wrong answer, you get no point of this 70%.

Comments and readability (30%) – However, you won’t need to write comments longer than total source code length. Writing a corresponding C code for a group of assembly instructions will be helpful.