Hi,
I just had a quick question. Let's say I have 2 labels string and word with string being a label associated with a string and word being an actual word with a 32 bit integer stored in it. Now let's say I use a syscall to print string using the label string and I use load address with register a0, it will print the string. However why doesn't it print the address, since this is load address. On the other hand if I do the exact same thing but instead of using the string label I use the word label I am now instead going to print the actual address. I was wondering why it works this way.
Thanks for your time
Varun G.
I think you are misinterpreting syscalls. You issue a certain syscall to do different things.
To print a string you issue a
syscall
4 ($v0
= 4). This service prints the string pointed by the address given in$a0
which you should previously load.To print an integer you issue a
syscall
1 ($v0
= 1). This service prints the integer stored at$a0
. This integer may be seen as an address if you have loaded it withla
pseudoinstruction.So if you have the following snippet:
it will print the address of the beginning of the string and also its contents.