summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-22 16:03:44 -0400
committerIan Moffett <ian@osmora.org>2025-07-22 16:09:06 -0400
commit2a7ad917c496354cd6f99bd876db6c1e72553662 (patch)
tree34d7b33201326fee9a4af3412c7274fcd619d4ce
parentfd0c31d4cfd6e220271e43102fb69301d7ffc664 (diff)
build: Add tests for oasm and oemu in etc/oemu/expt
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--etc/oemu/emutest.rc5
-rw-r--r--etc/oemu/test-00.s13
2 files changed, 18 insertions, 0 deletions
diff --git a/etc/oemu/emutest.rc b/etc/oemu/emutest.rc
new file mode 100644
index 0000000..39607dd
--- /dev/null
+++ b/etc/oemu/emutest.rc
@@ -0,0 +1,5 @@
+@ Test emulator
+echo Generating /tmp/a.out
+oasm /etc/oemu/test-00.s /tmp/a.out
+echo Running emulator...
+oemu /tmp/a.out
diff --git a/etc/oemu/test-00.s b/etc/oemu/test-00.s
new file mode 100644
index 0000000..b34c099
--- /dev/null
+++ b/etc/oemu/test-00.s
@@ -0,0 +1,13 @@
+mov x0, #1 ! ~ 0x00000000
+mov x1, #2 ! ~ 0x00000004
+mov x2, #3 ! ~ 0x00000008
+ ! X
+mov x2, #20 ! ~ 0x0000000C
+br x2 ! ~ 0x00000010 -----+
+!!!!!!!!!!!!!! X |
+!!!!!!!!!!!!!! X |
+ ! X |
+dec x0 ! ~ 0x00000014 <----+
+inc x1 ! ~ 0x00000018
+add x2, #3 ! ~ 0x0000001C
+hlt ! ~ 0x00000020