about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-01 15:18:00 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-01 15:18:00 -0700
commitf872f7c726c45b96ee5d3a899915fc3bde26f942 (patch)
treed0e11160c026bec28940cb420fc7014c424a7a08 /subx
parent4224ec8188bc0e6f27e7063a8f5ec3355e892570 (diff)
downloadmu-f872f7c726c45b96ee5d3a899915fc3bde26f942.tar.gz
4643
Diffstat (limited to 'subx')
-rw-r--r--subx/examples/ex7.subx4
-rw-r--r--subx/examples/ex8.subx18
2 files changed, 11 insertions, 11 deletions
diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx
index d0e5d415..7d610410 100644
--- a/subx/examples/ex7.subx
+++ b/subx/examples/ex7.subx
@@ -4,8 +4,8 @@
 # the character read.
 #
 # To run (from the subx directory):
-#   $ subx translate examples/ex8.subx -o examples/ex8
-#   $ subx run examples/ex8
+#   $ subx translate examples/ex7.subx -o examples/ex7
+#   $ subx run examples/ex7
 # Expected result:
 #   $ echo $?
 #   97
diff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx
index e3c578c0..274ff6a2 100644
--- a/subx/examples/ex8.subx
+++ b/subx/examples/ex8.subx
@@ -26,28 +26,28 @@
     # call
   e8/call  ascii_length/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32                 # add 4 to ESP
+  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add 4 to ESP
 
   # exit(EAX)
-  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to EBX
-  b8/copy                         .               .             .           .             .           .           .               1/imm32/exit            # copy 1 to EAX
+  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
+  b8/copy                         .               .             .           .             .           .           .               1/imm32/exit      # copy 1 to EAX
   cd/syscall  0x80/imm8
 
 ascii_length:  # (s)
   # initialize s (EDX)
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              2/r32/EDX   4/disp8                                 # copy *(ESP+4) to EDX
+  8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              2/r32/EDX   4/disp8                           # copy *(ESP+4) to EDX
   # var result = 0 (EAX)
-  b8/copy                         .               .             .           .             .           .           .               0/imm32                 # copy 0 to EAX
+  b8/copy                         .               .             .           .             .           .           .               0/imm32           # copy 0 to EAX
 $ascii_length_loop:
   # var c = *s (ECX)
-  8a/copy                         0/mod/*         2/rm32/EDX    .           .             .           1/r32/ECX   .               .                       # copy byte at *EDX to lower byte of ECX
+  8a/copy                         0/mod/*         2/rm32/EDX    .           .             .           1/r32/ECX   .               .                 # copy byte at *EDX to lower byte of ECX
   # if c == '\0' break
-  81          7/subop/compare     3/mod/direct    1/rm32/ECX    .           .             .           .           .               0/imm32                 # compare ECX with 0
+  81          7/subop/compare     3/mod/direct    1/rm32/ECX    .           .             .           .           .               0/imm32           # compare ECX with 0
   74/jump-if-equal  $ascii_length_ret/disp8
   # ++s
-  81          0/subop/add         3/mod/direct    2/rm32/EDX    .           .             .           .           .               1/imm32                 # add 1 to EDX
+  81          0/subop/add         3/mod/direct    2/rm32/EDX    .           .             .           .           .               1/imm32           # add 1 to EDX
   # ++result
-  81          0/subop/add         3/mod/direct    0/rm32/EAX    .           .             .           .           .               1/imm32                 # add 1 to EAX
+  81          0/subop/add         3/mod/direct    0/rm32/EAX    .           .             .           .           .               1/imm32           # add 1 to EAX
   # loop
   eb/jump  $ascii_length_loop/disp8
 $ascii_length_ret: