I’m trying to load a byte from a word saved in data:
.data
number:
.word w1
part of the .text:
stringlength:
li $t2, 10
li $t1, -1
la $a0, number
loop:
addiu $t1, $t1, 1
lb $t0, $t1($a0)
bne $t0, $t2, loop
move $v0, $t1
jr $ra
*the code is not finished
My problem is with,
lb $t0, $t1($a0)
I’m trying to achieve a dynamic offset that will increment by 1, to check each byte in the string, to check wether it’s equal to 10 (dec) or not.
QtSPIM raises an exception syntax error about this line,
What’s the correct way of doing so?
There is no such addressing mode, you’ll just have to calculate the address yourself by adding the offset, such as: