about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-22 09:03:20 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-22 09:03:20 -0700
commit4e70cac9984bf1731da052c1509ff16f0783c625 (patch)
tree1258df4cf5f8c37f3d81a96b6710999a3b69e944
parent8bbf7ad4552856cfe27e41b55ab50663dd6365ec (diff)
downloadmu-4e70cac9984bf1731da052c1509ff16f0783c625.tar.gz
.
-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 _)