about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-22 22:16:59 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-22 22:16:59 -0800
commit328d76e4ef151adbc8d5d8608c0d77d091fc28fd (patch)
tree0bd2148655f00ce5f7e81f8f477be6c7b427f796
parent12c9e8fff60985bed7c1a0c4d727831c74dc4c1f (diff)
downloadmu-328d76e4ef151adbc8d5d8608c0d77d091fc28fd.tar.gz
7545
-rw-r--r--baremetal/ex7.mu60
1 files changed, 32 insertions, 28 deletions
diff --git a/baremetal/ex7.mu b/baremetal/ex7.mu
index 50174385..d604c95a 100644
--- a/baremetal/ex7.mu
+++ b/baremetal/ex7.mu
@@ -11,34 +11,38 @@
 # k, l.
 
 fn main {
-  var key/eax: byte <- read-key 0
+  var space/eax: grapheme <- copy 0x20
+  set-cursor-position 0, 0, 0, space
   {
-    compare key, 0x68  # 'h'
-    break-if-!=
-    var g/eax: grapheme <- copy 0x2d  # '-'
-    draw-grapheme-at-cursor 0, g, 0x31
-    cursor-left 0
+    var key/eax: byte <- read-key 0
+    {
+      compare key, 0x68  # 'h'
+      break-if-!=
+      var g/eax: grapheme <- copy 0x2d  # '-'
+      draw-grapheme-at-cursor 0, g, 0x31
+      cursor-left 0
+    }
+    {
+      compare key, 0x6a  # 'j'
+      break-if-!=
+      var g/eax: grapheme <- copy 0x7c  # '|'
+      draw-grapheme-at-cursor 0, g, 0x31
+      cursor-down 0
+    }
+    {
+      compare key, 0x6b  # 'k'
+      break-if-!=
+      var g/eax: grapheme <- copy 0x7c  # '|'
+      draw-grapheme-at-cursor 0, g, 0x31
+      cursor-up 0
+    }
+    {
+      compare key, 0x6c  # 'l'
+      break-if-!=
+      var g/eax: grapheme <- copy 0x2d  # '-'
+      draw-grapheme-at-cursor 0, g, 0x31
+      cursor-right 0
+    }
+    loop
   }
-  {
-    compare key, 0x6a  # 'j'
-    break-if-!=
-    var g/eax: grapheme <- copy 0x7c  # '|'
-    draw-grapheme-at-cursor 0, g, 0x31
-    cursor-down 0
-  }
-  {
-    compare key, 0x6b  # 'k'
-    break-if-!=
-    var g/eax: grapheme <- copy 0x7c  # '|'
-    draw-grapheme-at-cursor 0, g, 0x31
-    cursor-up 0
-  }
-  {
-    compare key, 0x6c  # 'l'
-    break-if-!=
-    var g/eax: grapheme <- copy 0x2d  # '-'
-    draw-grapheme-at-cursor 0, g, 0x31
-    cursor-right 0
-  }
-  loop
 }