about summary refs log tree commit diff stats
path: root/linux/apps/ex1.subx
diff options
context:
space:
mode:
Diffstat (limited to 'linux/apps/ex1.subx')
-rw-r--r--linux/apps/ex1.subx20
1 files changed, 20 insertions, 0 deletions
diff --git a/linux/apps/ex1.subx b/linux/apps/ex1.subx
new file mode 100644
index 00000000..0406dbe8
--- /dev/null
+++ b/linux/apps/ex1.subx
@@ -0,0 +1,20 @@
+# First example: return the answer to the Ultimate Question of Life, the
+# Universe, and Everything.
+#
+# Same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+#
+# To run:
+#   $ bootstrap/bootstrap translate apps/ex1.subx -o ex1
+#   $ bootstrap/bootstrap run ex1
+# Expected result:
+#   $ echo $?
+#   42
+
+== code
+
+Entry:
+# exit(42)
+bb/copy-to-ebx  0x2a/imm32  # 42 in hex
+e8/call  syscall_exit/disp32
+
+# . . vim:nowrap:textwidth=0