Question: Write an assembly program to: Print first 2 Fib values ( 0 , 1 ) before starting These are hard - coded since they are
Write an assembly program to:
Print first Fib values before starting
These are hardcoded since they are starting values...no calculations required
Enter MainLoop
Loop and call subroutines to calculate each subsequent value in the sequence
Exit the loop once all singledigit values in the sequence have been printed
Complete all subroutines
calcNextFib Uses R and R to calc next value in Fibonacci sequence
printNum Outputs singledigit number to the display
printCommaSpace Outputs a comma and a space
Information
Calculate all the singledigit Fibonacci numbers in order
Start with the first values in the sequence
Calculate the next value by adding together the two largest values
Print each number in the sequence
With a comma and space after each
No comma after the last number
Use LC IO device to print number, commas, and spaces
No points will be awarded for number printed using Trap Routines
Fibonacci NumberLinks to an external site.
Fibonacci AlgorithmLinks to an external site.
Testing:
Expected Output is:
All on line with the commas and spaces as shown
Hints:
Saverestore registers in the subroutines
An ASCII table might be helpful
Note that there is no SaveR or SaveR allocated in the Data Declarations
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
