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: 3669683 • 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

Explanation / Answer

INCLUDE Irvine32.inc .data prev DWORD ? next DWORD ? value DWORD ? count DWORD ? total DWORD ? myMessage BYTE "Fibonacci Program",0dh,0ah,0 .code main PROC mov ecx,12 mov value, 1 mov prev, -1 mov eax, 1 L1: mov count,ecx mov ebx, value add ebx, prev mov total, ebx mov ebx, value mov prev, ebx mov eax, total mov value, eax call DumpRegs loop L1 mov edx,OFFSET myMessage call WriteString exit main ENDP END main

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