EE 306 Introduction to Computing: Program 2

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (3 votes)

Objective
The purpose of this assignment is to write a program in LC-3 assembly language to sort an array of
student records in descending order of scores. Additionally, the program should search the array (post
sorting) to find the score of a student given a name.
Details
An array of student records is given at address x3500. Each record holds information about a student
with two fields in this order:
● Score (ranges from 0 to 100)
● Address of Name (the address of the memory location where this student’s name is stored)
Both fields take up 16-bits each so all elements of the array are of the same length. The end of the array
of student records is indicated by the sentinel record which has a score of -1. The array itself is
unordered meaning that the student records don’t follow any ordering by score or name.
A few example files are provided for you so you can make sure you are reading the correct input and
producing the correct output. These files are: Students.asm, Joe.asm,
Batman.asm,Wow.asm and Lookup.asm.
Tasks: You have to complete two tasks.
● Task 1: Sort the array in decreasing order of score. Highest score first. Note that the sorted array
will be ordered by score but each record has an associated name that needs to go with the
record.
Here is an example test case with an array of 3 student records prior to sorting:
After sorting, the array looks like so:
● Task 2: You are given a lookup name at location x6000. You have to lookup this student in the
array (post Task 1) and put the student’s score at x5FFF (i.e., in front of the name). If the
student is not in the array then the a -1 should be written at x5FFF. If you are given a lookup
name of “Joe” (at address x6000) then the score 55 should be written at x5FFF. If you are
given a lookup name of “Bat man” then -1 should be written at x5FFF, because “Bat man” is
not a student. (Notice the difference in case.)
Note: Each name in the array will be unique. (There will be no duplicate names.) Additionally,
the names in the array and in the lookup string must match exactly for the lookup to match.
(The capitalization, length, spacing, etc. must all match exactly.)
Testing
To check to see if your code executes properly, you need to load in Students.asm, Joe.asm,
Batman.asm,Wow.asm and Lookup.asm before you load in Program2.asm.
You can test the different lookups by commenting/uncommenting lines in Lookup.asm and then
loading that in.
Submission Instructions
● You must do the programming assignment by yourself. You are permitted to get help from ONLY
the TAs and the instructor.
● The file you submit should be a LC-3 assembly language file named Program2.asm. A starter
version of this file is provided for you. This is the only file you need to submit.