Runtime exception address out of range in RARS String Manipulation

65 Views Asked by At
#asciis for l and U
li t4, 108
li t5, 'U'
la t1, str1 # t1 is ptr

repeat:
lb s1, (t1) # the char
beq s1, t2, tapos   # check for \r
beq s1, t3, tapos   # check for \n
beq s1, t5, tapos   # check for null
beq s1, t4, test_replace
j repeat

test_replace:
#Replace current letter, with a new letter
li t5, 'U'
sb t5, 0(s1)
j repeat

What I'm trying to do is when a character 'l' is encountered, it gets rewritten with the character 'U'. However, when I run it, I experience an Address out-of-range exception on the last line

0

There are 0 best solutions below