about summary refs log tree commit diff stats
path: root/rpn.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-26 22:47:44 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-26 23:07:35 -0700
commit1a43d12b15c11c1fb1686369665f48d87f350f37 (patch)
tree73902bccd19f3b6358b9b3ed1c9a0c33956a7e0b /rpn.mu
parent9f71d7248c908900e987c08b2ab4642dfd88eacb (diff)
downloadmu-1a43d12b15c11c1fb1686369665f48d87f350f37.tar.gz
explicitly pass screen and keyboard to main
Diffstat (limited to 'rpn.mu')
-rw-r--r--rpn.mu16
1 files changed, 8 insertions, 8 deletions
diff --git a/rpn.mu b/rpn.mu
index f7a56bd1..719fd03d 100644
--- a/rpn.mu
+++ b/rpn.mu
@@ -15,7 +15,7 @@
 #
 # Error handling is non-existent. This is just a prototype.
 
-fn main {
+fn main screen: (addr screen), keyboard: (addr keyboard) {
   var in-storage: (stream byte 0x80)
   var in/esi: (addr stream byte) <- address in-storage
   var y/ecx: int <- copy 0
@@ -23,13 +23,13 @@ fn main {
   # read-eval-print loop
   {
     # print prompt
-    var x/eax: int <- draw-text-rightward 0/screen, "> ", 0/x, 0x80/xmax, y, 3/fg/cyan, 0/bg
-    set-cursor-position 0/screen, x, y
+    var x/eax: int <- draw-text-rightward screen, "> ", 0/x, 0x80/xmax, y, 3/fg/cyan, 0/bg
+    set-cursor-position screen, x, y
     # read line from keyboard
     clear-stream in
     {
-      draw-cursor 0/screen, space
-      var key/eax: byte <- read-key 0/keyboard
+      draw-cursor screen, space
+      var key/eax: byte <- read-key keyboard
       compare key, 0xa/newline
       break-if-=
       compare key, 0
@@ -37,17 +37,17 @@ fn main {
       var key2/eax: int <- copy key
       append-byte in, key2
       var g/eax: grapheme <- copy key2
-      draw-grapheme-at-cursor 0/screen, g, 0xf/fg, 0/bg
+      draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg
       move-cursor-right 0
       loop
     }
     # clear cursor
-    draw-grapheme-at-cursor 0/screen, space, 3/fg/never-used, 0/bg
+    draw-grapheme-at-cursor screen, space, 3/fg/never-used, 0/bg
     # parse and eval
     var out/eax: int <- simplify in
     # print
     y <- increment
-    out, y <- draw-int32-decimal-wrapping-right-then-down 0/screen, out, 0/xmin, y, 0x80/xmax, 0x30/ymax, 0/x, y, 7/fg, 0/bg
+    out, y <- draw-int32-decimal-wrapping-right-then-down screen, out, 0/xmin, y, 0x80/xmax, 0x30/ymax, 0/x, y, 7/fg, 0/bg
     # newline
     y <- increment
     #