Section A.2 OS Calls
Calling the operating system is done by the
syscall
instruction. The operation to be carried out is specified by the $v0
register. Potential arguments to the system call are passed in the argument registers.Action | $v0 |
Description |
print integer | 1 |
$a0 = number to be printed. |
print string | 4 |
$a0 = address of ASCIIZ string. |
read integer | 5 | Read number stored in $v0 . |
read string | 8 | $a0 = start address of memory area where characters are put. $a1 = maximum number of characters to read. |
exit | 10 | End program execution. |
print character | 11 |
$a0 = ASCII code of character to print. |
read character | 12 | ASCII code of read character stored in $v0 . |