From 6e0ff0e5dceaa66e8883c336045713a74e845bb1 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 26 Sep 2020 23:40:47 -0700 Subject: 6880 We need the state of the stack at the call-site. But rendering is already working surprisingly well. --- apps/tile/environment.mu | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 76b59506..c343c106 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -237,14 +237,37 @@ fn render-line screen: (addr screen), defs: (addr handle function), bindings: (a compare *display-subsidiary-stack?, 0 # false break-if-= $render-line:subsidiary } + # does function exist? + var callee/edi: (addr function) <- copy 0 + { + var curr-stream-storage: (stream byte 0x10) + var curr-stream/esi: (addr stream byte) <- address curr-stream-storage + emit-word curr-word, curr-stream + var callee-h: (handle function) + var callee-ah/eax: (addr handle function) <- address callee-h + find-function defs, curr-stream, callee-ah + var _callee/eax: (addr function) <- lookup *callee-ah + callee <- copy _callee + compare callee, 0 + break-if-= $render-line:subsidiary + } move-cursor screen, top-row, curr-col print-word screen, curr-word var word-len/eax: int <- word-length curr-word curr-col <- add word-len curr-col <- add 2 add-to top-row, 1 - # HERE: construct new bindings -#? curr-col <- render-line screen, defs, callee-bindings, callee-body, top-row, curr-col, cursor-word, cursor-col-a + # construct new bindings + var callee-bindings-storage: table + var callee-bindings/esi: (addr table) <- address callee-bindings-storage + initialize-table callee-bindings, 0x10 + # HERE: obtain stack at call site +#? bind-args callee, callee-bindings + # obtain body + var callee-body-ah/eax: (addr handle line) <- get callee, body + var callee-body/eax: (addr line) <- lookup *callee-body-ah + # + curr-col <- render-line screen, defs, callee-bindings, callee-body, top-row, curr-col, cursor-word, cursor-col-a curr-col <- add 2 move-cursor screen, top-row, curr-col print-code-point screen, 0x21d7 # ⇗ -- cgit 1.4.1-2-gfad0