****************************************************************** ******************** *********************** ***************** Assignment #3 for CS341 ********************* ***** Due Monday 03/08/99 ***** ***** ***** ****************************************************************** Reading Assignment: Chapters 10-12 of the lab manual. ------------------ The goal of the programming assignment is to learn: (i) to write leaf subroutines (and use of call and retl instructions) (ii) the use of register windows (and use of save and restore instructions) (iii) to write non-leaf subroutines and conventions for passing parameters through the stack. A database of student records is maintained in the data segment of your program. For simplicity, the database consists of a single table or relation. Each row of the table (or tuple) corresponds to a student record. Each record is made up of 4 fixed-length fields. The four fields are: (i) student_id (two digits) eg. 45 (ii) course (5 alphanumeric characters) eg. CS341 (iii) credit_hours (single digit) eg. 3 (iv) grade (one of A, B, C or D). Note that there may be several records corresponding to a single student, one per course taken. Moreover, the records pertaining to a given student need not appear in consecutive rows. The main program will prompt the user to enter the student id. In response, main will scan the table for records of that student. If no record of that student is found, main will display "No record for student exists". Otherwise, for each record found, main will pass the start address of that record to subroutine "disp1". disp1 will display each record on a separate row leaving sufficient blank spaces for the left and right margins and also spaces between fields for readibility. For each course record of that student found, main will save the credit hours and grade. Upon scanning the entire table, main will call "gpa". gpa computes the student's gpa. Assuming main has found i records for the student, main will pass gpa 2i+1 parameters -- the first parameter is i and the remaining parameters are the credit hours and grade alternately for each of the i courses. (If there is an insufficient number of registers to pass parameters, some will have to be passed through the stack.) gpa is pretty much Assignment #2 except here we are dealing with subroutines. Also, gpa should compute the total number of credit hours and the sum, cj*gj (the numerator in the gpa calculation) and pass these two parameters to "decimal". decimal performs the division as in Assignment #2 and displays the GPA on the screen to two decimal places.