about summary refs log tree commit diff stats
path: root/baremetal/401draw-text-rightward.mu
diff options
context:
space:
mode:
Diffstat (limited to 'baremetal/401draw-text-rightward.mu')
-rw-r--r--baremetal/401draw-text-rightward.mu19
1 files changed, 8 insertions, 11 deletions
diff --git a/baremetal/401draw-text-rightward.mu b/baremetal/401draw-text-rightward.mu
index 089c5d5c..61b2d9ca 100644
--- a/baremetal/401draw-text-rightward.mu
+++ b/baremetal/401draw-text-rightward.mu
@@ -1,16 +1,13 @@
-fn draw-text-rightward screen: (addr screen), _text: (addr array byte), x: int, y: int, color: int {
-  var text/esi: (addr array byte) <- copy _text
-  var len/ecx: int <- length text
-  var i/edx: int <- copy 0
+fn draw-text-rightward screen: (addr screen), text: (addr array byte), x: int, y: int, color: int {
+  var stream-storage: (stream byte 0x100)
+  var stream/esi: (addr stream byte) <- address stream-storage
+  write stream, text
   {
-    compare i, len
-    break-if->=
-    var g/eax: (addr byte) <- index text, i
-    var g2/eax: byte <- copy-byte *g
-    var g3/eax: grapheme <- copy g2
-    draw-grapheme screen, g3, x, y, color
+    var g/eax: grapheme <- read-grapheme stream
+    compare g, 0xffffffff  # end-of-file
+    break-if-=
+    draw-grapheme screen, g, x, y, color
     add-to x, 8  # font-width
-    i <- increment
     loop
   }
 }