From f6fd7e1be0780b5b6dee042bef1c4f0264069787 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 13 Jan 2021 00:08:31 -0800 Subject: 7509 --- html/baremetal/ex5.mu.html | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'html/baremetal/ex5.mu.html') diff --git a/html/baremetal/ex5.mu.html b/html/baremetal/ex5.mu.html index 95c2f03d..c4321e97 100644 --- a/html/baremetal/ex5.mu.html +++ b/html/baremetal/ex5.mu.html @@ -14,12 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } -.muComment { color: #005faf; } +.PreProc { color: #c000c0; } .LineNr { } +.Constant { color: #008787; } +.SpecialChar { color: #d70000; } .Delimiter { color: #c000c0; } .muFunction { color: #af5f00; text-decoration: underline; } -.Constant { color: #008787; } -.PreProc { color: #c000c0; } +.muComment { color: #005faf; } --> @@ -55,20 +56,22 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/main/baremetal/ex5.mu
- 1 # Draw an ASCII string using the built-in font (GNU unifont)
- 2 #
- 3 # To build a disk image:
- 4 #   ./translate_mu_baremetal baremetal/ex5.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: text in green near the top-left corner of screen
-11 
-12 fn main {
-13   draw-text-rightward 0, "hello from baremetal Mu!", 0x10, 0x10, 0xa
-14 }
+ 1 # Draw a single line of ASCII text using the built-in font (GNU unifont)
+ 2 # Also demonstrates bounds-checking _before_ drawing.
+ 3 #
+ 4 # To build a disk image:
+ 5 #   ./translate_mu_baremetal baremetal/ex5.mu     # emits disk.img
+ 6 # To run:
+ 7 #   qemu-system-i386 disk.img
+ 8 # Or:
+ 9 #   bochs -f baremetal/boot.bochsrc               # boot.bochsrc loads disk.img
+10 #
+11 # Expected output: text in green near the top-left corner of screen
+12 
+13 fn main {
+14   var dummy/eax: int <- draw-text-rightward 0, "hello from baremetal Mu!", 0x10, 0x400, 0x10, 0xa  # xmax = end of screen, plenty of space
+15   dummy <- draw-text-rightward 0, "you shouldn't see this", 0x10, 0xa0, 0x30, 0x3  # xmax = 0xa0, which is too narrow
+16 }
 
-- cgit 1.4.1-2-gfad0