Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!


CPEN 3710 The University of Tennessee Chattanooga Assembly Language Exercise

CPEN 3710 The University of Tennessee Chattanooga Assembly Language Exercise

Question Description

Write an x86 assembly language program that will prompt the user for a nonnegative decimal integer nand determine whether or not n is prime. (You will need to do a bit of research regarding algorithms that can be used to test numbers to see if they are prime.) The program must display the number input and the result of the test on the screen, then prompt the user to enter another number. For example, if the user entered the numbers 7 and 100, the screen output produced by your program should appear as follows:

Enter a nonnegative integer (0 to exit): 7

7 is a prime number.

Enter a nonnegative integer (0 to exit): 100

100 is not a prime number; it is divisible by 2.

The input number is to be stored as an unsigned32bit (doubleword) value(legal input is any decimal integer value between 0 and 2321, inclusive). The program should terminate when the user enters 0and should generate an error message if the user enters nonnumeric input or a negative number. The prime number test must be done in a separate procedure that is called from the main program; the single argument (the number to be checked for primality) must be passed to this procedure on the stack, and a result code must be returned to the caller in the EAX register. The value returned in EAX must be 0 if the user’s number is prime and must be a divisor of the user’s number if it is composite(if the number has multiple divisors, any one of them may be returned as proof of nonprimality). In the special case that the user enters the number 1, return 1(note that the number 1 is not prime by definition, since it does not have two distinct divisors.) No other registers may be changed by the “prime check” procedure, so use the stack to save and restore any registers your procedure uses, other than EAX. Your called procedure must create a base pointer which is used to reference its input parameter as well as the local variables (if any) that it creates and must restore the caller’s base pointer before returning.

Your program must also measure the elapsed time, in milliseconds, taken to check each (legal) input value for primality. You should do this by calling Irvine’s GetMseconds procedure twice: once after the input is errorchecked, but before the prime number procedure is called; and again, just after the prime number procedure returns. The difference between the second value and the first will give you the run time in milliseconds, assuming that you did not commence your program run shortly before midnight (correction for “midnight rollover” is a desirable, but not required, feature of your program). In addition to outputting whether or not the number is prime, your program should also display the run time in milliseconds for each computation. For example:

Enter a nonnegative integer (0to exit): 1046527

1046527 is a prime number.

This computation took 15 milliseconds.

Enter a nonnegative integer (0 to exit): 4

4 is not a prime number; it is divisible by 2.

This computation took 0 milliseconds.

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Gold Grades only hire the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Gold Grades are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Gold Grades is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Gold Grades, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.