Question: LC-3 Assembly question: The following program determines whether a character is a palindrome or not. A palindrome is a string that reads the same backwards

LC-3 Assembly question:

LC-3 Assembly question: The following program determines whether a character is a

The following program determines whether a character is a palindrome or not. A palindrome is a string that reads the same backwards as forwards. For example, the string racecar is a palindrome. The string is stored in memory starting at x4000 and is in the .STRINGZ format. If the string is a palindrome, the program, the program terminates with the value 1 in R5. If not, the program terminates with the value 0 in R5. Insert instructions at (a)-(c) that will complete the program |ORIG x3000 LD R0, PTR ADD R1, R0, #0 AGAIN LDR R2, R1, #0 BRz CONT ADD R1, R1, #1 BRnpz AGAIN CONT ------------- (a) LOOP LDR R3, R0, #0. -------------(b) NOT R4, R4 ADD R4, R4, #1 ADD R3, R3, #1 ADD R3, R3, #4 BRnp NO ------------------(c) ------------------(d) NOT R2, R0 ADD R2, R2, #1 ADD R2, R1, R2 BRnz YES -------------------e) YES AND R5, R5, #0 ADD R5, R5, #1 BRnz DONE NO AND R5, R5, #0 DONE HALT PTR .FILL X4000 .END

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 Databases Questions!