summaryrefslogtreecommitdiff
path: root/boot/asm-boot.s
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-04-18 09:26:57 +0200
committerEugen Wissner <belka@caraus.de>2025-04-19 23:23:53 +0200
commit148da8ed91f17c6fb367f52c927629b0f4cacb5e (patch)
tree502e07dfc495c418e57a73b31d0e9d0cd5a0d429 /boot/asm-boot.s
downloadelna-148da8ed91f17c6fb367f52c927629b0f4cacb5e.tar.gz
Initial commit
Diffstat (limited to 'boot/asm-boot.s')
-rw-r--r--boot/asm-boot.s29
1 files changed, 29 insertions, 0 deletions
diff --git a/boot/asm-boot.s b/boot/asm-boot.s
new file mode 100644
index 0000000..594c624
--- /dev/null
+++ b/boot/asm-boot.s
@@ -0,0 +1,29 @@
+# s1 - Contains the current position in the source text.
+
+.data
+
+.equ SYS_EXIT, 93
+.equ SOURCE_BUFFER_SIZE, 2048
+
+.bss
+.global source_code
+.type source_code, @object
+.size source_code, SOURCE_BUFFER_SIZE
+source_code: .zero SOURCE_BUFFER_SIZE
+
+.text
+.global _start # Program entry point.
+
+_start:
+ # Read the source from the standard input.
+ la a0, source_code
+ li a1, SOURCE_BUFFER_SIZE # Buffer size.
+ call read_file
+
+ la s1, source_code # s1 = Source code position.
+ call compile
+
+ # Call exit.
+ addi a0, zero, 0 # Use 0 return code.
+ addi a7, zero, SYS_EXIT
+ ecall