diff options
Diffstat (limited to 'html/linux/raytracing/2.mu.html')
-rw-r--r-- | html/linux/raytracing/2.mu.html | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/html/linux/raytracing/2.mu.html b/html/linux/raytracing/2.mu.html index bd7d94fb..ff2f9576 100644 --- a/html/linux/raytracing/2.mu.html +++ b/html/linux/raytracing/2.mu.html @@ -7,20 +7,25 @@ <meta name="plugin-version" content="vim8.1_v1"> <meta name="syntax" content="none"> <meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy="> -<meta name="colorscheme" content="minimal-dark"> +<meta name="colorscheme" content="minimal-light"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #a8a8a8; } -body { font-size:12pt; font-family: monospace; color: #000000; background-color: #a8a8a8; } +pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #eeeeee; } +body { font-size:12pt; font-family: monospace; color: #000000; background-color: #eeeeee; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } .PreProc { color: #c000c0; } +.muRegEcx { color: #af875f; } .Special { color: #ff6060; } .LineNr { } -.Delimiter { color: #c000c0; } -.CommentedCode { color: #8a8a8a; } .Constant { color: #008787; } +.muRegEdx { color: #878700; } +.muRegEbx { color: #8787af; } +.muRegEsi { color: #87d787; } +.muRegEax { color: #875f00; } +.Delimiter { color: #c000c0; } .muFunction { color: #af5f00; text-decoration: underline; } +.CommentedCode { color: #8a8a8a; } .muComment { color: #005faf; } --> </style> @@ -65,18 +70,18 @@ if ('onhashchange' in window) { <span id="L6" class="LineNr"> 6 </span><span class="muComment"># $ ./translate raytracing/2.mu</span> <span id="L7" class="LineNr"> 7 </span><span class="muComment"># $ ./a.elf > 2.ppm</span> <span id="L8" class="LineNr"> 8 </span> -<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -> </span>_/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span> +<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -> </span>_/<span class="muRegEbx">ebx</span>: int <span class="Delimiter">{</span> <span id="L10" class="LineNr">10 </span> <a href='../405screen.mu.html#L169'>print-string</a> <span class="Constant">0</span>, <span class="Constant">"P3\n256 256\n255\n"</span> -<span id="L11" class="LineNr">11 </span> <span class="PreProc">var</span> _four/<span class="Constant">edx</span>: int <span class="Special"><-</span> copy <span class="Constant">4</span> +<span id="L11" class="LineNr">11 </span> <span class="PreProc">var</span> _four/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> copy <span class="Constant">4</span> <span id="L12" class="LineNr">12 </span> <span class="PreProc">var</span> four/<span class="Constant">xmm1</span>: float <span class="Special"><-</span> convert _four <span id="L13" class="LineNr">13 </span> <span class="PreProc">var</span> one-fourth/<span class="Constant">xmm1</span>: float <span class="Special"><-</span> reciprocal four -<span id="L14" class="LineNr">14 </span> <span class="PreProc">var</span> max/<span class="Constant">edx</span>: int <span class="Special"><-</span> copy <span class="Constant">0xff</span> +<span id="L14" class="LineNr">14 </span> <span class="PreProc">var</span> max/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> copy <span class="Constant">0xff</span> <span id="L15" class="LineNr">15 </span> <span class="PreProc">var</span> image-size/<span class="Constant">xmm2</span>: float <span class="Special"><-</span> convert max -<span id="L16" class="LineNr">16 </span> <span class="PreProc">var</span> j/<span class="Constant">ecx</span>: int <span class="Special"><-</span> copy <span class="Constant">0xff</span> +<span id="L16" class="LineNr">16 </span> <span class="PreProc">var</span> j/<span class="muRegEcx">ecx</span>: int <span class="Special"><-</span> copy <span class="Constant">0xff</span> <span id="L17" class="LineNr">17 </span> <span class="Delimiter">{</span> <span id="L18" class="LineNr">18 </span> compare j, <span class="Constant">0</span> <span id="L19" class="LineNr">19 </span> <span class="PreProc">break-if-<</span> -<span id="L20" class="LineNr">20 </span> <span class="PreProc">var</span> i/<span class="Constant">eax</span>: int <span class="Special"><-</span> copy <span class="Constant">0</span> +<span id="L20" class="LineNr">20 </span> <span class="PreProc">var</span> i/<span class="muRegEax">eax</span>: int <span class="Special"><-</span> copy <span class="Constant">0</span> <span id="L21" class="LineNr">21 </span> <span class="Delimiter">{</span> <span id="L22" class="LineNr">22 </span> compare i, <span class="Constant">0xff</span> <span id="L23" class="LineNr">23 </span> <span class="PreProc">break-if-></span> @@ -84,7 +89,7 @@ if ('onhashchange' in window) { <span id="L25" class="LineNr">25 </span> <span class="muComment"># compute r</span> <span id="L26" class="LineNr">26 </span> <span class="PreProc">var</span> tmp/<span class="Constant">xmm0</span>: float <span class="Special"><-</span> convert i <span id="L27" class="LineNr">27 </span> tmp <span class="Special"><-</span> divide image-size -<span id="L28" class="LineNr">28 </span> <span class="PreProc">var</span> r-addr/<span class="Constant">edx</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, r +<span id="L28" class="LineNr">28 </span> <span class="PreProc">var</span> r-addr/<span class="muRegEdx">edx</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, r <span id="L29" class="LineNr">29 </span> copy-to *r-addr, tmp <span id="L30" class="LineNr">30 </span><span class="CommentedCode">#? var tmp2/ebx: int <- reinterpret *r-addr</span> <span id="L31" class="LineNr">31 </span><span class="CommentedCode">#? print-int32-hex 0, tmp2</span> @@ -92,13 +97,13 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr">33 </span> <span class="muComment"># compute g</span> <span id="L34" class="LineNr">34 </span> tmp <span class="Special"><-</span> convert j <span id="L35" class="LineNr">35 </span> tmp <span class="Special"><-</span> divide image-size -<span id="L36" class="LineNr">36 </span> <span class="PreProc">var</span> g-addr/<span class="Constant">edx</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, g +<span id="L36" class="LineNr">36 </span> <span class="PreProc">var</span> g-addr/<span class="muRegEdx">edx</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, g <span id="L37" class="LineNr">37 </span> copy-to *g-addr, tmp <span id="L38" class="LineNr">38 </span> <span class="muComment"># compute b</span> -<span id="L39" class="LineNr">39 </span> <span class="PreProc">var</span> b-addr/<span class="Constant">edx</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, b +<span id="L39" class="LineNr">39 </span> <span class="PreProc">var</span> b-addr/<span class="muRegEdx">edx</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, b <span id="L40" class="LineNr">40 </span> copy-to *b-addr, one-fourth <span id="L41" class="LineNr">41 </span> <span class="muComment"># emit</span> -<span id="L42" class="LineNr">42 </span> <span class="PreProc">var</span> c-addr/<span class="Constant">edx</span>: (addr rgb) <span class="Special"><-</span> address c +<span id="L42" class="LineNr">42 </span> <span class="PreProc">var</span> c-addr/<span class="muRegEdx">edx</span>: (addr rgb) <span class="Special"><-</span> address c <span id="L43" class="LineNr">43 </span> print-rgb <span class="Constant">0</span>, c-addr <span id="L44" class="LineNr">44 </span> i <span class="Special"><-</span> increment <span id="L45" class="LineNr">45 </span> <span class="PreProc">loop</span> @@ -118,14 +123,14 @@ if ('onhashchange' in window) { <span id="L59" class="LineNr">59 </span> <span id="L60" class="LineNr">60 </span><span class="muComment"># print translating to [0, 256)</span> <span id="L61" class="LineNr">61 </span><span class="PreProc">fn</span> <span class="muFunction">print-rgb</span> <a href='../405screen.mu.html#L9'>screen</a>: (addr <a href='../405screen.mu.html#L9'>screen</a>), _c: (addr rgb) <span class="Delimiter">{</span> -<span id="L62" class="LineNr">62 </span> <span class="PreProc">var</span> c/<span class="Constant">esi</span>: (addr rgb) <span class="Special"><-</span> copy _c -<span id="L63" class="LineNr">63 </span> <span class="PreProc">var</span> n/<span class="Constant">ecx</span>: int <span class="Special"><-</span> copy <span class="Constant">0xff</span> <span class="muComment"># turns out 255 works just as well as 255.999, which is lucky because we don't have floating-point literals</span> +<span id="L62" class="LineNr">62 </span> <span class="PreProc">var</span> c/<span class="muRegEsi">esi</span>: (addr rgb) <span class="Special"><-</span> copy _c +<span id="L63" class="LineNr">63 </span> <span class="PreProc">var</span> n/<span class="muRegEcx">ecx</span>: int <span class="Special"><-</span> copy <span class="Constant">0xff</span> <span class="muComment"># turns out 255 works just as well as 255.999, which is lucky because we don't have floating-point literals</span> <span id="L64" class="LineNr">64 </span> <span class="PreProc">var</span> xn/<span class="Constant">xmm1</span>: float <span class="Special"><-</span> convert n <span id="L65" class="LineNr">65 </span> <span class="muComment"># print 255 * c->r</span> <span id="L66" class="LineNr">66 </span> <span class="PreProc">var</span> result/<span class="Constant">xmm0</span>: float <span class="Special"><-</span> copy xn -<span id="L67" class="LineNr">67 </span> <span class="PreProc">var</span> src-addr/<span class="Constant">eax</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, r +<span id="L67" class="LineNr">67 </span> <span class="PreProc">var</span> src-addr/<span class="muRegEax">eax</span>: (addr float) <span class="Special"><-</span> <a href='../131table.subx.html#L26'>get</a> c, r <span id="L68" class="LineNr">68 </span> result <span class="Special"><-</span> multiply *src-addr -<span id="L69" class="LineNr">69 </span> <span class="PreProc">var</span> result-int/<span class="Constant">edx</span>: int <span class="Special"><-</span> convert result +<span id="L69" class="LineNr">69 </span> <span class="PreProc">var</span> result-int/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> convert result <span id="L70" class="LineNr">70 </span> <a href='../405screen.mu.html#L484'>print-int32-decimal</a> <a href='../405screen.mu.html#L9'>screen</a>, result-int <span id="L71" class="LineNr">71 </span> <a href='../405screen.mu.html#L169'>print-string</a> <a href='../405screen.mu.html#L9'>screen</a>, <span class="Constant">" "</span> <span id="L72" class="LineNr">72 </span> <span class="muComment"># print 255 * c->g</span> |