Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assembly Language fibonacci.asm - computes the following. a. Compute fib(n) for

ID: 3670541 • Letter: A

Question

Assembly Language

fibonacci.asm
- computes the following.

a. Compute fib(n) for n = 2, 3, …, 6 using an array.

b. Store each computed value in an array of the appropriate size and type.

c. Store fib(3) through fib(6) in consecutive bytes of the ebx register starting from the lowest byte; that is, fib(3) is stored in the low byte (bl) of ebx, fib(4) is stored in the next byte (bh), fib(5) is stored in the next byte of ebx and fib(6) is stored in the highest byte.

d. If you don’t know what the Fibonacci sequence is, there is a lot of information online that you can find.

Notes


1. Assume fib(0)=0, fib(1)=1.

2. You may use any instruction/directive/operator through chapter 4 pg 128, including any of the arithmetic operators +, *, /, -.

3. Your program must use indirect operands in some way as discussed in chapter 4.

4. Your program must make one call to DumpRegs before quitting to display the ebx register.

Indirect Operand

• Can be any 32-bit general purpose register

– Surrounded by brackets

• The register is assumed to contain the address of some data

Here is the example for Indirect Operand

.data

byteval BYTE 10h

.code

mov esi, OFFSET byteval

mov al, [esi] ; al = 10h

mov [esi], al

Please make sure your code will compile on Visual Studio 2015, Thank u really appreciate

Explanation / Answer

using System;

namespace Fibonaccinumber

{

class Program

{

static void Main(string[] args)

{

int fib(0) = 0;

int fib(1) = 1;

int a = 1;

Console.WriteLine(fib(0));

Console.WriteLine(fib(1));

while(true)

{

a = fib(0) + fib(1);

if( a > = 200)

{

break;

}

Console.WriteLine(a);

fib(0) = fib(1);

fib(1) = a;

}

Console.Read();

}

}

}

Output :-

0

1

1

2

3

5

8

13

21

34

55

89

144

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote