Problem Statement:
Consider the same test cases as Lab 3, where you were given an array of courses with Course Numbers and number of Enrolled Students, starting at location x4000. In Lab4 you will write a program in LC-3 assembly language to:
1. create a histogram, and
2. calculate the range and mean of Enrolled Students.
Copyright By PowCoder代写 加微信 powcoder
The following highlighted portion has been taken from Lab3 to emphasize that the test cases for Lab4 will be formatted the same way as Lab3.
The array of available courses, non-zero integers between 0 and 256 (for the sake of this lab),
along with the corresponding number of enrolled students will be stored in memory starting at
address x4000. The Course Number and number of Enrolled Students will be specified as follows:
• Bits [15:8] – Non-zero Course Number
• Bits [7:0] – Number of Enrolled Students
The end of this array is specified using a Course Number of zero (or null), for which the Enrolled
Students field could be anything. (This entry merely acts as the sentinel or terminator of the array.)
A histogram is a table representing the number of items that fall between a given set of intervals. We will create the histogram to see how many of a particular classroom size will be needed for a given semester. The histogram is based on the following intervals of Enrolled Students (shown below in decimal):
25 and Below 26 – 50
51 – 100 Above 100
– ‘S’ (Small Classroom)
– ‘M’ (Medium Classroom)
– ‘L’ (Large Classroom) – ‘H’ (Lecture Hall)
The number of individuals falling in each of the 4 intervals is stored in consecutive memory locations starting at address x5000. Bits [7:0] contain the number of courses in each interval, and bits [15:8] contain the identifier of each interval in ASCII, which are ‘S’, ‘M’, ‘L’, and ‘H’.
Refer to the ASCII code chart to find the ASCII codes for ‘S’, ‘M’, ‘L’, ‘H’.
Example: Tables 1 and 2 show content of memory locations corresponding to array and outputs before and after execution of program for a given array. Note that in this lab you are not expected to sort the array. You can, however, sort it (or use the program that you wrote in Lab3).
Table 1. State of memory before program is executed
Bits[15:8]
(in decimal)
(in decimal)
x4000 23
Table 2. State of memory after program is executed
Bits[15:8]
(in decimal)
(in decimal)
83 77 76 72
Contains data that will be overwritten by your program.
Note that these are the ASCII codes (in decimal) for ‘S’, ‘M’, ‘L’, ‘H’.
Report the statistics of the student list.
1. Range as a concatenation of highest number of Students Enrolled in a course in higher order byte (bits [15:8]) and lowest number of Students Enrolled in a course in lower order byte (bits [7:0]) at location x5004.
2. Mean of the Students Enrolled as a 16-bit integer at location x5005.
If mean has a fractional part, round it up to the higher integer. For example, 55.545 can round to 56.
Table 3. State of memory after program is executed
X5004 X5005
Bits[15:8] (in decimal) 105
Bits[7:0] (in decimal) 15
1. Start your program at location x3000. So, the first line of your assembly program must be .ORIG x3000.
2. Course Numbers are all unsigned and non-zero.
3. If there are zero courses in the list, the range and mean should be set as -1 (xFFFF).
4. If there is one course in the list, both the highest and lowest number of credit hours will be
5. You can test your program by manually loading data in locations x4000 onwards (with the last
item in the list being the null course number).
6. Note that the length of the array is not specified. You can assume the maximum size of the
array in test cases is 256 (28). When you test your program for a variety of test cases make sure that you include a case with zero students in the array, and a case with the maximum number.
SUBMISSION INSTRUCTIONS:
The file that you will upload for this assignment must be named youreid.asm. For example, if your eid is ma123 then the file name should be ma123.asm)
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com