summaryrefslogtreecommitdiff
path: root/lib/runtime.asm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/runtime.asm')
-rw-r--r--lib/runtime.asm29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/runtime.asm b/lib/runtime.asm
new file mode 100644
index 0000000..5cb4458
--- /dev/null
+++ b/lib/runtime.asm
@@ -0,0 +1,29 @@
+#
+# MIPS32r6 ASSEMBLY RUNTIME
+# - sets up the stack
+# - calls main
+# - exits
+#
+
+.extern main
+
+.stack
+.align 2
+
+.space 4096
+__mips_stack:
+
+.text
+.align 2
+
+_start:
+ # setup stack
+ la $sp, __mips_stack
+
+ # call main
+ jal main
+
+ # exit
+ move $a0, $v0
+ li $v0, 1
+ syscall