about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-12-04 10:40:01 -0800
committerKartik Agaram <vc@akkartik.com>2018-12-04 10:40:01 -0800
commitaf5797eeffdcec43198337f60571ff4ac5f80228 (patch)
treee55ce0a382168e27027b2dddb5ed3082c6f25f12
parent9e03e2bd37dc440eeb62783378f11d718bab160f (diff)
downloadmu-af5797eeffdcec43198337f60571ff4ac5f80228.tar.gz
4838
Better to use EDI as a mnemonic for 'destination'.
-rw-r--r--html/subx/062write-byte.subx.html20
-rw-r--r--subx/062write-byte.subx20
-rwxr-xr-xsubx/apps/crenshaw2-1bin6980 -> 6980 bytes
-rwxr-xr-xsubx/apps/crenshaw2-1bbin7541 -> 7541 bytes
-rwxr-xr-xsubx/apps/factorialbin5871 -> 5871 bytes
5 files changed, 20 insertions, 20 deletions
diff --git a/html/subx/062write-byte.subx.html b/html/subx/062write-byte.subx.html
index d544a136..e279a005 100644
--- a/html/subx/062write-byte.subx.html
+++ b/html/subx/062write-byte.subx.html
@@ -107,24 +107,24 @@ if ('onhashchange' in window) {
 <span id="L42" class="LineNr"> 42 </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>
 <span id="L43" class="LineNr"> 43 </span>    <span class="subxS1Comment"># . save registers</span>
 <span id="L44" class="LineNr"> 44 </span>    51/push-ECX
-<span id="L45" class="LineNr"> 45 </span>    56/push-ESI
-<span id="L46" class="LineNr"> 46 </span>    <span class="subxComment"># ESI = f</span>
-<span id="L47" class="LineNr"> 47 </span>    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none <span class="CommentedCode"> . </span>          6/r32/ESI   8/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># copy *(EBP+8) to ESI</span>
+<span id="L45" class="LineNr"> 45 </span>    57/push-EDI
+<span id="L46" class="LineNr"> 46 </span>    <span class="subxComment"># EDI = f</span>
+<span id="L47" class="LineNr"> 47 </span>    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none <span class="CommentedCode"> . </span>          7/r32/EDI   8/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># copy *(EBP+8) to EDI</span>
 <span id="L48" class="LineNr"> 48 </span>    <span class="subxComment"># ECX = f-&gt;write</span>
-<span id="L49" class="LineNr"> 49 </span>    8b/copy                         1/mod/*+disp8   6/rm32/ESI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          1/r32/ECX   4/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># copy *(ESI+4) to ECX</span>
+<span id="L49" class="LineNr"> 49 </span>    8b/copy                         1/mod/*+disp8   7/rm32/EDI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          1/r32/ECX   4/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># copy *(EDI+4) to ECX</span>
 <span id="L50" class="LineNr"> 50 </span>    <span class="subxComment"># if (f-&gt;write &gt;= f-&gt;length) flush and clear f's stream</span>
-<span id="L51" class="LineNr"> 51 </span>    3b/compare                      1/mod/*+disp8   6/rm32/ESI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          1/r32/ECX   0xc/disp8      <span class="CommentedCode"> . </span>                <span class="subxComment"># compare ECX with *(ESI+12)</span>
+<span id="L51" class="LineNr"> 51 </span>    3b/compare                      1/mod/*+disp8   7/rm32/EDI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          1/r32/ECX   0xc/disp8      <span class="CommentedCode"> . </span>                <span class="subxComment"># compare ECX with *(EDI+12)</span>
 <span id="L52" class="LineNr"> 52 </span>    7c/jump-if-lesser  $write-byte:to-stream/disp8
 <span id="L53" class="LineNr"> 53 </span>    <span class="subxS1Comment"># . flush(f)</span>
 <span id="L54" class="LineNr"> 54 </span>    <span class="subxS2Comment"># . . push args</span>
-<span id="L55" class="LineNr"> 55 </span>    56/push-ESI
+<span id="L55" class="LineNr"> 55 </span>    57/push-EDI
 <span id="L56" class="LineNr"> 56 </span>    <span class="subxS2Comment"># . . call</span>
 <span id="L57" class="LineNr"> 57 </span>    e8/call  flush/disp32
 <span id="L58" class="LineNr"> 58 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L59" class="LineNr"> 59 </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="L60" class="LineNr"> 60 </span>    <span class="subxS1Comment"># . clear-stream(stream = f+4)</span>
 <span id="L61" class="LineNr"> 61 </span>    <span class="subxS2Comment"># . . push args</span>
-<span id="L62" class="LineNr"> 62 </span>    8d/copy-address                 1/mod/*+disp8   6/rm32/ESI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          0/r32/EAX   4/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># copy ESI+4 to EAX</span>
+<span id="L62" class="LineNr"> 62 </span>    8d/copy-address                 1/mod/*+disp8   7/rm32/EDI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          0/r32/EAX   4/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># copy EDI+4 to EAX</span>
 <span id="L63" class="LineNr"> 63 </span>    50/push-EAX
 <span id="L64" class="LineNr"> 64 </span>    <span class="subxS2Comment"># . . call</span>
 <span id="L65" class="LineNr"> 65 </span>    e8/call  clear-stream/disp32
@@ -135,12 +135,12 @@ if ('onhashchange' in window) {
 <span id="L70" class="LineNr"> 70 </span>    <span class="subxComment"># f-&gt;data[f-&gt;read] = LSB(n)</span>
 <span id="L71" class="LineNr"> 71 </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="L72" class="LineNr"> 72 </span>    8a/copy-byte                    1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none <span class="CommentedCode"> . </span>          0/r32/AL    0xc/disp8      <span class="CommentedCode"> . </span>                <span class="subxComment"># copy byte at *(EBP+12) to AL</span>
-<span id="L73" class="LineNr"> 73 </span>    88/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 AL to *(ESI+ECX+16)</span>
+<span id="L73" class="LineNr"> 73 </span>    88/copy-byte                    1/mod/*+disp8   4/rm32/sib    7/base/EDI  1/index/ECX  <span class="CommentedCode"> . </span>          0/r32/AL    0x10/disp8     <span class="CommentedCode"> . </span>                <span class="subxComment"># copy AL to *(EDI+ECX+16)</span>
 <span id="L74" class="LineNr"> 74 </span>    <span class="subxComment"># ++f-&gt;read</span>
-<span id="L75" class="LineNr"> 75 </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>          4/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># increment *(ESI+4)</span>
+<span id="L75" class="LineNr"> 75 </span>    ff          0/subop/increment   1/mod/*+disp8   7/rm32/EDI   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>          4/disp8        <span class="CommentedCode"> . </span>                <span class="subxComment"># increment *(EDI+4)</span>
 <span id="L76" class="LineNr"> 76 </span><span class="Constant">$write-byte:end</span>:
 <span id="L77" class="LineNr"> 77 </span>    <span class="subxS1Comment"># . restore registers</span>
-<span id="L78" class="LineNr"> 78 </span>    5e/pop-to-ESI
+<span id="L78" class="LineNr"> 78 </span>    5f/pop-to-EDI
 <span id="L79" class="LineNr"> 79 </span>    59/pop-to-ECX
 <span id="L80" class="LineNr"> 80 </span>    <span class="subxS1Comment"># . epilog</span>
 <span id="L81" class="LineNr"> 81 </span>    89/copy                         3/mod/direct    4/rm32/ESP   <span class="CommentedCode"> . </span>         <span class="CommentedCode"> . </span>           <span class="CommentedCode"> . </span>          5/r32/EBP  <span class="CommentedCode"> . </span>             <span class="CommentedCode"> . </span>                <span class="subxComment"># copy EBP to ESP</span>
diff --git a/subx/062write-byte.subx b/subx/062write-byte.subx
index 9451ee46..bfb8bcc3 100644
--- a/subx/062write-byte.subx
+++ b/subx/062write-byte.subx
@@ -42,24 +42,24 @@ write-byte:  # f : (address buffered-file), n : num -> <void>
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # . save registers
     51/push-ECX
-    56/push-ESI
-    # ESI = f
-    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           6/r32/ESI   8/disp8         .                 # copy *(EBP+8) to ESI
+    57/push-EDI
+    # EDI = f
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           7/r32/EDI   8/disp8         .                 # copy *(EBP+8) to EDI
     # ECX = f->write
-    8b/copy                         1/mod/*+disp8   6/rm32/ESI    .           .             .           1/r32/ECX   4/disp8         .                 # copy *(ESI+4) to ECX
+    8b/copy                         1/mod/*+disp8   7/rm32/EDI    .           .             .           1/r32/ECX   4/disp8         .                 # copy *(EDI+4) to ECX
     # if (f->write >= f->length) flush and clear f's stream
-    3b/compare                      1/mod/*+disp8   6/rm32/ESI    .           .             .           1/r32/ECX   0xc/disp8       .                 # compare ECX with *(ESI+12)
+    3b/compare                      1/mod/*+disp8   7/rm32/EDI    .           .             .           1/r32/ECX   0xc/disp8       .                 # compare ECX with *(EDI+12)
     7c/jump-if-lesser  $write-byte:to-stream/disp8
     # . flush(f)
     # . . push args
-    56/push-ESI
+    57/push-EDI
     # . . call
     e8/call  flush/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # . clear-stream(stream = f+4)
     # . . push args
-    8d/copy-address                 1/mod/*+disp8   6/rm32/ESI    .           .             .           0/r32/EAX   4/disp8         .                 # copy ESI+4 to EAX
+    8d/copy-address                 1/mod/*+disp8   7/rm32/EDI    .           .             .           0/r32/EAX   4/disp8         .                 # copy EDI+4 to EAX
     50/push-EAX
     # . . call
     e8/call  clear-stream/disp32
@@ -70,12 +70,12 @@ $write-byte:to-stream:
     # f->data[f->read] = LSB(n)
     31/xor                          3/mod/direct    0/rm32/EAX    .           .             .           0/r32/EAX   .               .                 # clear EAX
     8a/copy-byte                    1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           0/r32/AL    0xc/disp8       .                 # copy byte at *(EBP+12) to AL
-    88/copy-byte                    1/mod/*+disp8   4/rm32/sib    6/base/ESI  1/index/ECX   .           0/r32/AL    0x10/disp8      .                 # copy AL to *(ESI+ECX+16)
+    88/copy-byte                    1/mod/*+disp8   4/rm32/sib    7/base/EDI  1/index/ECX   .           0/r32/AL    0x10/disp8      .                 # copy AL to *(EDI+ECX+16)
     # ++f->read
-    ff          0/subop/increment   1/mod/*+disp8   6/rm32/ESI    .           .             .           .           4/disp8         .                 # increment *(ESI+4)
+    ff          0/subop/increment   1/mod/*+disp8   7/rm32/EDI    .           .             .           .           4/disp8         .                 # increment *(EDI+4)
 $write-byte:end:
     # . restore registers
-    5e/pop-to-ESI
+    5f/pop-to-EDI
     59/pop-to-ECX
     # . epilog
     89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index 75cf52eb..81739421 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b
index b37c0b92..9975fd8c 100755
--- a/subx/apps/crenshaw2-1b
+++ b/subx/apps/crenshaw2-1b
Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial
index ae38f80a..35405339 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differ