[prev] 29 [next]

System Calls

SPIM interacts with stdin/stdout via syscalls

These services are invoked via the syscall pseudo-instruction after storing the service code in the register $v0.

ServiceCodeArgumentsResult
print_int1$a0 = integer 
print_float2$f12 = float 
print_double3$f12 = double 
print_string4$a0 = char * 
read_int5 integer in $v0
read_float6 float in $f0
read_double7 double in $f0
read_string8$a0 = buffer, $a1 = lengthstring in buffer
(including "\n\0")
print_char11$a0 = char 
read_char12  char in $v0