Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly PLPTool 5.2 I have to make a program that checks if a string is a Palindrome or not. In this project, you will be

Assembly PLPTool 5.2

I have to make a program that checks if a string is a Palindrome or not.

"In this project, you will be writing a program that receives a string of characters via the UART, checks if this string is a palindrome, and then uses a print function to print either Yes or No. A palindrome sequence of characters (typically a word or phrase) that is the same both forwards and backwards. For this project, strings will be terminated using a period (.). You may assume that a string will contain at least one character in addition to a period. You will not need to handle empty strings or strings with only a period. Your program should be able to handle multiple strings sent one after another or concatenated together. For example, the string: abba. data. should print Yes followed by No on the next line. Spaces should be ignored when checking for a palindrome and the palindrome should not be case sensitive. For example, A nut for a jar of Tuna. would be considered a palindrome. "

Here is my code so far:

.org 0x10000000

# Initializations li $sp, 0x10fffffc li $a0, 0($a0) li $s0, 0xf0000000 #command register li $t7, 0b00000010 #clear status bit

# Initialize any registers you will be using here. # It can be helpful to include a comment about a register's purpose # next to an initialization at the start of the program for reference.

j main nop

array_ptr: # Label pointing to 100 word array .space 100

main: # TODO: write your primary program within this loop

j main nop

isPalindrome: # Check base case slti $t0, $a0, 2 bne $t0, $zero, returnTrue

# Make sure first and last are equal lb $t0, 0($a1) addi $t1, $a0, -1 add $t1, $t1, $a1 lb $t1, 0($t1) bne $t0, $t1, returnFalse # Shift pointer, length, recurse addi $a0, $a0, -2 addi $a1, $a1, 1 j isPalindrome

returnFalse: addi $v0, $zero, 0 jr $ra

returnTrue: addi $v0, $zero, 1 jr $ra

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

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

More Books

Students also viewed these Databases questions