1 # Draw a single line of ASCII text using the built-in font (GNU unifont) 2 # Also demonstrates bounds-checking _before_ drawing. 3 # 4 # To build a disk image: 5 # ./translate_mu_baremetal baremetal/ex5.mu # emits disk.img 6 # To run: 7 # qemu-system-i386 disk.img 8 # Or: 9 # bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img 10 # 11 # Expected output: text in green near the top-left corner of screen 12 13 fn main { 14 var dummy/eax: int <- draw-text-rightward 0, "hello from baremetal Mu!", 0x10, 0x400, 0x10, 0xa # xmax = end of screen, plenty of space 15 dummy <- draw-text-rightward 0, "you shouldn't see this", 0x10, 0xa0, 0x30, 0x3 # xmax = 0xa0, which is too narrow 16 }