diff options
Diffstat (limited to 'html/066write-int-hex.subx.html')
-rw-r--r-- | html/066write-int-hex.subx.html | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/html/066write-int-hex.subx.html b/html/066write-int-hex.subx.html index dac46129..0a68e432 100644 --- a/html/066write-int-hex.subx.html +++ b/html/066write-int-hex.subx.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - 066print-int.subx</title> +<title>Mu - 066write-int-hex.subx</title> <meta name="Generator" content="Vim/8.1"> <meta name="plugin-version" content="vim8.1_v1"> <meta name="syntax" content="none"> @@ -57,9 +57,9 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> -<a href='https://github.com/akkartik/mu/blob/master/066print-int.subx'>https://github.com/akkartik/mu/blob/master/066print-int.subx</a> +<a href='https://github.com/akkartik/mu/blob/master/066write-int-hex.subx'>https://github.com/akkartik/mu/blob/master/066write-int-hex.subx</a> <pre id='vimCodeElement'> -<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Print the (hex) textual representation of numbers.</span> +<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Write out the (hex) textual representation of numbers.</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span>== code <span id="L4" class="LineNr"> 4 </span><span class="subxComment"># instruction effective address register displacement immediate</span> @@ -90,7 +90,7 @@ if ('onhashchange' in window) { <span id="L29" class="LineNr"> 29 </span> c1/shift 5/subop/logic-right 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> 4/imm8 <span class="subxComment"># shift eax right by 4 bits, while padding zeroes</span> <span id="L30" class="LineNr"> 30 </span> 25/and-eax 0xf/imm32 <span id="L31" class="LineNr"> 31 </span> <span class="subxS1Comment"># . AL = to-hex-char(AL)</span> -<span id="L32" class="LineNr"> 32 </span> e8/call <a href='066print-int.subx.html#L9'>to-hex-char</a>/disp32 +<span id="L32" class="LineNr"> 32 </span> e8/call <a href='066write-int-hex.subx.html#L9'>to-hex-char</a>/disp32 <span id="L33" class="LineNr"> 33 </span> <span class="subxComment"># append-byte(f, AL)</span> <span id="L34" class="LineNr"> 34 </span> <span class="subxS2Comment"># . . push args</span> <span id="L35" class="LineNr"> 35 </span> 50/push-eax @@ -103,7 +103,7 @@ if ('onhashchange' in window) { <span id="L42" class="LineNr"> 42 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to eax</span> <span id="L43" class="LineNr"> 43 </span> 25/and-eax 0xf/imm32 <span id="L44" class="LineNr"> 44 </span> <span class="subxS1Comment"># . AL = to-hex-char(AL)</span> -<span id="L45" class="LineNr"> 45 </span> e8/call <a href='066print-int.subx.html#L9'>to-hex-char</a>/disp32 +<span id="L45" class="LineNr"> 45 </span> e8/call <a href='066write-int-hex.subx.html#L9'>to-hex-char</a>/disp32 <span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># append-byte(f, AL)</span> <span id="L47" class="LineNr"> 47 </span> <span class="subxS2Comment"># . . push args</span> <span id="L48" class="LineNr"> 48 </span> 50/push-eax @@ -135,7 +135,7 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span> 68/push 0xa/imm32 <span id="L75" class="LineNr"> 75 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L76" class="LineNr"> 76 </span> <span class="subxS2Comment"># . . call</span> -<span id="L77" class="LineNr"> 77 </span> e8/call <a href='066print-int.subx.html#L21'>append-byte-hex</a>/disp32 +<span id="L77" class="LineNr"> 77 </span> e8/call <a href='066write-int-hex.subx.html#L21'>append-byte-hex</a>/disp32 <span id="L78" class="LineNr"> 78 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L79" class="LineNr"> 79 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L80" class="LineNr"> 80 </span> <span class="subxComment"># check-stream-equal(_test-stream, "0a", msg)</span> @@ -151,7 +151,7 @@ if ('onhashchange' in window) { <span id="L90" class="LineNr"> 90 </span> c3/return <span id="L91" class="LineNr"> 91 </span> <span id="L92" class="LineNr"> 92 </span><span class="subxComment"># print the hex representation for the lowest byte of a number</span> -<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">print-byte-buffered</span>: <span class="subxComment"># f: (addr buffered-file), n: int</span> +<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">write-byte-hex-buffered</span>: <span class="subxComment"># f: (addr buffered-file), n: int</span> <span id="L94" class="LineNr"> 94 </span> <span class="subxS1Comment"># . prologue</span> <span id="L95" class="LineNr"> 95 </span> 55/push-ebp <span id="L96" class="LineNr"> 96 </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> @@ -162,7 +162,7 @@ if ('onhashchange' in window) { <span id="L101" class="LineNr">101 </span> c1/shift 5/subop/logic-right 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> 4/imm8 <span class="subxComment"># shift eax right by 4 bits, while padding zeroes</span> <span id="L102" class="LineNr">102 </span> 25/and-eax 0xf/imm32 <span id="L103" class="LineNr">103 </span> <span class="subxS1Comment"># . AL = to-hex-char(AL)</span> -<span id="L104" class="LineNr">104 </span> e8/call <a href='066print-int.subx.html#L9'>to-hex-char</a>/disp32 +<span id="L104" class="LineNr">104 </span> e8/call <a href='066write-int-hex.subx.html#L9'>to-hex-char</a>/disp32 <span id="L105" class="LineNr">105 </span> <span class="subxComment"># write-byte-buffered(f, AL)</span> <span id="L106" class="LineNr">106 </span> <span class="subxS2Comment"># . . push args</span> <span id="L107" class="LineNr">107 </span> 50/push-eax @@ -175,7 +175,7 @@ if ('onhashchange' in window) { <span id="L114" class="LineNr">114 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to eax</span> <span id="L115" class="LineNr">115 </span> 25/and-eax 0xf/imm32 <span id="L116" class="LineNr">116 </span> <span class="subxS1Comment"># . AL = to-hex-char(AL)</span> -<span id="L117" class="LineNr">117 </span> e8/call <a href='066print-int.subx.html#L9'>to-hex-char</a>/disp32 +<span id="L117" class="LineNr">117 </span> e8/call <a href='066write-int-hex.subx.html#L9'>to-hex-char</a>/disp32 <span id="L118" class="LineNr">118 </span> <span class="subxComment"># write-byte-buffered(f, AL)</span> <span id="L119" class="LineNr">119 </span> <span class="subxS2Comment"># . . push args</span> <span id="L120" class="LineNr">120 </span> 50/push-eax @@ -184,7 +184,7 @@ if ('onhashchange' in window) { <span id="L123" class="LineNr">123 </span> e8/call <a href='064write-byte.subx.html#L33'>write-byte-buffered</a>/disp32 <span id="L124" class="LineNr">124 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L125" class="LineNr">125 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> -<span id="L126" class="LineNr">126 </span><span class="Constant">$print-byte-buffered:end</span>: +<span id="L126" class="LineNr">126 </span><span class="Constant">$write-byte-hex-buffered:end</span>: <span id="L127" class="LineNr">127 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L128" class="LineNr">128 </span> 58/pop-to-eax <span id="L129" class="LineNr">129 </span> <span class="subxS1Comment"># . epilogue</span> @@ -192,8 +192,8 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </span> 5d/pop-to-ebp <span id="L132" class="LineNr">132 </span> c3/return <span id="L133" class="LineNr">133 </span> -<span id="L134" class="LineNr">134 </span><span class="subxTest">test-print-byte-buffered</span>: -<span id="L135" class="LineNr">135 </span> <span class="subxH1Comment"># - check that print-byte-buffered prints the hex textual representation</span> +<span id="L134" class="LineNr">134 </span><span class="subxTest">test-write-byte-hex-buffered</span>: +<span id="L135" class="LineNr">135 </span> <span class="subxH1Comment"># - check that write-byte-hex-buffered prints the hex textual representation</span> <span id="L136" class="LineNr">136 </span> <span class="subxComment"># setup</span> <span id="L137" class="LineNr">137 </span> <span class="subxS1Comment"># . clear-stream(_test-stream)</span> <span id="L138" class="LineNr">138 </span> <span class="subxS2Comment"># . . push args</span> @@ -209,12 +209,12 @@ if ('onhashchange' in window) { <span id="L148" class="LineNr">148 </span> e8/call <a href='055stream.subx.html#L17'>clear-stream</a>/disp32 <span id="L149" class="LineNr">149 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L150" class="LineNr">150 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esp</span> -<span id="L151" class="LineNr">151 </span> <span class="subxComment"># print-byte-buffered(_test-buffered-file, 0xa) # exercises digit, non-digit as well as leading zero</span> +<span id="L151" class="LineNr">151 </span> <span class="subxComment"># write-byte-hex-buffered(_test-buffered-file, 0xa) # exercises digit, non-digit as well as leading zero</span> <span id="L152" class="LineNr">152 </span> <span class="subxS2Comment"># . . push args</span> <span id="L153" class="LineNr">153 </span> 68/push 0xa/imm32 <span id="L154" class="LineNr">154 </span> 68/push <a href='061read-byte.subx.html#L274'>_test-buffered-file</a>/imm32 <span id="L155" class="LineNr">155 </span> <span class="subxS2Comment"># . . call</span> -<span id="L156" class="LineNr">156 </span> e8/call <a href='066print-int.subx.html#L93'>print-byte-buffered</a>/disp32 +<span id="L156" class="LineNr">156 </span> e8/call <a href='066write-int-hex.subx.html#L93'>write-byte-hex-buffered</a>/disp32 <span id="L157" class="LineNr">157 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L158" class="LineNr">158 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L159" class="LineNr">159 </span> <span class="subxComment"># flush(_test-buffered-file)</span> @@ -226,7 +226,7 @@ if ('onhashchange' in window) { <span id="L165" class="LineNr">165 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esp</span> <span id="L166" class="LineNr">166 </span> <span class="subxComment"># check-stream-equal(_test-stream, "0a", msg)</span> <span id="L167" class="LineNr">167 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L168" class="LineNr">168 </span> 68/push <span class="Constant">"F - test-print-byte-buffered"</span>/imm32 +<span id="L168" class="LineNr">168 </span> 68/push <span class="Constant">"F - test-write-byte-hex-buffered"</span>/imm32 <span id="L169" class="LineNr">169 </span> 68/push <span class="Constant">"0a"</span>/imm32 <span id="L170" class="LineNr">170 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L171" class="LineNr">171 </span> <span class="subxS2Comment"># . . call</span> @@ -236,7 +236,7 @@ if ('onhashchange' in window) { <span id="L175" class="LineNr">175 </span> <span class="subxS1Comment"># . end</span> <span id="L176" class="LineNr">176 </span> c3/return <span id="L177" class="LineNr">177 </span> -<span id="L178" class="LineNr">178 </span><span class="subxFunction">print-int32</span>: <span class="subxComment"># f: (addr stream byte), n: int</span> +<span id="L178" class="LineNr">178 </span><span class="subxFunction">write-int32-hex</span>: <span class="subxComment"># f: (addr stream byte), n: int</span> <span id="L179" class="LineNr">179 </span> <span class="subxComment"># pseudocode:</span> <span id="L180" class="LineNr">180 </span> <span class="subxComment"># write(f, "0x")</span> <span id="L181" class="LineNr">181 </span> <span class="subxComment"># ecx = 28</span> @@ -255,7 +255,7 @@ if ('onhashchange' in window) { <span id="L194" class="LineNr">194 </span> 51/push-ecx <span id="L195" class="LineNr">195 </span> <span class="subxComment"># ecx = 28</span> <span id="L196" class="LineNr">196 </span> b9/copy-to-ecx 0x1c/imm32 -<span id="L197" class="LineNr">197 </span><span class="Constant">$print-int32:print-hex-prefix</span>: +<span id="L197" class="LineNr">197 </span><span class="Constant">$write-int32-hex:hex-prefix</span>: <span id="L198" class="LineNr">198 </span> <span class="subxComment"># write(f, "0x")</span> <span id="L199" class="LineNr">199 </span> <span class="subxS2Comment"># . . push args</span> <span id="L200" class="LineNr">200 </span> 68/push <span class="Constant">"0x"</span>/imm32 @@ -264,16 +264,16 @@ if ('onhashchange' in window) { <span id="L203" class="LineNr">203 </span> e8/call <a href='057write.subx.html#L24'>write</a>/disp32 <span id="L204" class="LineNr">204 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L205" class="LineNr">205 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> -<span id="L206" class="LineNr">206 </span><span class="Constant">$print-int32:loop</span>: +<span id="L206" class="LineNr">206 </span><span class="Constant">$write-int32-hex:loop</span>: <span id="L207" class="LineNr">207 </span> <span class="subxComment"># if (ecx < 0) break</span> <span id="L208" class="LineNr">208 </span> 81 7/subop/compare 3/mod/direct 1/rm32/ecx <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"># compare ecx</span> -<span id="L209" class="LineNr">209 </span> 7c/jump-if-< $print-int32:end/disp8 +<span id="L209" class="LineNr">209 </span> 7c/jump-if-< $write-int32-hex:end/disp8 <span id="L210" class="LineNr">210 </span> <span class="subxComment"># eax = n >> ecx</span> <span id="L211" class="LineNr">211 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to eax</span> <span id="L212" class="LineNr">212 </span> d3/>>ecx 5/subop/pad-zeroes 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> <span class="Normal"> . </span> <span class="subxComment"># shift eax right by ecx bits, padding zeroes</span> <span id="L213" class="LineNr">213 </span> <span class="subxComment"># eax = to-hex-char(AL)</span> <span id="L214" class="LineNr">214 </span> 25/and-eax 0xf/imm32 -<span id="L215" class="LineNr">215 </span> e8/call <a href='066print-int.subx.html#L9'>to-hex-char</a>/disp32 +<span id="L215" class="LineNr">215 </span> e8/call <a href='066write-int-hex.subx.html#L9'>to-hex-char</a>/disp32 <span id="L216" class="LineNr">216 </span> <span class="subxComment"># append-byte(f, AL)</span> <span id="L217" class="LineNr">217 </span> <span class="subxS2Comment"># . . push args</span> <span id="L218" class="LineNr">218 </span> 50/push-eax @@ -284,8 +284,8 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L224" class="LineNr">224 </span> <span class="subxComment"># ecx -= 4</span> <span id="L225" class="LineNr">225 </span> 81 5/subop/subtract 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># subtract from ecx</span> -<span id="L226" class="LineNr">226 </span> eb/jump $print-int32:<span class="Constant">loop</span>/disp8 -<span id="L227" class="LineNr">227 </span><span class="Constant">$print-int32:end</span>: +<span id="L226" class="LineNr">226 </span> eb/jump $write-int32-hex:<span class="Constant">loop</span>/disp8 +<span id="L227" class="LineNr">227 </span><span class="Constant">$write-int32-hex:end</span>: <span id="L228" class="LineNr">228 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L229" class="LineNr">229 </span> 59/pop-to-ecx <span id="L230" class="LineNr">230 </span> 58/pop-to-eax @@ -294,8 +294,8 @@ if ('onhashchange' in window) { <span id="L233" class="LineNr">233 </span> 5d/pop-to-ebp <span id="L234" class="LineNr">234 </span> c3/return <span id="L235" class="LineNr">235 </span> -<span id="L236" class="LineNr">236 </span><span class="subxTest">test-print-int32</span>: -<span id="L237" class="LineNr">237 </span> <span class="subxH1Comment"># - check that print-int32 prints the hex textual representation</span> +<span id="L236" class="LineNr">236 </span><span class="subxTest">test-write-int32-hex</span>: +<span id="L237" class="LineNr">237 </span> <span class="subxH1Comment"># - check that write-int32-hex prints the hex textual representation</span> <span id="L238" class="LineNr">238 </span> <span class="subxComment"># setup</span> <span id="L239" class="LineNr">239 </span> <span class="subxS1Comment"># . clear-stream(_test-stream)</span> <span id="L240" class="LineNr">240 </span> <span class="subxS2Comment"># . . push args</span> @@ -304,17 +304,17 @@ if ('onhashchange' in window) { <span id="L243" class="LineNr">243 </span> e8/call <a href='055stream.subx.html#L17'>clear-stream</a>/disp32 <span id="L244" class="LineNr">244 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L245" class="LineNr">245 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esp</span> -<span id="L246" class="LineNr">246 </span> <span class="subxComment"># print-int32(_test-stream, 0x8899aa)</span> +<span id="L246" class="LineNr">246 </span> <span class="subxComment"># write-int32-hex(_test-stream, 0x8899aa)</span> <span id="L247" class="LineNr">247 </span> <span class="subxS2Comment"># . . push args</span> <span id="L248" class="LineNr">248 </span> 68/push 0x8899aa/imm32 <span id="L249" class="LineNr">249 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L250" class="LineNr">250 </span> <span class="subxS2Comment"># . . call</span> -<span id="L251" class="LineNr">251 </span> e8/call <a href='066print-int.subx.html#L178'>print-int32</a>/disp32 +<span id="L251" class="LineNr">251 </span> e8/call <a href='066write-int-hex.subx.html#L178'>write-int32-hex</a>/disp32 <span id="L252" class="LineNr">252 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L253" class="LineNr">253 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L254" class="LineNr">254 </span> <span class="subxComment"># check-stream-equal(_test-stream, "0x008899aa", msg)</span> <span id="L255" class="LineNr">255 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L256" class="LineNr">256 </span> 68/push <span class="Constant">"F - test-print-int32"</span>/imm32 +<span id="L256" class="LineNr">256 </span> 68/push <span class="Constant">"F - test-write-int32-hex"</span>/imm32 <span id="L257" class="LineNr">257 </span> 68/push <span class="Constant">"0x008899aa"</span>/imm32 <span id="L258" class="LineNr">258 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L259" class="LineNr">259 </span> <span class="subxS2Comment"># . . call</span> @@ -324,7 +324,7 @@ if ('onhashchange' in window) { <span id="L263" class="LineNr">263 </span> <span class="subxS1Comment"># . end</span> <span id="L264" class="LineNr">264 </span> c3/return <span id="L265" class="LineNr">265 </span> -<span id="L266" class="LineNr">266 </span><span class="subxFunction">print-int32-buffered</span>: <span class="subxComment"># f: (addr buffered-file), n: int</span> +<span id="L266" class="LineNr">266 </span><span class="subxFunction">write-int32-hex-buffered</span>: <span class="subxComment"># f: (addr buffered-file), n: int</span> <span id="L267" class="LineNr">267 </span> <span class="subxComment"># pseudocode:</span> <span id="L268" class="LineNr">268 </span> <span class="subxComment"># write-buffered(f, "0x")</span> <span id="L269" class="LineNr">269 </span> <span class="subxComment"># ecx = 28</span> @@ -343,7 +343,7 @@ if ('onhashchange' in window) { <span id="L282" class="LineNr">282 </span> 51/push-ecx <span id="L283" class="LineNr">283 </span> <span class="subxComment"># ecx = 28</span> <span id="L284" class="LineNr">284 </span> b9/copy-to-ecx 0x1c/imm32 -<span id="L285" class="LineNr">285 </span><span class="Constant">$print-int32-buffered:print-hex-prefix</span>: +<span id="L285" class="LineNr">285 </span><span class="Constant">$write-int32-hex-buffered:hex-prefix</span>: <span id="L286" class="LineNr">286 </span> <span class="subxComment"># write-buffered(f, "0x")</span> <span id="L287" class="LineNr">287 </span> <span class="subxS2Comment"># . . push args</span> <span id="L288" class="LineNr">288 </span> 68/push <span class="Constant">"0x"</span>/imm32 @@ -352,16 +352,16 @@ if ('onhashchange' in window) { <span id="L291" class="LineNr">291 </span> e8/call <a href='065write-buffered.subx.html#L8'>write-buffered</a>/disp32 <span id="L292" class="LineNr">292 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L293" class="LineNr">293 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> -<span id="L294" class="LineNr">294 </span><span class="Constant">$print-int32-buffered:loop</span>: +<span id="L294" class="LineNr">294 </span><span class="Constant">$write-int32-hex-buffered:loop</span>: <span id="L295" class="LineNr">295 </span> <span class="subxComment"># if (ecx < 0) break</span> <span id="L296" class="LineNr">296 </span> 81 7/subop/compare 3/mod/direct 1/rm32/ecx <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"># compare ecx</span> -<span id="L297" class="LineNr">297 </span> 7c/jump-if-< $print-int32-buffered:end/disp8 +<span id="L297" class="LineNr">297 </span> 7c/jump-if-< $write-int32-hex-buffered:end/disp8 <span id="L298" class="LineNr">298 </span> <span class="subxComment"># eax = n >> ecx</span> <span id="L299" class="LineNr">299 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to eax</span> <span id="L300" class="LineNr">300 </span> d3/>>ecx 5/subop/pad-zeroes 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> <span class="Normal"> . </span> <span class="subxComment"># shift eax right by ecx bits, padding zeroes</span> <span id="L301" class="LineNr">301 </span> <span class="subxComment"># eax = to-hex-char(AL)</span> <span id="L302" class="LineNr">302 </span> 25/and-eax 0xf/imm32 -<span id="L303" class="LineNr">303 </span> e8/call <a href='066print-int.subx.html#L9'>to-hex-char</a>/disp32 +<span id="L303" class="LineNr">303 </span> e8/call <a href='066write-int-hex.subx.html#L9'>to-hex-char</a>/disp32 <span id="L304" class="LineNr">304 </span> <span class="subxComment"># write-byte-buffered(f, AL)</span> <span id="L305" class="LineNr">305 </span> <span class="subxS2Comment"># . . push args</span> <span id="L306" class="LineNr">306 </span> 50/push-eax @@ -372,8 +372,8 @@ if ('onhashchange' in window) { <span id="L311" class="LineNr">311 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L312" class="LineNr">312 </span> <span class="subxComment"># ecx -= 4</span> <span id="L313" class="LineNr">313 </span> 81 5/subop/subtract 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># subtract from ecx</span> -<span id="L314" class="LineNr">314 </span> eb/jump $print-int32-buffered:<span class="Constant">loop</span>/disp8 -<span id="L315" class="LineNr">315 </span><span class="Constant">$print-int32-buffered:end</span>: +<span id="L314" class="LineNr">314 </span> eb/jump $write-int32-hex-buffered:<span class="Constant">loop</span>/disp8 +<span id="L315" class="LineNr">315 </span><span class="Constant">$write-int32-hex-buffered:end</span>: <span id="L316" class="LineNr">316 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L317" class="LineNr">317 </span> 59/pop-to-ecx <span id="L318" class="LineNr">318 </span> 58/pop-to-eax @@ -382,8 +382,8 @@ if ('onhashchange' in window) { <span id="L321" class="LineNr">321 </span> 5d/pop-to-ebp <span id="L322" class="LineNr">322 </span> c3/return <span id="L323" class="LineNr">323 </span> -<span id="L324" class="LineNr">324 </span><span class="subxTest">test-print-int32-buffered</span>: -<span id="L325" class="LineNr">325 </span> <span class="subxH1Comment"># - check that print-int32-buffered prints the hex textual representation</span> +<span id="L324" class="LineNr">324 </span><span class="subxTest">test-write-int32-hex-buffered</span>: +<span id="L325" class="LineNr">325 </span> <span class="subxH1Comment"># - check that write-int32-hex-buffered prints the hex textual representation</span> <span id="L326" class="LineNr">326 </span> <span class="subxComment"># setup</span> <span id="L327" class="LineNr">327 </span> <span class="subxS1Comment"># . clear-stream(_test-stream)</span> <span id="L328" class="LineNr">328 </span> <span class="subxS2Comment"># . . push args</span> @@ -399,12 +399,12 @@ if ('onhashchange' in window) { <span id="L338" class="LineNr">338 </span> e8/call <a href='055stream.subx.html#L17'>clear-stream</a>/disp32 <span id="L339" class="LineNr">339 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L340" class="LineNr">340 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esp</span> -<span id="L341" class="LineNr">341 </span> <span class="subxComment"># print-int32-buffered(_test-buffered-file, 0x8899aa)</span> +<span id="L341" class="LineNr">341 </span> <span class="subxComment"># write-int32-hex-buffered(_test-buffered-file, 0x8899aa)</span> <span id="L342" class="LineNr">342 </span> <span class="subxS2Comment"># . . push args</span> <span id="L343" class="LineNr">343 </span> 68/push 0x8899aa/imm32 <span id="L344" class="LineNr">344 </span> 68/push <a href='061read-byte.subx.html#L274'>_test-buffered-file</a>/imm32 <span id="L345" class="LineNr">345 </span> <span class="subxS2Comment"># . . call</span> -<span id="L346" class="LineNr">346 </span> e8/call <a href='066print-int.subx.html#L266'>print-int32-buffered</a>/disp32 +<span id="L346" class="LineNr">346 </span> e8/call <a href='066write-int-hex.subx.html#L266'>write-int32-hex-buffered</a>/disp32 <span id="L347" class="LineNr">347 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L348" class="LineNr">348 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L349" class="LineNr">349 </span> <span class="subxComment"># flush(_test-buffered-file)</span> @@ -417,7 +417,7 @@ if ('onhashchange' in window) { <span id="L356" class="Folded">356 </span><span class="Folded">+-- 18 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------</span> <span id="L374" class="LineNr">374 </span> <span class="subxComment"># check-stream-equal(_test-stream, "0x008899aa", msg)</span> <span id="L375" class="LineNr">375 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L376" class="LineNr">376 </span> 68/push <span class="Constant">"F - test-print-int32-buffered"</span>/imm32 +<span id="L376" class="LineNr">376 </span> 68/push <span class="Constant">"F - test-write-int32-hex-buffered"</span>/imm32 <span id="L377" class="LineNr">377 </span> 68/push <span class="Constant">"0x008899aa"</span>/imm32 <span id="L378" class="LineNr">378 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L379" class="LineNr">379 </span> <span class="subxS2Comment"># . . call</span> |