diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-06-26 20:55:36 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-06-26 20:55:36 -0700 |
commit | 372367f59a897162912d0646158bdea1e07d6e66 (patch) | |
tree | 16cd7f70de3505f35fbc86ed2b7d3810cab0d148 /html/life.mu.html | |
parent | dc5a0acf3feea227d03a98cedf427d2aef462320 (diff) | |
download | mu-372367f59a897162912d0646158bdea1e07d6e66.tar.gz |
html: better highlighting for int registers
Diffstat (limited to 'html/life.mu.html')
-rw-r--r-- | html/life.mu.html | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/html/life.mu.html b/html/life.mu.html index 147fccd1..e08e9f9f 100644 --- a/html/life.mu.html +++ b/html/life.mu.html @@ -14,20 +14,19 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #ffffd7; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } +.PreProc { color: #c000c0; } +.muRegEdx { color: #af5f00; } +.Special { color: #ff6060; } .LineNr { } -.Delimiter { color: #c000c0; } -.CommentedCode { color: #8a8a8a; } -.muRegEsi { color: #87d787; } -.muRegEdi { color: #87ffd7; } +.muRegEsi { color: #005faf; } +.muRegEbx { color: #5f00ff; } .Constant { color: #008787; } -.Special { color: #ff6060; } -.PreProc { color: #c000c0; } +.muRegEdi { color: #00af00; } +.muRegEcx { color: #870000; } +.Delimiter { color: #c000c0; } .muFunction { color: #af5f00; text-decoration: underline; } +.CommentedCode { color: #8a8a8a; } .muComment { color: #005faf; } -.muRegEax { color: #875f00; } -.muRegEcx { color: #af875f; } -.muRegEdx { color: #878700; } -.muRegEbx { color: #8787af; } --> </style> @@ -70,7 +69,7 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span><span class="muComment"># To run:</span> <span id="L6" class="LineNr"> 6 </span><span class="muComment"># $ qemu-system-i386 code.img</span> <span id="L7" class="LineNr"> 7 </span> -<span id="L8" class="LineNr"> 8 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='life.mu.html#L8'>state</a></span> _grid: (addr array boolean), x: int, y: int<span class="PreProc"> -> </span>_/<span class="muRegEax">eax</span>: boolean <span class="Delimiter">{</span> +<span id="L8" class="LineNr"> 8 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='life.mu.html#L8'>state</a></span> _grid: (addr array boolean), x: int, y: int<span class="PreProc"> -> </span>_/eax: boolean <span class="Delimiter">{</span> <span id="L9" class="LineNr"> 9 </span> <span class="muComment"># clip at the edge</span> <span id="L10" class="LineNr"> 10 </span> compare x, <span class="Constant">0</span> <span id="L11" class="LineNr"> 11 </span> <span class="Delimiter">{</span> @@ -92,31 +91,31 @@ if ('onhashchange' in window) { <span id="L27" class="LineNr"> 27 </span> <span class="PreProc">break-if-<</span> <span id="L28" class="LineNr"> 28 </span> <span class="PreProc">return</span> <span class="Constant">0</span>/false <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">}</span> -<span id="L30" class="LineNr"> 30 </span> <span class="PreProc">var</span> idx/<span class="muRegEax">eax</span>: int <span class="Special"><-</span> copy y +<span id="L30" class="LineNr"> 30 </span> <span class="PreProc">var</span> idx/eax: int <span class="Special"><-</span> copy y <span id="L31" class="LineNr"> 31 </span> idx <span class="Special"><-</span> shift-left <span class="Constant">8</span>/log2width <span id="L32" class="LineNr"> 32 </span> idx <span class="Special"><-</span> add x <span id="L33" class="LineNr"> 33 </span> <span class="PreProc">var</span> grid/<span class="muRegEsi">esi</span>: (addr array boolean) <span class="Special"><-</span> copy _grid -<span id="L34" class="LineNr"> 34 </span> <span class="PreProc">var</span> result/<span class="muRegEax">eax</span>: (addr boolean) <span class="Special"><-</span> index grid, idx +<span id="L34" class="LineNr"> 34 </span> <span class="PreProc">var</span> result/eax: (addr boolean) <span class="Special"><-</span> index grid, idx <span id="L35" class="LineNr"> 35 </span> <span class="PreProc">return</span> *result <span id="L36" class="LineNr"> 36 </span><span class="Delimiter">}</span> <span id="L37" class="LineNr"> 37 </span> <span id="L38" class="LineNr"> 38 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='life.mu.html#L38'>set-state</a></span> _grid: (addr array boolean), x: int, y: int, val: boolean <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> <span class="muComment"># don't bother checking bounds</span> -<span id="L40" class="LineNr"> 40 </span> <span class="PreProc">var</span> idx/<span class="muRegEax">eax</span>: int <span class="Special"><-</span> copy y +<span id="L40" class="LineNr"> 40 </span> <span class="PreProc">var</span> idx/eax: int <span class="Special"><-</span> copy y <span id="L41" class="LineNr"> 41 </span> idx <span class="Special"><-</span> shift-left <span class="Constant">8</span>/log2width <span id="L42" class="LineNr"> 42 </span> idx <span class="Special"><-</span> add x <span id="L43" class="LineNr"> 43 </span> <span class="PreProc">var</span> grid/<span class="muRegEsi">esi</span>: (addr array boolean) <span class="Special"><-</span> copy _grid -<span id="L44" class="LineNr"> 44 </span> <span class="PreProc">var</span> result/<span class="muRegEax">eax</span>: (addr boolean) <span class="Special"><-</span> index grid, idx +<span id="L44" class="LineNr"> 44 </span> <span class="PreProc">var</span> result/eax: (addr boolean) <span class="Special"><-</span> index grid, idx <span id="L45" class="LineNr"> 45 </span> <span class="PreProc">var</span> src/<span class="muRegEcx">ecx</span>: boolean <span class="Special"><-</span> copy val <span id="L46" class="LineNr"> 46 </span> copy-to *result, src <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">}</span> <span id="L48" class="LineNr"> 48 </span> -<span id="L49" class="LineNr"> 49 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='life.mu.html#L49'>num-live-neighbors</a></span> grid: (addr array boolean), x: int, y: int<span class="PreProc"> -> </span>_/<span class="muRegEax">eax</span>: int <span class="Delimiter">{</span> +<span id="L49" class="LineNr"> 49 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='life.mu.html#L49'>num-live-neighbors</a></span> grid: (addr array boolean), x: int, y: int<span class="PreProc"> -> </span>_/eax: int <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> <span class="PreProc">var</span> result/<span class="muRegEdi">edi</span>: int <span class="Special"><-</span> copy <span class="Constant">0</span> <span id="L51" class="LineNr"> 51 </span> <span class="muComment"># row above: zig</span> <span id="L52" class="LineNr"> 52 </span> decrement y <span id="L53" class="LineNr"> 53 </span> decrement x -<span id="L54" class="LineNr"> 54 </span> <span class="PreProc">var</span> s/<span class="muRegEax">eax</span>: boolean <span class="Special"><-</span> <a href='life.mu.html#L8'>state</a> grid, x, y +<span id="L54" class="LineNr"> 54 </span> <span class="PreProc">var</span> s/eax: boolean <span class="Special"><-</span> <a href='life.mu.html#L8'>state</a> grid, x, y <span id="L55" class="LineNr"> 55 </span> <span class="Delimiter">{</span> <span id="L56" class="LineNr"> 56 </span> compare s, <span class="Constant">0</span>/false <span id="L57" class="LineNr"> 57 </span> <span class="PreProc">break-if-=</span> @@ -185,7 +184,7 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span> <span class="Delimiter">{</span> <span id="L121" class="LineNr">121 </span> compare x, <span class="Constant">0x100</span>/width <span id="L122" class="LineNr">122 </span> <span class="PreProc">break-if->=</span> -<span id="L123" class="LineNr">123 </span> <span class="PreProc">var</span> n/<span class="muRegEax">eax</span>: int <span class="Special"><-</span> <a href='life.mu.html#L49'>num-live-neighbors</a> old-grid, x, y +<span id="L123" class="LineNr">123 </span> <span class="PreProc">var</span> n/eax: int <span class="Special"><-</span> <a href='life.mu.html#L49'>num-live-neighbors</a> old-grid, x, y <span id="L124" class="LineNr">124 </span> <span class="muComment"># if neighbors < 2, die of loneliness</span> <span id="L125" class="LineNr">125 </span> <span class="Delimiter">{</span> <span id="L126" class="LineNr">126 </span> compare n, <span class="Constant">2</span> @@ -202,7 +201,7 @@ if ('onhashchange' in window) { <span id="L137" class="LineNr">137 </span> <span class="Delimiter">{</span> <span id="L138" class="LineNr">138 </span> compare n, <span class="Constant">2</span> <span id="L139" class="LineNr">139 </span> <span class="PreProc">break-if-!=</span> -<span id="L140" class="LineNr">140 </span> <span class="PreProc">var</span> old-state/<span class="muRegEax">eax</span>: boolean <span class="Special"><-</span> <a href='life.mu.html#L8'>state</a> old-grid, x, y +<span id="L140" class="LineNr">140 </span> <span class="PreProc">var</span> old-state/eax: boolean <span class="Special"><-</span> <a href='life.mu.html#L8'>state</a> old-grid, x, y <span id="L141" class="LineNr">141 </span> <a href='life.mu.html#L38'>set-state</a> new-grid, x, y, old-state <span id="L142" class="LineNr">142 </span> <span class="Delimiter">}</span> <span id="L143" class="LineNr">143 </span> <span class="muComment"># if neighbors = 3, cell quickens to life</span> @@ -231,7 +230,7 @@ if ('onhashchange' in window) { <span id="L166" class="LineNr">166 </span> compare y, ymax <span id="L167" class="LineNr">167 </span> <span class="PreProc">break-if->=</span> <span id="L168" class="LineNr">168 </span> <span class="Delimiter">{</span> -<span id="L169" class="LineNr">169 </span> <span class="PreProc">var</span> x/<span class="muRegEax">eax</span>: int <span class="Special"><-</span> copy _x +<span id="L169" class="LineNr">169 </span> <span class="PreProc">var</span> x/eax: int <span class="Special"><-</span> copy _x <span id="L170" class="LineNr">170 </span> x <span class="Special"><-</span> shift-left <span class="Constant">2</span>/log2side <span id="L171" class="LineNr">171 </span> <span class="PreProc">var</span> xmax/<span class="muRegEcx">ecx</span>: int <span class="Special"><-</span> copy x <span id="L172" class="LineNr">172 </span> xmax <span class="Special"><-</span> add side @@ -257,7 +256,7 @@ if ('onhashchange' in window) { <span id="L192" class="LineNr">192 </span> <span class="Delimiter">{</span> <span id="L193" class="LineNr">193 </span> compare x, <span class="Constant">0x100</span>/width <span id="L194" class="LineNr">194 </span> <span class="PreProc">break-if->=</span> -<span id="L195" class="LineNr">195 </span> <span class="PreProc">var</span> <a href='life.mu.html#L8'>state</a>/<span class="muRegEax">eax</span>: boolean <span class="Special"><-</span> <a href='life.mu.html#L8'>state</a> grid, x, y +<span id="L195" class="LineNr">195 </span> <span class="PreProc">var</span> <a href='life.mu.html#L8'>state</a>/eax: boolean <span class="Special"><-</span> <a href='life.mu.html#L8'>state</a> grid, x, y <span id="L196" class="LineNr">196 </span> compare <a href='life.mu.html#L8'>state</a>, <span class="Constant">0</span>/false <span id="L197" class="LineNr">197 </span> <span class="Delimiter">{</span> <span id="L198" class="LineNr">198 </span> <span class="PreProc">break-if-=</span> @@ -284,14 +283,14 @@ if ('onhashchange' in window) { <span id="L219" class="LineNr">219 </span><span class="CommentedCode">#? var grid2/edi: (addr array boolean) <- address grid2-storage</span> <span id="L220" class="LineNr">220 </span> <span class="muComment"># allocate on the heap</span> <span id="L221" class="LineNr">221 </span> <span class="PreProc">var</span> grid1-storage: (handle array boolean) -<span id="L222" class="LineNr">222 </span> <span class="PreProc">var</span> grid1-ah/<span class="muRegEax">eax</span>: (addr handle array boolean) <span class="Special"><-</span> address grid1-storage +<span id="L222" class="LineNr">222 </span> <span class="PreProc">var</span> grid1-ah/eax: (addr handle array boolean) <span class="Special"><-</span> address grid1-storage <span id="L223" class="LineNr">223 </span> populate grid1-ah, <span class="Constant">0xc000</span> <span class="muComment"># width * height</span> -<span id="L224" class="LineNr">224 </span> <span class="PreProc">var</span> _grid1/<span class="muRegEax">eax</span>: (addr array boolean) <span class="Special"><-</span> <a href='120allocate.subx.html#L223'>lookup</a> *grid1-ah +<span id="L224" class="LineNr">224 </span> <span class="PreProc">var</span> _grid1/eax: (addr array boolean) <span class="Special"><-</span> <a href='120allocate.subx.html#L223'>lookup</a> *grid1-ah <span id="L225" class="LineNr">225 </span> <span class="PreProc">var</span> grid1/<span class="muRegEsi">esi</span>: (addr array boolean) <span class="Special"><-</span> copy _grid1 <span id="L226" class="LineNr">226 </span> <span class="PreProc">var</span> grid2-storage: (handle array boolean) -<span id="L227" class="LineNr">227 </span> <span class="PreProc">var</span> grid2-ah/<span class="muRegEax">eax</span>: (addr handle array boolean) <span class="Special"><-</span> address grid2-storage +<span id="L227" class="LineNr">227 </span> <span class="PreProc">var</span> grid2-ah/eax: (addr handle array boolean) <span class="Special"><-</span> address grid2-storage <span id="L228" class="LineNr">228 </span> populate grid2-ah, <span class="Constant">0xc000</span> <span class="muComment"># width * height</span> -<span id="L229" class="LineNr">229 </span> <span class="PreProc">var</span> _grid2/<span class="muRegEax">eax</span>: (addr array boolean) <span class="Special"><-</span> <a href='120allocate.subx.html#L223'>lookup</a> *grid2-ah +<span id="L229" class="LineNr">229 </span> <span class="PreProc">var</span> _grid2/eax: (addr array boolean) <span class="Special"><-</span> <a href='120allocate.subx.html#L223'>lookup</a> *grid2-ah <span id="L230" class="LineNr">230 </span> <span class="PreProc">var</span> grid2/<span class="muRegEdi">edi</span>: (addr array boolean) <span class="Special"><-</span> copy _grid2 <span id="L231" class="LineNr">231 </span> <span class="muComment"># initialize grid1</span> <span id="L232" class="LineNr">232 </span> <a href='life.mu.html#L38'>set-state</a> grid1, <span class="Constant">0x80</span>, <span class="Constant">0x5f</span>, <span class="Constant">1</span>/live @@ -302,7 +301,7 @@ if ('onhashchange' in window) { <span id="L237" class="LineNr">237 </span> <span class="muComment"># render grid1</span> <span id="L238" class="LineNr">238 </span> <a href='life.mu.html#L186'>render</a> grid1 <span id="L239" class="LineNr">239 </span> <span class="Delimiter">{</span> -<span id="L240" class="LineNr">240 </span> <span class="PreProc">var</span> key/<span class="muRegEax">eax</span>: byte <span class="Special"><-</span> <a href='102keyboard.subx.html#L21'>read-key</a> keyboard +<span id="L240" class="LineNr">240 </span> <span class="PreProc">var</span> key/eax: byte <span class="Special"><-</span> <a href='102keyboard.subx.html#L21'>read-key</a> keyboard <span id="L241" class="LineNr">241 </span> compare key, <span class="Constant">0</span> <span id="L242" class="LineNr">242 </span><span class="CommentedCode">#? loop-if-= # press key to step</span> <span id="L243" class="LineNr">243 </span> <span class="PreProc">break-if-!=</span> <span class="muComment"># press key to quit # comment this out to run under bochs; I'm not sure why there's a newline in the keyboard buffer</span> |