Solve each of the following problems. To receive full marks on your documentatio
ID: 3724621 • Letter: S
Question
Solve each of the following problems. To receive full marks on your documentation, you should have excellent internal documentation (i.e., appropriate comments, but also choice of variable names), as well as excellent external documentation (i.e., in the readme.txt file as described previously) 1. [70 points] Write an assembly program to compute the nth number in the Fibonacci series The first and second Fibonacci numbers are 0 and 1, respectively. Every subsequent Fibonacci numbers are the sum of the previous two Fibonacci numbers. For example, the third Fibonacci number is 1 (i.e., 0+1), the fourth is 2 (i.e., 1+1), the fifth is 3 (i.e., 1+2), and so on. The program must use a loop to compute Fibonacci numbers and display their values on the screen. Display the first 10, 15 and 20 numbers as test cases. 2. [30 points Extend your solution to Problem 1 so that instead of displaying the list in the increasing order, the program shows the Fibonacci numbers in reverse order. Particularly, after constructing the original list, initialize another list with the same size in which you build the contents of this list from the original one in the reverse orderExplanation / Answer
sys_exit equ 1
SECTION .data
phi dt 1.618033988749894848204
sqrt5 dt 2.236067977499789696409
SECTION .bss
result resq 1
SECTION .text
global _start
_start:
mov ecx, 5
fld tword [sqrt5]
fld tword [phi]
fld tword [phi]
fib:
fmul st1
loop fib
fdiv st2
fisttp qword [result]
Exit:
mov eax, sys_exit
xor ebx, ebx
int 80H
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.