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

I\'m trying to get a program in MIPS that converts a lower case letter into a up

ID: 671443 • Letter: I

Question

I'm trying to get a program in MIPS that converts a lower case letter into a upper case letter but every time try it doesn't print out the Upper case letter. Here is my following code.

main:
la $a0, msg1   #load the address of msg1 into $a0
li $v0, 4   #output the string
syscall       #call the system

li $v0, 12   #Reads a character
syscall       #call the system

move $v1, $v0   #move the contents of $v0 into $v1

la $a0, msg2   #load the address of msg2 into $a0
li $v0, 4   #output the string
syscall       #call the system

addiu $v0, $v1, 32
li $v0, 11
syscall

li $v0, 10
syscall

.data
msg1: .asciiz "Enter a lower case letter: "
msg2: .asciiz "The upper case letter is: "

Explanation / Answer

.data
mystring: .asciiz ""
nextline: .asciiz " "
.text
main:
#taking input
li $v0,8
li $a1,20
la $a0,mystring
syscall

li $v0,4
li $t0,0

#looping through the string

loop: lb $t1,mystring($t0)
beq $t1,0,exit
sub $t1,$t1,32
sb $t1,mystring($t0)
addi $t0,$t0,1
j loop



#print final string
exit:
li $v0,4
la $a0,mystring
syscall

#end program

li $v0,10
syscall