MIPS – why does the following print "OK"?


#1

The following fragment of MIPS code results in “OK” being printed when I run it on QtSpim.

But why is this?

addi $v0, $zero, 11

addi $a0, $zero, 79

syscall

addi $v0, $zero, 11

addi $a0, $zero, 75

syscall

addi $v0, $zero, 10

syscall

#2

Not sure what you mean by “why”, but perhaps reading the code lets you answer that yourself?

If you google a bit you can find what the addi and syscall instructions do
http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html

Google a bit more and find a list of syscalls for SPIM
https://www.doc.ic.ac.uk/lab/secondyear/spim/node8.html