loading...

CS401 Computer Architecture and Assembly Language Assignment 2 Solution

Question Statement:

Write a complete assembly language code having two subroutines:

  • One will be named as Fibonacci_series used to generate a Fibonacci series of first 10 elements.
  • Second will be named as Fibonacci_sum and will find the sum of all elements in a generated Fibonacci series/array.

Hint: Make a series/array named as Fibonacci_array and a lable named as fib_sum.

Fibonacci_array will contain the generated Fibonacci sequence elements, while fib_sum is used to store the sum of an array (Fibonacci array).

You can define Fibonacci array as:

Fibonacci_array: DW 0 1

            Fib_sum = Fibonacci (0) + Fibonacci (1) + … + Fibonacci (10).

Fibonacci function is defined as follows:

Fibonacci (0) = 0

Fibonacci (1) = 1

Fibonacci (n) = Fibonacci (n-1) + Fibonacci (n-2)

You have to calculate till Fibonacci (10).

You have to attach a final snapshot of your debugger showing the Fibonacci series and Fibonacci sum in Data segment (DS).

Solution:

DOWNLOAD SOLUTION HERE
loading...