Reputation: 351
#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
Upvotes: 0
Views: 110