summaryrefslogtreecommitdiff
path: root/boot/echo-boot.s
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-04-21 22:56:50 +0200
committerEugen Wissner <belka@caraus.de>2025-04-21 22:56:50 +0200
commit536443b020d01d0d5372496529086a11b2486621 (patch)
tree78632939b6e12ec6281f99e394bd56d236c4b965 /boot/echo-boot.s
parent148da8ed91f17c6fb367f52c927629b0f4cacb5e (diff)
downloadelna-536443b020d01d0d5372496529086a11b2486621.tar.gz
Add stages and a rakefile
Diffstat (limited to 'boot/echo-boot.s')
-rw-r--r--boot/echo-boot.s35
1 files changed, 35 insertions, 0 deletions
diff --git a/boot/echo-boot.s b/boot/echo-boot.s
new file mode 100644
index 0000000..b6e65f7
--- /dev/null
+++ b/boot/echo-boot.s
@@ -0,0 +1,35 @@
+.global _start, source_code
+
+.section .rodata
+.type SOURCE_BUFFER_SIZE, @object
+.size SOURCE_BUFFER_SIZE, 4
+SOURCE_BUFFER_SIZE: .long 4096
+
+.section .bss
+.type source_code, @object
+.size source_code, 4096
+source_code: .zero 4096
+
+.section .text
+
+_compile:
+ ret
+
+_start:
+ # Read the source from the standard input.
+ la a0, source_code
+ la a1, SOURCE_BUFFER_SIZE # Buffer size.
+ lw a1, (a1)
+ call read_file
+ mv s1, a0
+
+ call _compile
+
+ # Write the source to the standard output.
+ la a0, source_code
+ mv a1, s1
+ call write_out
+
+ # Call exit.
+ li a0, 0 # Use 0 return code.
+ call exit