Question: Fibonacci Sequence Write an assembly program that fills an array of N quadwords with the first N values in the Fibonacci Sequence. The Fibonacci Sequence

Fibonacci Sequence

Write an assembly program that fills an array of N quadwords with the first N values in the Fibonacci Sequence.

The Fibonacci Sequence is a number sequence that begins with two 1's, then each subsequent number in the sequence is the sum of the previous two numbers.

The starter code for this project includes a constant value and an array defined in the .bss section. Constant fib_size specifies the size of the array to receive the Fibonacci Sequence, and fib is the array to be filled with the sequence values.

Your program should be dependent on the array size specified by fib_size. In other words, if the constant value given for fib_size is changed, the size of the array also changes, and your program should fill the entire array without other changes to your code. You may assume that fib_size is at least 3 (your code need not consider lesser values).

Note that the Fibonacci Sequence always begins with two 1's. All values beginning with the third value are calculated. As such, your program should begin by simply moving 1 to the first two positions of the array, then use a loop to fill the remainder of the array. The loop should execute fib_size-2 times.

Check your results using the debugger. For convenience in checking your results, the first 20 Fibonacci Sequence positions, in decimal and hexadecimal, are as follows:

 

Pos Dec Hex

--- --- ---

0 1 1

1 1 1

2 2 2

3 3 3

4 5 5

5 8 8

6 13 d

7 21 15

8 34 22

9 55 37

10 89 59

11 144 90

12 233 e9

13 377 179

14 610 262

15 987 3db

16 1597 63d

17 2584 a18

18 4181 1055

19 6765 1a6d

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!