about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-12 15:16:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-12 15:16:50 -0700
commit70919b45f090e00d79b01928e311cfc77bac7f33 (patch)
treedc87ee8377f9afca3662f79b4399e744f5691598
parent4bd1785c86111b47b04ed28765fac972b8f3822a (diff)
downloadmu-70919b45f090e00d79b01928e311cfc77bac7f33.tar.gz
.
Rename cells containing screens to screen vars because of the ambiguity
that each grapheme in fake screens is represented by a type screen-cell.
While we're at it, we also analogously rename keyboard vars.
-rw-r--r--shell/cell.mu4
-rw-r--r--shell/environment.mu4
-rw-r--r--shell/evaluate.mu87
-rw-r--r--shell/global.mu16
-rw-r--r--shell/sandbox.mu24
5 files changed, 69 insertions, 66 deletions
diff --git a/shell/cell.mu b/shell/cell.mu
index ea14d7c0..a65402ce 100644
--- a/shell/cell.mu
+++ b/shell/cell.mu
@@ -161,7 +161,7 @@ fn new-fake-screen _out: (addr handle cell), width: int, height: int, pixel-grap
   initialize-screen dest-addr, width, height, pixel-graphics?
 }
 
-fn clear-screen-cell _self-ah: (addr handle cell) {
+fn clear-screen-var _self-ah: (addr handle cell) {
   var self-ah/eax: (addr handle cell) <- copy _self-ah
   var self/eax: (addr cell) <- lookup *self-ah
   compare self, 0
@@ -192,7 +192,7 @@ fn new-fake-keyboard _out: (addr handle cell), capacity: int {
   initialize-gap-buffer dest-addr, capacity
 }
 
-fn rewind-keyboard-cell _self-ah: (addr handle cell) {
+fn rewind-keyboard-var _self-ah: (addr handle cell) {
   var self-ah/eax: (addr handle cell) <- copy _self-ah
   var self/eax: (addr cell) <- lookup *self-ah
   compare self, 0
diff --git a/shell/environment.mu b/shell/environment.mu
index 06d9309c..516c545d 100644
--- a/shell/environment.mu
+++ b/shell/environment.mu
@@ -369,7 +369,7 @@ fn edit-environment _self: (addr environment), key: grapheme, data-disk: (addr d
   edit-sandbox sandbox, key, globals, data-disk
 }
 
-fn read-and-evaluate-and-save-gap-buffer-to-globals _in-ah: (addr handle gap-buffer), result-ah: (addr handle cell), globals: (addr global-table), definitions-created: (addr stream int), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {
+fn read-and-evaluate-and-save-gap-buffer-to-globals _in-ah: (addr handle gap-buffer), result-ah: (addr handle cell), globals: (addr global-table), definitions-created: (addr stream int), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell) {
   var in-ah/eax: (addr handle gap-buffer) <- copy _in-ah
   var in/eax: (addr gap-buffer) <- lookup *in-ah
   var read-result-h: (handle cell)
@@ -394,7 +394,7 @@ fn read-and-evaluate-and-save-gap-buffer-to-globals _in-ah: (addr handle gap-buf
 #?   set-cursor-position 0/screen, 0 0
 #?   turn-on-debug-print
   debug-print "^", 4/fg, 0/bg
-  evaluate read-result-ah, result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, definitions-created, 1/call-number
+  evaluate read-result-ah, result-ah, *nil-ah, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, 1/call-number
   debug-print "$", 4/fg, 0/bg
   var error?/eax: boolean <- has-errors? trace
   {
diff --git a/shell/evaluate.mu b/shell/evaluate.mu
index 78266a23..70cd544d 100644
--- a/shell/evaluate.mu
+++ b/shell/evaluate.mu
@@ -2,10 +2,13 @@
 # we never modify `_in-ah` or `env`
 # ignore args past 'trace' on a first reading; they're for the environment not the language
 # 'call-number' is just for showing intermediate progress; this is a _slow_ interpreter
-# side-effects if not in a test (screen-cell != 0):
-#   prints intermediate states of the screen to real screen
+# side-effects if not in a test (inner-screen-var != 0):
+#   prints intermediate states of the inner screen to outer screen
+#     (which may not be the real screen if we're using double-buffering)
 #   stops if a keypress is encountered
-fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell), definitions-created: (addr stream int), call-number: int {
+# Inner screen is what Lisp programs modify. Outer screen is shows the program
+# and its inner screen to the environment.
+fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell), definitions-created: (addr stream int), call-number: int {
   # stack overflow?   # disable when enabling Really-debug-print
   check-stack
   {
@@ -17,17 +20,17 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
   # show intermediate progress on screen if necessary
   # treat input at the real keyboard as interrupting
   {
-    compare screen-cell, 0
+    compare inner-screen-var, 0
     break-if-=
     var tmp/eax: int <- copy call-number
     tmp <- and 0xf  # every 16 calls to evaluate
     compare tmp, 0
     break-if-!=
-    var screen-cell/eax: (addr handle cell) <- copy screen-cell
-    var screen-cell-addr/eax: (addr cell) <- lookup *screen-cell
-    compare screen-cell-addr, 0
+    var inner-screen-var/eax: (addr handle cell) <- copy inner-screen-var
+    var inner-screen-var-addr/eax: (addr cell) <- lookup *inner-screen-var
+    compare inner-screen-var-addr, 0
     break-if-=
-    var screen-obj-ah/eax: (addr handle screen) <- get screen-cell-addr, screen-data
+    var screen-obj-ah/eax: (addr handle screen) <- get inner-screen-var-addr, screen-data
     var screen-obj/eax: (addr screen) <- lookup *screen-obj-ah
     compare screen-obj, 0
     break-if-=
@@ -106,7 +109,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     break-if-!=
     trace-text trace, "eval", "symbol"
     debug-print "a", 7/fg, 0/bg
-    lookup-symbol in, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell
+    lookup-symbol in, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var
     debug-print "z", 7/fg, 0/bg
     trace-higher trace
     return
@@ -208,7 +211,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     #
     trace-text trace, "eval", "backquote"
     debug-print "`(", 7/fg, 0/bg
-    evaluate-backquote rest-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate-backquote rest-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print ")", 7/fg, 0/bg
     trace-higher trace
     return
@@ -242,7 +245,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var second-arg-ah/edx: (addr handle cell) <- get rest, left
     debug-print "P", 4/fg, 0/bg
     increment call-number
-    evaluate second-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate second-arg-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "Q", 4/fg, 0/bg
     # errors? skip
     {
@@ -302,7 +305,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var second-arg-ah/edx: (addr handle cell) <- get rest, left
     debug-print "P", 4/fg, 0/bg
     increment call-number
-    evaluate second-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate second-arg-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "Q", 4/fg, 0/bg
     # errors? skip
     {
@@ -336,7 +339,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var first-arg-ah/ecx: (addr handle cell) <- get rest, left
     debug-print "R2", 4/fg, 0/bg
     increment call-number
-    evaluate first-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate first-arg-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "S2", 4/fg, 0/bg
     # errors? skip
     {
@@ -362,7 +365,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var second-ah/eax: (addr handle cell) <- get rest, left
     debug-print "T2", 4/fg, 0/bg
     increment call-number
-    evaluate second-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate second-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "U2", 4/fg, 0/bg
     trace-higher trace
     return
@@ -383,7 +386,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var first-arg-ah/ecx: (addr handle cell) <- get rest, left
     debug-print "R2", 4/fg, 0/bg
     increment call-number
-    evaluate first-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate first-arg-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "S2", 4/fg, 0/bg
     # errors? skip
     {
@@ -409,7 +412,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var second-ah/eax: (addr handle cell) <- get rest, left
     debug-print "T2", 4/fg, 0/bg
     increment call-number
-    evaluate second-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate second-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "U2", 4/fg, 0/bg
     # errors? skip
     {
@@ -441,7 +444,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var guard-ah/esi: (addr handle cell) <- address guard-h
     debug-print "R", 4/fg, 0/bg
     increment call-number
-    evaluate first-arg-ah, guard-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate first-arg-ah, guard-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "S", 4/fg, 0/bg
     # errors? skip
     {
@@ -467,7 +470,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     }
     debug-print "T", 4/fg, 0/bg
     increment call-number
-    evaluate branch-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate branch-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "U", 4/fg, 0/bg
     trace-higher trace
     return
@@ -503,7 +506,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
       trace-text trace, "eval", "loop termination check"
       debug-print "V", 4/fg, 0/bg
       increment call-number
-      evaluate first-arg-ah, guard-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+      evaluate first-arg-ah, guard-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
       debug-print "W", 4/fg, 0/bg
       # errors? skip
       {
@@ -517,7 +520,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
       var done?/eax: boolean <- nil? guard-a
       compare done?, 0/false
       break-if-!=
-      evaluate-exprs rest-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+      evaluate-exprs rest-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
       # errors? skip
       {
         var error?/eax: boolean <- has-errors? trace
@@ -563,7 +566,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var left-ah/esi: (addr handle cell) <- get curr, left
     debug-print "A", 4/fg, 0/bg
     increment call-number
-    evaluate left-ah, left-out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate left-ah, left-out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "B", 4/fg, 0/bg
     # errors? skip
     {
@@ -586,7 +589,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
   var function-ah/ecx: (addr handle cell) <- get evaluated-list, left
   var args-ah/edx: (addr handle cell) <- get evaluated-list, right
   debug-print "C", 4/fg, 0/bg
-  apply function-ah, args-ah, _out-ah, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+  apply function-ah, args-ah, _out-ah, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
   debug-print "Y", 4/fg, 0/bg
   trace-higher trace
   # trace "=> " _out-ah {{{
@@ -607,7 +610,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
   debug-print "Z", 4/fg, 0/bg
 }
 
-fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell), definitions-created: (addr stream int), call-number: int {
+fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr handle cell), globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell), definitions-created: (addr stream int), call-number: int {
   var f-ah/eax: (addr handle cell) <- copy _f-ah
   var _f/eax: (addr cell) <- lookup *f-ah
   var f/esi: (addr cell) <- copy _f
@@ -657,7 +660,7 @@ fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr hand
     var params-ah/ecx: (addr handle cell) <- get rest, left
     var body-ah/eax: (addr handle cell) <- get rest, right
     debug-print "D", 7/fg, 0/bg
-    apply-function params-ah, args-ah, body-ah, out, *callee-env-ah, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    apply-function params-ah, args-ah, body-ah, out, *callee-env-ah, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print "Y", 7/fg, 0/bg
     trace-higher trace
     return
@@ -665,7 +668,7 @@ fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr hand
   error trace, "unknown function"
 }
 
-fn apply-function params-ah: (addr handle cell), args-ah: (addr handle cell), body-ah: (addr handle cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell), definitions-created: (addr stream int), call-number: int {
+fn apply-function params-ah: (addr handle cell), args-ah: (addr handle cell), body-ah: (addr handle cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell), definitions-created: (addr stream int), call-number: int {
   # push bindings for params to env
   var new-env-h: (handle cell)
   var new-env-ah/esi: (addr handle cell) <- address new-env-h
@@ -678,10 +681,10 @@ fn apply-function params-ah: (addr handle cell), args-ah: (addr handle cell), bo
     return
   }
   #
-  evaluate-exprs body-ah, out, new-env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+  evaluate-exprs body-ah, out, new-env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
 }
 
-fn evaluate-exprs _exprs-ah: (addr handle cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell), definitions-created: (addr stream int), call-number: int {
+fn evaluate-exprs _exprs-ah: (addr handle cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell), definitions-created: (addr stream int), call-number: int {
   # eval all exprs, writing result to `out` each time
   var exprs-ah/ecx: (addr handle cell) <- copy _exprs-ah
   $evaluate-exprs:loop: {
@@ -697,7 +700,7 @@ fn evaluate-exprs _exprs-ah: (addr handle cell), out: (addr handle cell), env-h:
       var curr-ah/eax: (addr handle cell) <- get exprs, left
       debug-print "E", 7/fg, 0/bg
       increment call-number
-      evaluate curr-ah, out, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+      evaluate curr-ah, out, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
       debug-print "X", 7/fg, 0/bg
       # errors? skip
       {
@@ -821,7 +824,7 @@ fn push-bindings _params-ah: (addr handle cell), _args-ah: (addr handle cell), o
   trace-higher trace
 }
 
-fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {
+fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell) {
   # trace sym
   {
     var should-trace?/eax: boolean <- should-trace? trace
@@ -861,7 +864,7 @@ fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell)
     compare env-nil?, 0/false
     break-if-=
     debug-print "b", 7/fg, 0/bg
-    lookup-symbol-in-globals sym, out, globals, trace, screen-cell, keyboard-cell
+    lookup-symbol-in-globals sym, out, globals, trace, inner-screen-var, inner-keyboard-var
     debug-print "x", 7/fg, 0/bg
     trace-higher trace
     # trace "=> " out " (global)" {{{
@@ -947,7 +950,7 @@ fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell)
   var env-tail-storage: (handle cell)
   var env-tail-ah/eax: (addr handle cell) <- address env-tail-storage
   cdr env, env-tail-ah, trace
-  lookup-symbol sym, out, *env-tail-ah, globals, trace, screen-cell, keyboard-cell
+  lookup-symbol sym, out, *env-tail-ah, globals, trace, inner-screen-var, inner-keyboard-var
   trace-higher trace
   # trace "=> " out " (recurse)" {{{
   {
@@ -1592,18 +1595,18 @@ fn test-evaluate-backquote {
   check sym?, "F - test-evaluate-backquote/1"
 }
 
-fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell), definitions-created: (addr stream int), call-number: int {
+fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell), definitions-created: (addr stream int), call-number: int {
   # stack overflow?   # disable when enabling Really-debug-print
 #?   dump-cell-from-cursor-over-full-screen _in-ah
   check-stack
   {
-    var screen-cell/eax: (addr handle cell) <- copy screen-cell
-    compare screen-cell, 0
+    var inner-screen-var/eax: (addr handle cell) <- copy inner-screen-var
+    compare inner-screen-var, 0
     break-if-=
-    var screen-cell-addr/eax: (addr cell) <- lookup *screen-cell
-    compare screen-cell-addr, 0
+    var inner-screen-var-addr/eax: (addr cell) <- lookup *inner-screen-var
+    compare inner-screen-var-addr, 0
     break-if-=
-    # if screen-cell exists, we're probably not in a test
+    # if inner-screen-var exists, we're probably not in a test
     show-stack-state
   }
   # errors? skip
@@ -1654,7 +1657,7 @@ fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), e
     var rest-ah/eax: (addr handle cell) <- get in, right
     increment call-number
     debug-print ",", 3/fg, 0/bg
-    evaluate rest-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate rest-ah, _out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     debug-print ",)", 3/fg, 0/bg
     trace-higher trace
     return
@@ -1690,7 +1693,7 @@ fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), e
     trace-text trace, "eval", "unquote-splice"
     var in-unquote-payload-ah/eax: (addr handle cell) <- get in-left, right
     increment call-number
-    evaluate in-unquote-payload-ah, out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate in-unquote-payload-ah, out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     # errors? skip
     {
       var error?/eax: boolean <- has-errors? trace
@@ -1712,7 +1715,7 @@ fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), e
     }
     # append result of in-right
     var in-right-ah/ecx: (addr handle cell) <- get in, right
-    evaluate-backquote in-right-ah, out-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+    evaluate-backquote in-right-ah, out-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
     trace-higher trace
     return
   }
@@ -1726,7 +1729,7 @@ fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), e
   var out/eax: (addr cell) <- lookup *out-ah
   var out-left-ah/edx: (addr handle cell) <- get out, left
   debug-print "`(l", 3/fg, 0/bg
-  evaluate-backquote in-left-ah, out-left-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+  evaluate-backquote in-left-ah, out-left-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
   debug-print "`r)", 3/fg, 0/bg
   # errors? skip
   {
@@ -1739,7 +1742,7 @@ fn evaluate-backquote _in-ah: (addr handle cell), _out-ah: (addr handle cell), e
   var in-right-ah/ecx: (addr handle cell) <- get in, right
   var out-right-ah/edx: (addr handle cell) <- get out, right
   debug-print "`r(", 3/fg, 0/bg
-  evaluate-backquote in-right-ah, out-right-ah, env-h, globals, trace, screen-cell, keyboard-cell, definitions-created, call-number
+  evaluate-backquote in-right-ah, out-right-ah, env-h, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number
   debug-print "`r)", 3/fg, 0/bg
   trace-higher trace
 }
diff --git a/shell/global.mu b/shell/global.mu
index 6a6e89a6..8c44537b 100644
--- a/shell/global.mu
+++ b/shell/global.mu
@@ -326,7 +326,7 @@ fn assign-or-create-global _self: (addr global-table), name: (addr array byte),
   initialize-trace trace, 1/only-errors, 0x10/capacity, 0/visible
 }
 
-fn lookup-symbol-in-globals _sym: (addr cell), out: (addr handle cell), _globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {
+fn lookup-symbol-in-globals _sym: (addr cell), out: (addr handle cell), _globals: (addr global-table), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell) {
   var sym/eax: (addr cell) <- copy _sym
   var sym-name-ah/eax: (addr handle stream byte) <- get sym, text-data
   var _sym-name/eax: (addr stream byte) <- lookup *sym-name-ah
@@ -346,24 +346,24 @@ fn lookup-symbol-in-globals _sym: (addr cell), out: (addr handle cell), _globals
     copy-object curr-value, out
     return
   }
-  # if sym is "screen" and screen-cell exists, return it
+  # if sym is "screen" and inner-screen-var exists, return it
   {
     var sym-is-screen?/eax: boolean <- stream-data-equal? sym-name, "screen"
     compare sym-is-screen?, 0/false
     break-if-=
-    compare screen-cell, 0
+    compare inner-screen-var, 0
     break-if-=
-    copy-object screen-cell, out
+    copy-object inner-screen-var, out
     return
   }
-  # if sym is "keyboard" and keyboard-cell exists, return it
+  # if sym is "keyboard" and inner-keyboard-var exists, return it
   {
     var sym-is-keyboard?/eax: boolean <- stream-data-equal? sym-name, "keyboard"
     compare sym-is-keyboard?, 0/false
     break-if-=
-    compare keyboard-cell, 0
+    compare inner-keyboard-var, 0
     break-if-=
-    copy-object keyboard-cell, out
+    copy-object inner-keyboard-var, out
     return
   }
   # otherwise error "unbound symbol: ", sym
@@ -547,7 +547,7 @@ fn load-lexical-scope in-ah: (addr handle gap-buffer), _globals: (addr global-ta
   initialize-trace trace, 1/only-errors, 0x10/capacity, 0/visible
   var dummy-result-h: (handle cell)
   var dummy-result-ah/ecx: (addr handle cell) <- address dummy-result-h
-  read-and-evaluate-and-save-gap-buffer-to-globals in-ah, dummy-result-ah, globals, definitions-created, trace, 0/no-screen-cell, 0/no-keyboard-cell
+  read-and-evaluate-and-save-gap-buffer-to-globals in-ah, dummy-result-ah, globals, definitions-created, trace, 0/no-inner-screen-var, 0/no-inner-keyboard-var
   #
   # save trace to all needed globals as well
   rewind-stream definitions-created
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index 35337292..1b6cd61e 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -567,20 +567,20 @@ fn edit-sandbox _self: (addr sandbox), key: grapheme, globals: (addr global-tabl
     var cursor-in-keyboard?/eax: (addr boolean) <- get self, cursor-in-keyboard?
     compare *cursor-in-keyboard?, 0/false
     break-if-=
-    var keyboard-cell-ah/eax: (addr handle cell) <- get self, keyboard-var
-    var keyboard-cell/eax: (addr cell) <- lookup *keyboard-cell-ah
-    compare keyboard-cell, 0
+    var inner-keyboard-var-ah/eax: (addr handle cell) <- get self, keyboard-var
+    var inner-keyboard-var/eax: (addr cell) <- lookup *inner-keyboard-var-ah
+    compare inner-keyboard-var, 0
     {
       break-if-!=
       return
     }
-    var keyboard-cell-type/ecx: (addr int) <- get keyboard-cell, type
-    compare *keyboard-cell-type, 6/keyboard
+    var inner-keyboard-var-type/ecx: (addr int) <- get inner-keyboard-var, type
+    compare *inner-keyboard-var-type, 6/keyboard
     {
       break-if-=
       return
     }
-    var keyboard-ah/eax: (addr handle gap-buffer) <- get keyboard-cell, keyboard-data
+    var keyboard-ah/eax: (addr handle gap-buffer) <- get inner-keyboard-var, keyboard-data
     var keyboard/eax: (addr gap-buffer) <- lookup *keyboard-ah
     edit-gap-buffer keyboard, key
     return
@@ -632,13 +632,13 @@ fn run-sandbox _self: (addr sandbox), globals: (addr global-table) {
   var trace/ebx: (addr trace) <- copy _trace
   clear-trace trace
   var tmp/eax: (addr handle cell) <- get self, screen-var
-  var screen-cell: (addr handle cell)
-  copy-to screen-cell, tmp
-  clear-screen-cell screen-cell
-  var keyboard-cell/eax: (addr handle cell) <- get self, keyboard-var
-  rewind-keyboard-cell keyboard-cell  # don't clear keys from before
+  var inner-screen-var: (addr handle cell)
+  copy-to inner-screen-var, tmp
+  clear-screen-var inner-screen-var
+  var inner-keyboard-var/eax: (addr handle cell) <- get self, keyboard-var
+  rewind-keyboard-var inner-keyboard-var  # don't clear keys from before
   #
-  read-and-evaluate-and-save-gap-buffer-to-globals data-ah, eval-result-ah, globals, definitions-created, trace, screen-cell, keyboard-cell
+  read-and-evaluate-and-save-gap-buffer-to-globals data-ah, eval-result-ah, globals, definitions-created, trace, inner-screen-var, inner-keyboard-var
   # if necessary, initialize a new gap-buffer for sandbox
   {
     compare globals, 0