about summary refs log tree commit diff stats
path: root/ex7.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 /ex7.mu
parent9f71d7248c908900e987c08b2ab4642dfd88eacb (diff)
downloadmu-1a43d12b15c11c1fb1686369665f48d87f350f37.tar.gz
explicitly pass screen and keyboard to main
Diffstat (limited to 'ex7.mu')
-rw-r--r--ex7.mu16
1 files changed, 8 insertions, 8 deletions
diff --git a/ex7.mu b/ex7.mu
index 5b53dbdc..0b84d584 100644
--- a/ex7.mu
+++ b/ex7.mu
@@ -10,35 +10,35 @@
 # Expected output: an interactive game a bit like "snakes". Try pressing h, j,
 # k, l.
 
-fn main {
+fn main screen: (addr screen), keyboard: (addr keyboard) {
   var space/eax: grapheme <- copy 0x20
-  set-cursor-position 0/screen, 0, 0
+  set-cursor-position screen, 0, 0
   {
-    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, 0x68/h
       break-if-!=
-      draw-code-point-at-cursor 0/screen, 0x2d/dash, 0x31/fg, 0/bg
+      draw-code-point-at-cursor screen, 0x2d/dash, 0x31/fg, 0/bg
       move-cursor-left 0
     }
     {
       compare key, 0x6a/j
       break-if-!=
-      draw-code-point-at-cursor 0/screen, 0x7c/vertical-bar, 0x31/fg, 0/bg
+      draw-code-point-at-cursor screen, 0x7c/vertical-bar, 0x31/fg, 0/bg
       move-cursor-down 0
     }
     {
       compare key, 0x6b/k
       break-if-!=
-      draw-code-point-at-cursor 0/screen, 0x7c/vertical-bar, 0x31/fg, 0/bg
+      draw-code-point-at-cursor screen, 0x7c/vertical-bar, 0x31/fg, 0/bg
       move-cursor-up 0
     }
     {
       compare key, 0x6c/l
       break-if-!=
       var g/eax: code-point <- copy 0x2d/dash
-      draw-code-point-at-cursor 0/screen, 0x2d/dash, 0x31/fg, 0/bg
+      draw-code-point-at-cursor screen, 0x2d/dash, 0x31/fg, 0/bg
       move-cursor-right 0
     }
     loop