I have an assignment in which I am asked to change each lowercase letter of a given string to an uppercase letter.
My problem is that the professor has asked us to input the string into the text segment and not the data segment.
I have tried using lw
and sw
but it doesn't work.
Is there any other way?
(My program works when the string is in the data segment)
This is what I have so far:
.data
str: .space 100
textlow: .asciiz "This is a sample text!"
.text
main:
li $t0, 0
loop:
lb $t1, textlow($t0)
beq $t1, 0, exit
blt $t1, 'a', diff
bgt $t1, 'z', diff
sub $t1, $t1, 32
sb $t1, textlow($t0)
diff:
addi $t0, $t0, 1
j loop
exit:
li $v0, 10
syscall