about summary refs log tree commit diff stats
path: root/shell
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-05-22 10:28:21 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-05-22 10:28:21 -0700
commit7a04c8104d94ad6357a10218beed57bd783e3017 (patch)
treea351575630e74adba8f4ddc74a4a9dc1f3a9c8b6 /shell
parent6934f78e9792e051803adca3152d958382def0a9 (diff)
downloadmu-7a04c8104d94ad6357a10218beed57bd783e3017.tar.gz
shell: reduce trace depth in sandbox
We'll gradually make this more dynamic.
Diffstat (limited to 'shell')
-rw-r--r--shell/sandbox.mu2
-rw-r--r--shell/trace.mu16
2 files changed, 17 insertions, 1 deletions
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index d5cf6c8f..65dd6c4e 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -31,7 +31,7 @@ fn initialize-sandbox _self: (addr sandbox), fake-screen-and-keyboard?: boolean
   var trace-ah/eax: (addr handle trace) <- get self, trace
   allocate trace-ah
   var trace/eax: (addr trace) <- lookup *trace-ah
-  initialize-trace trace, 0x100/max-depth, 0x8000/lines, 0x80/visible
+  initialize-trace trace, 4/max-depth, 0x8000/lines, 0x80/visible
   var cursor-in-data?/eax: (addr boolean) <- get self, cursor-in-data?
   copy-to *cursor-in-data?, 1/true
 }
diff --git a/shell/trace.mu b/shell/trace.mu
index 0398a099..43b19246 100644
--- a/shell/trace.mu
+++ b/shell/trace.mu
@@ -433,6 +433,22 @@ fn render-trace screen: (addr screen), _self: (addr trace), xmin: int, ymin: int
   var i/edx: int <- copy 0
   var max-addr/ebx: (addr int) <- get self, first-free
   var max/ebx: int <- copy *max-addr
+  # display trace depth (not in tests)
+  $render-trace:render-depth: {
+    compare max, 0
+    break-if-<=
+    var max-depth/edx: (addr int) <- get self, max-depth
+    {
+      var width/eax: int <- copy 0
+      var height/ecx: int <- copy 0
+      width, height <- screen-size screen
+      compare width, 0x80
+      break-if-< $render-trace:render-depth
+    }
+    set-cursor-position screen, 0x70/x, y
+    draw-text-rightward-from-cursor-over-full-screen screen, "trace depth: ", 0x17/fg, 0xc5/bg=blue-bg
+    draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen screen, *max-depth, 0x7/fg, 0xc5/bg=blue-bg
+  }
   $render-trace:loop: {
     compare i, max
     break-if->=