syscall
System call
Invokes an OS service identified by the integer in $v0.
Used in
- .data, .text and directivesMIPS assembly
- Memory, little endian and alignmentMIPS assembly
- Words, halves and bytesMIPS assembly
- The MIPS instruction setMIPS assembly
- Loads, stores and immediatesMIPS assembly
- Comparing two numbersMIPS assembly
- Memory regions and executable filesMIPS assembly
- Branch on compareMIPS assembly
- LoopsMIPS assembly
- Arithmetic, logic and bitsMIPS assembly
Forms
syscall
Common services: 1=print integer ($a0), 4=print string (addr in $a0), 5=read integer (result in $v0), 8=read string ($a0=buf addr, $a1=len), 10=exit. See the Help menu for the full list.
.data
message: .asciiz "MIPS syscall example\n"
.text
# Service 4 prints the string addressed by $a0. Service 10 exits after the line. Inspect Console: MIPS syscall example, then a newline.
la $a0, message
li $v0, 4
syscall
li $v0, 10
syscall