about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx')
-rw-r--r--subx/056trace.subx28
-rwxr-xr-xsubx/apps/assortbin24081 -> 24092 bytes
-rwxr-xr-xsubx/apps/crenshaw2-1bin21308 -> 21319 bytes
-rwxr-xr-xsubx/apps/crenshaw2-1bbin21867 -> 21878 bytes
-rwxr-xr-xsubx/apps/factorialbin20224 -> 20235 bytes
-rwxr-xr-xsubx/apps/handlebin21030 -> 21041 bytes
-rwxr-xr-xsubx/apps/hexbin24317 -> 24328 bytes
-rwxr-xr-xsubx/apps/packbin39732 -> 39743 bytes
8 files changed, 23 insertions, 5 deletions
diff --git a/subx/056trace.subx b/subx/056trace.subx
index cedc512a..2e483bad 100644
--- a/subx/056trace.subx
+++ b/subx/056trace.subx
@@ -43,18 +43,36 @@ _test-trace-stream:
 
 # Allocate a new segment for the trace stream, initialize its length, and save its address to Trace-stream.
 # The Trace-stream segment will consist of variable-length lines separated by newlines (0x0a)
-initialize-trace-stream:
-    # EAX = new-segment(0x1000)
+initialize-trace-stream:  # n : int -> <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
+    # ECX = n
+    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           1/r32/ECX   8/disp8         .                 # copy *(EBP+8) to ECX
+    # EAX = new-segment(n)
     # . . push args
-    68/push  0x1000/imm32/N
+    51/push-ECX
     # . . call
     e8/call  new-segment/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # copy EAX to *Trace-stream
     89/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Trace-stream/disp32               # copy EAX to *Trace-stream
-    # Trace-stream->length = 0x1000/N - 12
-    c7          0/subop/copy        1/mod/*+disp8   0/rm32/EAX    .           .             .           .           8/disp8         0xff4/imm32       # copy 0xff4 to *(EAX+8)
+    # Trace-stream->length = n - 12
+    # . ECX -= 12
+    81          5/subop/subtract    3/mod/direct    1/rm32/ECX    .           .             .           .           .               0xc/imm32         # subtract from ECX
+    # . Trace-stream->length = ECX
+    89/copy                         1/mod/*+disp8   0/rm32/EAX    .           .             .           1/r32/ECX   8/disp8         .                 # copy ECX to *(EAX+8)
+$initialize-trace-stream:end:
+    # . restore registers
+    59/pop-to-ECX
+    58/pop-to-EAX
+    # . epilog
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
     c3/return
 
 # Append a string to the given trace stream.
diff --git a/subx/apps/assort b/subx/apps/assort
index 32023675..b9ba016b 100755
--- a/subx/apps/assort
+++ b/subx/apps/assort
Binary files differdiff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index def09e48..43fae481 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b
index 705ac0ad..0a3c2c44 100755
--- a/subx/apps/crenshaw2-1b
+++ b/subx/apps/crenshaw2-1b
Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial
index 2330d6ad..3439987b 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle
index 974e57a2..b6b806d5 100755
--- a/subx/apps/handle
+++ b/subx/apps/handle
Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex
index 4bce98eb..3eb6a5b7 100755
--- a/subx/apps/hex
+++ b/subx/apps/hex
Binary files differdiff --git a/subx/apps/pack b/subx/apps/pack
index d1e98aa6..b8bd13aa 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differ