diff options
Diffstat (limited to 'html/subx/examples')
-rw-r--r-- | html/subx/examples/ex10.subx.html | 12 | ||||
-rw-r--r-- | html/subx/examples/ex11.subx.html | 36 | ||||
-rw-r--r-- | html/subx/examples/ex3.subx.html | 5 | ||||
-rw-r--r-- | html/subx/examples/ex8.subx.html | 8 | ||||
-rw-r--r-- | html/subx/examples/ex9.subx.html | 3 |
5 files changed, 36 insertions, 28 deletions
diff --git a/html/subx/examples/ex10.subx.html b/html/subx/examples/ex10.subx.html index f0f582f2..55b1c177 100644 --- a/html/subx/examples/ex10.subx.html +++ b/html/subx/examples/ex10.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; } +.Constant { color:#00a0a0; } --> </style> @@ -94,12 +96,12 @@ if ('onhashchange' in window) { <span id="L34" class="LineNr">34 </span> <span id="L35" class="LineNr">35 </span><span class="subxComment"># compare two null-terminated ascii strings</span> <span id="L36" class="LineNr">36 </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="L37" class="LineNr">37 </span>argv-equal: <span class="subxComment"># (s1, s2) : null-terminated ascii strings -> EAX : boolean</span> +<span id="L37" class="LineNr">37 </span><span class="subxFunction">argv-equal</span>: <span class="subxComment"># (s1, s2) : null-terminated ascii strings -> EAX : boolean</span> <span id="L38" class="LineNr">38 </span> <span class="subxComment"># initialize s1 (ECX) and s2 (EDX)</span> <span id="L39" class="LineNr">39 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none <span class="CommentedCode"> . </span> 1/r32/ECX 4/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(ESP+4) to ECX</span> <span id="L40" class="LineNr">40 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none <span class="CommentedCode"> . </span> 2/r32/EDX 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(ESP+8) to EDX</span> <span id="L41" class="LineNr">41 </span> <span class="subxComment"># while (true)</span> -<span id="L42" class="LineNr">42 </span>$argv-equal:loop: +<span id="L42" class="LineNr">42 </span><span class="Constant">$argv-equal:loop</span>: <span id="L43" class="LineNr">43 </span> <span class="subxComment"># c1/EAX, c2/EBX = *s1, *s2</span> <span id="L44" class="LineNr">44 </span> b8/copy-to-EAX 0/imm32 <span id="L45" class="LineNr">45 </span> 8a/copy 0/mod/indirect 1/rm32/ECX <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 *ECX to lower byte of EAX</span> @@ -116,15 +118,15 @@ if ('onhashchange' in window) { <span id="L56" class="LineNr">56 </span> 42/inc-EDX <span id="L57" class="LineNr">57 </span> <span class="subxComment"># end while</span> <span id="L58" class="LineNr">58 </span> eb/jump $argv-equal:loop/disp8 -<span id="L59" class="LineNr">59 </span>$argv-equal:break: +<span id="L59" class="LineNr">59 </span><span class="Constant">$argv-equal:break</span>: <span id="L60" class="LineNr">60 </span> <span class="subxComment"># if (c2 == 0) return true</span> <span id="L61" class="LineNr">61 </span> 81 7/subop/compare 3/mod/direct 3/rm32/EBX <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 EBX</span> <span id="L62" class="LineNr">62 </span> 75/jump-if-not-equal $argv-equal:false/disp8 -<span id="L63" class="LineNr">63 </span>$argv-equal:success: +<span id="L63" class="LineNr">63 </span><span class="Constant">$argv-equal:success</span>: <span id="L64" class="LineNr">64 </span> b8/copy-to-EAX 1/imm32 <span id="L65" class="LineNr">65 </span> c3/return <span id="L66" class="LineNr">66 </span> <span class="subxComment"># return false</span> -<span id="L67" class="LineNr">67 </span>$argv-equal:false: +<span id="L67" class="LineNr">67 </span><span class="Constant">$argv-equal:false</span>: <span id="L68" class="LineNr">68 </span> b8/copy-to-EAX 0/imm32 <span id="L69" class="LineNr">69 </span> c3/return <span id="L70" class="LineNr">70 </span> 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 -> 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 -> 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 < 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, "")</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">""</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, "Abc")</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">"Abc"</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, "Abc")</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">"Abc"</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, "Adc")</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">"Adc"</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, "")</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">""</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, "Ab")</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">"Ab"</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, "Abcd")</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">"Abcd"</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 "."</span> -<span id="L256" class="LineNr">256 </span>check-ints-equal: <span class="subxComment"># (a : int, b : int, msg : (address array byte)) -> 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)) -> 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) -> <void></span> +<span id="L305" class="LineNr">305 </span><span class="subxFunction">write-stderr</span>: <span class="subxComment"># s : (address array byte) -> <void></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> diff --git a/html/subx/examples/ex3.subx.html b/html/subx/examples/ex3.subx.html index 533bea07..d814af53 100644 --- a/html/subx/examples/ex3.subx.html +++ b/html/subx/examples/ex3.subx.html @@ -23,6 +23,7 @@ body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: .LineNr { color:#444444; } .subxS1Comment { color:#2d8cff; } .CommentedCode { color: #6c6c6c; } +.Constant { color:#00a0a0; } --> </style> @@ -77,7 +78,7 @@ if ('onhashchange' in window) { <span id="L17" class="LineNr">17 </span> <span class="subxComment"># counter: ECX = 1</span> <span id="L18" class="LineNr">18 </span> b9/copy-to-ECX 1/imm32 <span id="L19" class="LineNr">19 </span> -<span id="L20" class="LineNr">20 </span>$loop: +<span id="L20" class="LineNr">20 </span><span class="Constant">$loop</span>: <span id="L21" class="LineNr">21 </span> <span class="subxComment"># while (counter <= 10)</span> <span id="L22" class="LineNr">22 </span> 81 7/subop/compare 3/mod/direct 1/rm32/ECX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xa/imm32 <span class="subxComment"># compare ECX</span> <span id="L23" class="LineNr">23 </span> 7f/jump-if-greater $exit/disp8 @@ -88,7 +89,7 @@ if ('onhashchange' in window) { <span id="L28" class="LineNr">28 </span> <span class="subxComment"># loop</span> <span id="L29" class="LineNr">29 </span> eb/jump $loop/disp8 <span id="L30" class="LineNr">30 </span> -<span id="L31" class="LineNr">31 </span>$exit: +<span id="L31" class="LineNr">31 </span><span class="Constant">$exit</span>: <span id="L32" class="LineNr">32 </span> <span class="subxComment"># syscall(exit, EBX)</span> <span id="L33" class="LineNr">33 </span> b8/copy-to-EAX 1/imm32 <span id="L34" class="LineNr">34 </span> cd/syscall 0x80/imm8 diff --git a/html/subx/examples/ex8.subx.html b/html/subx/examples/ex8.subx.html index 50f28a7c..07534b4d 100644 --- a/html/subx/examples/ex8.subx.html +++ b/html/subx/examples/ex8.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; } +.Constant { color:#00a0a0; } --> </style> @@ -94,12 +96,12 @@ if ('onhashchange' in window) { <span id="L34" class="LineNr">34 </span> b8/copy-to-EAX 1/imm32/exit <span id="L35" class="LineNr">35 </span> cd/syscall 0x80/imm8 <span id="L36" class="LineNr">36 </span> -<span id="L37" class="LineNr">37 </span>ascii-length: <span class="subxComment"># s : (address array byte) -> n/EAX</span> +<span id="L37" class="LineNr">37 </span><span class="subxFunction">ascii-length</span>: <span class="subxComment"># s : (address array byte) -> n/EAX</span> <span id="L38" class="LineNr">38 </span> <span class="subxComment"># EDX = s</span> <span id="L39" class="LineNr">39 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none <span class="CommentedCode"> . </span> 2/r32/EDX 4/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(ESP+4) to EDX</span> <span id="L40" class="LineNr">40 </span> <span class="subxComment"># var result/EAX = 0</span> <span id="L41" class="LineNr">41 </span> b8/copy-to-EAX 0/imm32 -<span id="L42" class="LineNr">42 </span>$ascii-length-loop: +<span id="L42" class="LineNr">42 </span><span class="Constant">$ascii-length-loop</span>: <span id="L43" class="LineNr">43 </span> <span class="subxComment"># var c/ECX = *s</span> <span id="L44" class="LineNr">44 </span> 8a/copy 0/mod/* 2/rm32/EDX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 1/r32/ECX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy byte at *EDX to lower byte of ECX</span> <span id="L45" class="LineNr">45 </span> <span class="subxComment"># if c == '\0' break</span> @@ -111,7 +113,7 @@ if ('onhashchange' in window) { <span id="L51" class="LineNr">51 </span> 40/inc-EAX <span id="L52" class="LineNr">52 </span> <span class="subxComment"># loop</span> <span id="L53" class="LineNr">53 </span> eb/jump $ascii-length-loop/disp8 -<span id="L54" class="LineNr">54 </span>$ascii-length-ret: +<span id="L54" class="LineNr">54 </span><span class="Constant">$ascii-length-ret</span>: <span id="L55" class="LineNr">55 </span> <span class="subxComment"># return EAX</span> <span id="L56" class="LineNr">56 </span> c3/return <span id="L57" class="LineNr">57 </span> diff --git a/html/subx/examples/ex9.subx.html b/html/subx/examples/ex9.subx.html index 23e35839..0bb4659c 100644 --- a/html/subx/examples/ex9.subx.html +++ b/html/subx/examples/ex9.subx.html @@ -23,6 +23,7 @@ body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: .LineNr { color:#444444; } .subxS1Comment { color:#2d8cff; } .CommentedCode { color: #6c6c6c; } +.subxFunction { color: #ff8700; } --> </style> @@ -98,7 +99,7 @@ if ('onhashchange' in window) { <span id="L38" class="LineNr">38 </span> b8/copy-to-EAX 1/imm32/exit <span id="L39" class="LineNr">39 </span> cd/syscall 0x80/imm8 <span id="L40" class="LineNr">40 </span> -<span id="L41" class="LineNr">41 </span>ascii-difference: <span class="subxComment"># (s1, s2) : null-terminated ascii strings</span> +<span id="L41" class="LineNr">41 </span><span class="subxFunction">ascii-difference</span>: <span class="subxComment"># (s1, s2) : null-terminated ascii strings</span> <span id="L42" class="LineNr">42 </span> <span class="subxComment"># a = first letter of s1 (ECX)</span> <span id="L43" class="LineNr">43 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 0/r32/EAX 4/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(ESP+4) to EAX</span> <span id="L44" class="LineNr">44 </span> 8b/copy 0/mod/indirect 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"># copy *EAX to EAX</span> |