Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
SPIM
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== The SPIM operating system == The SPIM simulator comes with a rudimentary operating system, which allows the programmer usage of common used functions in a comfortable way. Such functions are invoked by the {{mono|syscall}}-instruction. Then the OS acts depending on the values of specific registers. {| class=wikitable |+ '''Examples of system calls (used by SPIM)''' |- ! service || Trap code || Input || Output || Notes |- ! print_int | $v0 = 1 || $a0 = integer to print || prints $a0 to standard output || base = 10 |- ! print_string | $v0 = 4 || $a0 = address of first character || || prints a character string to standard output |- ! read_int | $v0 = 5 || || integer read from standard input placed in $v0 || base = 10 |- ! sbrk | $v0 = 9 || $a0 = number of bytes required || $v0= address of allocated memory || Allocates memory from the heap |- ! exit | $v0 = 10 || || || |- ! file_open | $v0 = 13 || $a0 = full path, $a1 = flags, $a2 = UNIX octal file mode || $v0 = file descriptor || example; there are read/write/close functions, too |} The SPIM OS expects a label named {{mono|main}} as a handover point from the OS-preamble.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)