about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx')
-rw-r--r--subx/022check_instruction.cc16
-rw-r--r--subx/024pack_operands.cc32
-rw-r--r--subx/026labels.cc20
-rw-r--r--subx/ex1.2.subx12
-rw-r--r--subx/ex2.subx14
-rw-r--r--subx/ex3.subx24
-rw-r--r--subx/ex4.subx30
-rw-r--r--subx/ex5.subx36
-rw-r--r--subx/ex6.subx22
-rw-r--r--subx/ex7.subx56
10 files changed, 131 insertions, 131 deletions
diff --git a/subx/022check_instruction.cc b/subx/022check_instruction.cc
index 1e0bf7de..97dc8140 100644
--- a/subx/022check_instruction.cc
+++ b/subx/022check_instruction.cc
@@ -55,10 +55,10 @@ cerr << "  instructions\n";
 :(scenario check_missing_imm8_operand)
 % Hide_errors = true;
 == 0x1
-# 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
-  cd                                                                                                                                        # int ??
+# 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
+  cd                                                                                                                                                # int ??
 +error: 'cd' (software interrupt): missing imm8 operand
 
 :(before "End One-time Setup")
@@ -584,10 +584,10 @@ void check_operands_f3(const line& /*unused*/) {
 :(scenario check_missing_disp16_operand)
 % Hide_errors = true;
 == 0x1
-# 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
-  0f 84                                                                                                                                     # jmp if ZF to ??
+# 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
+  0f 84                                                                                                                                             # jmp if ZF to ??
 +error: '0f 84' (jump disp16 bytes away if ZF is set): missing disp16 operand
 
 :(before "End Globals")
diff --git a/subx/024pack_operands.cc b/subx/024pack_operands.cc
index 26573395..f8effd16 100644
--- a/subx/024pack_operands.cc
+++ b/subx/024pack_operands.cc
@@ -3,10 +3,10 @@
 
 :(scenario pack_immediate_constants)
 == 0x1
-# 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
-  bb                                                                                                                      0x2a/imm32        # copy 42 to EBX
+# 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
+  bb                                                                                                                              0x2a/imm32        # copy 42 to EBX
 +transform: packing instruction 'bb 0x2a/imm32'
 +transform: instruction after packing: 'bb 2a 00 00 00'
 +run: copy imm32 0x0000002a to EBX
@@ -28,10 +28,10 @@
 
 :(scenario pack_modrm_imm32)
 == 0x1
-# 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
-  81          0/add/subop         3/mod/direct    3/ebx/rm32                                                              1/imm32           # add 1 to EBX
+# 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
+  81          0/add/subop         3/mod/direct    3/ebx/rm32                                                                      1/imm32           # add 1 to EBX
 +transform: packing instruction '81 0/add/subop 3/mod/direct 3/ebx/rm32 1/imm32'
 +transform: instruction after packing: '81 c3 01 00 00 00'
 
@@ -183,10 +183,10 @@ string to_string(const vector<word>& in) {
 
 :(scenario pack_immediate_constants_hex)
 == 0x1
-# 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
-  bb                                                                                                                      0x2a/imm32        # copy 42 to EBX
+# 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
+  bb                                                                                                                              0x2a/imm32        # copy 42 to EBX
 +transform: packing instruction 'bb 0x2a/imm32'
 +transform: instruction after packing: 'bb 2a 00 00 00'
 +run: copy imm32 0x0000002a to EBX
@@ -194,10 +194,10 @@ string to_string(const vector<word>& in) {
 :(scenarios transform)
 :(scenario pack_silently_ignores_non_hex)
 == 0x1
-# 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
-  bb                                                                                                                      foo/imm32         # copy foo to EBX
+# 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
+  bb                                                                                                                              foo/imm32         # copy foo to EBX
 +transform: packing instruction 'bb foo/imm32'
 # no change (we're just not printing metadata to the trace)
 +transform: instruction after packing: 'bb foo'
diff --git a/subx/026labels.cc b/subx/026labels.cc
index db6091d6..78190c6d 100644
--- a/subx/026labels.cc
+++ b/subx/026labels.cc
@@ -4,11 +4,11 @@
 :(scenarios transform)
 :(scenario map_label)
 == 0x1
-          # 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
 loop:
-            05                                                                                                                      0x0d0c0b0a/imm32  # add to EAX
+            05                                                                                                                              0x0d0c0b0a/imm32  # add to EAX
 +transform: label 'loop' is at address 1
 
 :(before "End One-time Setup")
@@ -138,18 +138,18 @@ string data_to_string(const line& inst) {
 
 :(scenario multiple_labels_at)
 == 0x1
-          # 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
 # address 1
 loop:
 loop2:
 # address 1 (labels take up no space)
-            05                                                                                                                      0x0d0c0b0a/imm32  # add to EAX
+            05                                                                                                                              0x0d0c0b0a/imm32  # add to EAX
 # address 6
-            eb                                                                                                      loop2/disp8
+            eb                                                                                                              loop2/disp8
 # address 8
-            eb                                                                                                      loop3/disp8
+            eb                                                                                                              loop3/disp8
 # address 10
 loop3:
 +transform: label 'loop' is at address 1
diff --git a/subx/ex1.2.subx b/subx/ex1.2.subx
index 844678b7..2652037a 100644
--- a/subx/ex1.2.subx
+++ b/subx/ex1.2.subx
@@ -9,12 +9,12 @@
 #   42
 
 == 0x08048054  # code segment, after leaving room for ELF header
-# 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
-  bb/copy                                                                                                                 2a/imm32          # copy 42 to EBX
+# 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
+  bb/copy                                                                                                                         2a/imm32          # copy 42 to EBX
   # exit(EBX)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 # vim:ft=subx
diff --git a/subx/ex2.subx b/subx/ex2.subx
index 20cee840..c63b7eb6 100644
--- a/subx/ex2.subx
+++ b/subx/ex2.subx
@@ -8,13 +8,13 @@
 #   2
 
 == 0x08048054  # code segment, after leaving room for ELF header
-# 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
-  bb/copy                                                                                                                 1/imm32           # copy 1 to EBX
-  81          0/subop/add         3/mod/direct    3/rm32/ebx                                                              1/imm32           # add 1 to EBX
+# 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
+  bb/copy                                                                                                                         1/imm32           # copy 1 to EBX
+  81          0/subop/add         3/mod/direct    3/rm32/ebx                                                                      1/imm32           # add 1 to EBX
   # exit(EBX)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 # vim:ft=subx
diff --git a/subx/ex3.subx b/subx/ex3.subx
index 2ad61edd..eb66f1bf 100644
--- a/subx/ex3.subx
+++ b/subx/ex3.subx
@@ -8,28 +8,28 @@
 #   55
 
 == 0x08048054  # code segment, after leaving room for ELF header
-# 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                                                                                                                 0/imm32           # copy 0 to EBX
+  bb/copy                                                                                                                         0/imm32           # copy 0 to EBX
   # counter: ECX = 1
-  b9/copy                                                                                                                 1/imm32           # copy 1 to ECX
+  b9/copy                                                                                                                         1/imm32           # copy 1 to ECX
 
 loop:
   # while (counter <= 10)
-  81          7/subop/compare     3/mod/direct    1/rm32/ecx                                                              0xa/imm32         # compare ECX, 10/imm
-  7f/jump-if                                                                                              exit/disp8                        # jump-if-greater exit
+  81          7/subop/compare     3/mod/direct    1/rm32/ecx                                                                      0xa/imm32         # compare ECX, 10/imm
+  7f/jump-if                                                                                                      exit/disp8                        # jump-if-greater exit
   # result += counter
-  01/add                          3/mod/direct    3/rm32/ebx                                  1/r32/ecx                                     # add ECX to EBX
+  01/add                          3/mod/direct    3/rm32/ebx                                          1/r32/ecx                                     # add ECX to EBX
   # ++counter
-  81          0/subop/add         3/mod/direct    1/rm32/ecx                                                              1/imm32           # add 1 to ECX
+  81          0/subop/add         3/mod/direct    1/rm32/ecx                                                                      1/imm32           # add 1 to ECX
   # loop
-  eb/jump                                                                                                 loop/disp8                        # jump loop
+  eb/jump                                                                                                         loop/disp8                        # jump loop
 
 exit:
   # exit(EBX)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 # vim:ft=subx:nowrap
diff --git a/subx/ex4.subx b/subx/ex4.subx
index 0d5f76a8..59dd14e1 100644
--- a/subx/ex4.subx
+++ b/subx/ex4.subx
@@ -5,35 +5,35 @@
 #   $ subx run ex4
 
 == 0x08048074  # code segment, after leaving room for ELF header and segment headers
-# 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
 
   ## read(stdin, x, 1)
   # fd = 0 (stdin)
-  bb/copy                                                                                                                 0/imm32           # copy 0 to EBX
+  bb/copy                                                                                                                         0/imm32           # copy 0 to EBX
   # initialize x (location to write result to)
-  b9/copy                                                                                                                 0x080490a7/imm32  # copy to ECX
+  b9/copy                                                                                                                         0x080490a7/imm32  # copy to ECX
   # size = 1 character
-  ba/copy                                                                                                                 1/imm32           # copy 1 to EDX
+  ba/copy                                                                                                                         1/imm32           # copy 1 to EDX
   # read(fd, x, size)
-  b8/copy                                                                                                                 3/imm32           # copy 3 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         3/imm32           # copy 3 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
   ## write(stdout, x, 1)
   # fd = 1 (stdout)
-  bb/copy                                                                                                                 1/imm32           # copy 1 to EBX
+  bb/copy                                                                                                                         1/imm32           # copy 1 to EBX
   # initialize x (location to read from)
-  b9/copy                                                                                                                 0x080490a7/imm32  # copy to ECX
+  b9/copy                                                                                                                         0x080490a7/imm32  # copy to ECX
   # size = 1 character
-  ba/copy                                                                                                                 1/imm32           # copy 1 to EDX
+  ba/copy                                                                                                                         1/imm32           # copy 1 to EDX
   # write(fd, x, size)
-  b8/copy                                                                                                                 4/imm32           # copy 4 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         4/imm32           # copy 4 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
   ## exit(EBX)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 == 0x080490a7
 00 00 00 00  # space for read() to write to
diff --git a/subx/ex5.subx b/subx/ex5.subx
index bdbfe6f4..e4a2db81 100644
--- a/subx/ex5.subx
+++ b/subx/ex5.subx
@@ -5,41 +5,41 @@
 #   $ subx run ex5
 
 == 0x08048054  # code segment, after leaving room for ELF header and segment headers
-# 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
 
 ## function main
   # prolog
-  55/push                                                                                                                                   # push EBP
-  89/copy                         3/mod/direct    5/rm32/EBP                                  4/r32/ESP                                     # copy ESP to EBP
+  55/push                                                                                                                                           # push EBP
+  89/copy                         3/mod/direct    5/rm32/EBP                                          4/r32/ESP                                     # copy ESP to EBP
   # allocate x on the stack
-  81          5/subop/subtract    3/mod/direct    4/rm32/ESP                                                              4/imm32           # subtract 4 bytes from ESP
+  81          5/subop/subtract    3/mod/direct    4/rm32/ESP                                                                      4/imm32           # subtract 4 bytes from ESP
 
   ## read(stdin, x, 1)
   # fd = 0 (stdin)
-  bb/copy                                                                                                                 0/imm32           # copy 0 to EBX
+  bb/copy                                                                                                                         0/imm32           # copy 0 to EBX
   # initialize x (location to write result to)
-  89/copy                         3/mod/direct    1/rm32/ECX                                  5/r32/EBP                                     # copy EBP to ECX
+  89/copy                         3/mod/direct    1/rm32/ECX                                          5/r32/EBP                                     # copy EBP to ECX
   # size = 1 character
-  ba/copy                                                                                                                 1/imm32           # copy 1 to EDX
+  ba/copy                                                                                                                         1/imm32           # copy 1 to EDX
   # read(fd, x, size)
-  b8/copy                                                                                                                 3/imm32           # copy 3 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         3/imm32           # copy 3 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
   ## write(stdout, x, 1)
   # fd = 1 (stdout)
-  bb/copy                                                                                                                 1/imm32           # copy 1 to EBX
+  bb/copy                                                                                                                         1/imm32           # copy 1 to EBX
   # initialize x (location to read from)
-  89/copy                         3/mod/direct    1/rm32/ECX                                  5/r32/EBP                                     # copy EBP to ECX
+  89/copy                         3/mod/direct    1/rm32/ECX                                          5/r32/EBP                                     # copy EBP to ECX
   # size = 1 character
-  ba/copy                                                                                                                 1/imm32           # copy 1 to EDX
+  ba/copy                                                                                                                         1/imm32           # copy 1 to EDX
   # write(fd, x, size)
-  b8/copy                                                                                                                 4/imm32           # copy 4 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         4/imm32           # copy 4 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
   ## exit(EBX)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 # vim:ft=subx:nowrap
diff --git a/subx/ex6.subx b/subx/ex6.subx
index 2c9555d8..8f4f6b40 100644
--- a/subx/ex6.subx
+++ b/subx/ex6.subx
@@ -6,25 +6,25 @@
 #   Hello, world!
 
 == 0x08048074  # code segment, after leaving room for ELF header and segment headers
-# 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
 
   ## write(stdout, x, 1)
   # fd = 1 (stdout)
-  bb/copy                                                                                                                 1/imm32           # copy 1 to EBX
+  bb/copy                                                                                                                         1/imm32           # copy 1 to EBX
   # initialize x (location to write result to)
-  b9/copy                                                                                                                 0x08049097/imm32  # copy to ECX
+  b9/copy                                                                                                                         0x08049097/imm32  # copy to ECX
   # initialize size
-  ba/copy                                                                                                                 0x08049093/imm32  # copy to EDX
-  8b/copy                         0/mod/indirect  2/rm32/edx                                  2/r32/edx                                     # copy *EDX to EDX
+  ba/copy                                                                                                                         0x08049093/imm32  # copy to EDX
+  8b/copy                         0/mod/indirect  2/rm32/edx                                          2/r32/edx                                     # copy *EDX to EDX
   # write(fd, x, size)
-  b8/copy                                                                                                                 4/imm32           # copy 4 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         4/imm32           # copy 4 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
   ## exit(EBX)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 == 0x08049093
 # size of string
diff --git a/subx/ex7.subx b/subx/ex7.subx
index fab91b6a..4474e110 100644
--- a/subx/ex7.subx
+++ b/subx/ex7.subx
@@ -8,80 +8,80 @@
 #   120
 
 == 0x08048054  # code segment, after leaving room for ELF header
-# 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:
   # prepare to make a call
 # 54
-  55/push                                                                                                                                   # push EBP
+  55/push                                                                                                                                           # push EBP
 # 55
-  89/copy                         3/mod/direct    5/rm32/EBP                                  4/r32/ESP                                     # copy ESP to EBP
+  89/copy                         3/mod/direct    5/rm32/EBP                                          4/r32/ESP                                     # copy ESP to EBP
 # 57
   # factorial(5)
-  68/push                                                                                                                 5/imm32           # push 5
+  68/push                                                                                                                         5/imm32           # push 5
 # 5c
-  e8/call                                                                                                 factorial/disp32
+  e8/call                                                                                                         factorial/disp32
 # 61
   # discard arg
-  5a/pop                                                                                                                                    # pop into EDX
+  5a/pop                                                                                                                                            # pop into EDX
 # 62
   # clean up after call
-  89/copy                         3/mod/direct    4/rm32/ESP                                  5/r32/EBP                                     # copy EBP to ESP
+  89/copy                         3/mod/direct    4/rm32/ESP                                          5/r32/EBP                                     # copy EBP to ESP
 # 64
-  5d/pop                                                                                                                                    # pop to EBP
+  5d/pop                                                                                                                                            # pop to EBP
 
   # exit(EAX)
 # 65
-  89/copy                         3/mod/direct    3/rm32/EBX                                  0/r32/EAX                                     # copy EAX to EBX
+  89/copy                         3/mod/direct    3/rm32/EBX                                          0/r32/EAX                                     # copy EAX to EBX
 # 67
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
 # 6c
-  cd/syscall                                                                                                              0x80/imm8         # int 80h
+  cd/syscall                                                                                                                      0x80/imm8         # int 80h
 
 # factorial(n)
 # 6e
 factorial:
   # initialize n
-  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
 # 72
   # initialize EAX to 1 (base case)
-  b8/copy                                                                                                                 1/imm32           # copy 1 to EAX
+  b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
 # 77
   # if (n <= 1) jump exit
-  81          7/subop/compare     3/mod/direct    2/rm32/EDX                                                              1/imm32           # compare EDX with 1
+  81          7/subop/compare     3/mod/direct    2/rm32/EDX                                                                      1/imm32           # compare EDX with 1
 # 7d
-  7e/jump-if                                                                                              factorial:exit/disp8              # jump if <= to exit
+  7e/jump-if                                                                                                      factorial:exit/disp8              # jump if <= to exit
 # 7f
   # EBX: n-1
-  89/copy                         3/mod/direct    3/rm32/EBX                                  2/r32/EDX                                     # copy EDX to EBX
+  89/copy                         3/mod/direct    3/rm32/EBX                                          2/r32/EDX                                     # copy EDX to EBX
 # 81
-  81          5/subop/subtract    3/mod/direct    3/rm32/EBX                                                              1/imm32           # subtract 1 from EBX
+  81          5/subop/subtract    3/mod/direct    3/rm32/EBX                                                                      1/imm32           # subtract 1 from EBX
 # 87
   # prepare call
-  55/push                                                                                                                                   # push EBP
+  55/push                                                                                                                                           # push EBP
 # 88
-  89/copy                         3/mod/direct    5/rm32/EBP                                  4/r32/ESP                                     # copy ESP to EBP
+  89/copy                         3/mod/direct    5/rm32/EBP                                          4/r32/ESP                                     # copy ESP to EBP
   # EAX: factorial(n-1)
 # 8a
-  53/push                                                                                                                                   # push EBX
+  53/push                                                                                                                                           # push EBX
 # 8b
-  e8/call                                                                                                 factorial/disp32
+  e8/call                                                                                                         factorial/disp32
 # 90
   # discard arg
-  5e/pop                                                                                                                                    # pop into ESI
+  5e/pop                                                                                                                                            # pop into ESI
 # 91
   # clean up after call
-  89/copy                         3/mod/direct    4/rm32/ESP                                  5/r32/EBP                                     # copy EBP to ESP
+  89/copy                         3/mod/direct    4/rm32/ESP                                          5/r32/EBP                                     # copy EBP to ESP
 # 93
-  5d/pop                                                                                                                                    # pop to EBP
+  5d/pop                                                                                                                                            # pop to EBP
 # 94
   # refresh n
-  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
 # 98
   # return n * factorial(n-1)
-  0f af/multiply                  3/mod/direct    2/rm32/EDX                                  0/r32/EAX                                     # multiply EDX (n) into EAX (factorial(n-1))
+  0f af/multiply                  3/mod/direct    2/rm32/EDX                                          0/r32/EAX                                     # multiply EDX (n) into EAX (factorial(n-1))
   # TODO: check for overflow
 # 9b
 factorial:exit: