System Calls
SPIM interacts with stdin/stdout via syscall s
These services are invoked via the syscall pseudo-instruction after storing the service code in the register $v0.
Service | Code | Arguments | Result |
print_int | 1 | $a0 = integer | |
print_float | 2 | $f12 = float | |
print_double | 3 | $f12 = double | |
print_string | 4 | $a0 = char * | |
read_int | 5 | | integer in $v0 |
read_float | 6 | | float in $f0 |
read_double | 7 | | double in $f0 |
read_string | 8 | $a0 = buffer, $a1 = length | string in buffer (including "\n\0") |
print_char | 11 | $a0 = char | |
read_char | 12 | | char in $v0 |
|