Question

assembley language in c++ 8086 please Write a procedure that computes the fibonacci sequence to a...

assembley language in c++ 8086 please


Write a procedure that computes the fibonacci sequence to a given term
0 0
Add a comment Improve this question Transcribed image text
Answer #1

X86-64 GCC 7.1 code to print fibonacci series for first n terms :

.LC0:

.string " "

printFibonacciNumbers(int):

push rbp

mov rbp, rsp

sub rsp, 32

mov DWORD PTR [rbp-20], edi

mov DWORD PTR [rbp-4], 0

mov DWORD PTR [rbp-8], 1

cmp DWORD PTR [rbp-20], 0

jle .L5

mov DWORD PTR [rbp-12], 1

.L4:

mov eax, DWORD PTR [rbp-12]

cmp eax, DWORD PTR [rbp-20]

jg .L1

mov eax, DWORD PTR [rbp-8]

mov esi, eax

mov edi, OFFSET FLAT:_ZSt4cout

call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)

mov esi, OFFSET FLAT:.LC0

mov rdi, rax

call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)

mov edx, DWORD PTR [rbp-4]

mov eax, DWORD PTR [rbp-8]

add eax, edx

mov DWORD PTR [rbp-16], eax

mov eax, DWORD PTR [rbp-8]

mov DWORD PTR [rbp-4], eax

mov eax, DWORD PTR [rbp-16]

mov DWORD PTR [rbp-8], eax

add DWORD PTR [rbp-12], 1

jmp .L4

.L5:

nop

.L1:

leave

ret

__static_initialization_and_destruction_0(int, int):

push rbp

mov rbp, rsp

sub rsp, 16

mov DWORD PTR [rbp-4], edi

mov DWORD PTR [rbp-8], esi

cmp DWORD PTR [rbp-4], 1

jne .L8

cmp DWORD PTR [rbp-8], 65535

jne .L8

mov edi, OFFSET FLAT:_ZStL8__ioinit

call std::ios_base::Init::Init() [complete object constructor]

mov edx, OFFSET FLAT:__dso_handle

mov esi, OFFSET FLAT:_ZStL8__ioinit

mov edi, OFFSET FLAT:_ZNSt8ios_base4InitD1Ev

call __cxa_atexit

.L8:

nop

leave

ret

_GLOBAL__sub_I_printFibonacciNumbers(int):

push rbp

mov rbp, rsp

mov esi, 65535

mov edi, 1

call __static_initialization_and_destruction_0(int, int)

pop rbp

ret

if you like the answer please provide a thumbs up.

Add a comment
Know the answer?
Add Answer to:
assembley language in c++ 8086 please Write a procedure that computes the fibonacci sequence to a...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ARM assembly language Write a program "fibonacci.s" that computes the Nth Fibonacci number where N is...

    ARM assembly language Write a program "fibonacci.s" that computes the Nth Fibonacci number where N is not so large that overflow of integer arithmetic is a concern. When your assembly language program is called it should expect the value of N to be passed using register r0 and your program should return the Nth Fibonacci number in register r0. Please include comments as well. Do not just use the output generated by gcc -S

  • Write an 8086-family assembly language procedure (code fragment) that would fill the first part of a...

    Write an 8086-family assembly language procedure (code fragment) that would fill the first part of a complete segment of memory (assume the segment is the data segment) with zeros (up to a certain offset within the segment), and the rest of the segment with ones. The code will fill the locations within the segment, up to the offset given in BX, with all 0s. Once the offset reaches the value in BX (inclusive), fill the rest of the locations form...

  • Below you will find a recursive function that computes a Fibonacci sequence (Links to an external...

    Below you will find a recursive function that computes a Fibonacci sequence (Links to an external site.).   # Python program to display the Fibonacci sequence up to n-th term using recursive functions def recur_fibo(n): """Recursive function to print Fibonacci sequence""" if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2)) # Change this value for a different result nterms = 10 # uncomment to take input from the user #nterms = int(input("How many terms? ")) # check if the number...

  • Please write in assembly language 8086 windows32 Question 3: Write an assembly program that has a...

    Please write in assembly language 8086 windows32 Question 3: Write an assembly program that has a macro maximum that finds the larger of two numbers inputted by the user

  • Question 3 Program Language C++ Problem 3 Fibonacci Numbers 10 points Fibonacci numbers are a sequence...

    Question 3 Program Language C++ Problem 3 Fibonacci Numbers 10 points Fibonacci numbers are a sequence of numbers where each number is represented by the sum of the two preceding numbers, starting with 0 and 1: 0, 1, 1, 2, 3, 5, 8, etc Write a program that repeatedly prompts the user for a positive integer and prints out whether or not that integer is a Fibonacci number. The program terminates when-I is entered. Create a method with the following...

  • In Haskell: Write a recursive function fibonacci that computes the n-th Fibonacci number. fibonacci :: Int...

    In Haskell: Write a recursive function fibonacci that computes the n-th Fibonacci number. fibonacci :: Int -> Int Write a recursive function myProduct that multiplies all the numbers in a list. myProduct :: [Integer] -> Integer Using the technique of List Comprehension write a function that would remove even numbers from a list of lists. For Example: given input: [[1,2,3,4], [6,3,45,8], [4,9,23,8]] expected output: [[1,3], [3,45],[9,23]]. Show how the library function replicate :: Int -> a-> [a] that produces a...

  • . Write an 8086 assembly language program to find the prime numbers among 100 bytes of...

    . Write an 8086 assembly language program to find the prime numbers among 100 bytes of data in an array stored from the address 4000H: 1000H in the data segment and store the result from the address 4000H: 3000H. write the code using 8086 assembly language only i do not want any other language If you Do not sure please do not solve it

  • Write a program in MIPs Assembly Language to compute nth number of a fibonacci number sequence....

    Write a program in MIPs Assembly Language to compute nth number of a fibonacci number sequence. Your program should prompt for an integer input n from the user. The program should call a recursive function to compute the nth fibonacci number. Your program must follow programming convention. You should submit program and screenshot of output in a single word/pdf file. You should use following recursive definition of fibonacci function: fib(0) = 0 fib(1) = 1 fib(n) = fib(n-1) +fib(n-2)

  • write in C language In = { 3.3 The Jacobsthal Function The Jacobsthal sequence is very...

    write in C language In = { 3.3 The Jacobsthal Function The Jacobsthal sequence is very similar to the Fibonacci sequence in that it is defined by its two previous terms. The difference is that the second term is multiplied by two. 0 if n=0 if n = 1 Jn-1 + 2Jn-2 otherwise Write a recursive function to compute the n-th Jacobsthal number. Write a main function that reads in an integer n and outputs Jn. Test your program for...

  • Write a program that computes the Fibonacci number for some input integer. (See segments 7.37 –...

    Write a program that computes the Fibonacci number for some input integer. (See segments 7.37 – 7.41 in your book for some info on the Fibonacci sequence or you can look it up on the Internet). The sequence is defined as the first two elements are each 1, after that each element in the sequence is the sum of the previous two elements. The first few numbers of the sequence are 1,1,2,3,5,8,13,21,34,55,… Your assignment is to write a program with...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT