summaryrefslogtreecommitdiff
path: root/boot/stage8.elna
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-09-13 21:15:09 +0200
committerEugen Wissner <belka@caraus.de>2025-09-13 21:15:09 +0200
commitee3b733a81f3136494e612a0d748f4d029064845 (patch)
tree10a6d7534dc3efd11562f28ce9b1a581530ebb5e /boot/stage8.elna
parent216dc59f0b1507a7529ce34332463f9443a05cd4 (diff)
downloadelna-ee3b733a81f3136494e612a0d748f4d029064845.tar.gz
Implement if-else
Diffstat (limited to 'boot/stage8.elna')
-rw-r--r--boot/stage8.elna12
1 files changed, 11 insertions, 1 deletions
diff --git a/boot/stage8.elna b/boot/stage8.elna
index 6243634..75c24d7 100644
--- a/boot/stage8.elna
+++ b/boot/stage8.elna
@@ -7,6 +7,10 @@
# - Procedure calls in expressions.
# - Comments between (* and *) are supported. These are still single line
# comments and they should be on a separate line.
+# - _syscall builtin. _syscall takes 7 arguments,
+# the 7th argument gets stored in a7 before invoking ecall.
+# Other arguments are saved in a0 through a5.
+# - New intrinsics: _load_byte, _load_word, _store_byte, _store_word.
const
symbol_builtin_name_int := "Int";
symbol_builtin_name_word := "Word";
@@ -1403,7 +1407,13 @@ begin
_skip_empty_lines();
_compile_var_part();
- _write_z(".section .text\n\0");
+ _write_z(".section .text\n\n\0");
+ _write_z(".type _syscall, @function\n_syscall:\n\tmv a7, a6\n\tecall\n\tret\n\n\0");
+ _write_z(".type _load_byte, @function\n_load_byte:\n\tlb a0, (a0)\nret\n\n\0");
+ _write_z(".type _load_word, @function\n_load_word:\n\tlw a0, (a0)\nret\n\n\0");
+ _write_z(".type _store_byte, @function\n_store_byte:\n\tsb a0, (a1)\nret\n\n\0");
+ _write_z(".type _store_word, @function\n_store_word:\n\tsw a0, (a1)\nret\n\n\0");
+
.compile_module_loop:
_skip_empty_lines();