Question: For this lab you will implement a basic LC 3 assembly program which calculates the sum of 1 0 2 s complement numbers Program Details

For this lab you will implement a basic LC3 assembly program which calculates the sum of
102s complement numbers
Program Details
Your program will start at x3000 in memory and sum the numbers stored at memory
locations x3100 to x3109. Please note that while the autograder will populate these memory
address with data values, when testing your program, you will need to place these values into
memory manually. I recommend doing so by modifying the memory values via the simulator
rather than using assembly code. The final sum will be stored at memory location x310A.
Once stored, your program will halt the machine using the HALT command.
You must place any .FILL pseudo-ops after your HALT command. Placing .FILL pseudo-
ops before the HALT will cause the data stored at those locations to be executed as
instructions. This can cause your code to produce unexpected results and prevent
Gradescope from executing correctly.
My code so far:
.ORIG x3000
AND R0, R0, #0
LD R1, START_ADDR
AND R3, R3, #0
ADD R3, R3, #10
LOOP
LDR R2, R1, #0
ADD R0, R0, R2
ADD R1, R1, #1
ADD R3, R3, #-1
BRp LOOP
ST R0, RESULT
HALT
START_ADDR .FILL x3100
RESULT .FILL x310A
.END
Errors/Failed Tests:
one2TenTest Test (0/10)
When summing the values 1-10 we expected 55 but was 0
ten2OneNegativeTest (0/10)
When summing the values -10--1 we expected 65481 but was 0
somePositiveSetTest (0/10)
When summing the values 12,61,8,23,82,81,16,8,36,101 we expected 428 but was 0
someNegativeSetTest (0/10)
When summing the values -83,-3,-71,-8,-28,-46,-26,-523,-868,-2 we expected 63878 but was 0
someMixedSetTest (0/10)
When summing the values 62,-73,57,-97,29,-36,8,-276,539,-84 we expected 129 but was 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!