Question: Write a x86 Assembly Language program that takes a 32-bit unsigned integer as input x and an output option y (1 largest prime, 2 smallest

Write a x86 Assembly Language program that takes a 32-bit unsigned integer as input x and an output option y (1 largest prime, 2 smallest prime, 3 all primes). Your program should determine appropriate prime number(s) using x and display the output according to the output option y. For invalid input, you can either stop the program or prompt user to renter data. Prime numbers are numbers that can only be divided by themselves and by 1. Input: 1. A 32-bit unsigned integer x, 2 <= x <= 2,000,000,000 2. An option y: 1, 2, or 3 Output: If option is 1 The largest prime number <= x If option is 2 The smallest prime number >= x If option is 3 All primes numbers from 2 to x The count of prime numbers from 2 to x

You need to come up with a structure/hierarchy chart showing all procedures as part of your design. You might want to come with pseudocode before coding it in assembly language. Your program must properly utilize procedures and parameters or points will be deducted. Include a procedure named isPrime that assigns 1 to eax if the 32-bit unsigned integer passed in as stack parameter is prime (assign 0 to eax if it is not a prime number). Make sure to use procedure isPrime to check all possible candidates as prime numbers. Include another procedure to process option 3 and use additional procedures as needed. A short comment is required for each instruction in your program (put comment on the right of that instruction). You should determine the prime numbers as efficiently as possible (skip unnecessary values and/or calculations). Run the following cases at the minimum for x and y: (10, 1), (2000000000, 2), and (20, 3).

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!