https://github.com/akkartik/mu/blob/main/baremetal/ex2.mu
 1 # Test out the video mode by filling in the screen with pixels.
 2 #
 3 # To build a disk image:
 4 #   ./translate_mu_baremetal baremetal/ex2.mu     # emits disk.img
 5 # To run:
 6 #   qemu-system-i386 disk.img
 7 # Or:
 8 #   bochs -f baremetal/boot.bochsrc               # boot.bochsrc loads disk.img
 9 #
10 # Expected output:
11 #   html/baremetal.png
12 
13 fn main {
14   var y/eax: int <- copy 0
15   {
16     compare y, 0x300/screen-height=768
17     break-if->=
18     var x/edx: int <- copy 0
19     {
20       compare x, 0x400/screen-width=1024
21       break-if->=
22       var color/ecx: int <- copy x
23       color <- and 0xff
24       pixel-on-real-screen x, y, color
25       x <- increment
26       loop
27     }
28     y <- increment
29     loop
30   }
31 }