about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-17 22:13:09 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-17 22:13:09 -0700
commit3b928346b895086cd61f8429f54b3c733daab60d (patch)
tree053a3f33be63bc062bc71e988bd2f27549a223b3
parent47821f1bddd6b5401b36e08043f28c6dd63e4ae4 (diff)
downloadmu-3b928346b895086cd61f8429f54b3c733daab60d.tar.gz
6798
Simplify the app for now.

I'm not actually sure what sort of language I want to create here. So let's
not get ahead of ourselves inventing a whole new grid model and everything.
-rw-r--r--apps/tile/environment.mu50
1 files changed, 7 insertions, 43 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 3f96b8c8..bd2a1814 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -10,29 +10,13 @@ fn initialize-environment _env: (addr environment) {
   var screen-ah/edi: (addr handle screen) <- get env, screen
   var _screen/eax: (addr screen) <- lookup *screen-ah
   var screen/edi: (addr screen) <- copy _screen
-  var nrows/eax: int <- copy 0
-  var ncols/ecx: int <- copy 0
-  nrows, ncols <- screen-size screen
-  # cursor-col
-  var midcol/edx: int <- copy ncols
-  midcol <- shift-right 1
-  var start-col/edx: int <- copy midcol
-  start-col <- add 2
   {
     var cursor-col/eax: (addr int) <- get env, cursor-col
-    copy-to *cursor-col start-col
+    copy-to *cursor-col, 3
   }
-  # cursor-row
-  var midrow/ebx: int <- copy 0
-  {
-    var tmp/eax: int <- try-divide nrows, 3
-    midrow <- copy tmp
-  }
-  var start-row/ebx: int <- copy midrow
-  start-row <- subtract 3
   {
     var cursor-row/eax: (addr int) <- get env, cursor-row
-    copy-to *cursor-row start-row
+    copy-to *cursor-row, 3
   }
   # buf
   var gap/eax: (addr gap-buffer) <- get env, buf
@@ -116,34 +100,14 @@ fn render _env: (addr environment) {
   var screen-ah/edi: (addr handle screen) <- get env, screen
   var _screen/eax: (addr screen) <- lookup *screen-ah
   var screen/edi: (addr screen) <- copy _screen
+  # prepare screen
   clear-screen screen
-  var nrows/eax: int <- copy 0
-  var ncols/ecx: int <- copy 0
-  nrows, ncols <- screen-size screen
-  var midcol/edx: int <- copy ncols
-  midcol <- shift-right 1
-  draw-vertical-line screen, 1, nrows, midcol
-  var midrow/ebx: int <- copy 0
-  {
-    var tmp/eax: int <- try-divide nrows, 3
-    midrow <- copy tmp
-  }
-  var left-col/edx: int <- copy midcol
-  left-col <- increment
-  draw-horizontal-line screen, midrow, left-col, ncols
-#?   # some debug info
-#?   ncols <- subtract 2
-#?   move-cursor screen, 1, ncols
+  move-cursor screen, 3, 3
+  # render input area
   var buf/ecx: (addr gap-buffer) <- get env, buf
-#?   var foo/eax: int <- gap-buffer-length buf
-#?   print-int32-decimal screen, foo
-  #
-  var start-row/ebx: int <- copy midrow
-  start-row <- subtract 3
-  var start-col/edx: int <- copy left-col
-  start-col <- increment
-  move-cursor screen, start-row, start-col
   render-gap-buffer screen, buf
+#?   # render stacks
+#?   render-all-stacks screen
   # update cursor
   var cursor-row/eax: (addr int) <- get env, cursor-row
   var cursor-col/ecx: (addr int) <- get env, cursor-col