From 00c4d6122182c37a8b37d27fd1e8e896cbdbe928 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 29 Dec 2020 21:20:36 -0800 Subject: 7472 --- html/baremetal/ex2.mu.html | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 html/baremetal/ex2.mu.html (limited to 'html/baremetal') diff --git a/html/baremetal/ex2.mu.html b/html/baremetal/ex2.mu.html new file mode 100644 index 00000000..1d2c4249 --- /dev/null +++ b/html/baremetal/ex2.mu.html @@ -0,0 +1,93 @@ + + + + +Mu - baremetal/ex2.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/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_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 }
+
+ + + -- cgit 1.4.1-2-gfad0