Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an LC-3 program (starting at memory location 0x3000) that checks if a string is the reverse of another string. The end of the string

Write an LC-3 program (starting at memory location 0x3000) that checks if a string is the reverse of another string. The end of the string is denoted by #. Your program should take both the strings as inputs from the keyboard. If the two strings are reverse of each other, you need to print Y to the screen, else you need to print N to the screen.

In particular, your code should do the following things:

a) Read an input character from the keyboard.

b) Test if the character is #. If the character is #, you successfully read the first string

S1.

c) Start reading input character from the keyboard again.

d) Test if the character is #. If the character is #, you successfully read the second

string S2.

e) Compare the two input strings S1 and S2.

f) If S2 is the reverse of S1, display Y else display N.

NOTE: The size of the two input strings S1 and S2 can be different. If the sizes are different, S2 is clearly not the reverse of S1. You may assume the size of the input strings are always non-zero, and do not exceed 10. The output Y or N should be uppercase. Sample runs:

Input: abcdaa# Input: aadcba# Ouput: Y

Input: abcdaa# Input: aaecba# Ouput: N

***Please have your response in LC-3 computer language***

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

How to reverse a Armstrong number by using double linked list ?

Answered: 1 week ago