diff options
-rw-r--r-- | 400.mu | 1 | ||||
-rw-r--r-- | apps/tile/environment.mu | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/400.mu b/400.mu index dbb16f2e..3e98822b 100644 --- a/400.mu +++ b/400.mu @@ -73,6 +73,7 @@ sig parse-decimal-int in: (addr array byte) -> result/eax: int sig parse-decimal-int-from-slice in: (addr slice) -> result/eax: int sig parse-decimal-int-from-stream in: (addr stream byte) -> result/eax: int #sig parse-decimal-int-helper start: (addr byte), end: (addr byte) -> result/eax: int +sig decimal-size n: int -> result/eax: int sig error-byte ed: (addr exit-descriptor), out: (addr buffered-file), msg: (addr array byte), n: byte #sig allocate ad: (addr allocation-descriptor), n: int, out: (addr handle _) #sig allocate-raw ad: (addr allocation-descriptor), n: int, out: (addr handle _) diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 929e4d6f..73162caf 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -135,13 +135,14 @@ fn render _env: (addr environment), max-depth: int { # - If final-word is same as cursor-word, do some additional computation to set # cursor-col-a. fn render-column screen: (addr screen), first-word: (addr word), final-word: (addr word), botleft-depth: int, botleft-col: int, cursor-word: (addr word), cursor-col-a: (addr int) -> right-col/ecx: int { + var max-width/ecx: int <- copy 0 # compute stack var stack: int-stack var stack-addr/edi: (addr int-stack) <- address stack initialize-int-stack stack-addr, 0x10 # max-words evaluate first-word, final-word, stack-addr # render stack - var curr-row/ecx: int <- copy botleft-depth + var curr-row/edx: int <- copy botleft-depth curr-row <- add 6 # input-row 3 + stack-margin-top 3 var i/eax: int <- int-stack-length stack-addr curr-row <- subtract i @@ -152,12 +153,15 @@ fn render-column screen: (addr screen), first-word: (addr word), final-word: (ad { var val/eax: int <- pop-int-stack stack-addr print-int32-decimal screen, val + var size/eax: int <- decimal-size val + compare size, max-width + break-if-<= + max-width <- copy size } curr-row <- increment i <- decrement loop } - right-col <- copy 8 # TODO: adaptive # render word, initialize result move-cursor screen, 3, botleft-col # input-row @@ -166,6 +170,7 @@ fn render-column screen: (addr screen), first-word: (addr word), final-word: (ad #? right-col <- copy len # post-process right-col + right-col <- copy max-width right-col <- add botleft-col right-col <- add 3 # margin-right } |