about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--apps/tile/environment.mu1
-rw-r--r--apps/tile/table.mu11
2 files changed, 7 insertions, 5 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 17224883..e2eaa13c 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -1431,6 +1431,7 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi
     var stack: value-stack
     var stack-addr/edi: (addr value-stack) <- address stack
     initialize-value-stack stack-addr, 0x10  # max-words
+    initialize-table bindings, 0x10
     evaluate functions, bindings, first-line, final-word, stack-addr
     # render stack
     var curr-row/edx: int <- copy top-row
diff --git a/apps/tile/table.mu b/apps/tile/table.mu
index fba6918e..a4a2bae6 100644
--- a/apps/tile/table.mu
+++ b/apps/tile/table.mu
@@ -65,18 +65,18 @@ fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle
   var data-ah/esi: (addr handle array bind) <- get self, data
   var _data/eax: (addr array bind) <- lookup *data-ah
   var data/esi: (addr array bind) <- copy _data
-  var i/edx: int <- length data
+  var len/edx: int <- length data
+  var i/ebx: int <- copy 0
   $lookup-binding:loop: {
-    i <- decrement
-    compare i, 0
-    break-if-<
+    compare i, len
+    break-if->=
     {
       var offset/edx: (offset bind) <- compute-offset data, i
       var target-bind/esi: (addr bind) <- index data, offset
       var target2/edx: (addr handle array byte) <- get target-bind, key
       var target3/eax: (addr array byte) <- lookup *target2
       compare target3, 0
-      break-if-=
+      break-if-= $lookup-binding:loop
       var is-match?/eax: boolean <- string-equal? target3, key
       compare is-match?, 0  # false
       break-if-=
@@ -85,6 +85,7 @@ fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle
       copy-object target, out
       break $lookup-binding:loop
     }
+    i <- increment
     loop
   }
 }