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 2 Fib values (0,1) before starting
These are hard-coded 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 single-digit values in the sequence have been printed
Complete all 3 subroutines
calcNextFib Uses R1 and R2 to calc next value in Fibonacci sequence
printNum Outputs single-digit number to the display
printCommaSpace Outputs a comma and a space
Information
Calculate all the single-digit Fibonacci numbers in order
Start with the first 2 values in the sequence (0,1)
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-3 I/O 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:
0,1,1,2,3,5,8
All on 1 line with the commas and spaces as shown
Hints:
Save/restore registers in the subroutines
An ASCII table might be helpful
Note that there is no SaveR1 or SaveR2 allocated in the Data Declarations

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!