1 # Test out the video mode by filling in the screen with pixels. 2 # 3 # To build a disk image: 4 # ./translate_subx_baremetal baremetal/ex2.subx # 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 # 768 17 break-if->= 18 var x/edx: int <- copy 0 19 { 20 compare x, 0x400 # 1024 21 break-if->= 22 var color/ecx: int <- copy x 23 color <- and 0xff 24 pixel 0, x, y, color 25 x <- increment 26 loop 27 } 28 y <- increment 29 loop 30 } 31 }