diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-12-09 01:26:58 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-12-09 01:26:58 -0800 |
commit | 8aeb85f04ee68b960a6d326aca1a17dec2f6d019 (patch) | |
tree | 26f861361c28ca77fb8298b21a905dc6e06c91ef /html/075print-int-decimal.subx.html | |
parent | 2249e605c19f0dbe0c34c1c4f635b802f56dc535 (diff) | |
download | mu-8aeb85f04ee68b960a6d326aca1a17dec2f6d019.tar.gz |
5806
Diffstat (limited to 'html/075print-int-decimal.subx.html')
-rw-r--r-- | html/075print-int-decimal.subx.html | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/html/075print-int-decimal.subx.html b/html/075print-int-decimal.subx.html index ad8fbe98..f79f4d70 100644 --- a/html/075print-int-decimal.subx.html +++ b/html/075print-int-decimal.subx.html @@ -66,7 +66,7 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span> <span id="L6" class="LineNr"> 6 </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="L7" class="LineNr"> 7 </span> -<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">print-int32-decimal</span>: <span class="subxComment"># out : (address stream), n : int32</span> +<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">print-int32-decimal</span>: <span class="subxComment"># out : (address stream byte), n : int32</span> <span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># works by generating characters from lowest to highest and pushing them</span> <span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># to the stack, before popping them one by one into the stream</span> <span id="L11" class="LineNr"> 11 </span> <span class="subxComment">#</span> @@ -105,11 +105,11 @@ if ('onhashchange' in window) { <span id="L44" class="LineNr"> 44 </span> 52/push-edx <span id="L45" class="LineNr"> 45 </span> 53/push-ebx <span id="L46" class="LineNr"> 46 </span> 57/push-edi -<span id="L47" class="LineNr"> 47 </span> <span class="subxComment"># ten/ecx = 10</span> +<span id="L47" class="LineNr"> 47 </span> <span class="subxComment"># const ten/ecx = 10</span> <span id="L48" class="LineNr"> 48 </span> b9/copy-to-ecx 0xa/imm32 <span id="L49" class="LineNr"> 49 </span> <span class="subxComment"># push sentinel</span> <span id="L50" class="LineNr"> 50 </span> 68/push 0/imm32/sentinel -<span id="L51" class="LineNr"> 51 </span> <span class="subxComment"># eax = abs(n)</span> +<span id="L51" class="LineNr"> 51 </span> <span class="subxComment"># var eax : int = abs(n)</span> <span id="L52" class="LineNr"> 52 </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="L53" class="LineNr"> 53 </span> 3d/compare-eax-with 0/imm32 <span id="L54" class="LineNr"> 54 </span> 7d/jump-if-greater-or-equal $print-int32-decimal:read-loop/disp8 @@ -135,11 +135,11 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span><span class="Constant">$print-int32-decimal:<a href='057write.subx.html#L24'>write</a></span>: <span id="L75" class="LineNr"> 75 </span> <span class="subxComment"># edi = out</span> <span id="L76" class="LineNr"> 76 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span> -<span id="L77" class="LineNr"> 77 </span> <span class="subxComment"># w/edx = out->write</span> +<span id="L77" class="LineNr"> 77 </span> <span class="subxComment"># var w/edx : int = out->write</span> <span id="L78" class="LineNr"> 78 </span> 8b/copy 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edi to edx</span> -<span id="L79" class="LineNr"> 79 </span> <span class="subxComment"># curr/ecx = &out->data[out->write]</span> +<span id="L79" class="LineNr"> 79 </span> <span class="subxComment"># var curr/ecx : (address byte) = &out->data[out->write]</span> <span id="L80" class="LineNr"> 80 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy ebx+edx+12 to ecx</span> -<span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># max/ebx = &out->data[out->length]</span> +<span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># var max/ebx : (address byte) = &out->data[out->length]</span> <span id="L82" class="LineNr"> 82 </span> 8b/copy 1/mod/*+disp8 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(edi+8) to ebx</span> <span id="L83" class="LineNr"> 83 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx <span class="Normal"> . </span> 3/r32/ebx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy edi+ebx+12 to ebx</span> <span id="L84" class="LineNr"> 84 </span><span class="Constant">$print-int32-decimal:write-loop</span>: @@ -180,7 +180,7 @@ if ('onhashchange' in window) { <span id="L119" class="LineNr">119 </span> 68/push <span class="Constant">"print-int32-decimal: out of space\n"</span>/imm32 <span id="L120" class="LineNr">120 </span> 68/push 2/imm32/stderr <span id="L121" class="LineNr">121 </span> <span class="subxS2Comment"># . . call</span> -<span id="L122" class="LineNr">122 </span> e8/call <a href='050_write.subx.html#L14'>_write</a>/disp32 +<span id="L122" class="LineNr">122 </span> e8/call <a href='050_write.subx.html#L34'>_write</a>/disp32 <span id="L123" class="LineNr">123 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L124" class="LineNr">124 </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="L125" class="LineNr">125 </span> <span class="subxS1Comment"># . syscall(exit, 1)</span> @@ -213,7 +213,7 @@ if ('onhashchange' in window) { <span id="L152" class="LineNr">152 </span> 68/push <span class="Constant">"9"</span>/imm32 <span id="L153" class="LineNr">153 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L154" class="LineNr">154 </span> <span class="subxS2Comment"># . . call</span> -<span id="L155" class="LineNr">155 </span> e8/call <a href='058stream-equal.subx.html#L193'>check-stream-equal</a>/disp32 +<span id="L155" class="LineNr">155 </span> e8/call <a href='058stream-equal.subx.html#L194'>check-stream-equal</a>/disp32 <span id="L156" class="LineNr">156 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L157" class="LineNr">157 </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> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L158" class="LineNr">158 </span> <span class="subxS1Comment"># . end</span> @@ -243,7 +243,7 @@ if ('onhashchange' in window) { <span id="L182" class="LineNr">182 </span> 68/push <span class="Constant">"0"</span>/imm32 <span id="L183" class="LineNr">183 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L184" class="LineNr">184 </span> <span class="subxS2Comment"># . . call</span> -<span id="L185" class="LineNr">185 </span> e8/call <a href='058stream-equal.subx.html#L193'>check-stream-equal</a>/disp32 +<span id="L185" class="LineNr">185 </span> e8/call <a href='058stream-equal.subx.html#L194'>check-stream-equal</a>/disp32 <span id="L186" class="LineNr">186 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L187" class="LineNr">187 </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> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L188" class="LineNr">188 </span> <span class="subxS1Comment"># . end</span> @@ -273,7 +273,7 @@ if ('onhashchange' in window) { <span id="L212" class="LineNr">212 </span> 68/push <span class="Constant">"10"</span>/imm32 <span id="L213" class="LineNr">213 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L214" class="LineNr">214 </span> <span class="subxS2Comment"># . . call</span> -<span id="L215" class="LineNr">215 </span> e8/call <a href='058stream-equal.subx.html#L193'>check-stream-equal</a>/disp32 +<span id="L215" class="LineNr">215 </span> e8/call <a href='058stream-equal.subx.html#L194'>check-stream-equal</a>/disp32 <span id="L216" class="LineNr">216 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L217" class="LineNr">217 </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> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L218" class="LineNr">218 </span> <span class="subxS1Comment"># . end</span> @@ -304,7 +304,7 @@ if ('onhashchange' in window) { <span id="L268" class="LineNr">268 </span> 68/push <span class="Constant">"-9"</span>/imm32 <span id="L269" class="LineNr">269 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L270" class="LineNr">270 </span> <span class="subxS2Comment"># . . call</span> -<span id="L271" class="LineNr">271 </span> e8/call <a href='058stream-equal.subx.html#L193'>check-stream-equal</a>/disp32 +<span id="L271" class="LineNr">271 </span> e8/call <a href='058stream-equal.subx.html#L194'>check-stream-equal</a>/disp32 <span id="L272" class="LineNr">272 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L273" class="LineNr">273 </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> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L274" class="LineNr">274 </span> <span class="subxS1Comment"># . end</span> @@ -334,7 +334,7 @@ if ('onhashchange' in window) { <span id="L298" class="LineNr">298 </span> 68/push <span class="Constant">"-10"</span>/imm32 <span id="L299" class="LineNr">299 </span> 68/push <a href='057write.subx.html#L148'>_test-stream</a>/imm32 <span id="L300" class="LineNr">300 </span> <span class="subxS2Comment"># . . call</span> -<span id="L301" class="LineNr">301 </span> e8/call <a href='058stream-equal.subx.html#L193'>check-stream-equal</a>/disp32 +<span id="L301" class="LineNr">301 </span> e8/call <a href='058stream-equal.subx.html#L194'>check-stream-equal</a>/disp32 <span id="L302" class="LineNr">302 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L303" class="LineNr">303 </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> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L304" class="LineNr">304 </span> <span class="subxS1Comment"># . end</span> |