Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help adjusting this code in assembly language (ASM). The program asks user to input N, after which the program outputs the first N fibonacci

Need help adjusting this code in assembly language (ASM). The program asks user to input N, after which the program outputs the first N fibonacci numbers.

For instance if you input N = 10 then the output is: 0 1 1 2 3 5 8 13 21 34 55.

The program needs to be adjusted the order is reversed instead. So if you input N = 10 then the output would be: 55 34 21 13 8 5 3 2 1 1 0

Program:

INCLUDE Irvine32.inc INCLUDELIB Irvine32.lib

.data N DWORD ? f0 DWORD 0 f1 DWORD 1 temp DWORD ? i DWORD 2 wN BYTE "Enter N: ", 0 coma BYTE ", ", 0 .code main proc mov edx, OFFSET wN call WriteString Call ReadInt mov N, eax

mov eax, f0 call WriteInt mov edx, OFFSET coma call WriteString mov eax, f1 call WriteInt mov edx, OFFSET coma call WriteString

top : mov ebx, i cmp ebx, N ja next mov eax, f0 add eax, f1 mov temp, eax mov eax, f1 mov f0, eax mov eax, temp mov f1, eax mov eax, temp call WriteInt mov edx, OFFSET coma call WriteString inc i jmp top next : exit main endp end main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago