diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-22 10:28:21 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-22 10:28:21 -0700 |
commit | 7a04c8104d94ad6357a10218beed57bd783e3017 (patch) | |
tree | a351575630e74adba8f4ddc74a4a9dc1f3a9c8b6 | |
parent | 6934f78e9792e051803adca3152d958382def0a9 (diff) | |
download | mu-7a04c8104d94ad6357a10218beed57bd783e3017.tar.gz |
shell: reduce trace depth in sandbox
We'll gradually make this more dynamic.
-rw-r--r-- | 501draw-text.mu | 7 | ||||
-rw-r--r-- | shell/sandbox.mu | 2 | ||||
-rw-r--r-- | shell/trace.mu | 16 |
3 files changed, 24 insertions, 1 deletions
diff --git a/501draw-text.mu b/501draw-text.mu index 1a953969..1a729c1f 100644 --- a/501draw-text.mu +++ b/501draw-text.mu @@ -138,6 +138,13 @@ fn draw-text-rightward-from-cursor screen: (addr screen), text: (addr array byte set-cursor-position screen, cursor-x, cursor-y } +fn draw-text-rightward-from-cursor-over-full-screen screen: (addr screen), text: (addr array byte), color: int, background-color: int { + var width/eax: int <- copy 0 + var height/ecx: int <- copy 0 + width, height <- screen-size screen + draw-text-rightward-from-cursor screen, text, width, color, background-color +} + fn render-grapheme screen: (addr screen), g: grapheme, xmin: int, ymin: int, xmax: int, ymax: int, x: int, y: int, color: int, background-color: int -> _/eax: int, _/ecx: int { compare g, 0xa/newline var x/eax: int <- copy x 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->= |