Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Architecture and Assembly Language - Assignment 2 - This assignment is designed to give you practice working with control and repetition structures as well

Computer Architecture and Assembly Language - Assignment 2 - This assignment is designed to give you practice working with control and repetition structures as well as the instruction execution cycle on the IA32 architecture. MASM Assembly Programming Section Objectives: 1) Getting string input 2) Designing and implementing a counted loop 3) Designing and implementing a post-test loop 4) Keeping track of a previous value 5) Implementing data validation Problem Definition: Write a program to calculate Fibonacci numbers. Display the program title and programmers name. Then get the users 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 term. The results should be displayed 5 terms per line with at least 5 spaces between terms. Display a parting message that includes the users name and terminate the program. Requirements: 1) The programmers name and the users name must appear in the output. 2) The loop that implements data validation must be implemented as a post-test loop. 3) The loop that calculates the Fibonacci terms must be implemented using the MASM loop instruction. 4) The main procedure must be modularized into at least the following sections (using labels): a. introduction b. userInstructions c. getUserData d. displayFibs e. farewell 5) Recursive solutions are not acceptable for this assignment. This one is about iteration. 6) The upper limit should be defined and used as a constant. 7) The program must be fully documented. This includes a complete header block for identification, description, etc., and a comment outline to explain each section of code. Notes: 1) It is not necessary to store the Fibonacci numbers. The terms may be displayed as they are generated. 2) The second-order Fibonacci sequence is defined as: a. The first two terms are both 1. b. All other terms are calculated as the sum of the two previous terms.

3) The reason for restricting n to [1 .. 46] is that the 47th Fibonacci number is too big for DWORD data type. Example (user input in italics): Fibonacci Numbers Programmed by Leonardo Pisano Whats your name? Paul Hello, Paul Enter the number of Fibonacci terms to be displayed Give the number as an integer in the range [1 .. 46]. How many Fibonacci terms do you want? 50 Out of range. Enter a number in [1 .. 46] How many Fibonacci terms do you want? 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Results certified by Leonardo Pisano. Goodbye, Paul. Extra-credit options (original definition must be fulfilled): 1. Display the numbers in aligned columns. 2. Do something incredible. To ensure you receive credit for any extra credit options you did, you must add one print statement to your program output PER EXTRA CREDIT which describes the extra credit you chose to work on. You will not receive extra credit points unless you do this. The statement must be formatted as follows... --Program Intro-- **EC: DESCRIPTION --Program prompts, etc

TITLE Program Template (template.asm) ; Author(s): ; Course / Project ID Date: ; Description: INCLUDE Irvine32.inc ; (insert constant definitions here) .data ; (insert variable definitions here) .code main PROC ; (insert executable instructions here) exit ; exit to operating system main ENDP ; (insert additional procedures here) 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

Students also viewed these Databases questions