Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this problem, you will write LC-3 assembly code to calculate some statistics

ID: 3817506 • Letter: I

Question

In this problem, you will write LC-3 assembly code to calculate some statistics about the performance of 30 students in a class, based on their scores for an exam. Assume that the scores of the 30 students are present in contiguous memory locations, starting at 0x4000. For each of the following, your program must implement subroutines. Failure to do so will result in deduction of points even if you get the correct results.

1) Implement a subroutine MAX_SCORES to find the highest score obtained by a student and store this value in the memory location 0x5000. (3 points)

2) Implement a subroutine MIN_SCORES to find the lowest score obtained by a student and store this value in the memory location 0x5001. (3 points)

3) Implement a subroutine AVG_SCORES to calculate the average score of the class and store this value in memory location 0x5002. If the average score is a fraction, round it off to the next higher integer. For example, if the average turns out to be 30.22, the average should be rounded off to 31. (5 points)

4) Implement a subroutine BELOW_AVG to calculate the number of students who have scored below the class average (which has been rounded off), and store this value in memory location 0x5003. (3 points)

Your code should start at memory location 0x3000. You can assume there is no overflow of integers at any step.

Explanation / Answer

.ORIG x3000
LD R3, POSASC ;Loads R3 with #48
LD R4, NEGASC
LD R1, word ;R1 = word
Include R6, R6, #5 ;Length of word
GETC ;Gets the burn
OUT ;Prints the burn
Include R2, R2, R0 ;Stores the burn in R2
;Include R2, R2, R4 ;To ascii
What's more, R0, R0, #0 ;set R0 back to 0
Circle
Furthermore, R5, R2, R1 ;check if singe is equivalent
Include R1, R1, #1 ;augmentation to next singe in word
Include R6, R6, #-1
BRnp LOOP
Include R0, R0, R5 ;Set R0 to # of events
OUT ;Print # of events
End
POSASC .FILL x0030 ;#48
word .STRINGZ "hi" ;word to tally events of a roast
NEGASC .FILL xFFD0 ;#-48
.END

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote