about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.arc7
-rw-r--r--trace.mu12
2 files changed, 14 insertions, 5 deletions
diff --git a/mu.arc b/mu.arc
index 02cbd652..16d6bd0c 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1680,7 +1680,7 @@
 (def screen-contains (addr width value)
   (or (memory-contains-array addr value)
       (do ;(memory-contains-array-verbose addr value)
-          (prn "Screen contents:")
+          (prn "Mismatch detected. Screen contents:")
           (with (row-start-addr  (+ addr 1)  ; skip count
                  idx  0)
             (for row 0  (< row (/ len.value width))  (do ++.row  (++ row-start-addr width))
@@ -1688,9 +1688,8 @@
               (for col 0  (< col width)  ++.col
                 (with (expected  value.idx
                        got  (memory* (+ col row-start-addr)))
-                  (if (is expected got)
-                    (do (pr got)  (pr " "))
-                    (do (pr "X")  (pr got))))
+                  (pr got)
+                  (pr (if (is expected got) " " "X")))
                 ++.idx)
               (prn " .")
               )))))
diff --git a/trace.mu b/trace.mu
index 60bff37e..1b9ccc17 100644
--- a/trace.mu
+++ b/trace.mu
@@ -295,8 +295,16 @@
   (0:space-address/names:screen-state <- next-input)
   (screen:terminal-address <- next-input)
   (traces:instruction-trace-address-array-address <- next-input)
+  (print-traces-collapsed-from 0:space-address screen:terminal-address traces:instruction-trace-address-array-address 0:literal/from)
+])
+
+(function print-traces-collapsed-from [
+  (default-space:space-address <- new space:literal 30:literal/capacity)
+  (0:space-address/names:screen-state <- next-input)
+  (screen:terminal-address <- next-input)
+  (traces:instruction-trace-address-array-address <- next-input)
+  (i:integer <- next-input)
   (len:integer <- length traces:instruction-trace-address-array-address/deref)
-  (i:integer <- copy 0:literal)
   { begin
     (done?:boolean <- greater-or-equal i:integer len:integer)
     (break-if done?:boolean)
@@ -352,6 +360,8 @@
     (target-row:integer <- copy cursor-row:integer/space:1)
     (tr:instruction-trace-address <- index traces:instruction-trace-address-array-address/deref cursor-row:integer/space:1)
     (print-instruction-trace screen:terminal-address tr:instruction-trace-address 0:space-address/screen-state)
+    (next-row:integer <- add target-row:integer 1:literal)
+    (print-traces-collapsed-from 0:space-address/screen-state screen:terminal-address traces:instruction-trace-address-array-address next-row:integer)
     (back-to 0:space-address/screen-state screen:terminal-address target-row:integer)
     (reply nil:literal)
   }