In: Computer Science
in assembly language x86 Masm, Write a program that calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(0) = 0, Fib(1) = 1, Fib(2) = Fib(0)+ Fib(1), Fib(n) = Fib(n-1) + Fib(n-2). You NEED to calculate each value in the series "using registers and the ADD operation" You can also use variables, Have your program print out "The first seven numbers is" Use WriteInt for the printing, Place each value in the EAX register and display it with a call WriteInt statement
Solution ::
Code to copy
;Support package
INCLUDE Irvine32.inc
;Code
.code
;Driver code
main PROC
;Move
mov eax,1
;Move
call DumpRegs
;Initial setup
mov ebx,0
;Move
mov edx,1
;Counter
mov ecx,6
;Loop
L1:
;EAX=EBX+EDX
mov eax, ebx
;Add
add eax, edx
;Display EAX
call DumpRegs
;Move
mov ebx, edx
;Move
mov edx, eax
;End of loop
Loop L1
;Exit
exit
;End
main ENDP
;End of driver
END main
Thank you::::