diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-06-27 08:44:34 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-06-27 08:44:34 -0700 |
commit | f9888786c387c0a4709915772e36a3f9bed2e06f (patch) | |
tree | b0d0bf5df97e6725d3c76b8f768e92d8f01d22e0 /html | |
parent | 0237be29aa2dc4827b9d83e6e3eeca08d8e7153e (diff) | |
download | mu-f9888786c387c0a4709915772e36a3f9bed2e06f.tar.gz |
.
Diffstat (limited to 'html')
-rw-r--r-- | html/mu_instructions.html | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/html/mu_instructions.html b/html/mu_instructions.html index 6f7f85f8..b12e3f12 100644 --- a/html/mu_instructions.html +++ b/html/mu_instructions.html @@ -10,20 +10,19 @@ <meta name="colorscheme" content="minimal-light"> <style type="text/css"> <!-- -pre { font-family: monospace; color: #000000; background-color: #eeeeee; } -body { font-family: monospace; color: #000000; background-color: #eeeeee; } +pre { font-family: monospace; color: #000000; background-color: #ffffd7; } +body { font-family: monospace; color: #000000; background-color: #ffffd7; } * { font-size: 1em; } -.muRegEdx { color: #878700; } -.PreProc { color: #c000c0; } -.muRegEsi { color: #87d787; } +.muRegEbx { color: #5f00ff; } +.muRegEdi { color: #00af00; } .muComment { color: #005faf; } -.muRegEdi { color: #87ffd7; } -.muRegEbx { color: #8787af; } +.PreProc { color: #c000c0; } +.muRegEsi { color: #005faf; } .Delimiter { color: #c000c0; } .Constant { color: #008787; } .Special { color: #ff6060; } -.muRegEax { color: #875f00; } -.muRegEcx { color: #af875f; } +.muRegEcx { color: #870000; } +.muRegEdx { color: #af5f00; } --> </style> </head> @@ -48,7 +47,7 @@ the SubX instruction they're translated to. These instructions use the general-purpose registers. -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> increment => <span class="Constant">"40/increment-eax"</span> +var/eax <span class="Special"><-</span> increment => <span class="Constant">"40/increment-eax"</span> var/<span class="muRegEcx">ecx</span> <span class="Special"><-</span> increment => <span class="Constant">"41/increment-ecx"</span> var/<span class="muRegEdx">edx</span> <span class="Special"><-</span> increment => <span class="Constant">"42/increment-edx"</span> var/<span class="muRegEbx">ebx</span> <span class="Special"><-</span> increment => <span class="Constant">"43/increment-ebx"</span> @@ -57,7 +56,7 @@ var/<span class="muRegEdi">edi</span> <span class="Special"><-</span> increme increment var => <span class="Constant">"ff 0/subop/increment *(ebp+"</span> var.stack-offset <span class="Constant">")"</span> increment *var/reg => <span class="Constant">"ff 0/subop/increment *"</span> reg -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> decrement => <span class="Constant">"48/decrement-eax"</span> +var/eax <span class="Special"><-</span> decrement => <span class="Constant">"48/decrement-eax"</span> var/<span class="muRegEcx">ecx</span> <span class="Special"><-</span> decrement => <span class="Constant">"49/decrement-ecx"</span> var/<span class="muRegEdx">edx</span> <span class="Special"><-</span> decrement => <span class="Constant">"4a/decrement-edx"</span> var/<span class="muRegEbx">ebx</span> <span class="Special"><-</span> decrement => <span class="Constant">"4b/decrement-ebx"</span> @@ -71,7 +70,7 @@ var/reg <span class="Special"><-</span> add var2 => <span cl var/reg <span class="Special"><-</span> add *var2/reg2 => <span class="Constant">"03/add *"</span> reg2 <span class="Constant">" "</span> reg <span class="Constant">"/r32"</span> add-to var1, var2/reg => <span class="Constant">"01/add-to *(ebp+"</span> var1.stack-offset <span class="Constant">") "</span> reg <span class="Constant">"/r32"</span> add-to *var1/reg1, var2/reg2 => <span class="Constant">"01/add-to *"</span> reg1 <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> add n => <span class="Constant">"05/add-to-eax "</span> n <span class="Constant">"/imm32"</span> +var/eax <span class="Special"><-</span> add n => <span class="Constant">"05/add-to-eax "</span> n <span class="Constant">"/imm32"</span> var/reg <span class="Special"><-</span> add n => <span class="Constant">"81 0/subop/add %"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> add-to var, n => <span class="Constant">"81 0/subop/add *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> add-to *var/reg, n => <span class="Constant">"81 0/subop/add *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> @@ -81,7 +80,7 @@ var/reg <span class="Special"><-</span> subtract var2 => <span cl var/reg <span class="Special"><-</span> subtract *var2/reg2 => <span class="Constant">"2b/subtract *"</span> reg2 <span class="Constant">" "</span> reg1 <span class="Constant">"/r32"</span> subtract-from var1, var2/reg2 => <span class="Constant">"29/subtract-from *(ebp+"</span> var1.stack-offset <span class="Constant">") "</span> reg2 <span class="Constant">"/r32"</span> subtract-from *var1/reg1, var2/reg2 => <span class="Constant">"29/subtract-from *"</span> reg1 <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> subtract n => <span class="Constant">"2d/subtract-from-eax "</span> n <span class="Constant">"/imm32"</span> +var/eax <span class="Special"><-</span> subtract n => <span class="Constant">"2d/subtract-from-eax "</span> n <span class="Constant">"/imm32"</span> var/reg <span class="Special"><-</span> subtract n => <span class="Constant">"81 5/subop/subtract %"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> subtract-from var, n => <span class="Constant">"81 5/subop/subtract *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> subtract-from *var/reg, n => <span class="Constant">"81 5/subop/subtract *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> @@ -91,7 +90,7 @@ var/reg <span class="Special"><-</span> and var2 => <span cl var/reg <span class="Special"><-</span> and *var2/reg2 => <span class="Constant">"23/and *"</span> reg2 <span class="Constant">" "</span> reg <span class="Constant">"/r32"</span> and-with var1, var2/reg => <span class="Constant">"21/and-with *(ebp+"</span> var1.stack-offset <span class="Constant">") "</span> reg <span class="Constant">"/r32"</span> and-with *var1/reg1, var2/reg2 => <span class="Constant">"21/and-with *"</span> reg1 <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> and n => <span class="Constant">"25/and-with-eax "</span> n <span class="Constant">"/imm32"</span> +var/eax <span class="Special"><-</span> and n => <span class="Constant">"25/and-with-eax "</span> n <span class="Constant">"/imm32"</span> var/reg <span class="Special"><-</span> and n => <span class="Constant">"81 4/subop/and %"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> and-with var, n => <span class="Constant">"81 4/subop/and *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> and-with *var/reg, n => <span class="Constant">"81 4/subop/and *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> @@ -101,7 +100,7 @@ var/reg <span class="Special"><-</span> or var2 => <span cl var/reg <span class="Special"><-</span> or *var2/reg2 => <span class="Constant">"0b/or *"</span> reg2 <span class="Constant">" "</span> reg <span class="Constant">"/r32"</span> or-with var1, var2/reg2 => <span class="Constant">"09/or-with *(ebp+"</span> var1.stack-offset <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> or-with *var1/reg1, var2/reg2 => <span class="Constant">"09/or-with *"</span> reg1 <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> or n => <span class="Constant">"0d/or-with-eax "</span> n <span class="Constant">"/imm32"</span> +var/eax <span class="Special"><-</span> or n => <span class="Constant">"0d/or-with-eax "</span> n <span class="Constant">"/imm32"</span> var/reg <span class="Special"><-</span> or n => <span class="Constant">"81 1/subop/or %"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> or-with var, n => <span class="Constant">"81 1/subop/or *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> or-with *var/reg, n => <span class="Constant">"81 1/subop/or *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> @@ -115,7 +114,7 @@ var/reg <span class="Special"><-</span> xor var2 => <span cl var/reg <span class="Special"><-</span> xor *var2/reg2 => <span class="Constant">"33/xor *"</span> reg2 <span class="Constant">" "</span> reg <span class="Constant">"/r32"</span> xor-with var1, var2/reg => <span class="Constant">"31/xor-with *(ebp+"</span> var1.stack-offset <span class="Constant">") "</span> reg <span class="Constant">"/r32"</span> xor-with *var1/reg1, var2/reg2 => <span class="Constant">"31/xor-with *"</span> reg1 <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> xor n => <span class="Constant">"35/xor-with-eax "</span> n <span class="Constant">"/imm32"</span> +var/eax <span class="Special"><-</span> xor n => <span class="Constant">"35/xor-with-eax "</span> n <span class="Constant">"/imm32"</span> var/reg <span class="Special"><-</span> xor n => <span class="Constant">"81 6/subop/xor %"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> xor-with var, n => <span class="Constant">"81 6/subop/xor *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> xor-with *var/reg, n => <span class="Constant">"81 6/subop/xor *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> @@ -134,7 +133,7 @@ shift-right *var/reg, n => <span class="Constant">"c1/shift 5/ shift-right-signed var, n => <span class="Constant">"c1/shift 7/subop/right-signed *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> shift-right-signed *var/reg, n => <span class="Constant">"c1/shift 7/subop/right-signed *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> -var/<span class="muRegEax">eax</span> <span class="Special"><-</span> copy n => <span class="Constant">"b8/copy-to-eax "</span> n <span class="Constant">"/imm32"</span> +var/eax <span class="Special"><-</span> copy n => <span class="Constant">"b8/copy-to-eax "</span> n <span class="Constant">"/imm32"</span> var/<span class="muRegEcx">ecx</span> <span class="Special"><-</span> copy n => <span class="Constant">"b9/copy-to-ecx "</span> n <span class="Constant">"/imm32"</span> var/<span class="muRegEdx">edx</span> <span class="Special"><-</span> copy n => <span class="Constant">"ba/copy-to-edx "</span> n <span class="Constant">"/imm32"</span> var/<span class="muRegEbx">ebx</span> <span class="Special"><-</span> copy n => <span class="Constant">"bb/copy-to-ebx "</span> n <span class="Constant">"/imm32"</span> @@ -159,7 +158,7 @@ compare var1, var2/reg2 => <span class="Constant">"39/compare compare *var1/reg1, var2/reg2 => <span class="Constant">"39/compare *"</span> reg1 <span class="Constant">" "</span> reg2 <span class="Constant">"/r32"</span> compare var1/reg1, var2 => <span class="Constant">"3b/compare<- *(ebp+"</span> var2.stack-offset <span class="Constant">") "</span> reg1 <span class="Constant">"/r32"</span> compare var/reg, *var2/reg2 => <span class="Constant">"3b/compare<- *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> -compare var/<span class="muRegEax">eax</span>, n => <span class="Constant">"3d/compare-eax-with "</span> n <span class="Constant">"/imm32"</span> +compare var/eax, n => <span class="Constant">"3d/compare-eax-with "</span> n <span class="Constant">"/imm32"</span> compare var/reg, n => <span class="Constant">"81 7/subop/compare %"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> compare var, n => <span class="Constant">"81 7/subop/compare *(ebp+"</span> var.stack-offset <span class="Constant">") "</span> n <span class="Constant">"/imm32"</span> compare *var/reg, n => <span class="Constant">"81 7/subop/compare *"</span> reg <span class="Constant">" "</span> n <span class="Constant">"/imm32"</span> @@ -414,8 +413,8 @@ var/reg: int <span class="Special"><-</span> length arr/reg2: (addr array T) <span class="Constant">"c1/shift 5/subop/logic-right %"</span> reg <span class="Constant">" "</span> log2(size-of(T)) <span class="Constant">"/imm8"</span> | otherwise x86 has no instruction to divide by a literal, so - we need up to <span class="Constant">3</span> extra registers! <span class="muRegEax">eax</span>/<span class="muRegEdx">edx</span> for division and say <span class="muRegEcx">ecx</span> - => if reg is not <span class="muRegEax">eax</span> + we need up to <span class="Constant">3</span> extra registers! eax/<span class="muRegEdx">edx</span> for division and say <span class="muRegEcx">ecx</span> + => if reg is not eax <span class="Constant">"50/push-eax"</span> if reg is not <span class="muRegEcx">ecx</span> <span class="Constant">"51/push-ecx"</span> @@ -425,13 +424,13 @@ var/reg: int <span class="Special"><-</span> length arr/reg2: (addr array T) <span class="Constant">"31/xor %edx 2/r32/edx"</span> <span class="muComment"># sign-extend, but array size can't be negative</span> <span class="Constant">"b9/copy-to-ecx "</span> size-of(T) <span class="Constant">"/imm32"</span> <span class="Constant">"f7 7/subop/idiv-eax-edx-by %ecx"</span> - if reg is not <span class="muRegEax">eax</span> + if reg is not eax <span class="Constant">"89/<- %"</span> reg <span class="Constant">" 0/r32/eax"</span> if reg is not <span class="muRegEdx">edx</span> <span class="Constant">"5a/pop-to-edx"</span> if reg is not <span class="muRegEcx">ecx</span> <span class="Constant">"59/pop-to-ecx"</span> - if reg is not <span class="muRegEax">eax</span> + if reg is not eax <span class="Constant">"58/pop-to-eax"</span> <span class="muComment"># User-defined types</span> |