From ba9abb1cc09c37ae86e3b1aaa8bec81353b2baf7 Mon Sep 17 00:00:00 2001
From: Wesley Moore <wes@wezm.net>
Date: Sun, 9 Feb 2025 11:32:46 +1000
Subject: [PATCH] Fix hello.s so that it only prints 5 times and exits

---
 README.md | 2 ++
 hello.s   | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 2269796..f604ebf 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,8 @@ Resources
 
 ### Syscalls on RV32E
 
+[Syscalls supported by rv32emu](https://github.com/sysprog21/rv32emu/blob/master/docs/syscall.md).
+
 Consensus seems to be pass the syscall number in `t0`:
 
 * https://github.com/riscvarchive/riscv-qemu/pull/61
diff --git a/hello.s b/hello.s
index 207b616..531c32f 100644
--- a/hello.s
+++ b/hello.s
@@ -14,8 +14,8 @@ str: .ascii "Hello World!\n"
 
 .text
 _start:
-    li t0, 0
-    li t1, 5
+    li t1, 0
+    li t2, 5
 
     # dummy test for jal instruction
 .L1:
@@ -24,14 +24,14 @@ _start:
     nop
 
 loop:
-    beq t0, t1, end
+    beq t1, t2, end
 
     li t0, SYSWRITE     # "write" syscall
     li a0, 1            # 1 = standard output (stdout)
     la a1, str          # load address of hello string
     li a2, str_size     # length of hello string
     ecall               # invoke syscall to print the string
-    addi t0, t0, 1
+    addi t1, t1, 1
     j loop
 
 end: