Project 3

.docx

School

Arizona State University *

*We aren’t endorsed by this school

Course

230

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

6

Uploaded by MateWorld4934

Report
.org 0x10000000 # Initializations # NOTE: You may add initializations after line 10, but please do not # remove or change the initializations to $sp, $s0, $s1, or $s2 li $sp, 0x10fffffc # Starting address of the empty stack li $s0, 0xf0000000 # UART base address li $s1, array_ptr # Array head pointer li $s2, array_ptr # Array tail pointer #################################################################### # Do not make changes to the jump to main, the allocation of # memory for the array, or the main loop #################################################################### j main nop array_ptr: # Label pointing to the array .space 100 # Reserve space for a 100-character array main: jal poll_UART nop jal period_check nop jal space_check nop
jal case_check nop jal array_push nop j main nop # The "poll_UART" function should poll the status register of the UART. # If the 2^1 bit position (ready bit) is set to 1, then it should copy # the receive buffer's value into $v0 and send a clear status command (2^1) # to the command register before returning. poll_UART: lw $t1, 4($s0) # Load the status register li $t2, 0b10 # Bit mask for the ready bit and $t3, $t1, $t2 # Check if the ready bit is set beq $t3, $0, poll_UART # If not ready, continue polling nop lw $v0, 8($s0) # Read the receive buffer sw $t2, 0($s0) # Send a clear status command to the command register jr $ra nop # The "period_check" function should check if the current character ($v0) # is a period ("."). If it is a period, then it should go to the label # "palindrome_check". If the character is not a period, then it should use # the included return. period_check:
li $t0, 0x2E # ASCII value of '.' beq $v0, $t0, palindrome_check # Check if the current character is a period nop jr $ra nop # The "space_check" function should check if the current character ($v0) # is a space (" "). If it is, then it should jump to "main" to skip saving # the space character. If not, it should use the included return. space_check: li $t4, 0x20 # ASCII value of space character beq $t4, $v0, main # Check if the current character is a space nop jr $ra nop # The "case_check" function should perform a single inequality check. # If the current character ($v0) is greater than the ASCII value of 'Z', # which indicates the current character is lowercase, then it should convert # the value of $v0 to the uppercase equivalent and then return. If the # current character ($v0) is already uppercase (meaning the inequality # mentioned before was not true), then the function should return without # performing a conversion. case_check: li $t5, 'a' # Load 'a' into $t5 li $t6, 'z' # Load 'z' into $t6 slt $t7, $v0, $t5 # Compare if input is less than 'a'
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help