diff --git a/407print-int32-decimal-right-justified.mu b/407print-int32-decimal-right-justified.mu index 47725b96..5cb9e8d6 100644 --- a/407print-int32-decimal-right-justified.mu +++ b/407print-int32-decimal-right-justified.mu @@ -1,8 +1,8 @@ # print 'n' with enough leading spaces to be right-justified in 'width' fn print-int32-decimal-right-justified screen: (addr screen), n: int, _width: int { # tweak things for negative numbers - var n-width/ecx: int <- int-width-decimal n - var width/eax: int <- copy _width + var n-width/eax: int <- decimal-size n + var width/ecx: int <- copy _width { compare n-width, width break-if->= @@ -12,54 +12,3 @@ fn print-int32-decimal-right-justified screen: (addr screen), n: int, _width: in } print-int32-decimal screen, n } - -fn int-width-decimal n: int -> result/ecx: int { - result <- copy 1 - var curr/eax: int <- copy n - # account for '-' - compare curr, 0 - { - break-if->= - curr <- negate - result <- increment - } - # now we're dealing with a positive number - { - compare curr, 0xa - break-if-< - curr <- try-divide curr, 0xa - result <- increment - loop - } -} - -fn test-int-width-decimal { - var x/ecx: int <- int-width-decimal 0 - check-ints-equal x, 1, "F - test-int-width-decimal: 0" - x <- int-width-decimal 1 - check-ints-equal x, 1, "F - test-int-width-decimal: 1" - x <- int-width-decimal 4 - check-ints-equal x, 1, "F - test-int-width-decimal: 4" - x <- int-width-decimal 9 - check-ints-equal x, 1, "F - test-int-width-decimal: 9" - x <- int-width-decimal 0xa - check-ints-equal x, 2, "F - test-int-width-decimal: 10" - x <- int-width-decimal 0xb - check-ints-equal x, 2, "F - test-int-width-decimal: 11" - x <- int-width-decimal 0x4f # 79 - check-ints-equal x, 2, "F - test-int-width-decimal: 79" - x <- int-width-decimal 0x63 # 99 - check-ints-equal x, 2, "F - test-int-width-decimal: 100" - x <- int-width-decimal 0x64 # 100 - check-ints-equal x, 3, "F - test-int-width-decimal: 100" - x <- int-width-decimal 0x65 # 101 - check-ints-equal x, 3, "F - test-int-width-decimal: 101" - x <- int-width-decimal 0x3e7 # 999 - check-ints-equal x, 3, "F - test-int-width-decimal: 999" - x <- int-width-decimal 0x3e8 # 1000 - check-ints-equal x, 4, "F - test-int-width-decimal: 1000" - x <- int-width-decimal -1 - check-ints-equal x, 2, "F - test-int-width-decimal: -1" - x <- int-width-decimal -0xb # -11 - check-ints-equal x, 3, "F - test-int-width-decimal: -11" -} diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 339b6401..5ff176c2 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -764,8 +764,7 @@ 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/eax: int <- value-stack-max-width stack-addr - var max-width/esi: int <- copy _max-width + var max-width/esi: int <- copy 0 var i/eax: int <- value-stack-length stack-addr { compare i, 0 diff --git a/apps/tile/int-stack.mu b/apps/tile/int-stack.mu index 8e58f456..3bb9336f 100644 --- a/apps/tile/int-stack.mu +++ b/apps/tile/int-stack.mu @@ -67,26 +67,3 @@ fn int-stack-length _self: (addr int-stack) -> result/eax: int { var top-addr/eax: (addr int) <- get self, top result <- copy *top-addr } - -fn int-stack-max-width _self: (addr int-stack) -> result/eax: int { - var self/esi: (addr int-stack) <- copy _self - var data-ah/edi: (addr handle array int) <- get self, data - var _data/eax: (addr array int) <- lookup *data-ah - var data/edi: (addr array int) <- copy _data - var top-addr/ecx: (addr int) <- get self, top - var i/ebx: int <- copy 0 - result <- copy 0 - { - compare i, *top-addr - break-if->= - var g/edx: (addr int) <- index data, i - var w/ecx: int <- int-width-decimal *g - compare w, result - { - break-if-<= - result <- copy w - } - i <- increment - loop - } -} diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu index 126ed036..b7b794c6 100644 --- a/apps/tile/value-stack.mu +++ b/apps/tile/value-stack.mu @@ -86,28 +86,3 @@ 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 - result <- copy 0 - { - 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/ecx: int <- int-width-decimal *g2 - compare w, result - { - break-if-<= - result <- copy w - } - i <- increment - loop - } -}