diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-10 02:08:46 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-10 02:08:46 -0700 |
commit | 831a133a4b15dfaf81318b848b0cabb7c7c91e98 (patch) | |
tree | 774c9663bd6099d917199b02828791d8ab55bd04 /apps | |
parent | dae19c9fe6b3c904610469506fb6c5029248fce8 (diff) | |
download | mu-831a133a4b15dfaf81318b848b0cabb7c7c91e98.tar.gz |
6990
Bring back definitions for 1+ and 2+. Expanding nested calls still doesn't work.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tile/data.mu | 136 |
1 files changed, 82 insertions, 54 deletions
diff --git a/apps/tile/data.mu b/apps/tile/data.mu index bab6215a..726a612a 100644 --- a/apps/tile/data.mu +++ b/apps/tile/data.mu @@ -132,60 +132,88 @@ fn create-primitive-functions _self: (addr handle function) { prev-word-ah <- get tmp, prev copy-object curr-word-ah, prev-word-ah tmp <- lookup *prev-word-ah -#? # 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 -#? 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, "+" -#? # 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 -#? 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+" + # 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 + var curr-word-ah/ecx: (addr handle word) <- get body, data + # *curr-word = "x" + allocate curr-word-ah + var tmp/eax: (addr word) <- lookup *curr-word-ah + curr-word <- copy tmp + initialize-word-with curr-word, "x" + # *curr-word->next = "1" + next-word-ah <- get curr-word, next + allocate next-word-ah + tmp <- lookup *next-word-ah + initialize-word-with tmp, "1" + # *curr-word->next->prev = curr-word + prev-word-ah <- get tmp, prev + copy-object curr-word-ah, prev-word-ah + # curr-word = curr-word->next + curr-word-ah <- copy next-word-ah + curr-word <- copy tmp + # *curr-word->next = "+" + next-word-ah <- get curr-word, next + allocate next-word-ah + tmp <- lookup *next-word-ah + initialize-word-with tmp, "+" + # *curr-word->next->prev = curr-word + prev-word-ah <- get tmp, prev + copy-object curr-word-ah, prev-word-ah + tmp <- lookup *prev-word-ah + # 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 + var curr-word-ah/ecx: (addr handle word) <- get body, data + # *curr-word = "x" + allocate curr-word-ah + var tmp/eax: (addr word) <- lookup *curr-word-ah + curr-word <- copy tmp + initialize-word-with curr-word, "x" + # *curr-word->next = "1+" + next-word-ah <- get curr-word, next + allocate next-word-ah + tmp <- lookup *next-word-ah + initialize-word-with tmp, "1+" + # *curr-word->next->prev = curr-word + prev-word-ah <- get tmp, prev + copy-object curr-word-ah, prev-word-ah + # curr-word = curr-word->next + curr-word-ah <- copy next-word-ah + curr-word <- copy tmp + # *curr-word->next = "1+" + next-word-ah <- get curr-word, next + allocate next-word-ah + tmp <- lookup *next-word-ah + initialize-word-with tmp, "1+" + # *curr-word->next->prev = curr-word + prev-word-ah <- get tmp, prev + copy-object curr-word-ah, prev-word-ah + tmp <- lookup *prev-word-ah } fn function-body functions: (addr handle function), _word: (addr handle word), out: (addr handle line) { |