Question: The following LC - 3 program compares two characters strings of the same length. The source strings are in the . STRINGZ form. The first

The following LC-3 program compares two characters strings of the same length. The source strings are
in the .STRINGZ form. The first string starts at memory location x4000, and the second string starts
at memory location x4100. If the strings are the same, the program terminates with the value 1 in R5.
Insert instructions at (1),(2), and (3) that will complete the program. Note: there may be multiple
possible solutions. You only need to provide one of them.
.ORIG x3000
LD R1, FIRST
LD R2, SECOND
AND R0, R0, #0
LOOP ____________________(1)
LDR R4, R2, #0
BRz NEXT
ADD R1, R1, #1
ADD R2, R2, #1
____________________(2)
____________________(3)
ADD R3, R3, R4
BRz LOOP
AND R5, R5, #0
BRnzp DONE
NEXT AND R5, R5, #0
ADD R5, R5, #1
DONE TRAP x25
FIRST .FILL x4000
SECOND .FILL x4100
.END
1.
2.
3.

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!