diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-01 20:39:56 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-01 20:39:56 -0700 |
commit | f3ca0e3cb33d6c34dbe4c6941598d16d140be206 (patch) | |
tree | 7ca17d79081e30a97e46f6692fab5f4d97b10864 | |
parent | c79b93ca6cfdbc883bae66662eeea52c8d674760 (diff) | |
download | mu-f3ca0e3cb33d6c34dbe4c6941598d16d140be206.tar.gz |
6922
-rw-r--r-- | apps/tile/data.mu | 56 | ||||
-rw-r--r-- | apps/tile/environment.mu | 6 |
2 files changed, 60 insertions, 2 deletions
diff --git a/apps/tile/data.mu b/apps/tile/data.mu index d66e0495..48966968 100644 --- a/apps/tile/data.mu +++ b/apps/tile/data.mu @@ -113,15 +113,69 @@ fn create-primitive-defs _self: (addr handle function) { var curr-word-ah/ecx: (addr handle word) <- get body, data allocate curr-word-ah var curr-word/eax: (addr word) <- lookup *curr-word-ah + initialize-word-with curr-word, "x" + curr-word-ah <- get curr-word, next + allocate curr-word-ah + curr-word <- lookup *curr-word-ah initialize-word-with curr-word, "2" curr-word-ah <- get curr-word, next allocate curr-word-ah curr-word <- lookup *curr-word-ah + initialize-word-with curr-word, "*" + # x 1+ = x 1 + + var next/esi: (addr handle function) <- get f, next + allocate next + var _f/eax: (addr function) <- lookup *next + var f/esi: (addr function) <- copy _f + var name-ah/eax: (addr handle array byte) <- get f, name + populate-text-with name-ah, "1+" + var args-ah/eax: (addr handle word) <- get f, args + allocate args-ah + var args/eax: (addr word) <- lookup *args-ah + initialize-word-with args, "x" + var body-ah/eax: (addr handle line) <- get f, body + allocate body-ah + var body/eax: (addr line) <- lookup *body-ah + initialize-line body, 0 + var curr-word-ah/ecx: (addr handle word) <- get body, data + allocate curr-word-ah + var curr-word/eax: (addr word) <- lookup *curr-word-ah initialize-word-with curr-word, "x" curr-word-ah <- get curr-word, next allocate curr-word-ah curr-word <- lookup *curr-word-ah - initialize-word-with curr-word, "*" + initialize-word-with curr-word, "1" + curr-word-ah <- get curr-word, next + allocate curr-word-ah + curr-word <- lookup *curr-word-ah + initialize-word-with curr-word, "+" + # x 2+ = x 1+ 1+ + var next/esi: (addr handle function) <- get f, next + allocate next + var _f/eax: (addr function) <- lookup *next + var f/ecx: (addr function) <- copy _f + var name-ah/eax: (addr handle array byte) <- get f, name + populate-text-with name-ah, "2+" + var args-ah/eax: (addr handle word) <- get f, args + allocate args-ah + var args/eax: (addr word) <- lookup *args-ah + initialize-word-with args, "x" + var body-ah/eax: (addr handle line) <- get f, body + allocate body-ah + var body/eax: (addr line) <- lookup *body-ah + initialize-line body, 0 + var curr-word-ah/ecx: (addr handle word) <- get body, data + allocate curr-word-ah + var curr-word/eax: (addr word) <- lookup *curr-word-ah + initialize-word-with curr-word, "x" + curr-word-ah <- get curr-word, next + allocate curr-word-ah + curr-word <- lookup *curr-word-ah + initialize-word-with curr-word, "1+" + curr-word-ah <- get curr-word, next + allocate curr-word-ah + curr-word <- lookup *curr-word-ah + initialize-word-with curr-word, "1+" # TODO: populate prev pointers } diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index eaeff4a9..2fa81894 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -408,7 +408,11 @@ fn clear-canvas _env: (addr environment) { var repl-col/ecx: int <- copy *_repl-col draw-vertical-line screen, 1, *nrows, repl-col move-cursor screen, 3, 2 - print-string screen, "x 2* = 2 x *" + print-string screen, "x 2* = x 2 *" + move-cursor screen, 4, 2 + print-string screen, "x 1+ = x 1 +" + move-cursor screen, 5, 2 + print-string screen, "x 2+ = x 1+ 1+" } fn real-grapheme? g: grapheme -> result/eax: boolean { |