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-23 08:45:51 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-23 08:45:51 -0800
commit63be7b7d0d5bb6e728d9afbb68e238fcd3bda3a7 (patch)
tree7f26c1430c53e0aec3cbe889bf80e70078db8506 /baremetal/501draw-text.mu
parent0f73127ef1eba0a8ea814c26115523da3590ffe2 (diff)
downloadmu-63be7b7d0d5bb6e728d9afbb68e238fcd3bda3a7.tar.gz
7548 - baremetal: better cursor management
Diffstat (limited to 'baremetal/501draw-text.mu')
-rw-r--r--baremetal/501draw-text.mu33
1 files changed, 11 insertions, 22 deletions
diff --git a/baremetal/501draw-text.mu b/baremetal/501draw-text.mu
index d7455829..0bb95dee 100644
--- a/baremetal/501draw-text.mu
+++ b/baremetal/501draw-text.mu
@@ -10,8 +10,7 @@ fn cursor-left screen: (addr screen) {
     return
   }
   cursor-x <- decrement
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, cursor-x, cursor-y, space
+  set-cursor-position screen, cursor-x, cursor-y
 }
 
 fn cursor-right screen: (addr screen) {
@@ -28,8 +27,7 @@ fn cursor-right screen: (addr screen) {
     return
   }
   cursor-x <- increment
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, cursor-x, cursor-y, space
+  set-cursor-position screen, cursor-x, cursor-y
 }
 
 fn cursor-up screen: (addr screen) {
@@ -42,8 +40,7 @@ fn cursor-up screen: (addr screen) {
     return
   }
   cursor-y <- decrement
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, cursor-x, cursor-y, space
+  set-cursor-position screen, cursor-x, cursor-y
 }
 
 fn cursor-down screen: (addr screen) {
@@ -60,8 +57,7 @@ fn cursor-down screen: (addr screen) {
     return
   }
   cursor-y <- increment
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, cursor-x, cursor-y, space
+  set-cursor-position screen, cursor-x, cursor-y
 }
 
 fn draw-grapheme-at-cursor screen: (addr screen), g: grapheme, color: int {
@@ -105,8 +101,7 @@ fn draw-text-rightward screen: (addr screen), text: (addr array byte), x: int, x
     xcurr <- increment
     loop
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, xcurr, y, space  # we'll assume it's ok to clear the next grapheme
+  set-cursor-position screen, xcurr, y
   return xcurr
 }
 
@@ -167,8 +162,7 @@ fn draw-text-wrapping-right-then-down screen: (addr screen), text: (addr array b
     }
     loop
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, xcurr, ycurr, space  # we'll assume it's ok to clear the next grapheme
+  set-cursor-position screen, xcurr, ycurr
   return xcurr, ycurr
 }
 
@@ -183,8 +177,7 @@ fn move-cursor-rightward-and-downward screen: (addr screen), xmin: int, xmax: in
     cursor-x <- copy xmin
     cursor-y <- increment
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, cursor-x, cursor-y, space  # we'll assume it's ok to clear the grapheme at the cursor
+  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 {
@@ -262,8 +255,7 @@ fn draw-int32-hex-wrapping-right-then-down screen: (addr screen), n: int, xmin:
     }
     loop
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, xcurr, ycurr, space  # we'll assume it's ok to clear the next grapheme
+  set-cursor-position screen, xcurr, ycurr
   return xcurr, ycurr
 }
 
@@ -342,8 +334,7 @@ fn draw-int32-decimal-wrapping-right-then-down screen: (addr screen), n: int, xm
     }
     loop
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, xcurr, ycurr, space  # we'll assume it's ok to clear the next grapheme
+  set-cursor-position screen, xcurr, ycurr
   return xcurr, ycurr
 }
 
@@ -413,8 +404,7 @@ fn draw-text-downward screen: (addr screen), text: (addr array byte), x: int, y:
     ycurr <- increment
     loop
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, x, ycurr, space  # we'll assume it's ok to clear the next grapheme
+  set-cursor-position screen, x, ycurr
   return ycurr
 }
 
@@ -474,8 +464,7 @@ fn draw-text-wrapping-down-then-right screen: (addr screen), text: (addr array b
     }
     loop
   }
-  var space/esi: grapheme <- copy 0x20
-  set-cursor-position screen, xcurr, ycurr, space  # we'll assume it's ok to clear the next grapheme
+  set-cursor-position screen, xcurr, ycurr
   return xcurr, ycurr
 }