Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete MIPS program to toggle the case of all alphabetic characters in

ID: 3882717 • Letter: W

Question

Write a complete MIPS program to toggle the case of all alphabetic characters in a C-string held in RAM in your program. Declare the string with a reasonable value (a 5 or 6 word sentence with spaces and punctuation) and print it before and after toggling the case of all alphabetic characters in the string. Do not add notes to the top of the program, but you may comment individual lines. The upper-case characters are 32 less than their corresponding lower-case characters. (less than 40 lines of code)

Explanation / Answer

This should give an idea:

.text

.globl __start

main:

la $t1, str

nextCh: lb $t2, ($t1)

beqz $t2, strEnd

addi $t4, $zero, 0x61

sub $t3, $t2, $t4

bgez $t3, l1

add $t2, $t2, 32

sb $t2, ($t1)

l1: add $t1, $t1, 1

j nextCh

strEnd: la $a0, ans

li $v0, 4

syscall

la $a0, str

li $v0,4

syscall

la $a0, endl

li $v0, 4

syscall

li $v0, 10

syscall

.data

str: .asciiz "ABCdEfgH"

ans: .asciiz "lowercase string ="

endl: .asciiz " "

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote