From 78357b8852626b510527f3b8d770a7dd8956fcc7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 16 Jul 2021 08:38:43 -0700 Subject: . --- html/apps/ex12.mu.html | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 html/apps/ex12.mu.html (limited to 'html/apps/ex12.mu.html') diff --git a/html/apps/ex12.mu.html b/html/apps/ex12.mu.html new file mode 100644 index 00000000..b0b3a763 --- /dev/null +++ b/html/apps/ex12.mu.html @@ -0,0 +1,92 @@ + + + + +Mu - apps/ex12.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/apps/ex12.mu +
+ 1 # Checking the timer.
+ 2 #
+ 3 # To build a disk image:
+ 4 #   ./translate apps/ex12.mu       # emits code.img
+ 5 # To run:
+ 6 #   qemu-system-i386 code.img
+ 7 # Or:
+ 8 #   bochs -f bochsrc               # bochsrc loads code.img
+ 9 #
+10 # Expected output: text with slowly updating colors
+11 
+12 fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
+13   var fg/ecx: int <- copy 0
+14   var prev-timer-counter/edx: int <- copy 0
+15   {
+16     var dummy/eax: int <- draw-text-rightward screen, "hello from baremetal Mu!", 0x10/x, 0x400/xmax, 0x10/y, fg, 0/bg
+17     # wait for timer to bump
+18     {
+19       var curr-timer-counter/eax: int <- timer-counter
+20       compare curr-timer-counter, prev-timer-counter
+21       loop-if-=
+22       prev-timer-counter <- copy curr-timer-counter
+23     }
+24     # switch color
+25     fg <- increment
+26     loop
+27   }
+28 }
+
+ + + -- cgit 1.4.1-2-gfad0