about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--apps/tests.subx29
-rwxr-xr-xtest_apps68
2 files changed, 57 insertions, 40 deletions
diff --git a/apps/tests.subx b/apps/tests.subx
index b70e6e1a..ff09730a 100644
--- a/apps/tests.subx
+++ b/apps/tests.subx
@@ -71,7 +71,9 @@ subx-gen-run-tests:  # in: (addr buffered-file), out: (addr buffered-file)
     # pseudocode
     #   boolean tests-found = false
     #   var line: (stream byte 512)
-    #   var new-code-segment: (handle stream byte) = new-stream(Segment-size, 1)
+    #   var new-code-segment-handle: (handle stream byte)
+    #   new-stream(Segment-size, 1, new-code-stream-handle)
+    #   var new-code-segment: (addr stream byte) = lookup(new-code-stream-handle)
     #   write(new-code-segment, "\n== code\n")
     #   write(new-code-segment, "run-tests:\n")
     #   while true
@@ -100,6 +102,7 @@ subx-gen-run-tests:  # in: (addr buffered-file), out: (addr buffered-file)
     51/push-ecx
     52/push-edx
     53/push-ebx
+    56/push-esi
     57/push-edi
     # var line/ecx: (stream byte 512)
     81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x200/imm32       # subtract from esp
@@ -113,17 +116,30 @@ subx-gen-run-tests:  # in: (addr buffered-file), out: (addr buffered-file)
     89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
     # tests-found?/ebx = false
     31/xor                          3/mod/direct    3/rm32/ebx    .           .             .           3/r32/ebx   .               .                 # clear ebx
-    # new-code-segment/edi = new-stream(Heap, Segment-size, 1)
-    # . eax = new-stream(Heap, Segment-size, 1)
+    # var new-code-stream-handle/esi: (handle stream byte)
+    68/push  0/imm32
+    68/push  0/imm32
+    89/copy                         3/mod/direct    6/rm32/esi    .           .             .           4/r32/esp   .               .                 # copy esp to esi
+    # new-stream(Heap, Segment-size, 1, new-code-stream-handle)
     # . . push args
+    56/push-esi
     68/push  1/imm32
     ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Segment-size/disp32               # push *Segment-size
     68/push  Heap/imm32
     # . . call
     e8/call  new-stream/disp32
     # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
-    # . edi = eax
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
+    # var new-code-stream/edi: (addr stream byte) = lookup(*new-code-stream-handle)
+    # . eax = lookup(*new-code-stream-handle)
+    # . . push args
+    ff          6/subop/push        1/mod/*+disp8   6/rm32/esi    .           .             .           .           4/disp8         .                 # push *(esi+4)
+    ff          6/subop/push        0/mod/indirect  6/rm32/esi    .           .             .           .           .               .                 # push *esi
+    # . . call
+    e8/call  lookup/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+    # . new-code-stream = eax
     89/copy                         3/mod/direct    7/rm32/edi    .           .             .           0/r32/eax   .               .                 # copy eax to edi
     # write(new-code-segment, "\n== code\n")
     # . . push args
@@ -269,9 +285,10 @@ $subx-gen-run-tests:end:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
     # . reclaim locals
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x214/imm32       # add to esp
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x21c/imm32       # add to esp
     # . restore registers
     5f/pop-to-edi
+    5e/pop-to-esi
     5b/pop-to-ebx
     5a/pop-to-edx
     59/pop-to-ecx
diff --git a/test_apps b/test_apps
index d1c516c3..4e1f5896 100755
--- a/test_apps
+++ b/test_apps
@@ -223,7 +223,7 @@ test $NATIVE  &&  {
 
 # Phases of the self-hosted SubX translator.
 
-for phase in hex pack  # survey assort dquotes tests
+for phase in hex pack tests  # survey assort dquotes
 do
   echo $phase
   ./bootstrap translate init.$OS 0[0-8]*.subx apps/subx-params.subx apps/$phase.subx -o apps/$phase
@@ -295,45 +295,45 @@ done
 #?   apps/mu test
 #?   echo
 #? }
-
-test $NATIVE  ||  exit 0
-echo "== translating using SubX (native only)"
-
-# example programs
-
-for n in `seq 1 12`
-do
-  echo ex$n
-  ./translate_subx init.$OS apps/ex$n.subx
-  diff apps/ex$n a.elf
-done
-
-# Larger apps that use the standard library.
-
-for app in factorial crenshaw2-1 crenshaw2-1b
-do
-  echo $app
-  ./translate_subx init.$OS 0[0-8]*.subx apps/$app.subx
-  diff apps/$app a.elf
-done
-
-# Phases of the self-hosted SubX translator.
-
-for app in hex pack  # survey assort dquotes tests
-do
-  echo $app
-  ./translate_subx init.$OS 0[0-8]*.subx apps/subx-params.subx apps/$app.subx
-  diff apps/$app a.elf
-done
-
+#? 
+#? test $NATIVE  ||  exit 0
+#? echo "== translating using SubX (native only)"
+#? 
+#? # example programs
+#? 
+#? for n in `seq 1 12`
+#? do
+#?   echo ex$n
+#?   ./translate_subx init.$OS apps/ex$n.subx
+#?   diff apps/ex$n a.elf
+#? done
+#? 
+#? # Larger apps that use the standard library.
+#? 
+#? for app in factorial crenshaw2-1 crenshaw2-1b
+#? do
+#?   echo $app
+#?   ./translate_subx init.$OS 0[0-8]*.subx apps/$app.subx
+#?   diff apps/$app a.elf
+#? done
+#? 
+#? # Phases of the self-hosted SubX translator.
+#? 
+#? for app in hex survey pack assort dquotes tests
+#? do
+#?   echo $app
+#?   ./translate_subx init.$OS 0[0-8]*.subx apps/subx-params.subx apps/$app.subx
+#?   diff apps/$app a.elf
+#? done
+#? 
 #? for app in sigils calls braces
 #? do
 #?   echo $app
 #?   ./translate_subx init.$OS 0*.subx apps/subx-params.subx apps/$app.subx
 #?   diff apps/$app a.elf
 #? done
-
-# Mu translator
+#? 
+#? # Mu translator
 #? echo mu
 #? ./translate_subx init.$OS [0-9]*.subx apps/mu.subx
 #? diff apps/mu a.elf