about summary refs log tree commit diff stats
path: root/501draw-text.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-10 15:59:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-10 15:59:40 -0700
commit97cffa20d4d847c76ae58c44a265ffd31dfb13a2 (patch)
tree217ce519fc5fd245bdc50009b54808095a449e6d /501draw-text.mu
parent1d724f926031a73dc2e6af18b6731593a548526c (diff)
downloadmu-97cffa20d4d847c76ae58c44a265ffd31dfb13a2.tar.gz
shell: start of 'print' primitive
Diffstat (limited to '501draw-text.mu')
-rw-r--r--501draw-text.mu22
1 files changed, 22 insertions, 0 deletions
diff --git a/501draw-text.mu b/501draw-text.mu
index ce87634e..79ec1930 100644
--- a/501draw-text.mu
+++ b/501draw-text.mu
@@ -196,6 +196,28 @@ fn draw-stream-wrapping-right-then-down screen: (addr screen), stream: (addr str
   return xcurr, ycurr
 }
 
+fn draw-stream-wrapping-right-then-down-from-cursor screen: (addr screen), stream: (addr stream byte), xmin: int, ymin: int, xmax: int, ymax: int, color: int, background-color: int {
+  var cursor-x/eax: int <- copy 0
+  var cursor-y/ecx: int <- copy 0
+  cursor-x, cursor-y <- cursor-position screen
+  var end-x/edx: int <- copy cursor-x
+  end-x <- increment
+  compare end-x, xmax
+  {
+    break-if-<
+    cursor-x <- copy xmin
+    cursor-y <- increment
+  }
+  cursor-x, cursor-y <- draw-stream-wrapping-right-then-down screen, stream, xmin, ymin, xmax, ymax, cursor-x, cursor-y, color, background-color
+}
+
+fn draw-stream-wrapping-right-then-down-from-cursor-over-full-screen screen: (addr screen), stream: (addr stream byte), color: int, background-color: int {
+  var width/eax: int <- copy 0
+  var height/ecx: int <- copy 0
+  width, height <- screen-size screen
+  draw-stream-wrapping-right-then-down-from-cursor screen, stream, 0/xmin, 0/ymin, width, height, color, background-color
+}
+
 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