about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--315stack-debug.subx36
-rw-r--r--400.mu3
2 files changed, 39 insertions, 0 deletions
diff --git a/315stack-debug.subx b/315stack-debug.subx
index 86e65fd8..99156707 100644
--- a/315stack-debug.subx
+++ b/315stack-debug.subx
@@ -81,6 +81,42 @@ $debug-print:end:
     5d/pop-to-ebp
     c3/return
 
+debug-print?:  # -> _/eax: boolean
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    #
+    8b/-> *Really-debug-print 0/r32/eax
+$debug-print?:end:
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+turn-on-debug-print:
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    #
+    c7 0/subop/copy *Really-debug-print 1/imm32/true
+$turn-on-debug-print:end:
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+turn-off-debug-print:
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    #
+    c7 0/subop/copy *Really-debug-print 0/imm32/false
+$turn-off-debug-print:end:
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 == data
 Really-debug-print:
   0/imm32/false
diff --git a/400.mu b/400.mu
index 4d71bd11..4052ea55 100644
--- a/400.mu
+++ b/400.mu
@@ -27,6 +27,9 @@ sig check-strings-equal s: (addr array byte), expected: (addr array byte), msg:
 sig check-stack
 sig show-stack-state
 sig debug-print x: (addr array byte), fg: int, bg: int
+sig debug-print? -> _/eax: boolean
+sig turn-on-debug-print
+sig turn-off-debug-print
 
 # streams
 sig clear-stream f: (addr stream _)