about summary refs log tree commit diff stats
path: root/baremetal/ex4.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-09 17:04:21 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-09 18:28:14 -0800
commit7f8770ae082a723faae89faea0dce6635feb7cdb (patch)
tree4955853fdd8c1f70197453b8ba339b950376908f /baremetal/ex4.mu
parentdbd7082a0ed09ee06401d0af06ce24e89e87b189 (diff)
downloadmu-7f8770ae082a723faae89faea0dce6635feb7cdb.tar.gz
7490 - baremetal: draw a grapheme to screen
Diffstat (limited to 'baremetal/ex4.mu')
-rw-r--r--baremetal/ex4.mu15
1 files changed, 15 insertions, 0 deletions
diff --git a/baremetal/ex4.mu b/baremetal/ex4.mu
new file mode 100644
index 00000000..52b681bc
--- /dev/null
+++ b/baremetal/ex4.mu
@@ -0,0 +1,15 @@
+# Draw a character using the built-in font (GNU unifont)
+#
+# To build a disk image:
+#   ./translate_mu_baremetal baremetal/ex4.mu     # emits disk.img
+# To run:
+#   qemu-system-i386 disk.img
+# Or:
+#   bochs -f baremetal/boot.bochsrc               # boot.bochsrc loads disk.img
+#
+# Expected output: letter 'A' in green near the top-left corner of screen
+
+fn main {
+  var g/eax: grapheme <- copy 0x41  # 'A'
+  draw-grapheme 0, g, 0x10, 0x10, 0xa
+}