diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-02 12:49:15 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-02 13:09:23 -0800 |
commit | 39d718afcff131abf9c12f89357e7e387d7892d5 (patch) | |
tree | d7179a92c27871ec646661517e348957b9805a5f /html/subx/059read-byte.subx.html | |
parent | f44c595267ba1dc6b076340e300961c304904408 (diff) | |
download | mu-39d718afcff131abf9c12f89357e7e387d7892d5.tar.gz |
4816
Diffstat (limited to 'html/subx/059read-byte.subx.html')
-rw-r--r-- | html/subx/059read-byte.subx.html | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/html/subx/059read-byte.subx.html b/html/subx/059read-byte.subx.html index eb760dd4..c81434ac 100644 --- a/html/subx/059read-byte.subx.html +++ b/html/subx/059read-byte.subx.html @@ -23,6 +23,9 @@ body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: .LineNr { color:#444444; } .subxS1Comment { color:#2d8cff; } .SpecialChar { color: #ff0000; } +.subxFunction { color: #ff8700; } +.subxTest { color: #00af00; } +.subxMinorFunction { color: #875f5f; } .Constant { color:#00a0a0; } .CommentedCode { color: #6c6c6c; } .subxH1Comment { color:#00ffff; } @@ -104,7 +107,7 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr"> 41 </span> <span id="L42" class="LineNr"> 42 </span><span class="subxComment"># return next byte value in EAX, with top 3 bytes cleared.</span> <span id="L43" class="LineNr"> 43 </span><span class="subxComment"># On EOF, return 0xffffffff.</span> -<span id="L44" class="LineNr"> 44 </span>read-byte: <span class="subxComment"># f : (address buffered-file) -> byte/EAX</span> +<span id="L44" class="LineNr"> 44 </span><span class="subxFunction">read-byte</span>: <span class="subxComment"># f : (address buffered-file) -> byte/EAX</span> <span id="L45" class="LineNr"> 45 </span> <span class="subxS1Comment"># . prolog</span> <span id="L46" class="LineNr"> 46 </span> 55/push-EBP <span id="L47" class="LineNr"> 47 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> @@ -140,14 +143,14 @@ if ('onhashchange' in window) { <span id="L77" class="LineNr"> 77 </span> 75/jump-if-not-equal $read-byte:from-stream/disp8 <span id="L78" class="LineNr"> 78 </span> b8/copy-to-EAX 0xffffffff/imm32 <span id="L79" class="LineNr"> 79 </span> eb/jump $read-byte:end/disp8 -<span id="L80" class="LineNr"> 80 </span>$read-byte:from-stream: +<span id="L80" class="LineNr"> 80 </span><span class="Constant">$read-byte:from-stream</span>: <span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># reading from stream</span> <span id="L82" class="LineNr"> 82 </span> <span class="subxComment"># AL = f->data[f->read]</span> <span id="L83" class="LineNr"> 83 </span> 31/xor 3/mod/direct 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># clear EAX</span> <span id="L84" class="LineNr"> 84 </span> 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX <span class="CommentedCode"> . </span> 0/r32/AL 0x10/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(ESI+ECX+16) to AL</span> <span id="L85" class="LineNr"> 85 </span> <span class="subxComment"># ++f->read</span> <span id="L86" class="LineNr"> 86 </span> ff 0/subop/increment 1/mod/*+disp8 6/rm32/ESI <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># increment *(ESI+8)</span> -<span id="L87" class="LineNr"> 87 </span>$read-byte:end: +<span id="L87" class="LineNr"> 87 </span><span class="Constant">$read-byte:end</span>: <span id="L88" class="LineNr"> 88 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L89" class="LineNr"> 89 </span> 5e/pop-to-ESI <span id="L90" class="LineNr"> 90 </span> 59/pop-to-ECX @@ -161,7 +164,7 @@ if ('onhashchange' in window) { <span id="L98" class="LineNr"> 98 </span> <span id="L99" class="LineNr"> 99 </span><span class="subxH1Comment"># - tests</span> <span id="L100" class="LineNr">100 </span> -<span id="L101" class="LineNr">101 </span>test-read-byte-single: +<span id="L101" class="LineNr">101 </span><span class="subxTest">test-read-byte-single</span>: <span id="L102" class="LineNr">102 </span> <span class="subxH1Comment"># - check that read-byte returns first byte of 'file'</span> <span id="L103" class="LineNr">103 </span> <span class="subxComment"># setup</span> <span id="L104" class="LineNr">104 </span> <span class="subxS1Comment"># . clear-stream(_test-stream)</span> @@ -207,7 +210,7 @@ if ('onhashchange' in window) { <span id="L144" class="LineNr">144 </span> <span class="subxS1Comment"># . end</span> <span id="L145" class="LineNr">145 </span> c3/return <span id="L146" class="LineNr">146 </span> -<span id="L147" class="LineNr">147 </span>test-read-byte-multiple: +<span id="L147" class="LineNr">147 </span><span class="subxTest">test-read-byte-multiple</span>: <span id="L148" class="LineNr">148 </span> <span class="subxH1Comment"># - call read-byte twice, check that second call returns second byte</span> <span id="L149" class="LineNr">149 </span> <span class="subxComment"># setup</span> <span id="L150" class="LineNr">150 </span> <span class="subxS1Comment"># . clear-stream(_test-stream)</span> @@ -260,7 +263,7 @@ if ('onhashchange' in window) { <span id="L197" class="LineNr">197 </span> <span class="subxS1Comment"># . end</span> <span id="L198" class="LineNr">198 </span> c3/return <span id="L199" class="LineNr">199 </span> -<span id="L200" class="LineNr">200 </span>test-read-byte-end-of-file: +<span id="L200" class="LineNr">200 </span><span class="subxTest">test-read-byte-end-of-file</span>: <span id="L201" class="LineNr">201 </span> <span class="subxH1Comment"># - call read-byte on an empty 'file', check that it returns -1</span> <span id="L202" class="LineNr">202 </span> <span class="subxComment"># setup</span> <span id="L203" class="LineNr">203 </span> <span class="subxS1Comment"># . clear-stream(_test-stream)</span> @@ -300,7 +303,7 @@ if ('onhashchange' in window) { <span id="L237" class="LineNr">237 </span> <span id="L238" class="LineNr">238 </span>== data <span id="L239" class="LineNr">239 </span> -<span id="L240" class="LineNr">240 </span>_test-buffered-file: +<span id="L240" class="LineNr">240 </span><span class="subxMinorFunction">_test-buffered-file</span>: <span id="L241" class="LineNr">241 </span> <span class="subxComment"># file descriptor or (address stream)</span> <span id="L242" class="LineNr">242 </span> _test-stream/imm32 <span id="L243" class="LineNr">243 </span> <span class="subxComment"># current write index</span> |