Question

Write a .asm program that computes the Nth Fibonacci number. N will be provided in R0...

Write a .asm program that computes the Nth Fibonacci number. N will be provided in R0 and the output should be in R1

Homework Answers

Answer #1
        AREA    RESET, CODE, READONLY
        ENTRY

start   MOV     R1, #16     ; n = 16
        MOV     R3, #0      ; fn1 = 0
        MOV     R0, #1      ; fn = 1
        MOV     R2, #1      ; curr = 1
whn     CMP     R2, R1      ; while (curr < 1)
        BHS     endwhn      ; {
        ADD     R2, R2, #1  ;   curr = curr + 1
        MOV     R4, R0      ;   tmp = fn
        ADD     R0, R0, R3  ;   fn = fn + fn1
        MOV     R3, R4      ;   fn1 = tmp
        B       whn         ; }
endwhn

STOP    B       STOP

        END

Note: Plzzz don' t give dislike.....Plzzz comment if u have any problem i will try to resolve it.......

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
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...
write an assembly program which computes the hamming distance between the values in R0 and R1...
write an assembly program which computes the hamming distance between the values in R0 and R1 and returns the result in R2
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 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 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
C+ VISUAL STUDIO.. SHOW OUTPUT PLEASE Write a program that computes the number of possible combinations...
C+ VISUAL STUDIO.. SHOW OUTPUT PLEASE Write a program that computes the number of possible combinations to obtain a successful result of an arbitrary event. The formula for computing the possible combinations is given by: C(n,k)= n! / [k! * (n - k)!] where, n = the number of events k = number of success for that event Use the recursive function factorial explained in the chapter to compute the possible combinations.  The output should be displayed as follows: C( n,...
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...
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...
Looking at the recursive formula we can design a simple program use pseudocode. Fibonacci(n): if (n...
Looking at the recursive formula we can design a simple program use pseudocode. Fibonacci(n): if (n == 0) return 0; if (n == 1) return 1; return Fibonacci (n-1) + Fibonacci(n-2). Discuss any issues you find with your program and what reasoning there may be.
Write an ARM assembly language program that counts the number of 1’s for any value in...
Write an ARM assembly language program that counts the number of 1’s for any value in R0. The program must assemble/compile in KEIL and must be able to run in the KEIL simulator. Generally, R0 may contain any value, but for purpose of this exercise, you may move 0x2345ABCD into R0. The number in R0 does not need be preserved. You may use any other registers as you need. The result, total count of 1’s in R0, should be in...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT