Question

ARM Assembly Code The Fibonacci Sequence is a series of integers. The first two numbers in...

ARM Assembly Code

The Fibonacci Sequence is a series of integers. The first two numbers in the sequence are both 1; after that, each number is the sum of the preceding two numbers.

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...

For example, 1+1=2, 1+2=3, 2+3=5, 3+5=8, etc.

The nth Fibonacci number is the nth number in this sequence, so for example fibonacci(1)=1, fibonacci(2)=1, fibonacci(3)=2, fibonacci(4)=3, etc. Do not use zero-based counting; fibonacci(4)is 3, not 5.

Your assignment is to write an assembler code (Fibonacci.s) that asks the user for the nth term in the Fibonacci sequence. Your program should then calculate the nth Fibonacci number and print it out.

For example, you program should produce the following outputs:

Enter Fibonacci term: 6

The 6th Fibonacci number is 8

Homework Answers

Answer #1

Following is the assembly code for the Fibonacci series.

MOV AL, 00H  
MOV SI, 500H  
MOV [SI], AL  
ADD SI, 01H  
ADD AL, 01H  
MOV [SI], AL  
MOV CX, [0000H]  
SUB CX, 0002H  
L1:  
   MOV AL, [SI-1]  
   ADD AL, [SI]  
   ADD SI, 01H  
   MOV [SI], AL  
   LOOP L1  
   HLT

That was a nice question to answer
Friend, If you have any doubts in understanding do let me know in the comment section. I will be happy to help you further.
Thanks

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci...
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, … The sequence Fn of Fibonacci numbers is defined by the recurrence relation: Fn = Fn-1 + Fn with seed values F1 = 1 F2 = 1 For more information on...
In mathematical terms, the sequence Fn of Fibonacci numbers is 0, 1, 1, 2, 3, 5,...
In mathematical terms, the sequence Fn of Fibonacci numbers is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….. Write a function int fib(int n) that returns Fn. For example, if n = 0, then fib() should return 0, PROGRAM: C
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the program title and programmer’s name. Then get the user’s name, and greet the user. • Prompt the user to enter the number of Fibonacci terms to be displayed. Advise the user to enter an integer in the range [1 .. 46]. • Get and validate the user input (n). • Calculate and display all of the Fibonacci numbers up to and including the nth...
Write a c++ program that evaluates the first 50 numbers of the Fibonacci sequence and store...
Write a c++ program that evaluates the first 50 numbers of the Fibonacci sequence and store the numbers in an array. The c++ program asks the user for an input to enter a positive integer 'n' and display the nth fibonacci number "FibN" that is stored inside of the array
Write a VSC (macro) program that computes and displays a Fibonacci sequence. A Fbonacci sequence is...
Write a VSC (macro) program that computes and displays a Fibonacci sequence. A Fbonacci sequence is generated by adding the two most recent sequence numbers together, i.e., 1, 1, 1+1-2, 1+2=3, 2+3=5, 3+5=8, … The user will enter the number of terms in the sequence to be displayed. Assemble this program using the VSC assembler (ASM), and simulate this program using the VSC simulator (SIM). Include a copy of the source listing (SOURCE.DAT), the assembled listing (SLIST.DAT) and the simulation...
Recall the Fibonacci sequence: 1,1,2,3,8,13.... In general we can generate Fibonacci-like sequences by making linear combinations...
Recall the Fibonacci sequence: 1,1,2,3,8,13.... In general we can generate Fibonacci-like sequences by making linear combinations of the formula that gives us the nth term of the sequence.Consider the following general case for generating Fibonacci-like sequences: F 1 = 1 F 2 = 1 Fn =  aFn-1 + bFn-2 where a, b are integers . Write a function that given values a, b and n will print a Fibonacci-like sequence up to the nth term of the sequence. ( eg, if...
Please Write the whole program in assembly i am able to calculate the fibonacci series but...
Please Write the whole program in assembly i am able to calculate the fibonacci series but not sure how to print it in reverse order. Please give a Complete code !! Programming Exercise 1 (10 points): [call it Ass2-Q1.asm] Write an ASM program that reads an integer number N and then displays the first N values of the Fibonacci number sequence, described by: Fib(0) = 0, Fib(1) = 1, Fib(N) = Fib(N-2) + Fib(N-1) Thus, if the input is N...
* Write a Java program that calculates and displays the Fibonacci numbers * First prompt the...
* Write a Java program that calculates and displays the Fibonacci numbers * First prompt the user to input a number, N * Then use a for loop to calculate and display the first N fibonocci numbers * For example, if the user enters 5, the output should be: * 1, 1, 2, 3, 5 * * if the user enters 10, the output should be: * 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
ARM assembly Code The Euclidean algorithm is a way to find the greatest common divisor of...
ARM assembly Code The Euclidean algorithm is a way to find the greatest common divisor of two positive integers, a and b. First let me show the computations for a=210 and b=45. Divide 210 by 45, and get the result 4 with remainder 30, so 210=4·45+30. Divide 45 by 30, and get the result 1 with remainder 15, so 45=1·30+15. Divide 30 by 15, and get the result 2 with remainder 0, so 30=2·15+0. The greatest common divisor of 210...
Solution.The Fibonacci numbers are defined by the recurrence relation is defined F1 = 1, F2 =...
Solution.The Fibonacci numbers are defined by the recurrence relation is defined F1 = 1, F2 = 1 and for n > 1, Fn+1 = Fn + Fn−1. So the first few Fibonacci Numbers are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, . . . There are numerous curious properties of the Fibonacci Numbers Use the method of mathematical induction to verify a: For all integers n > 1 and m > 0 Fn−1Fm + FnFm+1...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT