Question: Description and Requirements Write and test a friendly MIPS assembly program that calculates and prints Fibonacci numbers. Specifically, your program should be divided into the

Description and Requirements

Write and test a friendly MIPS assembly program that calculates and prints Fibonacci numbers. Specifically, your program should be divided into the following four sections, which must perform several specific tasks.

Section 1: Introduction

Print an introduction that includes: your name, a title, and (optionally) a description of the program.

Prompt the user to enter their name and read in the string input. (You should reserve 64 bytes in data memory for this string.)

Print a greeting that includes the users name.

Section 2: Get and validate n

Prompt the user to enter a number between 1 and 47 (inclusive); read in the input (well call this n).

Check that n is within the range. If not, print an error message and prompt the user again.

Repeat until the user enters a valid number.

Section 3: Calculate and print the first n Fibonacci numbers

Calculate and print each of the Fibonacci numbers up to and including the nth.

The first several numbers should be: 0, 1, 1, 2, 3, 5, 8, 13, 21, . . . (Note that you should start at 0!)

Numbers should be printed exactly five per line, with at least four spaces between numbers on a line.

Note that you do not need to store the Fibonacci numbers in memory. You may just print them as they are computed.

Section 4: Conclusion

Print a farewell message that again refers to the users name.

Use the exit system call to end your program.

Extra credit: (Small amount. Standard requirements must be fulfilled first!)

1. In Section 3, print the Fibonacci numbers in aligned columns. Note that you must still have at least four spaces between each number in a line.

Example execution Below is an example execution that illustrates what your program should do:

Fibonacci Numbers by, John Smith

What is your name?: Jonathan Bisnett

Hi, Jonathan Bisnett

How many Fibonacci numbers should I display?

Enter an integer in the range [1..47]: -7

That number was out of range, try again.

How many Fibonacci numbers should I display?

Enter an integer in the range [1..47]: 50

That number was out of range, try again.

How many Fibonacci numbers should I display?

Enter an integer in the range [1..47]: 22

0 1 1 2 3

5 8 13 21 34

55 89 144 233 377

610 987 1597 2584 4181

6765 10946

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!