https://github.com/akkartik/mu/blob/main/apps/ex14.mu
 1 # Unicode demo
 2 #
 3 # Mu can't read Unicode from keyboard yet, so we'll read from disk and print
 4 # to screen.
 5 #
 6 # Steps for trying it out:
 7 #   1. Translate this example into a disk image code.img.
 8 #       ./translate apps/ex14.mu
 9 #   2. Build a second disk image data.img containing some Unicode text.
10 #       dd if=/dev/zero of=data.img count=20160
11 #       echo 'நட' |dd of=data.img conv=notrunc
12 #   3. Run:
13 #       qemu-system-i386 -hda code.img -hdb data.img
14 #
15 # Expected output: 'நட' in green near the top-left corner of screen
16 #
17 # Limitations:
18 #   - Utf-8 is the one true encoding.
19 #   - No keyboard support yet.
20 #   - Just single-code-point graphemes so far. No combiner characters, etc.
21 
22 fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
23   var text-storage: (stream byte 0x200)
24   var text/esi: (addr stream byte) <- address text-storage
25   load-sectors data-disk, 0/lba, 1/num-sectors, text
26   var dummy/eax: int <- draw-stream-rightward screen, text, 0/x 0x80/xmax 0/y, 0xa/fg, 0/bg
27 }