It is a basic assembly instruction that corresponds to a 32-bit machine instruction.
Here are the services of the SPIM exception handler. The following pages explain how to use them. The print services write characters to the simulated monitor of SPIM. The read services read characters from the keyboard and (for numeric read services) convert character strings into the appropriate type.
|Service||Code in $v0||Arguments||Returned Value|
|print integer||1|| $a0 |
|print float||2|| $f12 |
|print double||3|| ($f12, $f13) |
|print string||4|| $a0 |
|read integer||5||$v0 |
|read float||6||$f0 |
|read double||7||($f0, $f1) |
|read string||8|| $a0 |
|allocate memory||9|| $a0 ||$v0 |
Here is an example of how to use a service.
$v0 with the code for the exit
service and then use the
The exit service stops the program.
(Until now we have been single stepping the program or crashing into the
bytes beyond the end of the program).
li $v0,10 # code 10 == exit syscall # Return control to the # operating system.
What (do you think) the exit service does for a program running on a computer with a real operating system?