diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-09-19 16:48:16 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-09-19 16:49:17 -0700 |
commit | abfd0bad29b2a481583207d17f7bd1ebe2ffc2f5 (patch) | |
tree | a231b5c8c1cb938a5fd1ac047436d1ea086c2ec8 /apps | |
parent | a83cde9663a639593334ef8220db4428e7a047c7 (diff) | |
download | mu-abfd0bad29b2a481583207d17f7bd1ebe2ffc2f5.tar.gz |
6803 - RPN: typing a single word now works
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tile/environment.mu | 26 | ||||
-rw-r--r-- | apps/tile/rpn.mu | 13 |
2 files changed, 9 insertions, 30 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 7814676a..6b31c22a 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -35,10 +35,7 @@ fn render-loop _self: (addr environment) { break-if-= process self, key var max-depth/eax: int <- compute-max-depth self - print-string-to-real-screen "ZZ: " - print-int32-decimal-to-real-screen max-depth - print-string-to-real-screen "\n" -#? render self, max-depth + render self, max-depth loop } } @@ -115,7 +112,6 @@ fn render _env: (addr environment), max-depth: int { compare curr-word, 0 break-if-= move-cursor screen, 3, curr-col - print-word screen, curr-word curr-col <- render-stack screen, first-word, curr-word, max-depth, curr-col, cursor-word, cursor-col-a var next-word-ah/edx: (addr handle word) <- get curr-word, next curr-word <- lookup *next-word-ah @@ -142,20 +138,8 @@ fn compute-max-depth _env: (addr environment) -> result/eax: int { # cursor-word var cursor-word-ah/esi: (addr handle word) <- get env, cursor-word var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - { - var foo/eax: int <- copy cursor-word - print-string-to-real-screen "cursor-word: " - print-int32-hex-to-real-screen foo - print-string-to-real-screen "\n" - } # curr-word var curr-word/eax: (addr word) <- first-word cursor-word - { - var foo/eax: int <- copy curr-word - print-string-to-real-screen "curr-word: " - print-int32-hex-to-real-screen foo - print-string-to-real-screen "\n" - } # first-word var first-word: (addr word) copy-to first-word, curr-word @@ -164,12 +148,6 @@ fn compute-max-depth _env: (addr environment) -> result/eax: int { { compare curr-word, 0 break-if-= - { - var a/eax: int <- copy first-word - print-string-to-real-screen "outside max-stack-depth: " - print-int32-hex-to-real-screen a - print-string-to-real-screen "\n" - } var curr-max-depth/edi: int <- max-stack-depth first-word, curr-word compare curr-max-depth, out { @@ -180,7 +158,5 @@ fn compute-max-depth _env: (addr environment) -> result/eax: int { curr-word <- lookup *next-word-ah loop } - print-int32-decimal-to-real-screen out - print-string-to-real-screen "\n" result <- copy out } diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu index a70d9fd5..696912fd 100644 --- a/apps/tile/rpn.mu +++ b/apps/tile/rpn.mu @@ -51,11 +51,7 @@ fn simplify in: (addr stream byte), out: (addr int-stack) { # Copy of 'simplify' that just tracks the maximum stack depth needed # Doesn't actually need to simulate the stack, since every word has a predictable effect. fn max-stack-depth first-word: (addr word), final-word: (addr word) -> result/edi: int { - var a/eax: int <- copy first-word - print-string-to-real-screen "inside max-stack-depth: " - print-int32-hex-to-real-screen a - print-string-to-real-screen "\n" - var curr-word/esi: (addr word) <- copy first-word + var curr-word/eax: (addr word) <- copy first-word var curr-depth/ecx: int <- copy 0 result <- copy 0 $max-stack-depth:word-loop: { @@ -89,6 +85,13 @@ fn max-stack-depth first-word: (addr word), final-word: (addr word) -> result/ed break-if-<= result <- copy curr-depth } + # if curr-word == final-word break + compare curr-word, final-word + break-if-= + # curr-word = curr-word->next + var next-word-ah/edx: (addr handle word) <- get curr-word, next + curr-word <- lookup *next-word-ah + # loop } } |