Question: Hello! Thanks for your time! This is an Assembly Language Programming question, if you could please solve it and add comments on what each line

Hello! Thanks for your time! This is an Assembly Language Programming question, if you could please solve it and add comments on what each line does, that'll be great!

CSP025 Assembly Language Homework #7 (LOOP instruction)

Fibonacci Numbers

Write a program that uses a loop to calculate the first n values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n-1) + Fib(n-2).

Example Run:

Enter the number of terms: 5

First 5 terms of Fibonacci series are:

1

1

2

3

5

***********************

NOTE: Loop statement pattern is included for completeness and not as a recommendation for use.

***********************

Pseudocode for Loop instruction:

;do/while pattern using LOOP statement

mov ECX, 5 ;ct = 5

lup: ;do

; ... statements to be repeated

; ct--

loop lup ;while ct > 0

Use one of the following pseudocode solutions:

****************************************************************************************

NOTE: do not enter zero for a LOOP instruction solution. Zero - 1 is four billion times:

****************************************************************************************

Start

first = 0

second = 0

next = 1

print "Enter the number of terms: "

input n

print "First ", n, " terms of Fibonacci series are:"

termCt = n

Do

print next

first = second

second = next

next = first + second

termCt--

While termCt > 0

Stop

************************

start

fib1 = 1

fib2 = 0

print "Enter the number of terms: "

input n

print "First ", n, " terms of Fibonacci series are:"

termCt = n

Do

fib1 += fib2

print fib1

swap (fib1, fib2)

termCt--

While termCt > 0

stop

************************

start

fib1 = 1

fib2 = 0

print "Enter the number of terms: "

input n

print "First ", n, " terms of Fibonacci series are:"

termCt = 0

While termCt < n

fib1 += fib2

print fib1

swap (fib1, fib2)

termCt--

EndWhile

stop

************************

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!