about summary refs log tree commit diff stats
path: root/baremetal/ex6.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-12 00:20:22 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-12 00:20:22 -0800
commitbb0e67a308922fc1a1a6972b00fcc37909a028ce (patch)
tree4636ba8cfaad3ad2f3d64c67a08557c2d89cc8b4 /baremetal/ex6.mu
parent589eba07e2b1f1f3c6dbb3087b306071a2f9809b (diff)
downloadmu-bb0e67a308922fc1a1a6972b00fcc37909a028ce.tar.gz
7501 - baremetal: draw text within a rectangle
Diffstat (limited to 'baremetal/ex6.mu')
-rw-r--r--baremetal/ex6.mu17
1 files changed, 17 insertions, 0 deletions
diff --git a/baremetal/ex6.mu b/baremetal/ex6.mu
new file mode 100644
index 00000000..f0c1f896
--- /dev/null
+++ b/baremetal/ex6.mu
@@ -0,0 +1,17 @@
+# Draw ASCII text within a bounding box, while wrapping.
+#
+# To build a disk image:
+#   ./translate_mu_baremetal baremetal/ex6.mu     # emits disk.img
+# To run:
+#   qemu-system-i386 disk.img
+# Or:
+#   bochs -f baremetal/boot.bochsrc               # boot.bochsrc loads disk.img
+#
+# Expected output: a box and text that doesn't overflow it
+
+fn main {
+  draw-box 0, 0xf, 0xf, 0x61, 0x41, 0x4
+  var x/eax: int <- copy 0
+  var y/ecx: int <- copy 0
+  x, y <- draw-text-rightward-wrapped 0, "hello from baremetal Mu!", 0x10, 0x10, 0x60, 0x40, 0xa  # xmax = 0x60, ymax = 0x40
+}