about summary refs log tree commit diff stats
path: root/baremetal/501draw-text.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-02-22 22:32:12 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-02-22 22:32:12 -0800
commitfdc3df04300f20fac81792d1f5ee1e170a5644ec (patch)
tree939b3d091baa7b62ab1a86ba761bd0c8513921d6 /baremetal/501draw-text.mu
parenta4bc5df0809319e118be77246aa12aa639d82f1a (diff)
downloadmu-fdc3df04300f20fac81792d1f5ee1e170a5644ec.tar.gz
7788
Diffstat (limited to 'baremetal/501draw-text.mu')
-rw-r--r--baremetal/501draw-text.mu19
1 files changed, 19 insertions, 0 deletions
diff --git a/baremetal/501draw-text.mu b/baremetal/501draw-text.mu
index b2c2136f..b17b54a3 100644
--- a/baremetal/501draw-text.mu
+++ b/baremetal/501draw-text.mu
@@ -62,6 +62,25 @@ fn move-cursor-down screen: (addr screen) {
   set-cursor-position screen, cursor-x, cursor-y
 }
 
+fn move-cursor-to-start-of-next-line screen: (addr screen) {
+  var dummy/eax: int <- copy 0
+  var _height/ecx: int <- copy 0
+  dummy, _height <- screen-size screen
+  var limit/edx: int <- copy _height
+  limit <- decrement
+  var cursor-x/eax: int <- copy 0
+  var cursor-y/ecx: int <- copy 0
+  cursor-x, cursor-y <- cursor-position screen
+  compare cursor-y, limit
+  {
+    break-if-<
+    return
+  }
+  cursor-y <- increment
+  cursor-x <- copy 0
+  set-cursor-position screen, cursor-x, cursor-y
+}
+
 fn draw-grapheme-at-cursor screen: (addr screen), g: grapheme, color: int, background-color: int {
   var cursor-x/eax: int <- copy 0
   var cursor-y/ecx: int <- copy 0