Reputation: 1437
I'm struggling to find a good site that explains MIPS and how it works.
The code I am trying to understand is:
SW 7000(R0),R1
I know SW means save word and that it is saving the value of R1 to memory address 7000. What is the point of (R0)? What does it do?
Is there a good resource for problems I run into similar to this?
Thanks!
Upvotes: 0
Views: 3979
Reputation: 31393
Here R0 is a register. Placing it in brackets is indicating that you are using indirect addressing (ie: like a pointer) : not storing in R0, but in the address stored in R0.
The 7000 indicates an offset. In this case you would have the address stored in R0 + 7000.
Upvotes: 5
Reputation: 22585
Looks like it should be
SW R1, 7000(R0)
where R1 and R0 are any MIPS registers.
It would read as store the contents of register R1 into effective memory address 7000+R0
.
E.g. if R1 contains value 10 and R0 contains value 1192, then it would store a word (32 bits) with value 10 into memory address 8192.
Upvotes: 1