From ac608bc72eb5bde1c7d84e36d83a1e15357fe16d Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 3 Oct 2020 00:25:55 -0700 Subject: 6929 --- html/apps/raytracing/1.mu.html | 54 +++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'html/apps/raytracing/1.mu.html') diff --git a/html/apps/raytracing/1.mu.html b/html/apps/raytracing/1.mu.html index e09f4a03..c0fe05b0 100644 --- a/html/apps/raytracing/1.mu.html +++ b/html/apps/raytracing/1.mu.html @@ -17,6 +17,7 @@ a { color:inherit; } .LineNr { } .muFunction { color: #af5f00; text-decoration: underline; } .SpecialChar { color: #d70000; } +.Comment { color: #005faf; } .Constant { color: #008787; } .Delimiter { color: #c000c0; } .PreProc { color: #c000c0; } @@ -55,28 +56,37 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/apps/raytracing/1.mu
- 1 fn main -> exit-status/ebx: int {
- 2   print-string 0, "P3\n256 256\n255\n"
- 3   var j/ecx: int <- copy 0xff
- 4   {
- 5     compare j, 0
- 6     break-if-<
- 7     var i/eax: int <- copy 0
- 8     {
- 9       compare i, 0xff
-10       break-if->
-11       print-int32-decimal 0, i
-12       print-string 0, " "
-13       print-int32-decimal 0, j
-14       print-string 0, " 64\n"
-15       i <- increment
-16       loop
-17     }
-18     j <- decrement
-19     loop
-20   }
-21   exit-status <- copy 1
-22 }
+ 1 # Listing 1 of https://raytracing.github.io/books/RayTracingInOneWeekend.html
+ 2 # (simplified)
+ 3 #
+ 4 # To run (on Linux):
+ 5 #   $ git clone https://github.com/akkartik/mu
+ 6 #   $ cd mu
+ 7 #   $ ./translate_mu apps/raytracing/1.mu
+ 8 #   $ ./a.elf > 1.ppm
+ 9 
+10 fn main -> exit-status/ebx: int {
+11   print-string 0, "P3\n256 256\n255\n"
+12   var j/ecx: int <- copy 0xff
+13   {
+14     compare j, 0
+15     break-if-<
+16     var i/eax: int <- copy 0
+17     {
+18       compare i, 0xff
+19       break-if->
+20       print-int32-decimal 0, i
+21       print-string 0, " "
+22       print-int32-decimal 0, j
+23       print-string 0, " 64\n"
+24       i <- increment
+25       loop
+26     }
+27     j <- decrement
+28     loop
+29   }
+30   exit-status <- copy 1
+31 }
 
-- cgit 1.4.1-2-gfad0