Question: assembly plptool 52 i have to make a program that...
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:
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.
Label pointing to 100 word array
# TODO: write your primary program within this loop
# 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
addi $v0, $zero, 0
addi $v0, $zero, 1