PDA

View Full Version : Assembly Language MIPS


webguy08
02-18-2009, 10:30 PM
Hi all,
Just a very quick question:
What does the following line of code mean/do?
lb $t0,str($t1)
I am just unsure about the bracket.

Thanks for any help.

oracleguy
02-19-2009, 01:07 AM
MIPS is a load and store architecture.

The lb instruction means "Load byte". In this case load a byte into register t0 from the address indicated by the second operand.

In the case of the str($t1), I am not sure. From what I remember about those types of architectures, normally you'd do something like 8($t1) which would give an offset to address stored in a register. Perhaps looking in the instruction set reference manual might shed some light on what str does to the t1 register.

oesxyl
02-19-2009, 01:19 AM
I'm not not sure but could be a macro - pointer to ascii string, null ended, for variable $t1( I'm talking about str part only)..
as oracleguy said, looking in the reference manual is the solution. Also I guess you can find what happend if you can add some option to the assambler to keep the temporary preprocessing files and look inside. Usualy there are some comment inserted.

best regards

webguy08
02-19-2009, 01:34 AM
The str part is just the name of the .asciiz string which holds a sentence. It's just that end part which I don't understand :p

I have a reference sheet here, it states that it [($t1)] "addresses that this instruction requires what is held in the specified register (register indirect)". However I don't understand what that means lol.

oesxyl
02-19-2009, 01:39 AM
The str part is just the name of the .asciiz string which holds a sentence. It's just that end part which I don't understand :p

I have a reference sheet here, it states that it [($t1)] "addresses that this instruction requires what is held in the specified register (register indirect)". However I don't understand what that means lol.
register t1 hold the addres, so will be "load in t0 what is stored in t1".
I'm not so sure about what I say, try to put a break point there and trace it.

best regards