Service
System Call Code
Arguments
Result
PRINT_INT
1
$a0=int

PRINT_FLOAT
2
$f12=float

PRINT_DOUBLE
3
$f12=double

PRINT_STRING
4
$a0=string

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

SBRK
9
$a0=amount
address in $v0 of newly allocated memory
EXIT
10

Terminate Program
PRINT_CHARACTER
11
$a0=character

READ_CHARACTER
12

character in $v0
FILE_OPEN
13
$a0=string (path and file name), $a1=flags, $a2=permission mode
a1 = any of the following:
Read Only = 0x0
Write Only=0x1
Read/Write=0x2
which may be bit-wise or'd with the creation options:
Create=0x8 unix, 0x100 windows
Truncate=0x200 unix, 0x200 windows
Append=0x2000 unix, 0x8 windows
on windows, the "file type" may be specified:
Text=0x4000
Binary=0x8000
a2= read/write permissions (Bitwise or for both)
Read=0x100
Write=0x80
results in $v0
-1 = Error
Anything else is a file descriptor (to use the file in the future)
FILE_READ
14
$a0=file descriptor (to an open/good file)
$a1=buffer
$a2=amount to read
Data read from file into buffer.
result in $v0
-1=Error
0=End of File (With no bytes read)
>0 = The number of bytes read (which will be < or == amount)
FILE_WRITE
15
$a0=file descriptor (to an open/good file)
$a1=buffer
$a2=amount to write
Data written from the buffer into the file.
result in $v0
-1=Error
0=End of File (With no bytes read)
>0 = The number of bytes written (which will be < or == amount)
FILE_CLOSE
16
$a0=file descriptor (to an open/good file)
The file is closed (the descriptor will no longer be valid)