ECE 267 - Computer Organization and Programming

Programming Assignment #3

 

Spring 2003 - email code submission due before 11:00 PM on Tuesday, April 1;
code listing and flowchart due in class on Wednesday, April 2.


The purpose of this assignment is to give you practice with integer arithmetic in the IA-32 (Intel Architecture 32-bit addressing mode) assembly language, and with advanced 32-bit register use.

 

Assignment

Write an Intel 80386 assembly language program that prompts the user to enter a positive integer N (assumed to be in the range 2<N<1012, but no error checking is required). Your program then determines and displays whether or not N is a prime number.

 

Sample Runs


ECE 267, Spring 2003
MP3 submission by Vladimir Goncharoff (web code 1234)
-----------------------------------------------------

Enter an integer between 2 and one trillion: 123,456

The integer 123456 is not prime.


ECE 267, Spring 2003
MP3 submission by Vladimir Goncharoff (web code 1234)
-----------------------------------------------------

Enter an integer between 2 and one trillion: 99,151,589

The integer 99151589 is prime.


ECE 267, Spring 2003
MP3 submission by Vladimir Goncharoff (web code 1234)
-----------------------------------------------------

Enter an integer between 2 and one trillion: 7,999,999,433

The integer 7999999433 is prime.


ECE 267, Spring 2003
MP3 submission by Vladimir Goncharoff (web code 1234)
-----------------------------------------------------

Enter an integer between 2 and one trillion: 1111111111

The integer 1111111111 is not prime.

You may refer to this web site to test whether or not a number in the range 2 to 8 trillion is prime.

Submission

1) Be sure to specify your Last Name, First Name, and Web Code in the main text body of your email. Also, include the program number, your name and web code in the output as shown in the sample output above. To get a perfect score, your program should correctly perform the "prime test" for integers up to one trillion. (8/10 points will be awarded if your program does not correctly test numbers for primeness that are this high, but works for any integer less than one billion.)

2) Send your assembly language code, renamed <your uic netid>_3.asm, as an email attachment to the following address by the specified deadline: i267@ece.uic.edu. Please send this email from your @uic.edu or @ece.uic.edu accounts, not some other one (such as @aol.com, for example). Be sure to send the most up-to-date version of your code, and keep a copy for your own records. The submission deadline pertains to the time that your email is actually received, not when you mail it.

3) For this programming assignment you are also required to submit the following in class on Wednesday, 4/2/03:

a) Printed source code with "MP3", your Name and Web Code in comment lines at the top, and sufficiently many comments throughout to give the reader a clear idea of your program is doing at any time.

b) A neatly drawn program flowchart.