0

Helloo,

I'm learning MIPS Assembly righ know at University and I'm bit confused. When using the command 'li' for example in li $v0, ()... when do I use which value for the brackets? I saw now 1s and 4s.

Please Help

I tried using different values but I dont understand it.

Willi
  • 1
  • 2
    `li`, load immediate, is a pseudo instruction that the MARS assembler changes into one or two real instructions depending on the size of the immediate. If the immediate is small then MARS will use `addi` with `$0`, which will accomplish loading the immediate value into a register. We never use `()`s with `li` — that syntax is for memory reference instructions like `lw` and `sw`, or the pseudo instruction `la` (load word, store word, load address). – Erik Eidt Dec 26 '22 at 17:10
  • If it's before `syscall`, see https://courses.missouristate.edu/kenvollmar/mars/help/syscallhelp.html for the call number. Think of it like indexing an array of functions (or function pointers) in the OS, so the same `syscall` instruction can ask for different functions. If it's anywhere else, it's up to you what integer value you want in a register, depending on what you're going to do with the value. (If your question isn't about syscall numbers, it's unclear what you're asking.) – Peter Cordes Dec 26 '22 at 20:13

0 Answers0