From f3ca0e3cb33d6c34dbe4c6941598d16d140be206 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 1 Oct 2020 20:39:56 -0700 Subject: 6922 --- apps/tile/data.mu | 56 +++++++++++++++++++++++++++++++++++++++++++++++- apps/tile/environment.mu | 6 +++++- 2 files changed, 60 insertions(+), 2 deletions(-) (limited to 'apps') 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 { -- cgit 1.4.1-2-gfad0