Question: Update 1 0 / 1 8 / 2 4 : refer to the demonstration in lecture; instructions below updated for clarification Hello All, For this

Update 10/18/24: refer to the demonstration in lecture; instructions below updated for clarification
Hello All,
For this assignment, you will be debugging the the following example:
Copy machine language (binary) program from Figure 5.14/5.15 to your LC-3 simulator
Figure 5.14 is a flowchart of the "algorithm for adding integers using a sentinel for loop control". Figure 5.15 is the program you will running and testing.
Add improved comments for each line, overall program, and other important info (like what each register does); if you are unsure of something, write down your questions as comments in the code (or a separate doc)
Create object file & load the simulator
Set values for 12 integers as follows (starting @ x3100): 5,10,15,20,25,20,15,10,5,1,2,3
For the first iteration, since everything is "0", also set x310C to the value specified in the course book
For following iterations, since we randomize the machine, let's just leave x310C alone
Verify the initial & final values (update code comments if things become more clear)
Do whatever other tasks you need to in order to verify that the program works as intended.
Choose "randomize machine" and run the program again (go to step 4); do this several times (up to 5 times). It should fail one of the times.
If it doesn't fail any of the times, consider what could happen to make the program fail
Write down any remaining questions concerns about this program (either in comments in code or as a separate doc)
While it seemed to be working from first simulation & possibly even after randomizing, eventually it stopped working as expected after more randomize attempts.
You are allowed to work on this assignment in groups (3 students max), please put all your names on your submission. Group submissions are enabled on Gradescope (please email if there are issues submitting as a group). If working on this assignment as a group, everyone on the team is responsible for making sure the submission is submitted correctly.
NOTE: each time your randomize the machine, be sure to set the 12 integer values from 3100 to 310B.
Homework Template (can submit handwritten version, make sure to include all questions in template):
Small Assignment 8 Template (docx darr )(pdf darr )
Be sure to verify/identify your solution location for each question in your submission
A template is available here
Recreate the problem & take a screenshot showing the simulator (showing the incorrect register values). Note: this may take several randomizations.
Step through the code (using "step over") and identify the point where this problem occurs (show the screenshot showing the incorrect register values). List the line number that is being executed (x3dots ) as well as any other important information (maybe the value located @ x31_).
Briefly describe what the problem is and why it only happens sometimes.
Propose a fix/modification that will guarantee that we will get the expected result regardless of how many times we randomize the machine.Figure 5.14 An algorithm for adding integers using a sentinel for loop control.
R1- x3100
R3-0
R4- M[R1]
BRn x3008
R3- R3+R4
R1- R1+1
R4- M[R1]
BRnzp x3003
Figure 5.15 A program that implements the algorithm of Figure 5.14.
Update 1 0 / 1 8 / 2 4 : refer to the

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!