Question: This assignment is designed to give you experience working with procedures, loops and data validation in MASM. Please submit your .asm file Objectives: 1) Designing

This assignment is designed to give you experience working with procedures, loops and data validation in MASM. Please submit your .asm file Objectives: 1) Designing and implementing procedures 2) Designing and implementing loops & nested loops 3) Understanding functional decomposition 4) Understanding data validation Problem Definition: Write a program to calculate composite numbers. First, the user is instructed to enter the number of composites to be displayed, and is prompted to enter an integer in the range [1 .. 400]. The user enters a number, n, and the program verifies that 1 n 400. If n is out of range, the user is re- prompted until they enter a value in the specified range. The program then calculates and displays all the composite numbers up to and including the nth composite. The results should be displayed 10 composites per line with at least 3 spaces between the numbers. Requirements: 1) The programmers name must appear in the output. 2) The counting loop (1 to n) must be implemented using the MASM loop instruction. 3) The main procedure must consist of (mostly) of procedure calls. It should be a readable list of what the program will do. 4) The program must be modularized into at least the following procedures and sub-procedures: introduction getUserData validate showComposites isComposite farewell 5) The upper and lower limits should be defined and used as a constant. 6) Data validation is required. If the user enters a number outside the range [1 .. 400] an error message should be displayed, and the user should be prompted to re-enter the number of composites. 7) The usual requirements regarding documentation, readability, user-friendliness, etc., apply. Notes: 1) For this program, you may use global variables instead of passing parameters. This is a onetime relaxation of the standards so that you can get accustomed to using procedures. 2) A number k is composite if it can be factored into a product of smaller integers. Every integer greater than one is either prime or composite. Note that this implies that a. 1 is not composite. b. The number must be positive. 3) There are several ways to make your isComposite procedure efficient. (I recommend discussing this in your groups!)

Example (user input in italics): Composite Numbers Programmed by Euclid Enter the number of composite numbers you would like to see. Ill accept orders for up to 400 composites. Enter the number of composites to display [1 .. 400]: 501 Out of range. Try again. Enter the number of composites to display [1 .. 400]: 0 Out of range. Try again. Enter the number of composites to display [1 .. 400]: 31 4 6 8 9 10 12 14 15 16 18 20 21 22 24 25 26 27 28 30 32 33 34 35 36 38 39 40 42 44 45 46 Results certified by Euclid. Goodbye. Extra Credit: 1) Align the output columns. 2) Display more composites but show them one page at a time. The user can Press any key to continue ... to view the next page. Since length of the numbers will increase, its OK to display fewer numbers per line. 3) One way to make the program more efficient is to check against only prime divisors, which requires saving all the primes found so far (numbers that fail the composite test). Its easy in a high-level language, but you will have to look ahead in the textbook to figure out how to do it in assembly language. 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

Here is template.

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!