What Does Li $V0,10, in Mips?
I Am Just Starting with Mips So This May Sound Simple but: When I Wrote the Code Above Without Li $V0,10 Instruction, I Got an Error Message: Memory Adress out...
I am just starting with Mips so this may sound simple but:
When I wrote the code above without li $v0,10 instruction , I got an error message: memory adress out of bound
When , I added it , it worked with no warnings.
What does this means?
.text
.globl main
main:
li $t1,27
li $t2,2
mulou $t3,$t1,$t2
li $v0,10
syscall
1 Answer
li itself just loads an immediate into a register. In this particular case, the service routine on the other side of syscall looks at the value in $v0 to tell what function is requested. 10 is the code for exit (see list of system calls supported by spim). If you don't set $v0 then some random function will be performed based on what value $v0 happens to contain. Likely it isn't going to be exit so the cpu tries to continue executing whatever is after your code in memory which will sooner or later crash.