about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-12 10:46:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-12 10:46:28 -0700
commit4bd1785c86111b47b04ed28765fac972b8f3822a (patch)
treeb8004ed23ef5193c28b7471af46ede7a76732b27
parent662e6b717743a641d3b33139094e172d6dab0d44 (diff)
downloadmu-4bd1785c86111b47b04ed28765fac972b8f3822a.tar.gz
shell: larger fake screen
-rw-r--r--shell/environment.mu62
-rw-r--r--shell/evaluate.mu2
-rw-r--r--shell/main.mu2
-rw-r--r--shell/sandbox.mu12
4 files changed, 41 insertions, 37 deletions
diff --git a/shell/environment.mu b/shell/environment.mu
index 01b2b4a3..06d9309c 100644
--- a/shell/environment.mu
+++ b/shell/environment.mu
@@ -20,7 +20,7 @@ type environment {
 fn test-environment {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -34,18 +34,16 @@ fn test-environment {
   # top row blank for now
   check-screen-row                     screen,         0/y, "                                                                                                                                ", "F - test-environment/0"
   check-screen-row                     screen,         1/y, "                                                                                      screen:                                   ", "F - test-environment/1"
-  # starting at the same screen row, render the fake screen that exists within the sandbox within env
-  check-background-color-in-screen-row screen, 0/bg,   1/y, "                                                                                                ........                        ", "F - test-environment/1-2"
-  check-background-color-in-screen-row screen, 0/bg,   2/y, "                                                                                                ........                        ", "F - test-environment/2"
-  check-background-color-in-screen-row screen, 0/bg,   3/y, "                                                                                                ........                        ", "F - test-environment/3"
-  check-screen-row                     screen,         4/y, "                                                                                                                                ", "F - test-environment/4"
-  check-screen-row                     screen,         5/y, "                                                                                      keyboard:                                 ", "F - test-environment/5"
-  check-background-color-in-screen-row screen, 0/bg,   5/y, "                                                                                                ................                ", "F - test-environment/5-2"
-  check-screen-row                     screen,         6/y, "                                                                                                                                ", "F - test-environment/6"
-  check-screen-row                     screen,         7/y, "                                                                                      (+ 3 4)                                   ", "F - test-environment/7"
-  check-screen-row                     screen,         8/y, "                                                                                      ...                       trace depth: 4  ", "F - test-environment/8"
-  check-screen-row                     screen,         9/y, "                                                                                      => 7                                      ", "F - test-environment/9"
-  check-screen-row                     screen,       0xa/y, "                                                                                                                                ", "F - test-environment/10"
+  check-background-color-in-screen-row screen, 0/bg,   2/y, "                                                                                        ........                                ", "F - test-environment/2"
+  check-background-color-in-screen-row screen, 0/bg,   3/y, "                                                                                        ........                                ", "F - test-environment/3"
+  check-background-color-in-screen-row screen, 0/bg,   4/y, "                                                                                        ........                                ", "F - test-environment/4"
+  check-screen-row                     screen,         5/y, "                                                                                                                                ", "F - test-environment/5"
+  check-screen-row                     screen,         6/y, "                                                                                      keyboard:                                 ", "F - test-environment/6"
+  check-background-color-in-screen-row screen, 0/bg,   6/y, "                                                                                                ................                ", "F - test-environment/6-2"
+  check-screen-row                     screen,         7/y, "                                                                                                                                ", "F - test-environment/7"
+  check-screen-row                     screen,         8/y, "                                                                                      (+ 3 4)                                   ", "F - test-environment/8"
+  check-screen-row                     screen,         9/y, "                                                                                      ...                       trace depth: 4  ", "F - test-environment/9"
+  check-screen-row                     screen,       0xa/y, "                                                                                      => 7                                      ", "F - test-environment/10"
   check-screen-row                     screen,       0xb/y, "                                                                                                                                ", "F - test-environment/11"
   check-screen-row                     screen,       0xc/y, "                                                                                                                                ", "F - test-environment/12"
   check-screen-row                     screen,       0xd/y, "                                                                                                                                ", "F - test-environment/13"
@@ -57,7 +55,7 @@ fn test-environment {
 fn test-definition-in-environment {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -70,16 +68,16 @@ fn test-definition-in-environment {
   check-screen-row                     screen,         0/y, "                                                                                                                                ", "F - test-definition-in-environment/0"
   # global definition is now on the left side
   check-screen-row                     screen,         1/y, "                                           (define f 42)                              screen:                                   ", "F - test-definition-in-environment/1"
-  check-background-color-in-screen-row screen, 0/bg,   1/y, "                                                                                                ........                        ", "F - test-definition-in-environment/1-2"
-  check-background-color-in-screen-row screen, 0/bg,   2/y, "                                                                                                ........                        ", "F - test-definition-in-environment/2"
-  check-background-color-in-screen-row screen, 0/bg,   3/y, "                                                                                                ........                        ", "F - test-definition-in-environment/3"
-  check-screen-row                     screen,         4/y, "                                                                                                                                ", "F - test-definition-in-environment/4"
-  check-screen-row                     screen,         5/y, "                                                                                      keyboard:                                 ", "F - test-definition-in-environment/5"
-  check-background-color-in-screen-row screen, 0/bg,   5/y, "                                                                                                ................                ", "F - test-definition-in-environment/5-2"
-  check-screen-row                     screen,         6/y, "                                                                                                                                ", "F - test-definition-in-environment/6"
-  check-screen-row                     screen,         7/y, "                                                                                                                                ", "F - test-definition-in-environment/7"
+  check-background-color-in-screen-row screen, 0/bg,   2/y, "                                                                                        ........                                ", "F - test-environment/2"
+  check-background-color-in-screen-row screen, 0/bg,   3/y, "                                                                                        ........                                ", "F - test-environment/3"
+  check-background-color-in-screen-row screen, 0/bg,   4/y, "                                                                                        ........                                ", "F - test-environment/4"
+  check-screen-row                     screen,         5/y, "                                                                                                                                ", "F - test-definition-in-environment/4"
+  check-screen-row                     screen,         6/y, "                                                                                      keyboard:                                 ", "F - test-definition-in-environment/5"
+  check-background-color-in-screen-row screen, 0/bg,   6/y, "                                                                                                ................                ", "F - test-definition-in-environment/5-2"
+  check-screen-row                     screen,         7/y, "                                                                                                                                ", "F - test-definition-in-environment/6"
+  check-screen-row                     screen,         8/y, "                                                                                                                                ", "F - test-definition-in-environment/7"
   # you can still see the trace on the right for what you just added to the left
-  check-screen-row                     screen,         8/y, "                                                                                      ...                       trace depth: 4  ", "F - test-definition-in-environment/8"
+  check-screen-row                     screen,         9/y, "                                                                                      ...                       trace depth: 4  ", "F - test-definition-in-environment/8"
 }
 
 # helper for testing
@@ -102,12 +100,12 @@ fn type-in self: (addr environment), screen: (addr screen), keys: (addr array by
   }
 }
 
-fn initialize-environment _self: (addr environment) {
+fn initialize-environment _self: (addr environment), fake-screen-width: int, fake-screen-height: int {
   var self/esi: (addr environment) <- copy _self
   var globals/eax: (addr global-table) <- get self, globals
   initialize-globals globals
   var sandbox/eax: (addr sandbox) <- get self, sandbox
-  initialize-sandbox sandbox, 1/with-screen
+  initialize-sandbox sandbox, fake-screen-width, fake-screen-height
   var partial-global-name-ah/eax: (addr handle gap-buffer) <- get self, partial-global-name
   allocate partial-global-name-ah
   var partial-global-name/eax: (addr gap-buffer) <- lookup *partial-global-name-ah
@@ -415,7 +413,7 @@ fn read-and-evaluate-and-save-gap-buffer-to-globals _in-ah: (addr handle gap-buf
 fn test-go-modal {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -450,7 +448,7 @@ fn test-go-modal {
 fn test-leave-go-modal {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -483,7 +481,7 @@ fn test-leave-go-modal {
 fn test-jump-to-global {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -526,7 +524,7 @@ fn test-jump-to-global {
 fn test-go-modal-prepopulates-word-at-cursor {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -627,7 +625,7 @@ fn test-go-modal-prepopulates-word-at-cursor {
 fn test-jump-to-nonexistent-global {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -698,7 +696,7 @@ fn test-jump-to-nonexistent-global {
 fn test-create-global {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
@@ -736,7 +734,7 @@ fn test-create-global {
 fn test-create-nonexistent-global {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 8/fake-screen-width, 3/fake-screen-height
   # setup: screen
   var screen-on-stack: screen
   var screen/edi: (addr screen) <- address screen-on-stack
diff --git a/shell/evaluate.mu b/shell/evaluate.mu
index a47d557c..78266a23 100644
--- a/shell/evaluate.mu
+++ b/shell/evaluate.mu
@@ -31,7 +31,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     var screen-obj/eax: (addr screen) <- lookup *screen-obj-ah
     compare screen-obj, 0
     break-if-=
-    var y/ecx: int <- render-screen 0/screen, screen-obj, 0x70/xmin, 1/ymin
+    var y/ecx: int <- render-screen 0/screen, screen-obj, 0x58/xmin, 2/ymin
     var key/eax: byte <- read-key 0/keyboard
     compare key, 0
     break-if-=
diff --git a/shell/main.mu b/shell/main.mu
index 04055b88..7e4bc32c 100644
--- a/shell/main.mu
+++ b/shell/main.mu
@@ -4,7 +4,7 @@
 fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
-  initialize-environment env
+  initialize-environment env, 0x20/fake-screen-width, 8/fake-screen-height
   load-state env, data-disk
   $main:loop: {
     render-environment screen, env
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index 085a882d..35337292 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -9,7 +9,7 @@ type sandbox {
   cursor-in-keyboard?: boolean
 }
 
-fn initialize-sandbox _self: (addr sandbox), fake-screen-and-keyboard?: boolean {
+fn initialize-sandbox _self: (addr sandbox), fake-screen-width: int, fake-screen-height: int {
   var self/esi: (addr sandbox) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, data
   allocate data-ah
@@ -20,10 +20,10 @@ fn initialize-sandbox _self: (addr sandbox), fake-screen-and-keyboard?: boolean
   populate-stream value-ah, 0x1000/4KB
   #
   {
-    compare fake-screen-and-keyboard?, 0/false
+    compare fake-screen-width, 0
     break-if-=
     var screen-ah/eax: (addr handle cell) <- get self, screen-var
-    new-fake-screen screen-ah, 8/width, 3/height, 1/enable-pixel-graphics
+    new-fake-screen screen-ah, fake-screen-width, fake-screen-height, 1/enable-pixel-graphics
     var keyboard-ah/eax: (addr handle cell) <- get self, keyboard-var
     new-fake-keyboard keyboard-ah, 0x10/keyboard-capacity
   }
@@ -188,6 +188,9 @@ fn maybe-render-empty-screen screen: (addr screen), _self: (addr sandbox), xmin:
   var _screen-obj/eax: (addr screen) <- lookup *screen-obj-ah
   var screen-obj/edx: (addr screen) <- copy _screen-obj
   var x/eax: int <- draw-text-rightward screen, "screen:   ", xmin, 0x99/xmax, y, 0x17/fg, 0xc5/bg=blue-bg
+  x <- copy xmin
+  x <- add 2
+  y <- increment
   y <- render-empty-screen screen, screen-obj, x, y
   return y
 }
@@ -217,7 +220,10 @@ fn maybe-render-screen screen: (addr screen), _self: (addr sandbox), xmin: int,
     return ymin
   }
   var x/eax: int <- draw-text-rightward screen, "screen:   ", xmin, 0x99/xmax, ymin, 0x17/fg, 0xc5/bg=blue-bg
+  x <- copy xmin
+  x <- add 2
   var y/ecx: int <- copy ymin
+  y <- increment
   y <- render-screen screen, screen-obj, x, y
   return y
 }