diff options
-rw-r--r-- | apps/tile/environment.mu | 7 | ||||
-rw-r--r-- | apps/tile/value-stack.mu | 26 |
2 files changed, 28 insertions, 5 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 5ff176c2..6e865c38 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -764,7 +764,8 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi # render stack var curr-row/edx: int <- copy top-row curr-row <- add 3 # stack-margin-top - var max-width/esi: int <- copy 0 + var _max-width/eax: int <- value-stack-max-width stack-addr + var max-width/esi: int <- copy _max-width var i/eax: int <- value-stack-length stack-addr { compare i, 0 @@ -776,10 +777,6 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi { var val/eax: int <- pop-int-from-value-stack stack-addr render-integer screen, val, max-width - var size/eax: int <- decimal-size val - compare size, max-width - break-if-<= - max-width <- copy size } curr-row <- increment i <- decrement diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu index b7b794c6..8e921eca 100644 --- a/apps/tile/value-stack.mu +++ b/apps/tile/value-stack.mu @@ -86,3 +86,29 @@ fn value-stack-length _self: (addr value-stack) -> result/eax: int { var top-addr/eax: (addr int) <- get self, top result <- copy *top-addr } + +fn value-stack-max-width _self: (addr value-stack) -> result/eax: int { + var self/esi: (addr value-stack) <- copy _self + var data-ah/edi: (addr handle array value) <- get self, data + var _data/eax: (addr array value) <- lookup *data-ah + var data/edi: (addr array value) <- copy _data + var top-addr/ecx: (addr int) <- get self, top + var i/ebx: int <- copy 0 + var out: int + { + compare i, *top-addr + break-if->= + var o/edx: (offset value) <- compute-offset data, i + var g/edx: (addr value) <- index data, o + var g2/edx: (addr int) <- get g, scalar-data + var w/eax: int <- decimal-size *g2 + compare w, out + { + break-if-<= + copy-to out, w + } + i <- increment + loop + } + result <- copy out +} |