about summary refs log tree commit diff stats
path: root/apps/ex1.subx
diff options
context:
space:
mode:
Diffstat (limited to 'apps/ex1.subx')
-rw-r--r--apps/ex1.subx18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/ex1.subx b/apps/ex1.subx
new file mode 100644
index 00000000..5558d310
--- /dev/null
+++ b/apps/ex1.subx
@@ -0,0 +1,18 @@
+# First program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+# Just return 42.
+#
+# To run:
+#   $ ./subx translate init.linux examples/ex1.2.subx -o examples/ex1
+#   $ ./subx run examples/ex1
+# Expected result:
+#   $ echo $?
+#   42
+
+== code
+
+Entry:
+# exit(42)
+bb/copy-to-ebx  2a/imm32  # 42 in hex
+e8/call  syscall_exit/disp32
+
+# . . vim:nowrap:textwidth=0