Assignment #3
Date assigned: 3/5/04
Date due: 3/15/04
Points: 45

Let's have some fun. I would like to run a programming contest and the contest goes as follows: Write an assembly language program that prints on the display screen the number of prime integers between 2 and 65535. Also, print on the screen the largest prime number closest to 65535. The bottom line is that I want this done as fast as possible using only instructions covered so far in class with no regard to program size. I'm looking for sheer speed. That's it!!!

As output on the display screen, I want the following:

Number of prime numbers between 2 and 65535 inclusive is: xxxxxx
Largest prime number in that range is: xxxxxx

Remember, a prime number is defined to be a number larger than 1 that is only evenly divisible by 1 and the number itself. Also, we are only working with natural numbers for this assignment.

One other small issue is that you must have some way to time your program and I would like the program timed to display the number of milliseconds taken to execute. Therefore, display the results described above and the number of milliseconds your program took to execute. Here is an example of the output I'm looking for:


                PRIME PROGRAMMING CONTEST

Number of prime numbers between 2 and 65535 inclusive is: xxxxxx
Largest prime number in that range is: xxxxxx
Number of milliseconds to calculate total primes is: xxxxxx

Note1: Get started early. This is not as easy as it sounds.

Note2: Five extra credit points will be given for the fastest solution.

Note3: Make your program so that if I want to change the number 65535 to something else, I only have to do it once at the very beginning of your program. The rest of your program needs to adjust to this new upper bound. I will probably do this when you come in to demo your solution.

Note4: You will need to research and use the DIV instruction on p.242. The DIV instruction can be used to get the Quotient and Remainder of a division.

Note5: Start counting time after the user enters the prime number.


©Douglas J. Ryan / Douglas J. Ryan