diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-01-27 00:39:46 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-01-27 00:39:46 -0800 |
commit | 2104d1a75b76dbffc0b15a96c98d94e7a16594e8 (patch) | |
tree | 2a839b86e76431a9bbe4bf155f7411171a26d7f8 /html/055stream.subx.html | |
parent | 71eb22a5bf94f5fa0a3c95212450e3c6a1a6a990 (diff) | |
download | mu-2104d1a75b76dbffc0b15a96c98d94e7a16594e8.tar.gz |
5925
Diffstat (limited to 'html/055stream.subx.html')
-rw-r--r-- | html/055stream.subx.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/html/055stream.subx.html b/html/055stream.subx.html index 7bd7705b..e08d690c 100644 --- a/html/055stream.subx.html +++ b/html/055stream.subx.html @@ -59,9 +59,9 @@ if ('onhashchange' in window) { <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># streams: data structure for operating on arrays in a stateful manner</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> <span id="L3" class="LineNr"> 3 </span><span class="subxComment"># A stream looks like this:</span> -<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># write : int # index at which writes go</span> -<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># read : int # index that we've read until</span> -<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># data : (array byte) # prefixed by length as usual</span> +<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># write: int # index at which writes go</span> +<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># read: int # index that we've read until</span> +<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># data: (array byte) # prefixed by length as usual</span> <span id="L7" class="LineNr"> 7 </span><span class="subxComment">#</span> <span id="L8" class="LineNr"> 8 </span><span class="subxComment"># some primitives for operating on streams:</span> <span id="L9" class="LineNr"> 9 </span><span class="subxComment"># - clear-stream (clears everything but the data length)</span> @@ -72,7 +72,7 @@ if ('onhashchange' in window) { <span id="L14" class="LineNr">14 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span> <span id="L15" class="LineNr">15 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span> <span id="L16" class="LineNr">16 </span> -<span id="L17" class="LineNr">17 </span><span class="subxFunction">clear-stream</span>: <span class="subxComment"># f : (addr stream byte)</span> +<span id="L17" class="LineNr">17 </span><span class="subxFunction">clear-stream</span>: <span class="subxComment"># f: (addr stream byte)</span> <span id="L18" class="LineNr">18 </span> <span class="subxS1Comment"># . prologue</span> <span id="L19" class="LineNr">19 </span> 55/push-ebp <span id="L20" class="LineNr">20 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span> @@ -81,15 +81,15 @@ if ('onhashchange' in window) { <span id="L23" class="LineNr">23 </span> 51/push-ecx <span id="L24" class="LineNr">24 </span> <span class="subxComment"># eax = f</span> <span id="L25" class="LineNr">25 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to eax</span> -<span id="L26" class="LineNr">26 </span> <span class="subxComment"># var count/ecx : int = f->length</span> +<span id="L26" class="LineNr">26 </span> <span class="subxComment"># var count/ecx: int = f->length</span> <span id="L27" class="LineNr">27 </span> 8b/copy 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(eax+8) to ecx</span> -<span id="L28" class="LineNr">28 </span> <span class="subxComment"># var max/ecx : (addr byte) = &f->data[f->length]</span> +<span id="L28" class="LineNr">28 </span> <span class="subxComment"># var max/ecx: (addr byte) = &f->data[f->length]</span> <span id="L29" class="LineNr">29 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy eax+ecx+12 to ecx</span> <span id="L30" class="LineNr">30 </span> <span class="subxComment"># f->write = 0</span> <span id="L31" class="LineNr">31 </span> c7 0/subop/copy 0/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/imm32 <span class="subxComment"># copy to *eax</span> <span id="L32" class="LineNr">32 </span> <span class="subxComment"># f->read = 0</span> <span id="L33" class="LineNr">33 </span> c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/disp8 0/imm32 <span class="subxComment"># copy to *(eax+4)</span> -<span id="L34" class="LineNr">34 </span> <span class="subxComment"># var curr/eax : (addr byte) = f->data</span> +<span id="L34" class="LineNr">34 </span> <span class="subxComment"># var curr/eax: (addr byte) = f->data</span> <span id="L35" class="LineNr">35 </span> 81 0/subop/add 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to eax</span> <span id="L36" class="LineNr">36 </span><span class="Constant">$clear-stream:loop</span>: <span id="L37" class="LineNr">37 </span> <span class="subxComment"># if (curr >= max) break</span> @@ -109,7 +109,7 @@ if ('onhashchange' in window) { <span id="L51" class="LineNr">51 </span> 5d/pop-to-ebp <span id="L52" class="LineNr">52 </span> c3/return <span id="L53" class="LineNr">53 </span> -<span id="L54" class="LineNr">54 </span><span class="subxFunction">rewind-stream</span>: <span class="subxComment"># f : (addr stream byte)</span> +<span id="L54" class="LineNr">54 </span><span class="subxFunction">rewind-stream</span>: <span class="subxComment"># f: (addr stream byte)</span> <span id="L55" class="LineNr">55 </span> <span class="subxS1Comment"># . prologue</span> <span id="L56" class="LineNr">56 </span> 55/push-ebp <span id="L57" class="LineNr">57 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span> |