summaryrefslogtreecommitdiff
path: root/main.asm
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-05-12 01:26:32 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-05-12 01:26:32 +0200
commitb9dd0160640adcbb1b5a66247b274bf99a7de705 (patch)
treeb94743ccc426ea7855c1185b2710ec9364090c9a /main.asm
parent7642349be93be4a1acf62e9c5ca831f918ba1c3c (diff)
First real program running!
Diffstat (limited to 'main.asm')
-rw-r--r--main.asm23
1 files changed, 18 insertions, 5 deletions
diff --git a/main.asm b/main.asm
index e90d6a2..2d41e48 100644
--- a/main.asm
+++ b/main.asm
@@ -1,9 +1,22 @@
.section .text
.global _main
+
+print:
+ li t1, 0x80000000
+l0:
+ lb t0, 0(a0)
+ beqz t0, l1
+ sb t0, 0(t1)
+ addi a0, a0, 1
+ j l0
+l1:
+ ret
+
_main:
- li x1, 5
- addi x2, x1, 45
+ la a0, my_str
+ call print
+
+halt: j halt
-loop:
- addi x2, x2, 1
- j loop
+.section .rodata
+my_str: .string "Hello, world!\n"