SYSCALL functions available in RARS

Introduction

A number of system services, mainly for input and output, are available for use by your program. They are described in the table below.

Register contents are not affected by a system call, except for result registers as specified in the table below.

How to use SYSCALL system services

Step 1. Load the service number in register a7.
Step 2. Load argument values, if any, in a0, a1, a2, a3, fa0, ... as specified.
Step 3. Issue the ECALL instruction.
Step 4. Retrieve return values, if any, from result registers as specified.

Example: display the value stored in $t0 on the console
    li  a7, 1          # service 1 is print integer
    add a0, t0, zero   # load desired value into argument register a0, using pseudo-op
    ecall

Table of Available Services