about summary refs log tree commit diff stats
path: root/apps/ex2.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-01-01 17:23:29 -0800
committerKartik Agaram <vc@akkartik.com>2020-01-01 17:23:29 -0800
commit113bae7311b63e55e55160970718d19bfeeb56c3 (patch)
treed2468b58470e173329c7ef6e8da496c2f768b037 /apps/ex2.subx
parent1b050736eea04323e09e5e8e7499c33cee1899d0 (diff)
downloadmu-113bae7311b63e55e55160970718d19bfeeb56c3.tar.gz
5856
Diffstat (limited to 'apps/ex2.subx')
-rw-r--r--apps/ex2.subx20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/ex2.subx b/apps/ex2.subx
new file mode 100644
index 00000000..8df4c62c
--- /dev/null
+++ b/apps/ex2.subx
@@ -0,0 +1,20 @@
+# Add 1 and 1, and return the result in the exit code.
+#
+# To run:
+#   $ ./subx translate init.linux examples/ex2.subx -o examples/ex2
+#   $ ./subx run examples/ex2
+# Expected result:
+#   $ echo $?
+#   2
+
+== code
+
+Entry:
+# ebx = 1
+bb/copy-to-ebx  1/imm32
+# increment ebx
+43/increment-ebx
+# exit(ebx)
+e8/call  syscall_exit/disp32
+
+# . . vim:nowrap:textwidth=0