about summary refs log tree commit diff stats
path: root/315stack-debug.subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-22 07:57:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-22 07:57:10 -0700
commit8bbf7ad4552856cfe27e41b55ab50663dd6365ec (patch)
treec8614bc95fdd93d1e50ae91d40a015b768146b4b /315stack-debug.subx
parent6842dddd681e85afd8373e66227f110ea963671d (diff)
downloadmu-8bbf7ad4552856cfe27e41b55ab50663dd6365ec.tar.gz
.
Diffstat (limited to '315stack-debug.subx')
-rw-r--r--315stack-debug.subx13
1 files changed, 13 insertions, 0 deletions
diff --git a/315stack-debug.subx b/315stack-debug.subx
index a01c5687..86e65fd8 100644
--- a/315stack-debug.subx
+++ b/315stack-debug.subx
@@ -57,13 +57,25 @@ debug-print:  # x: (addr array byte), fg: int, bg: int    # x is very short; usu
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
+    # . save registers
+    50/push-eax
+    51/push-ecx
     #
     {
       81 7/subop/compare *Really-debug-print 0/imm32/false
       74/jump-if-= break/disp8
       (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+8) *(ebp+0xc) *(ebp+0x10))
+      # clear the screen and continue if we got too close to the bottom
+      (cursor-position 0)  # => eax, ecx
+      81 7/subop/compare %ecx 0x28/imm32
+      75/jump-if-!= break/disp8
+      (clear-screen 0)
+      (set-cursor-position 0 0 0)
     }
 $debug-print:end:
+    # . restore registers
+    59/pop-to-ecx
+    58/pop-to-eax
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp
@@ -72,3 +84,4 @@ $debug-print:end:
 == data
 Really-debug-print:
   0/imm32/false
+#?   1/imm32/true