about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-24 20:39:59 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-24 20:39:59 -0700
commitd1e2b0aa5b52ac63cbb92d1f1a70cb510ff970fb (patch)
tree05e4f4af116202014e20f35232c82a269bd1f4ab /subx
parentd57d39cb3f867d6e33ffa8e4cdc7d0ca749cb75c (diff)
downloadmu-d1e2b0aa5b52ac63cbb92d1f1a70cb510ff970fb.tar.gz
4396
Fix ex4 binary, which has been corrupted in the repo since commit 4356.
In this time it hasn't changed further. The correct version added here
is also the file that should have been committed then.
Diffstat (limited to 'subx')
-rw-r--r--subx/Readme.md16
-rw-r--r--subx/ex2.subx5
-rw-r--r--subx/ex3.subx5
-rwxr-xr-xsubx/ex4bin171 -> 171 bytes
4 files changed, 22 insertions, 4 deletions
diff --git a/subx/Readme.md b/subx/Readme.md
index e86b16b8..78ff30e8 100644
--- a/subx/Readme.md
+++ b/subx/Readme.md
@@ -68,8 +68,17 @@ $ chmod +x ex1
 $ ./ex1
 ```
 
-I'm not building general infrastructure here for all of the x86 ISA and ELF
-format. SubX is about programming with a small, regular subset of 32-bit x86:
+There are a few such example programs here. At any commit an example's binary
+should be identical bit for bit with the output of translating the .subx file.
+The binary should also be natively runnable on a 32-bit Linux system. If
+either of these invariants is broken it's a bug on my part. The binary should
+also be runnable on a 64-bit Linux system. I can't guarantee it, but I'd
+appreciate hearing if it doesn't run.
+
+However, there are a few more binaries in the teensy/ directory. They are not
+guaranteed to be runnable by subx. I'm not building general infrastructure
+here for all of the x86 ISA and ELF format. SubX is about programming with a
+small, regular subset of 32-bit x86:
 
 * Only instructions that operate on the 32-bit E\*X registers. (No
   floating-point yet.)
@@ -80,6 +89,9 @@ format. SubX is about programming with a small, regular subset of 32-bit x86:
   on unsigned integers)
 * Only relative jump instructions (with 8-bit or 16-bit offsets).
 
+The ELF binaries generated are statically linked and missing a lot of features
+as well. But they will run.
+
 For more details on programming in this subset, consult the online help:
 ```
 $ ./subx help
diff --git a/subx/ex2.subx b/subx/ex2.subx
index de63f12e..4708a8b5 100644
--- a/subx/ex2.subx
+++ b/subx/ex2.subx
@@ -1,8 +1,11 @@
-## add 1 and 1
+## add 1 and 1, and return the result in the exit code
 #
 # To run:
 #   $ subx translate ex2.subx ex2
 #   $ subx run ex2
+# Expected result:
+#   $ echo $?
+#   2
 
 == 0x08048054  # code segment, after leaving room for ELF header
 # opcode        ModR/M                    SIB                   displacement    immediate
diff --git a/subx/ex3.subx b/subx/ex3.subx
index 00ca234f..8560167d 100644
--- a/subx/ex3.subx
+++ b/subx/ex3.subx
@@ -1,8 +1,11 @@
-## add the first 10 numbers
+## add the first 10 numbers, and return the result in the exit code
 #
 # To run:
 #   $ subx translate ex3.subx ex3
 #   $ subx run ex3
+# Expected result:
+#   $ echo $?
+#   55
 
 == 0x08048054  # code segment, after leaving room for ELF header
 # opcode        ModR/M                    SIB                   displacement    immediate
diff --git a/subx/ex4 b/subx/ex4
index 15529a9f..7721c94b 100755
--- a/subx/ex4
+++ b/subx/ex4
Binary files differ