From 3350c34a74844e21ea69077e01efff3bae64bdcd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 23 Mar 2021 17:31:08 -0700 Subject: . --- html/ex2.mu.html | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 html/ex2.mu.html (limited to 'html/ex2.mu.html') diff --git a/html/ex2.mu.html b/html/ex2.mu.html new file mode 100644 index 00000000..6795bedf --- /dev/null +++ b/html/ex2.mu.html @@ -0,0 +1,90 @@ + + + + +Mu - ex2.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/ex2.mu +
+ 1 # Test out the video mode by filling in the screen with pixels.
+ 2 #
+ 3 # To build a disk image:
+ 4 #   ./translate ex2.mu             # emits disk.img
+ 5 # To run:
+ 6 #   qemu-system-i386 disk.img
+ 7 # Or:
+ 8 #   bochs -f bochsrc               # bochsrc loads disk.img
+ 9 
+10 fn main {
+11   var y/eax: int <- copy 0
+12   {
+13     compare y, 0x300/screen-height=768
+14     break-if->=
+15     var x/edx: int <- copy 0
+16     {
+17       compare x, 0x400/screen-width=1024
+18       break-if->=
+19       var color/ecx: int <- copy x
+20       color <- and 0xff
+21       pixel-on-real-screen x, y, color
+22       x <- increment
+23       loop
+24     }
+25     y <- increment
+26     loop
+27   }
+28 }
+
+ + + -- cgit 1.4.1-2-gfad0