Reputation: 23
I have this code
size: .word 8 9
I would like to get the 9 and store it in a register, so far I have tried this
lw $a0, size
lw $a0, 4(size)
But I don't think I am using the right offset number, how do I get the 8 and the 9 from this .word and store them in seperate registers
Upvotes: 2
Views: 366
Reputation: 5242
To load an address, use la
, not lw
. Then, go 4 bytes past it.
la $t0, size
lw $a0, 0($t0) # 8
lw $a1, 4($t0) # 9
Additionally, as @Eraklon said, comma-separate your .word directive:
size:
.word 8, 9
Upvotes: 3