about summary refs log tree commit diff stats
path: root/subx/examples/ex3.subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx/examples/ex3.subx')
-rw-r--r--subx/examples/ex3.subx38
1 files changed, 19 insertions, 19 deletions
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