about summary refs log tree commit diff stats
path: root/subx/examples
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-11-30 10:54:42 -0800
committerKartik Agaram <vc@akkartik.com>2018-11-30 10:54:42 -0800
commit6030d7e2e56d445ca67c6a0e8c9cf33e46bc673c (patch)
tree83b6fc800dc5c90295b58e5b0494b083636efbaa /subx/examples
parente9661581f092f3e210b7bd900af058d8b8c4369e (diff)
downloadmu-6030d7e2e56d445ca67c6a0e8c9cf33e46bc673c.tar.gz
4801
Reindent all SubX code to make some room for the new comment style.
Diffstat (limited to 'subx/examples')
-rw-r--r--subx/examples/ex10.subx74
-rw-r--r--subx/examples/ex11.subx444
-rw-r--r--subx/examples/ex12.subx50
-rw-r--r--subx/examples/ex3.subx38
-rw-r--r--subx/examples/ex4.subx18
-rw-r--r--subx/examples/ex5.subx40
-rw-r--r--subx/examples/ex6.subx28
-rw-r--r--subx/examples/ex7.subx122
-rw-r--r--subx/examples/ex8.subx60
-rw-r--r--subx/examples/ex9.subx46
10 files changed, 460 insertions, 460 deletions
diff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx
index b179369f..4da713ae 100644
--- a/subx/examples/ex10.subx
+++ b/subx/examples/ex10.subx
@@ -8,9 +8,9 @@
 #   0  # false
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
 # main: return argv-equal(argv[1], argv[2])
 #       At the start of a SubX program:
@@ -18,55 +18,55 @@
 #         argv[0]: *(ESP+4)
 #         argv[1]: *(ESP+8)
 #         ...
-  # prolog
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # call argv-equal(argv[1], argv[2])
+    # prolog
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # call argv-equal(argv[1], argv[2])
     # push argv[2]
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0xc/disp8       .                 # push *(EBP+12)
+    ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0xc/disp8       .                 # push *(EBP+12)
     # push argv[1]
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x8/disp8       .                 # push *(EBP+8)
+    ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x8/disp8       .                 # push *(EBP+8)
     # call
-  e8/call argv-equal/disp32
-  # exit(EAX)
+    e8/call argv-equal/disp32
+    # exit(EAX)
 $exit:
-  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
-  b8/copy-to-EAX  1/imm32
-  cd/syscall  0x80/imm8
+    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
+    b8/copy-to-EAX  1/imm32
+    cd/syscall  0x80/imm8
 
 # compare two null-terminated ascii strings
 # reason for the name: the only place we should have null-terminated ascii strings is from commandline args
 argv-equal:  # (s1, s2) : null-terminated ascii strings -> EAX : boolean
-  # initialize s1 (ECX) and s2 (EDX)
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none  .           1/r32/ECX   4/disp8         .                 # copy *(ESP+4) to ECX
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none  .           2/r32/EDX   8/disp8         .                 # copy *(ESP+8) to EDX
-  # while (true)
+    # initialize s1 (ECX) and s2 (EDX)
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none  .           1/r32/ECX   4/disp8         .                 # copy *(ESP+4) to ECX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none  .           2/r32/EDX   8/disp8         .                 # copy *(ESP+8) to EDX
+    # while (true)
 $argv-equal:loop:
     # c1/EAX, c2/EBX = *s1, *s2
-  b8/copy-to-EAX  0/imm32
-  8a/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy byte at *ECX to lower byte of EAX
-  bb/copy-to-EBX  0/imm32
-  8a/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           3/r32/EBX   .               .                 # copy byte at *EDX to lower byte of EBX
+    b8/copy-to-EAX  0/imm32
+    8a/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy byte at *ECX to lower byte of EAX
+    bb/copy-to-EBX  0/imm32
+    8a/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           3/r32/EBX   .               .                 # copy byte at *EDX to lower byte of EBX
     # if (c1 == 0) break
-  3d/compare-EAX  0/imm32
-  74/jump-if-equal  $argv-equal:break/disp8
+    3d/compare-EAX  0/imm32
+    74/jump-if-equal  $argv-equal:break/disp8
     # if (c1 != c2) return false
-  39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
-  75/jump-if-not-equal  $argv-equal:false/disp8
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
+    75/jump-if-not-equal  $argv-equal:false/disp8
     # ++s1, ++s2
-  41/inc-ECX
-  42/inc-EDX
-  # end while
-  eb/jump  $argv-equal:loop/disp8
+    41/inc-ECX
+    42/inc-EDX
+    # end while
+    eb/jump  $argv-equal:loop/disp8
 $argv-equal:break:
-  # if (c2 == 0) return true
-  81          7/subop/compare     3/mod/direct    3/rm32/EBX    .           .             .           .           .               0/imm32           # compare EBX
-  75/jump-if-not-equal  $argv-equal:false/disp8
+    # if (c2 == 0) return true
+    81          7/subop/compare     3/mod/direct    3/rm32/EBX    .           .             .           .           .               0/imm32           # compare EBX
+    75/jump-if-not-equal  $argv-equal:false/disp8
 $argv-equal:success:
-  b8/copy-to-EAX  1/imm32
-  c3/return
-  # return false
+    b8/copy-to-EAX  1/imm32
+    c3/return
+    # return false
 $argv-equal:false:
-  b8/copy-to-EAX  0/imm32
-  c3/return
+    b8/copy-to-EAX  0/imm32
+    c3/return
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx
index 28eb2a8a..247a0076 100644
--- a/subx/examples/ex11.subx
+++ b/subx/examples/ex11.subx
@@ -15,336 +15,336 @@
 # would cause tests to not run, rather than to fail as we'd like.)
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
 # main:
-  e8/call  run-tests/disp32  # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
-  # syscall(exit, EAX)
-  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
-  b8/copy-to-EAX  1/imm32
-  cd/syscall  0x80/imm8
+    e8/call  run-tests/disp32  # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
+    # syscall(exit, EAX)
+    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
+    b8/copy-to-EAX  1/imm32
+    cd/syscall  0x80/imm8
 
 # compare a null-terminated ascii string with a more idiomatic length-prefixed byte array
 # reason for the name: the only place we should have null-terminated ascii strings is from commandline args
 kernel-string-equal:  # s : null-terminated ascii string, benchmark : length-prefixed ascii string -> EAX : boolean
-  # prolog
-  55/push-EBP
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # save registers
-  51/push-ECX
-  52/push-EDX
-  53/push-EBX
-  56/push-ESI
-  57/push-EDI
+    # prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # save registers
+    51/push-ECX
+    52/push-EDX
+    53/push-EBX
+    56/push-ESI
+    57/push-EDI
 
-  # pseudocode:
-  #   initialize n = b.length
-  #   initialize s1 = s
-  #   initialize s2 = b.data
-  #   i = 0
-  #   for (i = 0; i < n; ++n)
-  #     c1 = *s1
-  #     c2 = *s2
-  #     if c1 == 0
-  #       return false
-  #     if c1 != c2
-  #       return false
-  #   return *s1 == 0
-  # initialize s into EDI
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           7/r32/EDI   8/disp8         .                 # copy *(EBP+8) to EDI
-  # initialize benchmark length n into EDX
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           2/r32/EDX   0xc/disp8       .                 # copy *(EBP+12) to EDX
-  8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
-  # initialize benchmark data into ESI
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           6/r32/ESI   0xc/disp8       .                 # copy *(EBP+12) to ESI
-  81          0/subop/add         3/mod/direct    6/rm32/ESI    .           .             .           .           .               4/imm32           # add to ESI
-  # initialize loop counter i into ECX
-  b9/copy-to-ECX  0/imm32/exit
-  # while (i/ECX < n/EDX)
+    # pseudocode:
+    #   initialize n = b.length
+    #   initialize s1 = s
+    #   initialize s2 = b.data
+    #   i = 0
+    #   for (i = 0; i < n; ++n)
+    #     c1 = *s1
+    #     c2 = *s2
+    #     if c1 == 0
+    #       return false
+    #     if c1 != c2
+    #       return false
+    #   return *s1 == 0
+    # initialize s into EDI
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           7/r32/EDI   8/disp8         .                 # copy *(EBP+8) to EDI
+    # initialize benchmark length n into EDX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           2/r32/EDX   0xc/disp8       .                 # copy *(EBP+12) to EDX
+    8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
+    # initialize benchmark data into ESI
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           6/r32/ESI   0xc/disp8       .                 # copy *(EBP+12) to ESI
+    81          0/subop/add         3/mod/direct    6/rm32/ESI    .           .             .           .           .               4/imm32           # add to ESI
+    # initialize loop counter i into ECX
+    b9/copy-to-ECX  0/imm32/exit
+    # while (i/ECX < n/EDX)
 $kernel-string-equal:loop:
-  39/compare                      3/mod/direct    1/rm32/ECX    .           .             .           2/r32/EDX   .               .                 # compare ECX with EDX
-  74/jump-if-equal  $kernel-string-equal:break/disp8
+    39/compare                      3/mod/direct    1/rm32/ECX    .           .             .           2/r32/EDX   .               .                 # compare ECX with EDX
+    74/jump-if-equal  $kernel-string-equal:break/disp8
     # c1/EAX, c2/EBX = *s, *benchmark
-  b8/copy-to-EAX  0/imm32
-  8a/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy byte at *EDI to lower byte of EAX
-  bb/copy-to-EBX  0/imm32
-  8a/copy                         0/mod/indirect  6/rm32/ESI    .           .             .           3/r32/EBX   .               .                 # copy byte at *ESI to lower byte of EBX
+    b8/copy-to-EAX  0/imm32
+    8a/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy byte at *EDI to lower byte of EAX
+    bb/copy-to-EBX  0/imm32
+    8a/copy                         0/mod/indirect  6/rm32/ESI    .           .             .           3/r32/EBX   .               .                 # copy byte at *ESI to lower byte of EBX
     # if (c1 == 0) return false
-  3d/compare-EAX  0/imm32
-  74/jump-if-equal  $kernel-string-equal:false/disp8
+    3d/compare-EAX  0/imm32
+    74/jump-if-equal  $kernel-string-equal:false/disp8
     # if (c1 != c2) return false
-  39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
-  75/jump-if-not-equal  $kernel-string-equal:false/disp8
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
+    75/jump-if-not-equal  $kernel-string-equal:false/disp8
     # ++s1, ++s2, ++i
-  41/inc-ECX
-  46/inc-ESI
-  47/inc-EDI
-  # end while
-  eb/jump  $kernel-string-equal:loop/disp8
+    41/inc-ECX
+    46/inc-ESI
+    47/inc-EDI
+    # end while
+    eb/jump  $kernel-string-equal:loop/disp8
 $kernel-string-equal:break:
-  # if (*s/EDI == 0) return true
-  b8/copy-to-EAX  0/imm32
-  8a/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy byte at *EDI to lower byte of EAX
-  81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0/imm32           # compare EAX
-  75/jump-if-not-equal  $kernel-string-equal:false/disp8
-  b8/copy-to-EAX  1/imm32
+    # if (*s/EDI == 0) return true
+    b8/copy-to-EAX  0/imm32
+    8a/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy byte at *EDI to lower byte of EAX
+    81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0/imm32           # compare EAX
+    75/jump-if-not-equal  $kernel-string-equal:false/disp8
+    b8/copy-to-EAX  1/imm32
 $kernel-string-equal:true:
-  eb/jump  $kernel-string-equal:end/disp8
-  # return false
+    eb/jump  $kernel-string-equal:end/disp8
+    # return false
 $kernel-string-equal:false:
-  b8/copy-to-EAX  0/imm32
+    b8/copy-to-EAX  0/imm32
 
 $kernel-string-equal:end:
-  # restore registers
-  5f/pop-to-EDI
-  5e/pop-to-ESI
-  5b/pop-to-EBX
-  5a/pop-to-EDX
-  59/pop-to-ECX
-  # end
-  89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
-  5d/pop-to-EBP
-  c3/return
+    # restore registers
+    5f/pop-to-EDI
+    5e/pop-to-ESI
+    5b/pop-to-EBX
+    5a/pop-to-EDX
+    59/pop-to-ECX
+    # end
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
 
 ## tests
 
 test-compare-null-kernel-string-with-empty-array:
-  # EAX = kernel-string-equal(Null-kernel-string, "")
+    # EAX = kernel-string-equal(Null-kernel-string, "")
     # push args
-  68/push  ""/imm32
-  68/push  Null-kernel-string/imm32
+    68/push  ""/imm32
+    68/push  Null-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 1, msg)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 1, msg)
     # push args
-  68/push  "F - test-compare-null-kernel-string-with-empty-array"/imm32
-  68/push  1/imm32/true
-  50/push-EAX
+    68/push  "F - test-compare-null-kernel-string-with-empty-array"/imm32
+    68/push  1/imm32/true
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 test-compare-null-kernel-string-with-non-empty-array:
-  # EAX = kernel-string-equal(Null-kernel-string, "Abc")
+    # EAX = kernel-string-equal(Null-kernel-string, "Abc")
     # push args
-  68/push  "Abc"/imm32
-  68/push  Null-kernel-string/imm32
+    68/push  "Abc"/imm32
+    68/push  Null-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 0, msg)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 0, msg)
     # push args
-  68/push  "F - test-compare-null-kernel-string-with-non-empty-array"/imm32
-  68/push  0/imm32/false
-  50/push-EAX
+    68/push  "F - test-compare-null-kernel-string-with-non-empty-array"/imm32
+    68/push  0/imm32/false
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 test-compare-kernel-string-with-equal-array:
-  # EAX = kernel-string-equal(Abc-kernel-string, "Abc")
+    # EAX = kernel-string-equal(Abc-kernel-string, "Abc")
     # push args
-  68/push  "Abc"/imm32
-  68/push  Abc-kernel-string/imm32
+    68/push  "Abc"/imm32
+    68/push  Abc-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 1, msg)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 1, msg)
     # push args
-  68/push  "F - test-compare-kernel-string-with-equal-array"/imm32
-  68/push  1/imm32/true
-  50/push-EAX
+    68/push  "F - test-compare-kernel-string-with-equal-array"/imm32
+    68/push  1/imm32/true
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 test-compare-kernel-string-with-inequal-array:
-  # EAX = kernel-string-equal(Abc-kernel-string, "Adc")
+    # EAX = kernel-string-equal(Abc-kernel-string, "Adc")
     # push args
-  68/push  "Adc"/imm32
-  68/push  Abc-kernel-string/imm32
+    68/push  "Adc"/imm32
+    68/push  Abc-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 0, msg)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 0, msg)
     # push args
-  68/push  "F - test-compare-kernel-string-with-equal-array"/imm32
-  68/push  0/imm32/false
-  50/push-EAX
+    68/push  "F - test-compare-kernel-string-with-equal-array"/imm32
+    68/push  0/imm32/false
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 test-compare-kernel-string-with-empty-array:
-  # EAX = kernel-string-equal(Abc-kernel-string, "")
+    # EAX = kernel-string-equal(Abc-kernel-string, "")
     # push args
-  68/push  ""/imm32
-  68/push  Abc-kernel-string/imm32
+    68/push  ""/imm32
+    68/push  Abc-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 0)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 0)
     # push args
-  68/push  "F - test-compare-kernel-string-with-equal-array"/imm32
-  68/push  0/imm32/false
-  50/push-EAX
+    68/push  "F - test-compare-kernel-string-with-equal-array"/imm32
+    68/push  0/imm32/false
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 test-compare-kernel-string-with-shorter-array:
-  # EAX = kernel-string-equal(Abc-kernel-string, "Ab")
+    # EAX = kernel-string-equal(Abc-kernel-string, "Ab")
     # push args
-  68/push  "Ab"/imm32
-  68/push  Abc-kernel-string/imm32
+    68/push  "Ab"/imm32
+    68/push  Abc-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 0)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 0)
     # push args
-  68/push  "F - test-compare-kernel-string-with-shorter-array"/imm32
-  68/push  0/imm32/false
-  50/push-EAX
+    68/push  "F - test-compare-kernel-string-with-shorter-array"/imm32
+    68/push  0/imm32/false
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 test-compare-kernel-string-with-longer-array:
-  # EAX = kernel-string-equal(Abc-kernel-string, "Abcd")
+    # EAX = kernel-string-equal(Abc-kernel-string, "Abcd")
     # push args
-  68/push  "Abcd"/imm32
-  68/push  Abc-kernel-string/imm32
+    68/push  "Abcd"/imm32
+    68/push  Abc-kernel-string/imm32
     # call
-  e8/call  kernel-string-equal/disp32
+    e8/call  kernel-string-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # call check-ints-equal(EAX, 0)
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # call check-ints-equal(EAX, 0)
     # push args
-  68/push  "F - test-compare-kernel-string-with-longer-array"/imm32
-  68/push  0/imm32/false
-  50/push-EAX
+    68/push  "F - test-compare-kernel-string-with-longer-array"/imm32
+    68/push  0/imm32/false
+    50/push-EAX
     # call
-  e8/call  check-ints-equal/disp32
+    e8/call  check-ints-equal/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  c3/return
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
 
 ## helpers
 
 # print msg to stderr if a != b, otherwise print "."
 check-ints-equal:  # (a : int, b : int, msg : (address array byte)) -> boolean
-  # prolog
-  55/push-EBP
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # save registers
-  51/push-ECX
-  53/push-EBX
-  # load args into EAX, EBX and ECX
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           0/r32/EAX   0x8/disp8       .                 # copy *(EBP+8) to EAX
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           3/r32/EBX   0xc/disp8       .                 # copy *(EBP+12) to EBX
-  # if EAX == b/EBX
-  39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
-  75/jump-if-unequal  $check-ints-equal:else/disp8
+    # prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # save registers
+    51/push-ECX
+    53/push-EBX
+    # load args into EAX, EBX and ECX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           0/r32/EAX   0x8/disp8       .                 # copy *(EBP+8) to EAX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           3/r32/EBX   0xc/disp8       .                 # copy *(EBP+12) to EBX
+    # if EAX == b/EBX
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
+    75/jump-if-unequal  $check-ints-equal:else/disp8
     # print('.')
       # push args
-  68/push  "."/imm32
+    68/push  "."/imm32
       # call
-  e8/call  write-stderr/disp32
+    e8/call  write-stderr/disp32
       # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # return
-  eb/jump  $check-ints-equal:end/disp8
-  # else:
+    eb/jump  $check-ints-equal:end/disp8
+    # else:
 $check-ints-equal:else:
-  # copy msg into ECX
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   0x10/disp8       .                # copy *(EBP+16) to ECX
+    # copy msg into ECX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   0x10/disp8       .                # copy *(EBP+16) to ECX
     # print(ECX)
       # push args
-  51/push-ECX
+    51/push-ECX
       # call
-  e8/call  write-stderr/disp32
+    e8/call  write-stderr/disp32
       # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # print newline
       # push args
-  68/push  Newline/imm32
+    68/push  Newline/imm32
       # call
-  e8/call  write-stderr/disp32
+    e8/call  write-stderr/disp32
       # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
 $check-ints-equal:end:
-  # restore registers
-  5b/pop-to-EBX
-  59/pop-to-ECX
-  # end
-  89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
-  5d/pop-to-EBP
-  c3/return
+    # restore registers
+    5b/pop-to-EBX
+    59/pop-to-ECX
+    # end
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
 
 write-stderr:  # s : (address array byte) -> <void>
-  # prolog
-  55/push-EBP
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # save registers
-  50/push-EAX
-  51/push-ECX
-  52/push-EDX
-  53/push-EBX
-  # syscall(write, 2/stderr, (data) s+4, (size) *s)
+    # prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # save registers
+    50/push-EAX
+    51/push-ECX
+    52/push-EDX
+    53/push-EBX
+    # syscall(write, 2/stderr, (data) s+4, (size) *s)
     # fd = 2 (stderr)
-  bb/copy-to-EBX  2/imm32
+    bb/copy-to-EBX  2/imm32
     # x = s+4
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   8/disp8         .                 # copy *(EBP+8) to ECX
-  81          0/subop/add         3/mod/direct    1/rm32/ECX    .           .             .           .           .               4/imm32           # add to ECX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   8/disp8         .                 # copy *(EBP+8) to ECX
+    81          0/subop/add         3/mod/direct    1/rm32/ECX    .           .             .           .           .               4/imm32           # add to ECX
     # size = *s
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           2/r32/EDX   8/disp8         .                 # copy *(EBP+8) to EDX
-  8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           2/r32/EDX   8/disp8         .                 # copy *(EBP+8) to EDX
+    8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
     # syscall
-  b8/copy-to-EAX  4/imm32/write
-  cd/syscall  0x80/imm8
-  # restore registers
-  5b/pop-to-EBX
-  5a/pop-to-EDX
-  59/pop-to-ECX
-  58/pop-to-EAX
-  # end
-  89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
-  5d/pop-to-EBP
-  c3/return
+    b8/copy-to-EAX  4/imm32/write
+    cd/syscall  0x80/imm8
+    # restore registers
+    5b/pop-to-EBX
+    5a/pop-to-EDX
+    59/pop-to-ECX
+    58/pop-to-EAX
+    # end
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
 
 == data
 
 Newline:
-  # size
-  01 00 00 00
-  # data
-  0a/newline
+    # size
+    01 00 00 00
+    # data
+    0a/newline
 
 # for kernel-string-equal tests
 Null-kernel-string:
-  00/null
+    00/null
 Abc-kernel-string:
-  41/A 62/b 63/c 00/null
+    41/A 62/b 63/c 00/null
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex12.subx b/subx/examples/ex12.subx
index 83943e1d..73d78d96 100644
--- a/subx/examples/ex12.subx
+++ b/subx/examples/ex12.subx
@@ -7,38 +7,38 @@
 # You shouldn't get a segmentation fault.
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-  # syscall(mmap, 0x1000)
-  bb/copy-to-EBX  Mmap-new-segment/imm32
-  b8/copy-to-EAX  0x5a/imm32/mmap
-  cd/syscall  0x80/imm8
+    # syscall(mmap, 0x1000)
+    bb/copy-to-EBX  Mmap-new-segment/imm32
+    b8/copy-to-EAX  0x5a/imm32/mmap
+    cd/syscall  0x80/imm8
 
-  # store to *EAX
-  c7/copy                         0/mod/direct    0/rm32/EAX    .           .             .           .           .               0x34/imm32              # copy to *EAX
+    # store to *EAX
+    c7/copy                         0/mod/direct    0/rm32/EAX    .           .             .           .           .               0x34/imm32              # copy to *EAX
 
-  # syscall(exit, EAX)
-  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to EBX
-  b8/copy-to-EAX  1/imm32/exit
-  cd/syscall  0x80/imm8
+    # syscall(exit, EAX)
+    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to EBX
+    b8/copy-to-EAX  1/imm32/exit
+    cd/syscall  0x80/imm8
 
 == data
 
 # various constants used here were found in the Linux sources (search for file mman-common.h)
 Mmap-new-segment:  # type mmap_arg_struct
-  # addr
-  00 00 00 00  # null
-  # len
-  00 01 00 00  # 0x1000
-  # protection flags
-  03 00 00 00  # PROT_READ | PROT_WRITE
-  # sharing flags
-  22 00 00 00  # MAP_PRIVATE | MAP_ANONYMOUS
-  # fd
-  ff ff ff ff  # -1 since MAP_ANONYMOUS is specified
-  # offset
-  00 00 00 00  # 0 since MAP_ANONYMOUS is specified
+    # addr
+    00 00 00 00  # null
+    # len
+    00 01 00 00  # 0x1000
+    # protection flags
+    03 00 00 00  # PROT_READ | PROT_WRITE
+    # sharing flags
+    22 00 00 00  # MAP_PRIVATE | MAP_ANONYMOUS
+    # fd
+    ff ff ff ff  # -1 since MAP_ANONYMOUS is specified
+    # offset
+    00 00 00 00  # 0 since MAP_ANONYMOUS is specified
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex3.subx b/subx/examples/ex3.subx
index e5dad9e4..b3f7d6fe 100644
--- a/subx/examples/ex3.subx
+++ b/subx/examples/ex3.subx
@@ -8,29 +8,29 @@
 #   55
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-  # result: EBX = 0
-  bb/copy-to-EBX  0/imm32
-  # counter: ECX = 1
-  b9/copy-to-ECX  1/imm32
+    # result: EBX = 0
+    bb/copy-to-EBX  0/imm32
+    # counter: ECX = 1
+    b9/copy-to-ECX  1/imm32
 
 $loop:
-  # while (counter <= 10)
-  81          7/subop/compare     3/mod/direct    1/rm32/ECX    .           .             .           .           .               0xa/imm32         # compare ECX
-  7f/jump-if-greater  $exit/disp8
-  # result += counter
-  01/add                          3/mod/direct    3/rm32/EBX    .           .             .           1/r32/ECX   .               .                 # add ECX to EBX
-  # ++counter
-  41/inc-ECX
-  # loop
-  eb/jump  $loop/disp8
+    # while (counter <= 10)
+    81          7/subop/compare     3/mod/direct    1/rm32/ECX    .           .             .           .           .               0xa/imm32         # compare ECX
+    7f/jump-if-greater  $exit/disp8
+    # result += counter
+    01/add                          3/mod/direct    3/rm32/EBX    .           .             .           1/r32/ECX   .               .                 # add ECX to EBX
+    # ++counter
+    41/inc-ECX
+    # loop
+    eb/jump  $loop/disp8
 
 $exit:
-  # exit(EBX)
-  b8/copy-to-EAX  1/imm32
-  cd/syscall  0x80/imm8
+    # exit(EBX)
+    b8/copy-to-EAX  1/imm32
+    cd/syscall  0x80/imm8
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex4.subx b/subx/examples/ex4.subx
index 17dae120..445f7d1b 100644
--- a/subx/examples/ex4.subx
+++ b/subx/examples/ex4.subx
@@ -7,24 +7,24 @@
 == code
 
 # syscall(read, stdin, X, 1)
-  # fd = 0 (stdin)
+    # fd = 0 (stdin)
 bb/copy-to-EBX  0/imm32
-  # initialize X (location to write result to)
+    # initialize X (location to write result to)
 b9/copy-to-ECX  X/imm32
-  # size = 1 character
+    # size = 1 character
 ba/copy-to-EDX  1/imm32
-  # syscall
+    # syscall
 b8/copy-to-EAX  3/imm32/read
 cd/syscall  0x80/imm8
 
 # syscall(write, stdout, X, 1)
-  # fd = 1 (stdout)
+    # fd = 1 (stdout)
 bb/copy-to-EBX  1/imm32
-  # initialize X (location to read from)
+    # initialize X (location to read from)
 b9/copy-to-ECX  X/imm32
-  # size = 1 character
+    # size = 1 character
 ba/copy-to-EDX  1/imm32
-  # syscall
+    # syscall
 b8/copy-to-EAX  4/imm32/write
 cd/syscall  0x80/imm8
 
@@ -35,6 +35,6 @@ cd/syscall  0x80/imm8
 == data
 
 X:
-  00 00 00 00  # space for read() to write to
+    00 00 00 00  # space for read() to write to
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex5.subx b/subx/examples/ex5.subx
index cdc009bf..44291b35 100644
--- a/subx/examples/ex5.subx
+++ b/subx/examples/ex5.subx
@@ -5,38 +5,38 @@
 #   $ subx run examples/ex5
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
 # main:
-  # allocate x on the stack
-  81          5/subop/subtract    3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # subtract from ESP
+    # allocate x on the stack
+    81          5/subop/subtract    3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # subtract from ESP
 
-  # syscall(read, stdin, x, 1)
+    # syscall(read, stdin, x, 1)
     # fd = 0 (stdin)
-  bb/copy-to-EBX  0/imm32
+    bb/copy-to-EBX  0/imm32
     # initialize x (location to write result to)
-  8d/copy-address                 1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   4/disp8         .                 # copy ESP+4 to ECX
+    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   4/disp8         .                 # copy ESP+4 to ECX
     # size = 1 character
-  ba/copy-to-EDX  1/imm32
+    ba/copy-to-EDX  1/imm32
     # syscall
-  b8/copy-to-EAX  3/imm32/read
-  cd/syscall  0x80/imm8
+    b8/copy-to-EAX  3/imm32/read
+    cd/syscall  0x80/imm8
 
-  # syscall(write, stdout, x, 1)
+    # syscall(write, stdout, x, 1)
     # fd = 1 (stdout)
-  bb/copy-to-EBX  1/imm32
+    bb/copy-to-EBX  1/imm32
     # initialize x (location to read from)
-  8d/copy-address                 1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   4/disp8         .                 # copy ESP+4 to ECX
+    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   4/disp8         .                 # copy ESP+4 to ECX
     # size = 1 character
-  ba/copy-to-EDX  1/imm32
+    ba/copy-to-EDX  1/imm32
     # syscall
-  b8/copy-to-EAX  4/imm32/write
-  cd/syscall  0x80/imm8
+    b8/copy-to-EAX  4/imm32/write
+    cd/syscall  0x80/imm8
 
-  # syscall(exit, EBX)
-  b8/copy-to-EAX  1/imm32/exit
-  cd/syscall  0x80/imm8
+    # syscall(exit, EBX)
+    b8/copy-to-EAX  1/imm32/exit
+    cd/syscall  0x80/imm8
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex6.subx b/subx/examples/ex6.subx
index dfec4bf9..10331808 100644
--- a/subx/examples/ex6.subx
+++ b/subx/examples/ex6.subx
@@ -6,31 +6,31 @@
 #   Hello, world!
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-  # syscall(write, stdout, X, size)
+    # syscall(write, stdout, X, size)
     # fd = 1 (stdout)
-  bb/copy-to-EBX  1/imm32
+    bb/copy-to-EBX  1/imm32
     # initialize X (location to write result to)
-  b9/copy-to-ECX  X/imm32
+    b9/copy-to-ECX  X/imm32
     # initialize size
-  8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           2/r32/EDX   Size/disp32     .                 # copy *size to EDX
+    8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           2/r32/EDX   Size/disp32     .                 # copy *size to EDX
     # syscall
-  b8/copy-to-EAX  4/imm32/write
-  cd/syscall  0x80/imm8
+    b8/copy-to-EAX  4/imm32/write
+    cd/syscall  0x80/imm8
 
-  # syscall(exit, EBX)
-  b8/copy-to-EAX  1/imm32/exit
-  cd/syscall  0x80/imm8
+    # syscall(exit, EBX)
+    b8/copy-to-EAX  1/imm32/exit
+    cd/syscall  0x80/imm8
 
 == data
 
 Size:  # size of string
-  0e 00 00 00  # 14
+    0e 00 00 00  # 14
 X:  # string to print
-  48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a       00
+    48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a       00
 # H  e  l  l  o  ,  ␣  w  o  r  l  d  !  newline  null
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx
index fc04ce2d..93b568f9 100644
--- a/subx/examples/ex7.subx
+++ b/subx/examples/ex7.subx
@@ -11,94 +11,94 @@
 #   97
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-  # syscall(creat, Filename)
-  bb/copy-to-EBX  Filename/imm32
-  b9/copy-to-ECX  0x180/imm32/fixed-perms
-  b8/copy-to-EAX  8/imm32/creat
-  cd/syscall  0x80/imm8
+    # syscall(creat, Filename)
+    bb/copy-to-EBX  Filename/imm32
+    b9/copy-to-ECX  0x180/imm32/fixed-perms
+    b8/copy-to-EAX  8/imm32/creat
+    cd/syscall  0x80/imm8
 
-  # stream = syscall(open, Filename, O_WRONLY, 0)  # we can't use 'fd' because it looks like a hex byte
-  bb/copy-to-EBX  Filename/imm32
-  b9/copy-to-ECX  1/imm32/wronly
-  ba/copy-to-EDX  0x180/imm32/fixed-perms
-  b8/copy-to-EAX  5/imm32/open
-  cd/syscall  0x80/imm8
+    # stream = syscall(open, Filename, O_WRONLY, 0)  # we can't use 'fd' because it looks like a hex byte
+    bb/copy-to-EBX  Filename/imm32
+    b9/copy-to-ECX  1/imm32/wronly
+    ba/copy-to-EDX  0x180/imm32/fixed-perms
+    b8/copy-to-EAX  5/imm32/open
+    cd/syscall  0x80/imm8
     # save stream
-  bb/copy-to-EBX  Stream/imm32
-  89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to *EBX
+    bb/copy-to-EBX  Stream/imm32
+    89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to *EBX
 
-  # syscall(write, Stream, "a", 1)
+    # syscall(write, Stream, "a", 1)
     # load stream
-  bb/copy-to-EBX  Stream/imm32
-  8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
+    bb/copy-to-EBX  Stream/imm32
+    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
     #
-  b9/copy-to-ECX  A/imm32
-  ba/copy-to-EDX  1/imm32/size
-  b8/copy-to-EAX  4/imm32/write
-  cd/syscall  0x80/imm8
+    b9/copy-to-ECX  A/imm32
+    ba/copy-to-EDX  1/imm32/size
+    b8/copy-to-EAX  4/imm32/write
+    cd/syscall  0x80/imm8
 
-  # syscall(close, Stream)
+    # syscall(close, Stream)
     # load stream
-  bb/copy-to-EBX  Stream/imm32
-  8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
+    bb/copy-to-EBX  Stream/imm32
+    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
     #
-  b8/copy-to-EAX  6/imm32/close
-  cd/syscall  0x80/imm8
+    b8/copy-to-EAX  6/imm32/close
+    cd/syscall  0x80/imm8
 
-  # stream = syscall(open, Filename, O_RDONLY, 0)
-  bb/copy-to-EBX  Filename/imm32
-  b9/copy-to-ECX  0/imm32/rdonly
-  ba/copy-to-EDX  0x180/imm32/fixed-perms
-  b8/copy-to-EAX  5/imm32/open
-  cd/syscall  0x80/imm8
+    # stream = syscall(open, Filename, O_RDONLY, 0)
+    bb/copy-to-EBX  Filename/imm32
+    b9/copy-to-ECX  0/imm32/rdonly
+    ba/copy-to-EDX  0x180/imm32/fixed-perms
+    b8/copy-to-EAX  5/imm32/open
+    cd/syscall  0x80/imm8
     # save Stream
-  bb/copy-to-EBX  Stream/imm32
-  89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to *EBX
+    bb/copy-to-EBX  Stream/imm32
+    89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                       # copy EAX to *EBX
 
-  # syscall(read, Stream, B, 1)
+    # syscall(read, Stream, B, 1)
     # load stream
-  bb/copy-to-EBX  Stream/imm32
-  8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
+    bb/copy-to-EBX  Stream/imm32
+    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
     #
-  b9/copy-to-ECX  B/imm32
-  ba/copy-to-EDX  1/imm32/size
-  b8/copy-to-EAX  3/imm32/read
-  cd/syscall  0x80/imm8
+    b9/copy-to-ECX  B/imm32
+    ba/copy-to-EDX  1/imm32/size
+    b8/copy-to-EAX  3/imm32/read
+    cd/syscall  0x80/imm8
 
-  # syscall(close, Stream)
+    # syscall(close, Stream)
     # load stream
-  bb/copy-to-EBX  Stream/imm32
-  8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
+    bb/copy-to-EBX  Stream/imm32
+    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
     #
-  b8/copy-to-EAX  6/imm32/close
-  cd/syscall  0x80/imm8
+    b8/copy-to-EAX  6/imm32/close
+    cd/syscall  0x80/imm8
 
-  # syscall(unlink, filename)
-  bb/copy-to-EBX  Filename/imm32
-  b8/copy-to-EAX  0xa/imm32/unlink
-  cd/syscall  0x80/imm8
+    # syscall(unlink, filename)
+    bb/copy-to-EBX  Filename/imm32
+    b8/copy-to-EAX  0xa/imm32/unlink
+    cd/syscall  0x80/imm8
 
-  # syscall(exit, b)
+    # syscall(exit, b)
     # load b
-  bb/copy-to-EBX  B/imm32
-  8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
+    bb/copy-to-EBX  B/imm32
+    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                       # copy *EBX to EBX
     #
-  b8/copy-to-EAX  1/imm32/exit
-  cd/syscall  0x80/imm8
+    b8/copy-to-EAX  1/imm32/exit
+    cd/syscall  0x80/imm8
 
 == data
 
 Stream:
-  00 00 00 00
+    00 00 00 00
 A:
-  61 00 00 00
+    61 00 00 00
 B:
-  00 00 00 00
+    00 00 00 00
 Filename:
-  2e 66 6f 6f 00 00 00 00
+    2e 66 6f 6f 00 00 00 00
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx
index 3f5ebce5..fd7929f4 100644
--- a/subx/examples/ex8.subx
+++ b/subx/examples/ex8.subx
@@ -15,44 +15,44 @@
 # Locals start from ESP-4 downwards.
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-  # prolog
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # call ascii-length(argv[1])
+    # prolog
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # call ascii-length(argv[1])
     # push args
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x8/disp8       .                 # push *(EBP+8)
+    ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x8/disp8       .                 # push *(EBP+8)
     # call
-  e8/call  ascii-length/disp32
+    e8/call  ascii-length/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
 
-  # exit(EAX)
-  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
-  b8/copy-to-EAX  1/imm32/exit
-  cd/syscall  0x80/imm8
+    # exit(EAX)
+    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
+    b8/copy-to-EAX  1/imm32/exit
+    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
-  # var result = 0 (EAX)
-  b8/copy-to-EAX  0/imm32
+    # 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
+    # var result = 0 (EAX)
+    b8/copy-to-EAX  0/imm32
 $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
-  # if c == '\0' break
-  81          7/subop/compare     3/mod/direct    1/rm32/ECX    .           .             .           .           .               0/imm32           # compare ECX
-  74/jump-if-equal  $ascii-length-ret/disp8
-  # ++s
-  81          0/subop/add         3/mod/direct    2/rm32/EDX    .           .             .           .           .               1/imm32           # add to EDX
-  # ++result
-  40/inc-EAX
-  # loop
-  eb/jump  $ascii-length-loop/disp8
+    # var c = *s (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
+    74/jump-if-equal  $ascii-length-ret/disp8
+    # ++s
+    81          0/subop/add         3/mod/direct    2/rm32/EDX    .           .             .           .           .               1/imm32           # add to EDX
+    # ++result
+    40/inc-EAX
+    # loop
+    eb/jump  $ascii-length-loop/disp8
 $ascii-length-ret:
-  # return (result in EAX)
-  c3/return
+    # return (result in EAX)
+    c3/return
 
 # vim:nowrap:textwidth=0
diff --git a/subx/examples/ex9.subx b/subx/examples/ex9.subx
index 6c6fc04b..00f2d661 100644
--- a/subx/examples/ex9.subx
+++ b/subx/examples/ex9.subx
@@ -17,35 +17,35 @@
 # Locals start from ESP-4 downwards.
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-  # prolog
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # call ascii-difference(argv[1], argv[2])
+    # prolog
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # call ascii-difference(argv[1], argv[2])
     # push argv[2]
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0xc/disp8       .                 # push *(EBP+12)
+    ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0xc/disp8       .                 # push *(EBP+12)
     # push argv[1]
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x8/disp8       .                 # push *(EBP+8)
+    ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x8/disp8       .                 # push *(EBP+8)
     # call
-  e8/call  ascii-difference/disp32
+    e8/call  ascii-difference/disp32
     # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # exit(EAX)
-  89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
-  b8/copy-to-EAX  1/imm32/exit
-  cd/syscall  0x80/imm8
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # exit(EAX)
+    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
+    b8/copy-to-EAX  1/imm32/exit
+    cd/syscall  0x80/imm8
 
 ascii-difference:  # (s1, s2) : null-terminated ascii strings
-  # a = first letter of s1 (ECX)
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              0/r32/EAX   4/disp8         .                 # copy *(ESP+4) to EAX
-  8b/copy                         0/mod/indirect  0/rm32/EAX    .           .             .           0/r32/EAX   .               .                 # copy *EAX to EAX
-  # b = first letter of s2 (EDX)
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   8/disp8                           # copy *(ESP+8) to ECX
-  8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           1/r32/ECX   .               .                 # copy *ECX to ECX
-  # a-b
-  29/subtract                     3/mod/direct    0/rm32/EAX    .           .             .           1/r32/ECX   .               .                 # subtract ECX from EAX
-  c3/return
+    # a = first letter of s1 (ECX)
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              0/r32/EAX   4/disp8         .                 # copy *(ESP+4) to EAX
+    8b/copy                         0/mod/indirect  0/rm32/EAX    .           .             .           0/r32/EAX   .               .                 # copy *EAX to EAX
+    # b = first letter of s2 (EDX)
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   8/disp8                           # copy *(ESP+8) to ECX
+    8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           1/r32/ECX   .               .                 # copy *ECX to ECX
+    # a-b
+    29/subtract                     3/mod/direct    0/rm32/EAX    .           .             .           1/r32/ECX   .               .                 # subtract ECX from EAX
+    c3/return
 
 # vim:nowrap:textwidth=0