about summary refs log tree commit diff stats
path: root/baremetal/501draw-text.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-16 20:56:28 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-16 20:56:28 -0800
commit9822a2429f549491b1c7dfa4035260bb6c44ff77 (patch)
tree96a91da494e51463e04da5808cbbfc0218bbdabc /baremetal/501draw-text.mu
parentaa6c50d2bc62336fbdec06f7cb919c1656c332cf (diff)
downloadmu-9822a2429f549491b1c7dfa4035260bb6c44ff77.tar.gz
7533
Both issues of commit 7531 fixed.
Diffstat (limited to 'baremetal/501draw-text.mu')
-rw-r--r--baremetal/501draw-text.mu14
1 files changed, 14 insertions, 0 deletions
diff --git a/baremetal/501draw-text.mu b/baremetal/501draw-text.mu
index 5ab280db..dd55d7a1 100644
--- a/baremetal/501draw-text.mu
+++ b/baremetal/501draw-text.mu
@@ -158,6 +158,20 @@ fn draw-text-wrapping-right-then-down screen: (addr screen), text: (addr array b
   return xcurr, ycurr
 }
 
+fn move-cursor-rightward-and-downward screen: (addr screen), xmin: int, xmax: int {
+  var cursor-x/eax: int <- copy 0
+  var cursor-y/ecx: int <- copy 0
+  cursor-x, cursor-y <- cursor-position screen
+  cursor-x <- add 8  # font-width
+  compare cursor-x, xmax
+  {
+    break-if-<
+    cursor-x <- copy xmin
+    cursor-y <- add 0x10  # font-height
+  }
+  set-cursor-position screen, cursor-x, cursor-y
+}
+
 fn draw-text-wrapping-right-then-down-over-full-screen screen: (addr screen), text: (addr array byte), x: int, y: int, color: int -> _/eax: int, _/ecx: int {
   var cursor-x/eax: int <- copy 0
   var cursor-y/ecx: int <- copy 0