Consider the following complete LC-3 program with 3 bugs: .ADDR x3000 LD R1, N LOOP ADD R1, R1, #-1 BRz DONE ADD R2, R2, R1 BRnzp LOOP DONE ST RESULT HALT N .FILL x000B RESULT .BLKW #1 .END The program is meant to sum the integers from N down to 1 (inclusive) and save the total in memory. Identify the bugs in the program above. To maximize partial credit, it is best to select only those for which you are certain. memory not properly initialized invalid register name register not properly initialized wrong number of operands invalid assembler directive wrong instruction sets condition codes prior to branch undefined label wrong order of operand types invalid operation
Added by Jennifer N.
Close
Step 1
The first bug is that the memory is not properly initialized. The program uses the value of N, but it is not defined anywhere in the program. Therefore, the program will not work as intended. Show more…
Show all steps
Your feedback will help us improve your experience
Sri K and 88 other Physics 103 educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Consider the following complete LC-3 program with 3 bugs: .ORIG x3000 LD R1, N LOOP ADD R1, R1, #-1 BRz DONE ADD R2, R2, R1 BRnzp LOOP DONE ST RESULT HALT N .FILL x000B RESULT .BLKW #1 .END
Supreeta N.
Determine how many times the innermost loop will be iterated when the following algorithm segment is implemented and run. (Assume that m and n are positive integers.) for j := 1 to m for k := 1 to n [Statements in body of inner loop. None contain branching statements that lead outside the loop.] next k next j (Hint: See Example 9.2.5 in the "Read It" link.) For each iteration of the outer loop there are iterations of the inner loop. Therefore, the answer is mn
Yujie W.
Adi S.
Recommended Textbooks
University Physics with Modern Physics
Physics: Principles with Applications
Fundamentals of Physics
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD