My question is about how I'm supposed to get around the use of pseudo-instructions such as la
and li
. Many Internet sources just use pseudo-instructions anyway, which confuses me to some extent.
Part of my problem is with what is going wrong with this snippet. The simulator spits out a syntax error with the liu
instruction and I don't understand what is going wrong.
From my understanding, the liu
command grabs the significant bits, shifts left 16 bits, and puts that in the register ($a0). The ori
instruction takes the label, and performs an OR on the lower 16 bits which is effectively adding it to the register.
.data
m1: .asciiz "Some string"
.text
main:
lui $a0, m1 # loads m1 into $a0 to be printed
ori $a0, $a0, m1
Am I not supposed to use the label m1 for liu
or ori
? And if I'm not meant to, what do I do instead?
I've already read this and I understand what is supposed to be happening, but I'm still not sure as to why my instructions has a different effect, and why there is a andi $a0,$a0,0x0000ffff
before the liu
and ori
commands.
The MIPS simulator I'm using is QtSpim if that is relevant. I've gone looking for answers to this question here and elsewhere, and I've failed to understand them. Any help/corrections would be wonderful.