about summary refs log tree commit diff stats
path: root/html/subx/examples/ex11.subx.html
diff options
context:
space:
mode:
Diffstat (limited to 'html/subx/examples/ex11.subx.html')
-rw-r--r--html/subx/examples/ex11.subx.html36
1 files changed, 19 insertions, 17 deletions
diff --git a/html/subx/examples/ex11.subx.html b/html/subx/examples/ex11.subx.html
index 9749967e..9ea97266 100644
--- a/html/subx/examples/ex11.subx.html
+++ b/html/subx/examples/ex11.subx.html
@@ -23,6 +23,8 @@ body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color:
 .LineNr { color:#444444; }
 .subxS1Comment { color:#2d8cff; }
 .CommentedCode { color: #6c6c6c; }
+.subxFunction { color: #ff8700; }
+.subxTest { color: #00af00; }
 .Constant { color:#00a0a0; }
 .SpecialChar { color: #ff0000; }
 .subxH1Comment { color:#00ffff; }
@@ -91,7 +93,7 @@ if ('onhashchange' in window) {
 <span id="L28" class="LineNr"> 28 </span>
 <span id="L29" class="LineNr"> 29 </span><span class="subxComment"># compare a null-terminated ascii string with a more idiomatic length-prefixed byte array</span>
 <span id="L30" class="LineNr"> 30 </span><span class="subxComment"># reason for the name: the only place we should have null-terminated ascii strings is from commandline args</span>
-<span id="L31" class="LineNr"> 31 </span>kernel-string-equal:  <span class="subxComment"># s : null-terminated ascii string, benchmark : length-prefixed ascii string -&gt; EAX : boolean</span>
+<span id="L31" class="LineNr"> 31 </span><span class="subxFunction">kernel-string-equal</span>:  <span class="subxComment"># s : null-terminated ascii string, benchmark : length-prefixed ascii string -&gt; EAX : boolean</span>
 <span id="L32" class="LineNr"> 32 </span>    <span class="subxS1Comment"># . prolog</span>
 <span id="L33" class="LineNr"> 33 </span>    55/push-EBP
 <span id="L34" class="LineNr"> 34 </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>
@@ -126,7 +128,7 @@ if ('onhashchange' in window) {
 <span id="L63" class="LineNr"> 63 </span>    <span class="subxComment"># initialize loop counter i into ECX</span>
 <span id="L64" class="LineNr"> 64 </span>    b9/copy-to-ECX  0/imm32/exit
 <span id="L65" class="LineNr"> 65 </span>    <span class="subxComment"># while (i/ECX &lt; n/EDX)</span>
-<span id="L66" class="LineNr"> 66 </span>$kernel-string-equal:loop:
+<span id="L66" class="LineNr"> 66 </span><span class="Constant">$kernel-string-equal:loop</span>:
 <span id="L67" class="LineNr"> 67 </span>    39/compare                      3/mod/direct    1/rm32/ECX   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          2/r32/EDX  <span class="CommentedCode"> . </span>             <span class="CommentedCode"> . </span>                <span class="subxComment"># compare ECX with EDX</span>
 <span id="L68" class="LineNr"> 68 </span>    74/jump-if-equal  $kernel-string-equal:break/disp8
 <span id="L69" class="LineNr"> 69 </span>    <span class="subxComment"># c1/EAX, c2/EBX = *s, *benchmark</span>
@@ -146,20 +148,20 @@ if ('onhashchange' in window) {
 <span id="L83" class="LineNr"> 83 </span>    47/inc-EDI
 <span id="L84" class="LineNr"> 84 </span>    <span class="subxComment"># end while</span>
 <span id="L85" class="LineNr"> 85 </span>    eb/jump  $kernel-string-equal:loop/disp8
-<span id="L86" class="LineNr"> 86 </span>$kernel-string-equal:break:
+<span id="L86" class="LineNr"> 86 </span><span class="Constant">$kernel-string-equal:break</span>:
 <span id="L87" class="LineNr"> 87 </span>    <span class="subxComment"># if (*s/EDI == 0) return true</span>
 <span id="L88" class="LineNr"> 88 </span>    b8/copy-to-EAX  0/imm32
 <span id="L89" class="LineNr"> 89 </span>    8a/copy                         0/mod/indirect  7/rm32/EDI   <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"># copy byte at *EDI to lower byte of EAX</span>
 <span id="L90" class="LineNr"> 90 </span>    81          7/subop/compare     3/mod/direct    0/rm32/EAX   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0/imm32           <span class="subxComment"># compare EAX</span>
 <span id="L91" class="LineNr"> 91 </span>    75/jump-if-not-equal  $kernel-string-equal:false/disp8
 <span id="L92" class="LineNr"> 92 </span>    b8/copy-to-EAX  1/imm32
-<span id="L93" class="LineNr"> 93 </span>$kernel-string-equal:true:
+<span id="L93" class="LineNr"> 93 </span><span class="Constant">$kernel-string-equal:true</span>:
 <span id="L94" class="LineNr"> 94 </span>    eb/jump  $kernel-string-equal:end/disp8
 <span id="L95" class="LineNr"> 95 </span>    <span class="subxComment"># return false</span>
-<span id="L96" class="LineNr"> 96 </span>$kernel-string-equal:false:
+<span id="L96" class="LineNr"> 96 </span><span class="Constant">$kernel-string-equal:false</span>:
 <span id="L97" class="LineNr"> 97 </span>    b8/copy-to-EAX  0/imm32
 <span id="L98" class="LineNr"> 98 </span>
-<span id="L99" class="LineNr"> 99 </span>$kernel-string-equal:end:
+<span id="L99" class="LineNr"> 99 </span><span class="Constant">$kernel-string-equal:end</span>:
 <span id="L100" class="LineNr">100 </span>    <span class="subxS1Comment"># . restore registers</span>
 <span id="L101" class="LineNr">101 </span>    5f/pop-to-EDI
 <span id="L102" class="LineNr">102 </span>    5e/pop-to-ESI
@@ -173,7 +175,7 @@ if ('onhashchange' in window) {
 <span id="L110" class="LineNr">110 </span>
 <span id="L111" class="LineNr">111 </span><span class="subxH1Comment"># - tests</span>
 <span id="L112" class="LineNr">112 </span>
-<span id="L113" class="LineNr">113 </span>test-compare-null-kernel-string-with-empty-array:
+<span id="L113" class="LineNr">113 </span><span class="subxTest">test-compare-null-kernel-string-with-empty-array</span>:
 <span id="L114" class="LineNr">114 </span>    <span class="subxComment"># EAX = kernel-string-equal(Null-kernel-string, &quot;&quot;)</span>
 <span id="L115" class="LineNr">115 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L116" class="LineNr">116 </span>    68/push  <span class="Constant">&quot;&quot;</span>/imm32
@@ -193,7 +195,7 @@ if ('onhashchange' in window) {
 <span id="L130" class="LineNr">130 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0xc/imm32         <span class="subxComment"># add to ESP</span>
 <span id="L131" class="LineNr">131 </span>    c3/return
 <span id="L132" class="LineNr">132 </span>
-<span id="L133" class="LineNr">133 </span>test-compare-null-kernel-string-with-non-empty-array:
+<span id="L133" class="LineNr">133 </span><span class="subxTest">test-compare-null-kernel-string-with-non-empty-array</span>:
 <span id="L134" class="LineNr">134 </span>    <span class="subxComment"># EAX = kernel-string-equal(Null-kernel-string, &quot;Abc&quot;)</span>
 <span id="L135" class="LineNr">135 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L136" class="LineNr">136 </span>    68/push  <span class="Constant">&quot;Abc&quot;</span>/imm32
@@ -213,7 +215,7 @@ if ('onhashchange' in window) {
 <span id="L150" class="LineNr">150 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0xc/imm32         <span class="subxComment"># add to ESP</span>
 <span id="L151" class="LineNr">151 </span>    c3/return
 <span id="L152" class="LineNr">152 </span>
-<span id="L153" class="LineNr">153 </span>test-compare-kernel-string-with-equal-array:
+<span id="L153" class="LineNr">153 </span><span class="subxTest">test-compare-kernel-string-with-equal-array</span>:
 <span id="L154" class="LineNr">154 </span>    <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, &quot;Abc&quot;)</span>
 <span id="L155" class="LineNr">155 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L156" class="LineNr">156 </span>    68/push  <span class="Constant">&quot;Abc&quot;</span>/imm32
@@ -233,7 +235,7 @@ if ('onhashchange' in window) {
 <span id="L170" class="LineNr">170 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0xc/imm32         <span class="subxComment"># add to ESP</span>
 <span id="L171" class="LineNr">171 </span>    c3/return
 <span id="L172" class="LineNr">172 </span>
-<span id="L173" class="LineNr">173 </span>test-compare-kernel-string-with-inequal-array:
+<span id="L173" class="LineNr">173 </span><span class="subxTest">test-compare-kernel-string-with-inequal-array</span>:
 <span id="L174" class="LineNr">174 </span>    <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, &quot;Adc&quot;)</span>
 <span id="L175" class="LineNr">175 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L176" class="LineNr">176 </span>    68/push  <span class="Constant">&quot;Adc&quot;</span>/imm32
@@ -253,7 +255,7 @@ if ('onhashchange' in window) {
 <span id="L190" class="LineNr">190 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0xc/imm32         <span class="subxComment"># add to ESP</span>
 <span id="L191" class="LineNr">191 </span>    c3/return
 <span id="L192" class="LineNr">192 </span>
-<span id="L193" class="LineNr">193 </span>test-compare-kernel-string-with-empty-array:
+<span id="L193" class="LineNr">193 </span><span class="subxTest">test-compare-kernel-string-with-empty-array</span>:
 <span id="L194" class="LineNr">194 </span>    <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, &quot;&quot;)</span>
 <span id="L195" class="LineNr">195 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L196" class="LineNr">196 </span>    68/push  <span class="Constant">&quot;&quot;</span>/imm32
@@ -273,7 +275,7 @@ if ('onhashchange' in window) {
 <span id="L210" class="LineNr">210 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0xc/imm32         <span class="subxComment"># add to ESP</span>
 <span id="L211" class="LineNr">211 </span>    c3/return
 <span id="L212" class="LineNr">212 </span>
-<span id="L213" class="LineNr">213 </span>test-compare-kernel-string-with-shorter-array:
+<span id="L213" class="LineNr">213 </span><span class="subxTest">test-compare-kernel-string-with-shorter-array</span>:
 <span id="L214" class="LineNr">214 </span>    <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, &quot;Ab&quot;)</span>
 <span id="L215" class="LineNr">215 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L216" class="LineNr">216 </span>    68/push  <span class="Constant">&quot;Ab&quot;</span>/imm32
@@ -293,7 +295,7 @@ if ('onhashchange' in window) {
 <span id="L230" class="LineNr">230 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              0xc/imm32         <span class="subxComment"># add to ESP</span>
 <span id="L231" class="LineNr">231 </span>    c3/return
 <span id="L232" class="LineNr">232 </span>
-<span id="L233" class="LineNr">233 </span>test-compare-kernel-string-with-longer-array:
+<span id="L233" class="LineNr">233 </span><span class="subxTest">test-compare-kernel-string-with-longer-array</span>:
 <span id="L234" class="LineNr">234 </span>    <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, &quot;Abcd&quot;)</span>
 <span id="L235" class="LineNr">235 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L236" class="LineNr">236 </span>    68/push  <span class="Constant">&quot;Abcd&quot;</span>/imm32
@@ -316,7 +318,7 @@ if ('onhashchange' in window) {
 <span id="L253" class="LineNr">253 </span><span class="subxH1Comment"># - helpers</span>
 <span id="L254" class="LineNr">254 </span>
 <span id="L255" class="LineNr">255 </span><span class="subxComment"># print msg to stderr if a != b, otherwise print &quot;.&quot;</span>
-<span id="L256" class="LineNr">256 </span>check-ints-equal:  <span class="subxComment"># (a : int, b : int, msg : (address array byte)) -&gt; boolean</span>
+<span id="L256" class="LineNr">256 </span><span class="subxFunction">check-ints-equal</span>:  <span class="subxComment"># (a : int, b : int, msg : (address array byte)) -&gt; boolean</span>
 <span id="L257" class="LineNr">257 </span>    <span class="subxS1Comment"># . prolog</span>
 <span id="L258" class="LineNr">258 </span>    55/push-EBP
 <span id="L259" class="LineNr">259 </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>
@@ -339,7 +341,7 @@ if ('onhashchange' in window) {
 <span id="L276" class="LineNr">276 </span>    <span class="subxS1Comment"># . return</span>
 <span id="L277" class="LineNr">277 </span>    eb/jump  $check-ints-equal:end/disp8
 <span id="L278" class="LineNr">278 </span>    <span class="subxComment"># otherwise print(msg)</span>
-<span id="L279" class="LineNr">279 </span>$check-ints-equal:else:
+<span id="L279" class="LineNr">279 </span><span class="Constant">$check-ints-equal:else</span>:
 <span id="L280" class="LineNr">280 </span>    <span class="subxComment"># copy msg into ECX</span>
 <span id="L281" class="LineNr">281 </span>    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none <span class="CommentedCode"> . </span>          1/r32/ECX   0x10/disp8      <span class="CommentedCode"> . </span>               <span class="subxComment"># copy *(EBP+16) to ECX</span>
 <span id="L282" class="LineNr">282 </span>    <span class="subxComment"># print(ECX)</span>
@@ -356,7 +358,7 @@ if ('onhashchange' in window) {
 <span id="L293" class="LineNr">293 </span>    e8/call  write-stderr/disp32
 <span id="L294" class="LineNr">294 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L295" class="LineNr">295 </span>    81          0/subop/add         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>              4/imm32           <span class="subxComment"># add to ESP</span>
-<span id="L296" class="LineNr">296 </span>$check-ints-equal:end:
+<span id="L296" class="LineNr">296 </span><span class="Constant">$check-ints-equal:end</span>:
 <span id="L297" class="LineNr">297 </span>    <span class="subxS1Comment"># . restore registers</span>
 <span id="L298" class="LineNr">298 </span>    5b/pop-to-EBX
 <span id="L299" class="LineNr">299 </span>    59/pop-to-ECX
@@ -365,7 +367,7 @@ if ('onhashchange' in window) {
 <span id="L302" class="LineNr">302 </span>    5d/pop-to-EBP
 <span id="L303" class="LineNr">303 </span>    c3/return
 <span id="L304" class="LineNr">304 </span>
-<span id="L305" class="LineNr">305 </span>write-stderr:  <span class="subxComment"># s : (address array byte) -&gt; &lt;void&gt;</span>
+<span id="L305" class="LineNr">305 </span><span class="subxFunction">write-stderr</span>:  <span class="subxComment"># s : (address array byte) -&gt; &lt;void&gt;</span>
 <span id="L306" class="LineNr">306 </span>    <span class="subxS1Comment"># . prolog</span>
 <span id="L307" class="LineNr">307 </span>    55/push-EBP
 <span id="L308" class="LineNr">308 </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>