Department of Electrical and Computer Engineering

The University of Texas at Austin

EE 306, Fall 2009
Programming Assignment 2
Due: 25 October, 11:59 pm
Yale N. Patt, Instructor
TAs: Aater Suleman, Chang Joo Lee, Ameya Chaudhari, Antonius Keddis, Arvind Chandrababu, Bhargavi Narayanasetty, Eshar Ben-dor, Faruk Guvenilir, Marc Kellermann, RJ Harden

You must do the programming assignment by yourself. You are permitted to get help ONLY from the TAs and the instructor. When you have completed the program, and tested it sufficiently so that you are comfortable that it works on any input (i.e., values initially stored starting at x3200), submit it for grading according to the instructions Submit your program at the end of this handout.


Grade Sorting with Arrays

Background: A local high school teacher, Alga Rythm, needs your help in deciding the grades for her students. She wants to assign grades based on the student's rank and the score in the course. Her criteria are as follows:

  • A student deserves an A if the student is in the top 25% of the class and has earned a score of 85 or above.
  • A student deserves an B if the student is in the top 50% of the class and has earned a score of 75 or above. A student deserves a B if the student does not qualify for an A but is in the top 50% of the class and has earned a score of 75 or above.
  • All remaining students deserve a C.

    There are 16 students in her class where each student has one score.

    Your job: Write a program in assembly language to assign grades to Ms. Rythm's class. Your program must sort the list of scores and count the number of students that deserve As and Bs. Your program should start at x3000.

    Program input: The unsorted scores of all 16 students in class. Each score is a number between 0 and 100 and is represented as a 16-bit unsigned integer. The list is stored in 16 consecutive memory locations -- one score per location-- starting at address x3200. The last score is at location x320F Make no assumptions about the ordering of the scores. You can assume that all scores are unique (no two scores can be the same).

    Program output:Your program must produce two outputs:

    1. The sorted scores of all 16 students. The scores must be sorted in descending order stored in consecutive memory locations--one score per location-- starting at address x4000. Location x4000 will contain the highest score.

    2. The numbers of students earning As and Bs. The number of As must be stored in x4100 and the number of Bs must be stored in location x4101

    Note: Test your program thoroughly before you submit. Make sure there are no silly mistakes. Please note that there will be NO regrades for this programming lab under any circumstances.

    Submit your Program: The program you are to submit is the .asm file. Save your .asm file, and give it the name grades.asm. Follow the submission instructions for uploading your grades.asm file for grading.