diff options
Diffstat (limited to 'ue4/doxygen/instructions_8h-source.html')
| -rw-r--r-- | ue4/doxygen/instructions_8h-source.html | 752 |
1 files changed, 752 insertions, 0 deletions
diff --git a/ue4/doxygen/instructions_8h-source.html b/ue4/doxygen/instructions_8h-source.html new file mode 100644 index 0000000..e92a004 --- /dev/null +++ b/ue4/doxygen/instructions_8h-source.html | |||
| @@ -0,0 +1,752 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | ||
| 3 | <title>mycpu: mycpu/instructions.h Source File</title> | ||
| 4 | <link href="doxygen.css" rel="stylesheet" type="text/css"> | ||
| 5 | <link href="tabs.css" rel="stylesheet" type="text/css"> | ||
| 6 | </head><body> | ||
| 7 | <!-- Generated by Doxygen 1.5.3 --> | ||
| 8 | <div class="tabs"> | ||
| 9 | <ul> | ||
| 10 | <li><a href="index.html"><span>Main Page</span></a></li> | ||
| 11 | <li><a href="annotated.html"><span>Classes</span></a></li> | ||
| 12 | <li class="current"><a href="files.html"><span>Files</span></a></li> | ||
| 13 | </ul> | ||
| 14 | </div> | ||
| 15 | <h1>mycpu/instructions.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 | ||
| 16 | <a name="l00008"></a>00008 <span class="preprocessor">#ifndef INSTRUCTIONS_H</span> | ||
| 17 | <a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define INSTRUCTIONS_H 1</span> | ||
| 18 | <a name="l00010"></a>00010 <span class="preprocessor"></span> | ||
| 19 | <a name="l00011"></a>00011 <span class="preprocessor">#include "cinstruction.h"</span> | ||
| 20 | <a name="l00012"></a>00012 <span class="preprocessor">#include "ccpu.h"</span> | ||
| 21 | <a name="l00013"></a>00013 <span class="preprocessor">#include "cprogram.h"</span> | ||
| 22 | <a name="l00014"></a>00014 | ||
| 23 | <a name="l00022"></a>00022 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 24 | <a name="l00023"></a><a class="code" href="classCInstructionInc.html">00023</a> <span class="keyword">class </span><a class="code" href="classCInstructionInc.html">CInstructionInc</a> | ||
| 25 | <a name="l00024"></a>00024 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 26 | <a name="l00025"></a>00025 { | ||
| 27 | <a name="l00026"></a>00026 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 28 | <a name="l00027"></a>00027 | ||
| 29 | <a name="l00028"></a>00028 <span class="keyword">public</span>: | ||
| 30 | <a name="l00029"></a>00029 <a class="code" href="classCInstructionInc.html">CInstructionInc</a>() | ||
| 31 | <a name="l00030"></a>00030 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"inc"</span>) | ||
| 32 | <a name="l00031"></a>00031 {} | ||
| 33 | <a name="l00032"></a>00032 | ||
| 34 | <a name="l00033"></a><a class="code" href="classCInstructionInc.html#f556b01208bb2c7a1a9e116365d3b094">00033</a> <a class="code" href="classCInstructionInc.html">CInstructionInc</a> *<a class="code" href="classCInstructionInc.html#f556b01208bb2c7a1a9e116365d3b094" title="creates a new instance of this instruction">factory</a>() | ||
| 35 | <a name="l00034"></a>00034 { | ||
| 36 | <a name="l00035"></a>00035 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionInc.html">CInstructionInc</a>; | ||
| 37 | <a name="l00036"></a>00036 } | ||
| 38 | <a name="l00037"></a>00037 | ||
| 39 | <a name="l00038"></a>00038 <span class="keywordtype">void</span> <a class="code" href="classCInstructionInc.html#58639820dac10e44455e2b4ee03c16a4" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 40 | <a name="l00039"></a>00039 <span class="keywordtype">void</span> <a class="code" href="classCInstructionInc.html#95685bd60c72f5e99f4c74946fc17d24" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 41 | <a name="l00040"></a>00040 | ||
| 42 | <a name="l00041"></a>00041 <span class="keyword">protected</span>: | ||
| 43 | <a name="l00043"></a><a class="code" href="classCInstructionInc.html#d200eebadcf6c37d11dacfca00f2c364">00043</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionInc.html#d200eebadcf6c37d11dacfca00f2c364">m_regidx1</a>; | ||
| 44 | <a name="l00044"></a>00044 }; | ||
| 45 | <a name="l00045"></a>00045 | ||
| 46 | <a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 47 | <a name="l00047"></a>00047 | ||
| 48 | <a name="l00048"></a>00048 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 49 | <a name="l00049"></a><a class="code" href="classCInstructionInc.html#58639820dac10e44455e2b4ee03c16a4">00049</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionInc.html#58639820dac10e44455e2b4ee03c16a4" title="parses instruction parameters and prepares the instruction for executing">CInstructionInc<T>::compile</a>(std::list<std::string>& params) | ||
| 50 | <a name="l00050"></a>00050 { | ||
| 51 | <a name="l00051"></a>00051 <span class="keywordflow">if</span> (params.size() != 1) | ||
| 52 | <a name="l00052"></a>00052 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 1"</span>); | ||
| 53 | <a name="l00053"></a>00053 <a class="code" href="classCInstructionInc.html#d200eebadcf6c37d11dacfca00f2c364">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 54 | <a name="l00054"></a>00054 params.pop_front(); | ||
| 55 | <a name="l00055"></a>00055 } | ||
| 56 | <a name="l00056"></a>00056 | ||
| 57 | <a name="l00057"></a>00057 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 58 | <a name="l00058"></a>00058 | ||
| 59 | <a name="l00059"></a>00059 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 60 | <a name="l00060"></a><a class="code" href="classCInstructionInc.html#95685bd60c72f5e99f4c74946fc17d24">00060</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionInc.html#95685bd60c72f5e99f4c74946fc17d24" title="executes the instruction">CInstructionInc<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 61 | <a name="l00061"></a>00061 { | ||
| 62 | <a name="l00062"></a>00062 assert(cpu != NULL); | ||
| 63 | <a name="l00063"></a>00063 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionInc.html#d200eebadcf6c37d11dacfca00f2c364">m_regidx1</a>); | ||
| 64 | <a name="l00064"></a>00064 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionInc.html#d200eebadcf6c37d11dacfca00f2c364">m_regidx1</a> ]++; | ||
| 65 | <a name="l00065"></a>00065 } | ||
| 66 | <a name="l00066"></a>00066 | ||
| 67 | <a name="l00067"></a>00067 <span class="comment">/*============================================================================*/</span> | ||
| 68 | <a name="l00068"></a>00068 | ||
| 69 | <a name="l00076"></a>00076 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 70 | <a name="l00077"></a><a class="code" href="classCInstructionDec.html">00077</a> <span class="keyword">class </span><a class="code" href="classCInstructionDec.html">CInstructionDec</a> | ||
| 71 | <a name="l00078"></a>00078 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 72 | <a name="l00079"></a>00079 { | ||
| 73 | <a name="l00080"></a>00080 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 74 | <a name="l00081"></a>00081 | ||
| 75 | <a name="l00082"></a>00082 <span class="keyword">public</span>: | ||
| 76 | <a name="l00083"></a>00083 <a class="code" href="classCInstructionDec.html">CInstructionDec</a>() | ||
| 77 | <a name="l00084"></a>00084 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"dec"</span>) | ||
| 78 | <a name="l00085"></a>00085 {} | ||
| 79 | <a name="l00086"></a>00086 | ||
| 80 | <a name="l00087"></a><a class="code" href="classCInstructionDec.html#3fb78e4289bed054394f0b186c76d12f">00087</a> <a class="code" href="classCInstructionDec.html">CInstructionDec</a> *<a class="code" href="classCInstructionInc.html#f556b01208bb2c7a1a9e116365d3b094" title="creates a new instance of this instruction">factory</a>() | ||
| 81 | <a name="l00088"></a>00088 { | ||
| 82 | <a name="l00089"></a>00089 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionDec.html">CInstructionDec</a>; | ||
| 83 | <a name="l00090"></a>00090 } | ||
| 84 | <a name="l00091"></a>00091 | ||
| 85 | <a name="l00092"></a>00092 <span class="keywordtype">void</span> <a class="code" href="classCInstructionInc.html#58639820dac10e44455e2b4ee03c16a4" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 86 | <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classCInstructionInc.html#95685bd60c72f5e99f4c74946fc17d24" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 87 | <a name="l00094"></a>00094 | ||
| 88 | <a name="l00095"></a>00095 <span class="keyword">protected</span>: | ||
| 89 | <a name="l00097"></a><a class="code" href="classCInstructionDec.html#7fd9ee6cab9ea8504e6755b6b475f186">00097</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionInc.html#d200eebadcf6c37d11dacfca00f2c364">m_regidx1</a>; | ||
| 90 | <a name="l00098"></a>00098 }; | ||
| 91 | <a name="l00099"></a>00099 | ||
| 92 | <a name="l00100"></a>00100 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 93 | <a name="l00101"></a>00101 | ||
| 94 | <a name="l00102"></a>00102 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 95 | <a name="l00103"></a><a class="code" href="classCInstructionDec.html#7d71e63eda1fc908481919e54f219df9">00103</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionDec.html#7d71e63eda1fc908481919e54f219df9" title="parses instruction parameters and prepares the instruction for executing">CInstructionDec<T>::compile</a>(std::list<std::string>& params) | ||
| 96 | <a name="l00104"></a>00104 { | ||
| 97 | <a name="l00105"></a>00105 <span class="keywordflow">if</span> (params.size() != 1) | ||
| 98 | <a name="l00106"></a>00106 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 1"</span>); | ||
| 99 | <a name="l00107"></a>00107 <a class="code" href="classCInstructionDec.html#7fd9ee6cab9ea8504e6755b6b475f186">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 100 | <a name="l00108"></a>00108 params.pop_front(); | ||
| 101 | <a name="l00109"></a>00109 } | ||
| 102 | <a name="l00110"></a>00110 | ||
| 103 | <a name="l00111"></a>00111 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 104 | <a name="l00112"></a>00112 | ||
| 105 | <a name="l00113"></a>00113 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 106 | <a name="l00114"></a><a class="code" href="classCInstructionDec.html#85000776f57be3f298f4707d712d1e29">00114</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionDec.html#85000776f57be3f298f4707d712d1e29" title="executes the instruction">CInstructionDec<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 107 | <a name="l00115"></a>00115 { | ||
| 108 | <a name="l00116"></a>00116 assert(cpu != NULL); | ||
| 109 | <a name="l00117"></a>00117 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionDec.html#7fd9ee6cab9ea8504e6755b6b475f186">m_regidx1</a>); | ||
| 110 | <a name="l00118"></a>00118 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionDec.html#7fd9ee6cab9ea8504e6755b6b475f186">m_regidx1</a> ]--; | ||
| 111 | <a name="l00119"></a>00119 } | ||
| 112 | <a name="l00120"></a>00120 | ||
| 113 | <a name="l00121"></a>00121 <span class="comment">/*============================================================================*/</span> | ||
| 114 | <a name="l00122"></a>00122 | ||
| 115 | <a name="l00130"></a>00130 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 116 | <a name="l00131"></a><a class="code" href="classCInstructionAdd.html">00131</a> <span class="keyword">class </span><a class="code" href="classCInstructionAdd.html">CInstructionAdd</a> | ||
| 117 | <a name="l00132"></a>00132 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 118 | <a name="l00133"></a>00133 { | ||
| 119 | <a name="l00134"></a>00134 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 120 | <a name="l00135"></a>00135 | ||
| 121 | <a name="l00136"></a>00136 <span class="keyword">public</span>: | ||
| 122 | <a name="l00137"></a>00137 <a class="code" href="classCInstructionAdd.html">CInstructionAdd</a>() | ||
| 123 | <a name="l00138"></a>00138 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"add"</span>) | ||
| 124 | <a name="l00139"></a>00139 {} | ||
| 125 | <a name="l00140"></a>00140 | ||
| 126 | <a name="l00141"></a><a class="code" href="classCInstructionAdd.html#d964d1e7ede00ee12b8d8768db4fde3e">00141</a> <a class="code" href="classCInstructionAdd.html">CInstructionAdd</a> *<a class="code" href="classCInstructionDec.html#3fb78e4289bed054394f0b186c76d12f" title="creates a new instance of this instruction">factory</a>() | ||
| 127 | <a name="l00142"></a>00142 { | ||
| 128 | <a name="l00143"></a>00143 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionAdd.html">CInstructionAdd</a>; | ||
| 129 | <a name="l00144"></a>00144 } | ||
| 130 | <a name="l00145"></a>00145 | ||
| 131 | <a name="l00146"></a>00146 <span class="keywordtype">void</span> <a class="code" href="classCInstructionDec.html#7d71e63eda1fc908481919e54f219df9" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 132 | <a name="l00147"></a>00147 <span class="keywordtype">void</span> <a class="code" href="classCInstructionDec.html#85000776f57be3f298f4707d712d1e29" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 133 | <a name="l00148"></a>00148 | ||
| 134 | <a name="l00149"></a>00149 <span class="keyword">protected</span>: | ||
| 135 | <a name="l00151"></a><a class="code" href="classCInstructionAdd.html#8089bcb5dcf9acd471dd07b19f5081c5">00151</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionDec.html#7fd9ee6cab9ea8504e6755b6b475f186">m_regidx1</a>; | ||
| 136 | <a name="l00153"></a><a class="code" href="classCInstructionAdd.html#25f0fab0bae358796643b1e33b0074a8">00153</a> <span class="keywordtype">unsigned</span> m_regidx2; | ||
| 137 | <a name="l00155"></a><a class="code" href="classCInstructionAdd.html#5c66a8d18ca4575d92a3e6d2263045c8">00155</a> <span class="keywordtype">unsigned</span> m_regidx3; | ||
| 138 | <a name="l00156"></a>00156 }; | ||
| 139 | <a name="l00157"></a>00157 | ||
| 140 | <a name="l00158"></a>00158 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 141 | <a name="l00159"></a>00159 | ||
| 142 | <a name="l00160"></a>00160 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 143 | <a name="l00161"></a><a class="code" href="classCInstructionAdd.html#1e3aaea6e2d3a969f3a271e9206f3793">00161</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionAdd.html#1e3aaea6e2d3a969f3a271e9206f3793" title="parses instruction parameters and prepares the instruction for executing">CInstructionAdd<T>::compile</a>(std::list<std::string>& params) | ||
| 144 | <a name="l00162"></a>00162 { | ||
| 145 | <a name="l00163"></a>00163 <span class="keywordflow">if</span> (params.size() != 3) | ||
| 146 | <a name="l00164"></a>00164 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 3"</span>); | ||
| 147 | <a name="l00165"></a>00165 <a class="code" href="classCInstructionAdd.html#8089bcb5dcf9acd471dd07b19f5081c5">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 148 | <a name="l00166"></a>00166 params.pop_front(); | ||
| 149 | <a name="l00167"></a>00167 <a class="code" href="classCInstructionAdd.html#25f0fab0bae358796643b1e33b0074a8">m_regidx2</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 150 | <a name="l00168"></a>00168 params.pop_front(); | ||
| 151 | <a name="l00169"></a>00169 <a class="code" href="classCInstructionAdd.html#5c66a8d18ca4575d92a3e6d2263045c8">m_regidx3</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 152 | <a name="l00170"></a>00170 params.pop_front(); | ||
| 153 | <a name="l00171"></a>00171 } | ||
| 154 | <a name="l00172"></a>00172 | ||
| 155 | <a name="l00173"></a>00173 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 156 | <a name="l00174"></a>00174 | ||
| 157 | <a name="l00175"></a>00175 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 158 | <a name="l00176"></a><a class="code" href="classCInstructionAdd.html#ae1f8adc22bd3257ad3a52eb9f0f1dbc">00176</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionAdd.html#ae1f8adc22bd3257ad3a52eb9f0f1dbc" title="executes the instruction">CInstructionAdd<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 159 | <a name="l00177"></a>00177 { | ||
| 160 | <a name="l00178"></a>00178 assert(cpu != NULL); | ||
| 161 | <a name="l00179"></a>00179 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionAdd.html#8089bcb5dcf9acd471dd07b19f5081c5">m_regidx1</a>); | ||
| 162 | <a name="l00180"></a>00180 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionAdd.html#25f0fab0bae358796643b1e33b0074a8">m_regidx2</a>); | ||
| 163 | <a name="l00181"></a>00181 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionAdd.html#5c66a8d18ca4575d92a3e6d2263045c8">m_regidx3</a>); | ||
| 164 | <a name="l00182"></a>00182 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionAdd.html#8089bcb5dcf9acd471dd07b19f5081c5">m_regidx1</a> ] = cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionAdd.html#25f0fab0bae358796643b1e33b0074a8">m_regidx2</a> ] | ||
| 165 | <a name="l00183"></a>00183 + cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionAdd.html#5c66a8d18ca4575d92a3e6d2263045c8">m_regidx3</a> ]; | ||
| 166 | <a name="l00184"></a>00184 } | ||
| 167 | <a name="l00185"></a>00185 | ||
| 168 | <a name="l00186"></a>00186 <span class="comment">/*============================================================================*/</span> | ||
| 169 | <a name="l00187"></a>00187 | ||
| 170 | <a name="l00195"></a>00195 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 171 | <a name="l00196"></a><a class="code" href="classCInstructionSub.html">00196</a> <span class="keyword">class </span><a class="code" href="classCInstructionSub.html">CInstructionSub</a> | ||
| 172 | <a name="l00197"></a>00197 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 173 | <a name="l00198"></a>00198 { | ||
| 174 | <a name="l00199"></a>00199 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 175 | <a name="l00200"></a>00200 | ||
| 176 | <a name="l00201"></a>00201 <span class="keyword">public</span>: | ||
| 177 | <a name="l00202"></a>00202 <a class="code" href="classCInstructionSub.html">CInstructionSub</a>() | ||
| 178 | <a name="l00203"></a>00203 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"sub"</span>) | ||
| 179 | <a name="l00204"></a>00204 {} | ||
| 180 | <a name="l00205"></a>00205 | ||
| 181 | <a name="l00206"></a><a class="code" href="classCInstructionSub.html#07e7a95548ffa6b16fde4af21f6974eb">00206</a> <a class="code" href="classCInstructionSub.html">CInstructionSub</a> *<a class="code" href="classCInstructionAdd.html#d964d1e7ede00ee12b8d8768db4fde3e" title="creates a new instance of this instruction">factory</a>() | ||
| 182 | <a name="l00207"></a>00207 { | ||
| 183 | <a name="l00208"></a>00208 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionSub.html">CInstructionSub</a>; | ||
| 184 | <a name="l00209"></a>00209 } | ||
| 185 | <a name="l00210"></a>00210 | ||
| 186 | <a name="l00211"></a>00211 <span class="keywordtype">void</span> <a class="code" href="classCInstructionAdd.html#1e3aaea6e2d3a969f3a271e9206f3793" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 187 | <a name="l00212"></a>00212 <span class="keywordtype">void</span> <a class="code" href="classCInstructionAdd.html#ae1f8adc22bd3257ad3a52eb9f0f1dbc" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 188 | <a name="l00213"></a>00213 | ||
| 189 | <a name="l00214"></a>00214 <span class="keyword">protected</span>: | ||
| 190 | <a name="l00216"></a><a class="code" href="classCInstructionSub.html#f7bc15436479eb225912e759efc267ea">00216</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionAdd.html#8089bcb5dcf9acd471dd07b19f5081c5">m_regidx1</a>; | ||
| 191 | <a name="l00218"></a><a class="code" href="classCInstructionSub.html#b9c280bc85e9eda2e90f04f8f270c577">00218</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionAdd.html#25f0fab0bae358796643b1e33b0074a8">m_regidx2</a>; | ||
| 192 | <a name="l00220"></a><a class="code" href="classCInstructionSub.html#5aac7e92257fb4757802ac05efb162c8">00220</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionAdd.html#5c66a8d18ca4575d92a3e6d2263045c8">m_regidx3</a>; | ||
| 193 | <a name="l00221"></a>00221 }; | ||
| 194 | <a name="l00222"></a>00222 | ||
| 195 | <a name="l00223"></a>00223 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 196 | <a name="l00224"></a>00224 | ||
| 197 | <a name="l00225"></a>00225 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 198 | <a name="l00226"></a><a class="code" href="classCInstructionSub.html#a06f12adcf971f2815353eee22186cda">00226</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionSub.html#a06f12adcf971f2815353eee22186cda" title="parses instruction parameters and prepares the instruction for executing">CInstructionSub<T>::compile</a>(std::list<std::string>& params) | ||
| 199 | <a name="l00227"></a>00227 { | ||
| 200 | <a name="l00228"></a>00228 <span class="keywordflow">if</span> (params.size() != 3) | ||
| 201 | <a name="l00229"></a>00229 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 3"</span>); | ||
| 202 | <a name="l00230"></a>00230 <a class="code" href="classCInstructionSub.html#f7bc15436479eb225912e759efc267ea">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 203 | <a name="l00231"></a>00231 params.pop_front(); | ||
| 204 | <a name="l00232"></a>00232 <a class="code" href="classCInstructionSub.html#b9c280bc85e9eda2e90f04f8f270c577">m_regidx2</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 205 | <a name="l00233"></a>00233 params.pop_front(); | ||
| 206 | <a name="l00234"></a>00234 <a class="code" href="classCInstructionSub.html#5aac7e92257fb4757802ac05efb162c8">m_regidx3</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 207 | <a name="l00235"></a>00235 params.pop_front(); | ||
| 208 | <a name="l00236"></a>00236 } | ||
| 209 | <a name="l00237"></a>00237 | ||
| 210 | <a name="l00238"></a>00238 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 211 | <a name="l00239"></a>00239 | ||
| 212 | <a name="l00240"></a>00240 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 213 | <a name="l00241"></a><a class="code" href="classCInstructionSub.html#56e1918846036e631d75423d628ec795">00241</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionSub.html#56e1918846036e631d75423d628ec795" title="executes the instruction">CInstructionSub<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 214 | <a name="l00242"></a>00242 { | ||
| 215 | <a name="l00243"></a>00243 assert(cpu != NULL); | ||
| 216 | <a name="l00244"></a>00244 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionSub.html#f7bc15436479eb225912e759efc267ea">m_regidx1</a>); | ||
| 217 | <a name="l00245"></a>00245 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionSub.html#b9c280bc85e9eda2e90f04f8f270c577">m_regidx2</a>); | ||
| 218 | <a name="l00246"></a>00246 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionSub.html#5aac7e92257fb4757802ac05efb162c8">m_regidx3</a>); | ||
| 219 | <a name="l00247"></a>00247 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionSub.html#f7bc15436479eb225912e759efc267ea">m_regidx1</a> ] = cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionSub.html#b9c280bc85e9eda2e90f04f8f270c577">m_regidx2</a> ] | ||
| 220 | <a name="l00248"></a>00248 - cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionSub.html#5aac7e92257fb4757802ac05efb162c8">m_regidx3</a> ]; | ||
| 221 | <a name="l00249"></a>00249 } | ||
| 222 | <a name="l00250"></a>00250 | ||
| 223 | <a name="l00251"></a>00251 <span class="comment">/*============================================================================*/</span> | ||
| 224 | <a name="l00252"></a>00252 | ||
| 225 | <a name="l00260"></a>00260 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 226 | <a name="l00261"></a><a class="code" href="classCInstructionMul.html">00261</a> <span class="keyword">class </span><a class="code" href="classCInstructionMul.html">CInstructionMul</a> | ||
| 227 | <a name="l00262"></a>00262 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 228 | <a name="l00263"></a>00263 { | ||
| 229 | <a name="l00264"></a>00264 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 230 | <a name="l00265"></a>00265 | ||
| 231 | <a name="l00266"></a>00266 <span class="keyword">public</span>: | ||
| 232 | <a name="l00267"></a>00267 <a class="code" href="classCInstructionMul.html">CInstructionMul</a>() | ||
| 233 | <a name="l00268"></a>00268 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"mul"</span>) | ||
| 234 | <a name="l00269"></a>00269 {} | ||
| 235 | <a name="l00270"></a>00270 | ||
| 236 | <a name="l00271"></a><a class="code" href="classCInstructionMul.html#a8965040e952736b4a6c0927241eac34">00271</a> <a class="code" href="classCInstructionMul.html">CInstructionMul</a> *<a class="code" href="classCInstructionSub.html#07e7a95548ffa6b16fde4af21f6974eb" title="creates a new instance of this instruction">factory</a>() | ||
| 237 | <a name="l00272"></a>00272 { | ||
| 238 | <a name="l00273"></a>00273 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionMul.html">CInstructionMul</a>; | ||
| 239 | <a name="l00274"></a>00274 } | ||
| 240 | <a name="l00275"></a>00275 | ||
| 241 | <a name="l00276"></a>00276 <span class="keywordtype">void</span> <a class="code" href="classCInstructionSub.html#a06f12adcf971f2815353eee22186cda" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 242 | <a name="l00277"></a>00277 <span class="keywordtype">void</span> <a class="code" href="classCInstructionSub.html#56e1918846036e631d75423d628ec795" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 243 | <a name="l00278"></a>00278 | ||
| 244 | <a name="l00279"></a>00279 <span class="keyword">protected</span>: | ||
| 245 | <a name="l00281"></a><a class="code" href="classCInstructionMul.html#8f337109ed74975e8a2b4d72f8ce0346">00281</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionSub.html#f7bc15436479eb225912e759efc267ea">m_regidx1</a>; | ||
| 246 | <a name="l00283"></a><a class="code" href="classCInstructionMul.html#7f9cdf152315af758c9cc076d8e2ab9f">00283</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionSub.html#b9c280bc85e9eda2e90f04f8f270c577">m_regidx2</a>; | ||
| 247 | <a name="l00285"></a><a class="code" href="classCInstructionMul.html#68378953b889a978e7826ca3d5f7c816">00285</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionSub.html#5aac7e92257fb4757802ac05efb162c8">m_regidx3</a>; | ||
| 248 | <a name="l00286"></a>00286 }; | ||
| 249 | <a name="l00287"></a>00287 | ||
| 250 | <a name="l00288"></a>00288 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 251 | <a name="l00289"></a>00289 | ||
| 252 | <a name="l00290"></a>00290 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 253 | <a name="l00291"></a><a class="code" href="classCInstructionMul.html#d44d0cc3f52602c2a8b6c76a6346826b">00291</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionMul.html#d44d0cc3f52602c2a8b6c76a6346826b" title="parses instruction parameters and prepares the instruction for executing">CInstructionMul<T>::compile</a>(std::list<std::string>& params) | ||
| 254 | <a name="l00292"></a>00292 { | ||
| 255 | <a name="l00293"></a>00293 <span class="keywordflow">if</span> (params.size() != 3) | ||
| 256 | <a name="l00294"></a>00294 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 3"</span>); | ||
| 257 | <a name="l00295"></a>00295 <a class="code" href="classCInstructionMul.html#8f337109ed74975e8a2b4d72f8ce0346">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 258 | <a name="l00296"></a>00296 params.pop_front(); | ||
| 259 | <a name="l00297"></a>00297 <a class="code" href="classCInstructionMul.html#7f9cdf152315af758c9cc076d8e2ab9f">m_regidx2</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 260 | <a name="l00298"></a>00298 params.pop_front(); | ||
| 261 | <a name="l00299"></a>00299 <a class="code" href="classCInstructionMul.html#68378953b889a978e7826ca3d5f7c816">m_regidx3</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 262 | <a name="l00300"></a>00300 params.pop_front(); | ||
| 263 | <a name="l00301"></a>00301 } | ||
| 264 | <a name="l00302"></a>00302 | ||
| 265 | <a name="l00303"></a>00303 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 266 | <a name="l00304"></a>00304 | ||
| 267 | <a name="l00305"></a>00305 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 268 | <a name="l00306"></a><a class="code" href="classCInstructionMul.html#c6655475fdc386f6553a674e928faeef">00306</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionMul.html#c6655475fdc386f6553a674e928faeef" title="executes the instruction">CInstructionMul<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 269 | <a name="l00307"></a>00307 { | ||
| 270 | <a name="l00308"></a>00308 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionMul.html#8f337109ed74975e8a2b4d72f8ce0346">m_regidx1</a>); | ||
| 271 | <a name="l00309"></a>00309 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionMul.html#7f9cdf152315af758c9cc076d8e2ab9f">m_regidx2</a>); | ||
| 272 | <a name="l00310"></a>00310 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionMul.html#68378953b889a978e7826ca3d5f7c816">m_regidx3</a>); | ||
| 273 | <a name="l00311"></a>00311 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionMul.html#8f337109ed74975e8a2b4d72f8ce0346">m_regidx1</a> ] = cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionMul.html#7f9cdf152315af758c9cc076d8e2ab9f">m_regidx2</a> ] | ||
| 274 | <a name="l00312"></a>00312 * cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionMul.html#68378953b889a978e7826ca3d5f7c816">m_regidx3</a> ]; | ||
| 275 | <a name="l00313"></a>00313 } | ||
| 276 | <a name="l00314"></a>00314 | ||
| 277 | <a name="l00315"></a>00315 <span class="comment">/*============================================================================*/</span> | ||
| 278 | <a name="l00316"></a>00316 | ||
| 279 | <a name="l00324"></a>00324 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 280 | <a name="l00325"></a><a class="code" href="classCInstructionDiv.html">00325</a> <span class="keyword">class </span><a class="code" href="classCInstructionDiv.html">CInstructionDiv</a> | ||
| 281 | <a name="l00326"></a>00326 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 282 | <a name="l00327"></a>00327 { | ||
| 283 | <a name="l00328"></a>00328 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 284 | <a name="l00329"></a>00329 | ||
| 285 | <a name="l00330"></a>00330 <span class="keyword">public</span>: | ||
| 286 | <a name="l00331"></a>00331 <a class="code" href="classCInstructionDiv.html">CInstructionDiv</a>() | ||
| 287 | <a name="l00332"></a>00332 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"div"</span>) | ||
| 288 | <a name="l00333"></a>00333 {} | ||
| 289 | <a name="l00334"></a>00334 | ||
| 290 | <a name="l00335"></a><a class="code" href="classCInstructionDiv.html#37893855d88bdd2607f10543fd4aadbc">00335</a> <a class="code" href="classCInstructionDiv.html">CInstructionDiv</a> *<a class="code" href="classCInstructionMul.html#a8965040e952736b4a6c0927241eac34" title="creates a new instance of this instruction">factory</a>() | ||
| 291 | <a name="l00336"></a>00336 { | ||
| 292 | <a name="l00337"></a>00337 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionDiv.html">CInstructionDiv</a>; | ||
| 293 | <a name="l00338"></a>00338 } | ||
| 294 | <a name="l00339"></a>00339 | ||
| 295 | <a name="l00340"></a>00340 <span class="keywordtype">void</span> <a class="code" href="classCInstructionMul.html#d44d0cc3f52602c2a8b6c76a6346826b" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 296 | <a name="l00341"></a>00341 <span class="keywordtype">void</span> <a class="code" href="classCInstructionMul.html#c6655475fdc386f6553a674e928faeef" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 297 | <a name="l00342"></a>00342 | ||
| 298 | <a name="l00343"></a>00343 <span class="keyword">protected</span>: | ||
| 299 | <a name="l00345"></a><a class="code" href="classCInstructionDiv.html#12268ddbbd4994e5a679d938dfbbdddf">00345</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionMul.html#8f337109ed74975e8a2b4d72f8ce0346">m_regidx1</a>; | ||
| 300 | <a name="l00347"></a><a class="code" href="classCInstructionDiv.html#893812d619293cb5080d04cf71582aaf">00347</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionMul.html#7f9cdf152315af758c9cc076d8e2ab9f">m_regidx2</a>; | ||
| 301 | <a name="l00349"></a><a class="code" href="classCInstructionDiv.html#8a9ba5457f0d3c13000a83c90035b01d">00349</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionMul.html#68378953b889a978e7826ca3d5f7c816">m_regidx3</a>; | ||
| 302 | <a name="l00350"></a>00350 }; | ||
| 303 | <a name="l00351"></a>00351 | ||
| 304 | <a name="l00352"></a>00352 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 305 | <a name="l00353"></a>00353 | ||
| 306 | <a name="l00354"></a>00354 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 307 | <a name="l00355"></a><a class="code" href="classCInstructionDiv.html#b4d0c2cd45ec584a16f23ed16f6a1831">00355</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionDiv.html#b4d0c2cd45ec584a16f23ed16f6a1831" title="parses instruction parameters and prepares the instruction for executing">CInstructionDiv<T>::compile</a>(std::list<std::string>& params) | ||
| 308 | <a name="l00356"></a>00356 { | ||
| 309 | <a name="l00357"></a>00357 <span class="keywordflow">if</span> (params.size() != 3) | ||
| 310 | <a name="l00358"></a>00358 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 3"</span>); | ||
| 311 | <a name="l00359"></a>00359 <a class="code" href="classCInstructionDiv.html#12268ddbbd4994e5a679d938dfbbdddf">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 312 | <a name="l00360"></a>00360 params.pop_front(); | ||
| 313 | <a name="l00361"></a>00361 <a class="code" href="classCInstructionDiv.html#893812d619293cb5080d04cf71582aaf">m_regidx2</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 314 | <a name="l00362"></a>00362 params.pop_front(); | ||
| 315 | <a name="l00363"></a>00363 <a class="code" href="classCInstructionDiv.html#8a9ba5457f0d3c13000a83c90035b01d">m_regidx3</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 316 | <a name="l00364"></a>00364 params.pop_front(); | ||
| 317 | <a name="l00365"></a>00365 } | ||
| 318 | <a name="l00366"></a>00366 | ||
| 319 | <a name="l00367"></a>00367 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 320 | <a name="l00368"></a>00368 | ||
| 321 | <a name="l00369"></a>00369 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 322 | <a name="l00370"></a><a class="code" href="classCInstructionDiv.html#62b6351aa17d0a8f5ac420f6dcabab65">00370</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionDiv.html#62b6351aa17d0a8f5ac420f6dcabab65" title="executes the instruction">CInstructionDiv<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 323 | <a name="l00371"></a>00371 { | ||
| 324 | <a name="l00372"></a>00372 assert(cpu != NULL); | ||
| 325 | <a name="l00373"></a>00373 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionDiv.html#12268ddbbd4994e5a679d938dfbbdddf">m_regidx1</a>); | ||
| 326 | <a name="l00374"></a>00374 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionDiv.html#893812d619293cb5080d04cf71582aaf">m_regidx2</a>); | ||
| 327 | <a name="l00375"></a>00375 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionDiv.html#8a9ba5457f0d3c13000a83c90035b01d">m_regidx3</a>); | ||
| 328 | <a name="l00376"></a>00376 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionDiv.html#12268ddbbd4994e5a679d938dfbbdddf">m_regidx1</a> ] = cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionDiv.html#893812d619293cb5080d04cf71582aaf">m_regidx2</a> ] | ||
| 329 | <a name="l00377"></a>00377 / cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionDiv.html#8a9ba5457f0d3c13000a83c90035b01d">m_regidx3</a> ]; | ||
| 330 | <a name="l00378"></a>00378 } | ||
| 331 | <a name="l00379"></a>00379 | ||
| 332 | <a name="l00380"></a>00380 <span class="comment">/*============================================================================*/</span> | ||
| 333 | <a name="l00381"></a>00381 | ||
| 334 | <a name="l00389"></a>00389 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 335 | <a name="l00390"></a><a class="code" href="classCInstructionLoad.html">00390</a> <span class="keyword">class </span><a class="code" href="classCInstructionLoad.html">CInstructionLoad</a> | ||
| 336 | <a name="l00391"></a>00391 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 337 | <a name="l00392"></a>00392 { | ||
| 338 | <a name="l00393"></a>00393 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 339 | <a name="l00394"></a>00394 | ||
| 340 | <a name="l00395"></a>00395 <span class="keyword">public</span>: | ||
| 341 | <a name="l00396"></a>00396 <a class="code" href="classCInstructionLoad.html">CInstructionLoad</a>() | ||
| 342 | <a name="l00397"></a>00397 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"load"</span>) | ||
| 343 | <a name="l00398"></a>00398 {} | ||
| 344 | <a name="l00399"></a>00399 | ||
| 345 | <a name="l00400"></a><a class="code" href="classCInstructionLoad.html#6f42217be849c83a114e71e2f45c75a3">00400</a> <a class="code" href="classCInstructionLoad.html">CInstructionLoad</a> *<a class="code" href="classCInstructionDiv.html#37893855d88bdd2607f10543fd4aadbc" title="creates a new instance of this instruction">factory</a>() | ||
| 346 | <a name="l00401"></a>00401 { | ||
| 347 | <a name="l00402"></a>00402 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionLoad.html">CInstructionLoad</a>; | ||
| 348 | <a name="l00403"></a>00403 } | ||
| 349 | <a name="l00404"></a>00404 | ||
| 350 | <a name="l00405"></a>00405 <span class="keywordtype">void</span> <a class="code" href="classCInstructionDiv.html#b4d0c2cd45ec584a16f23ed16f6a1831" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 351 | <a name="l00406"></a>00406 <span class="keywordtype">void</span> <a class="code" href="classCInstructionDiv.html#62b6351aa17d0a8f5ac420f6dcabab65" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 352 | <a name="l00407"></a>00407 | ||
| 353 | <a name="l00408"></a>00408 <span class="keyword">protected</span>: | ||
| 354 | <a name="l00410"></a><a class="code" href="classCInstructionLoad.html#e9305dab5a868e4c57aa2308b0fc3856">00410</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionDiv.html#12268ddbbd4994e5a679d938dfbbdddf">m_regidx1</a>; | ||
| 355 | <a name="l00412"></a><a class="code" href="classCInstructionLoad.html#b06960ae11173791614e2cd276b05f75">00412</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionDiv.html#893812d619293cb5080d04cf71582aaf">m_regidx2</a>; | ||
| 356 | <a name="l00413"></a>00413 }; | ||
| 357 | <a name="l00414"></a>00414 | ||
| 358 | <a name="l00415"></a>00415 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 359 | <a name="l00416"></a>00416 | ||
| 360 | <a name="l00417"></a>00417 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 361 | <a name="l00418"></a><a class="code" href="classCInstructionLoad.html#77025a0fb65898352167258f191ef9ea">00418</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionLoad.html#77025a0fb65898352167258f191ef9ea" title="parses instruction parameters and prepares the instruction for executing">CInstructionLoad<T>::compile</a>(std::list<std::string>& params) | ||
| 362 | <a name="l00419"></a>00419 { | ||
| 363 | <a name="l00420"></a>00420 <span class="keywordflow">if</span> (params.size() != 2) | ||
| 364 | <a name="l00421"></a>00421 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 2"</span>); | ||
| 365 | <a name="l00422"></a>00422 <a class="code" href="classCInstructionLoad.html#e9305dab5a868e4c57aa2308b0fc3856">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 366 | <a name="l00423"></a>00423 params.pop_front(); | ||
| 367 | <a name="l00424"></a>00424 <a class="code" href="classCInstructionLoad.html#b06960ae11173791614e2cd276b05f75">m_regidx2</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 368 | <a name="l00425"></a>00425 params.pop_front(); | ||
| 369 | <a name="l00426"></a>00426 } | ||
| 370 | <a name="l00427"></a>00427 | ||
| 371 | <a name="l00428"></a>00428 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 372 | <a name="l00429"></a>00429 | ||
| 373 | <a name="l00430"></a>00430 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 374 | <a name="l00431"></a><a class="code" href="classCInstructionLoad.html#96e0f7e931c3d7716add468ac35af296">00431</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionLoad.html#96e0f7e931c3d7716add468ac35af296" title="executes the instruction">CInstructionLoad<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 375 | <a name="l00432"></a>00432 { | ||
| 376 | <a name="l00433"></a>00433 assert(cpu != NULL); | ||
| 377 | <a name="l00434"></a>00434 assert(cpu-><a class="code" href="classCCPU.html#8fcad8b71caaf9874d2619783568a67c" title="get pointer to memory">getMemory</a>() != NULL); | ||
| 378 | <a name="l00435"></a>00435 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionLoad.html#e9305dab5a868e4c57aa2308b0fc3856">m_regidx1</a>); | ||
| 379 | <a name="l00436"></a>00436 super::checkRegister(cpu, <a class="code" href="classCInstructionLoad.html#b06960ae11173791614e2cd276b05f75">m_regidx2</a>); | ||
| 380 | <a name="l00437"></a>00437 T val(cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionLoad.html#b06960ae11173791614e2cd276b05f75">m_regidx2</a> ]); | ||
| 381 | <a name="l00438"></a>00438 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionLoad.html#e9305dab5a868e4c57aa2308b0fc3856">m_regidx1</a> ] = (*cpu-><a class="code" href="classCCPU.html#8fcad8b71caaf9874d2619783568a67c" title="get pointer to memory">getMemory</a>())[ val ]; | ||
| 382 | <a name="l00439"></a>00439 } | ||
| 383 | <a name="l00440"></a>00440 | ||
| 384 | <a name="l00441"></a>00441 <span class="comment">/*============================================================================*/</span> | ||
| 385 | <a name="l00442"></a>00442 | ||
| 386 | <a name="l00450"></a>00450 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 387 | <a name="l00451"></a><a class="code" href="classCInstructionStore.html">00451</a> <span class="keyword">class </span><a class="code" href="classCInstructionStore.html">CInstructionStore</a> | ||
| 388 | <a name="l00452"></a>00452 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 389 | <a name="l00453"></a>00453 { | ||
| 390 | <a name="l00454"></a>00454 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 391 | <a name="l00455"></a>00455 | ||
| 392 | <a name="l00456"></a>00456 <span class="keyword">public</span>: | ||
| 393 | <a name="l00457"></a>00457 <a class="code" href="classCInstructionStore.html">CInstructionStore</a>() | ||
| 394 | <a name="l00458"></a>00458 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"store"</span>) | ||
| 395 | <a name="l00459"></a>00459 {} | ||
| 396 | <a name="l00460"></a>00460 | ||
| 397 | <a name="l00461"></a><a class="code" href="classCInstructionStore.html#451ec5bffdef06776cf5876b44b756bc">00461</a> <a class="code" href="classCInstructionStore.html">CInstructionStore</a> *<a class="code" href="classCInstructionLoad.html#6f42217be849c83a114e71e2f45c75a3" title="creates a new instance of this instruction">factory</a>() | ||
| 398 | <a name="l00462"></a>00462 { | ||
| 399 | <a name="l00463"></a>00463 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionStore.html">CInstructionStore</a>; | ||
| 400 | <a name="l00464"></a>00464 } | ||
| 401 | <a name="l00465"></a>00465 | ||
| 402 | <a name="l00466"></a>00466 <span class="keywordtype">void</span> <a class="code" href="classCInstructionLoad.html#77025a0fb65898352167258f191ef9ea" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 403 | <a name="l00467"></a>00467 <span class="keywordtype">void</span> <a class="code" href="classCInstructionLoad.html#96e0f7e931c3d7716add468ac35af296" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 404 | <a name="l00468"></a>00468 | ||
| 405 | <a name="l00469"></a>00469 <span class="keyword">protected</span>: | ||
| 406 | <a name="l00471"></a><a class="code" href="classCInstructionStore.html#24691daf9061658a54e4864e77d3847f">00471</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionLoad.html#e9305dab5a868e4c57aa2308b0fc3856">m_regidx1</a>; | ||
| 407 | <a name="l00473"></a><a class="code" href="classCInstructionStore.html#113e2d972fe34263bceb7550e863a8ca">00473</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionLoad.html#b06960ae11173791614e2cd276b05f75">m_regidx2</a>; | ||
| 408 | <a name="l00474"></a>00474 }; | ||
| 409 | <a name="l00475"></a>00475 | ||
| 410 | <a name="l00476"></a>00476 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 411 | <a name="l00477"></a>00477 | ||
| 412 | <a name="l00478"></a>00478 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 413 | <a name="l00479"></a><a class="code" href="classCInstructionStore.html#7e0849084dbd7a73ac19c3797de6077c">00479</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionStore.html#7e0849084dbd7a73ac19c3797de6077c" title="parses instruction parameters and prepares the instruction for executing">CInstructionStore<T>::compile</a>(std::list<std::string>& params) | ||
| 414 | <a name="l00480"></a>00480 { | ||
| 415 | <a name="l00481"></a>00481 <span class="keywordflow">if</span> (params.size() != 2) | ||
| 416 | <a name="l00482"></a>00482 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 2"</span>); | ||
| 417 | <a name="l00483"></a>00483 <a class="code" href="classCInstructionStore.html#24691daf9061658a54e4864e77d3847f">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 418 | <a name="l00484"></a>00484 params.pop_front(); | ||
| 419 | <a name="l00485"></a>00485 <a class="code" href="classCInstructionStore.html#113e2d972fe34263bceb7550e863a8ca">m_regidx2</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 420 | <a name="l00486"></a>00486 params.pop_front(); | ||
| 421 | <a name="l00487"></a>00487 } | ||
| 422 | <a name="l00488"></a>00488 | ||
| 423 | <a name="l00489"></a>00489 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 424 | <a name="l00490"></a>00490 | ||
| 425 | <a name="l00491"></a>00491 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 426 | <a name="l00492"></a><a class="code" href="classCInstructionStore.html#d3cd7956705076da3d87b5187ec1ddfb">00492</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionStore.html#d3cd7956705076da3d87b5187ec1ddfb" title="executes the instruction">CInstructionStore<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 427 | <a name="l00493"></a>00493 { | ||
| 428 | <a name="l00494"></a>00494 assert(cpu != NULL); | ||
| 429 | <a name="l00495"></a>00495 assert(cpu-><a class="code" href="classCCPU.html#8fcad8b71caaf9874d2619783568a67c" title="get pointer to memory">getMemory</a>() != NULL); | ||
| 430 | <a name="l00496"></a>00496 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionStore.html#24691daf9061658a54e4864e77d3847f">m_regidx1</a>); | ||
| 431 | <a name="l00497"></a>00497 super::checkRegister(cpu, <a class="code" href="classCInstructionStore.html#113e2d972fe34263bceb7550e863a8ca">m_regidx2</a>); | ||
| 432 | <a name="l00498"></a>00498 T val(cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionStore.html#113e2d972fe34263bceb7550e863a8ca">m_regidx2</a> ]); | ||
| 433 | <a name="l00499"></a>00499 (*cpu-><a class="code" href="classCCPU.html#8fcad8b71caaf9874d2619783568a67c" title="get pointer to memory">getMemory</a>())[ val ] = cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionStore.html#24691daf9061658a54e4864e77d3847f">m_regidx1</a> ]; | ||
| 434 | <a name="l00500"></a>00500 } | ||
| 435 | <a name="l00501"></a>00501 | ||
| 436 | <a name="l00502"></a>00502 <span class="comment">/*============================================================================*/</span> | ||
| 437 | <a name="l00503"></a>00503 | ||
| 438 | <a name="l00511"></a>00511 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 439 | <a name="l00512"></a><a class="code" href="classCInstructionTest.html">00512</a> <span class="keyword">class </span><a class="code" href="classCInstructionTest.html">CInstructionTest</a> | ||
| 440 | <a name="l00513"></a>00513 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 441 | <a name="l00514"></a>00514 { | ||
| 442 | <a name="l00515"></a>00515 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 443 | <a name="l00516"></a>00516 | ||
| 444 | <a name="l00517"></a>00517 <span class="keyword">public</span>: | ||
| 445 | <a name="l00518"></a>00518 <a class="code" href="classCInstructionTest.html">CInstructionTest</a>() | ||
| 446 | <a name="l00519"></a>00519 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"test"</span>) | ||
| 447 | <a name="l00520"></a>00520 {} | ||
| 448 | <a name="l00521"></a>00521 | ||
| 449 | <a name="l00522"></a><a class="code" href="classCInstructionTest.html#9d9f28f5be45f089259032bbf947b06e">00522</a> <a class="code" href="classCInstructionTest.html">CInstructionTest</a> *<a class="code" href="classCInstructionStore.html#451ec5bffdef06776cf5876b44b756bc" title="creates a new instance of this instruction">factory</a>() | ||
| 450 | <a name="l00523"></a>00523 { | ||
| 451 | <a name="l00524"></a>00524 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionTest.html">CInstructionTest</a>; | ||
| 452 | <a name="l00525"></a>00525 } | ||
| 453 | <a name="l00526"></a>00526 | ||
| 454 | <a name="l00527"></a>00527 <span class="keywordtype">void</span> <a class="code" href="classCInstructionStore.html#7e0849084dbd7a73ac19c3797de6077c" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 455 | <a name="l00528"></a>00528 <span class="keywordtype">void</span> <a class="code" href="classCInstructionStore.html#d3cd7956705076da3d87b5187ec1ddfb" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 456 | <a name="l00529"></a>00529 | ||
| 457 | <a name="l00530"></a>00530 <span class="keyword">protected</span>: | ||
| 458 | <a name="l00532"></a><a class="code" href="classCInstructionTest.html#c4661836718750c626c3aa13ab367340">00532</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstructionStore.html#24691daf9061658a54e4864e77d3847f">m_regidx1</a>; | ||
| 459 | <a name="l00533"></a>00533 }; | ||
| 460 | <a name="l00534"></a>00534 | ||
| 461 | <a name="l00535"></a>00535 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 462 | <a name="l00536"></a>00536 | ||
| 463 | <a name="l00537"></a>00537 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 464 | <a name="l00538"></a><a class="code" href="classCInstructionTest.html#e986a4a3a2f445cb672e056a263e02f4">00538</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionTest.html#e986a4a3a2f445cb672e056a263e02f4" title="parses instruction parameters and prepares the instruction for executing">CInstructionTest<T>::compile</a>(std::list<std::string>& params) | ||
| 465 | <a name="l00539"></a>00539 { | ||
| 466 | <a name="l00540"></a>00540 <span class="keywordflow">if</span> (params.size() != 1) | ||
| 467 | <a name="l00541"></a>00541 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 1"</span>); | ||
| 468 | <a name="l00542"></a>00542 <a class="code" href="classCInstructionTest.html#c4661836718750c626c3aa13ab367340">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 469 | <a name="l00543"></a>00543 params.pop_front(); | ||
| 470 | <a name="l00544"></a>00544 } | ||
| 471 | <a name="l00545"></a>00545 | ||
| 472 | <a name="l00546"></a>00546 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 473 | <a name="l00547"></a>00547 | ||
| 474 | <a name="l00548"></a>00548 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 475 | <a name="l00549"></a><a class="code" href="classCInstructionTest.html#9f219f782c3752f53b60d3e37477a128">00549</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionTest.html#9f219f782c3752f53b60d3e37477a128" title="executes the instruction">CInstructionTest<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 476 | <a name="l00550"></a>00550 { | ||
| 477 | <a name="l00551"></a>00551 assert(cpu != NULL); | ||
| 478 | <a name="l00552"></a>00552 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionTest.html#c4661836718750c626c3aa13ab367340">m_regidx1</a>); | ||
| 479 | <a name="l00553"></a>00553 <span class="keywordflow">if</span> (cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionTest.html#c4661836718750c626c3aa13ab367340">m_regidx1</a> ] == T(0)) | ||
| 480 | <a name="l00554"></a>00554 cpu-><a class="code" href="classCCPU.html#e3f54dc93c58891c8a1d8a78680fcc95" title="set zero flag">setFlagZero</a>(<span class="keyword">true</span>); | ||
| 481 | <a name="l00555"></a>00555 <span class="keywordflow">if</span> (cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionTest.html#c4661836718750c626c3aa13ab367340">m_regidx1</a> ] < T(0)) | ||
| 482 | <a name="l00556"></a>00556 cpu-><a class="code" href="classCCPU.html#2d6f448d0fb64f3b466b2f9fea621e81" title="set sign flag">setFlagSign</a>(<span class="keyword">true</span>); | ||
| 483 | <a name="l00557"></a>00557 } | ||
| 484 | <a name="l00558"></a>00558 | ||
| 485 | <a name="l00559"></a>00559 <span class="comment">/*============================================================================*/</span> | ||
| 486 | <a name="l00560"></a>00560 | ||
| 487 | <a name="l00567"></a>00567 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 488 | <a name="l00568"></a><a class="code" href="classCInstructionLabel.html">00568</a> <span class="keyword">class </span><a class="code" href="classCInstructionLabel.html">CInstructionLabel</a> | ||
| 489 | <a name="l00569"></a>00569 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 490 | <a name="l00570"></a>00570 { | ||
| 491 | <a name="l00571"></a>00571 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 492 | <a name="l00572"></a>00572 | ||
| 493 | <a name="l00573"></a>00573 <span class="keyword">public</span>: | ||
| 494 | <a name="l00574"></a>00574 <a class="code" href="classCInstructionLabel.html">CInstructionLabel</a>() | ||
| 495 | <a name="l00575"></a>00575 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"label"</span>) | ||
| 496 | <a name="l00576"></a>00576 {} | ||
| 497 | <a name="l00577"></a>00577 | ||
| 498 | <a name="l00578"></a><a class="code" href="classCInstructionLabel.html#2b8633ca1c29200b7db2eea6ce6296dc">00578</a> <a class="code" href="classCInstructionLabel.html">CInstructionLabel</a> *<a class="code" href="classCInstructionTest.html#9d9f28f5be45f089259032bbf947b06e" title="creates a new instance of this instruction">factory</a>() | ||
| 499 | <a name="l00579"></a>00579 { | ||
| 500 | <a name="l00580"></a>00580 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionLabel.html">CInstructionLabel</a>; | ||
| 501 | <a name="l00581"></a>00581 } | ||
| 502 | <a name="l00582"></a>00582 | ||
| 503 | <a name="l00583"></a><a class="code" href="classCInstructionLabel.html#01fc1fd49c590243834df8089138b273">00583</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionTest.html#e986a4a3a2f445cb672e056a263e02f4" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params) | ||
| 504 | <a name="l00584"></a>00584 {} | ||
| 505 | <a name="l00585"></a>00585 | ||
| 506 | <a name="l00586"></a><a class="code" href="classCInstructionLabel.html#14beb571121b02585e706b44ae6d515e">00586</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionTest.html#9f219f782c3752f53b60d3e37477a128" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 507 | <a name="l00587"></a>00587 {} | ||
| 508 | <a name="l00588"></a>00588 }; | ||
| 509 | <a name="l00589"></a>00589 | ||
| 510 | <a name="l00590"></a>00590 <span class="comment">/*============================================================================*/</span> | ||
| 511 | <a name="l00591"></a>00591 | ||
| 512 | <a name="l00599"></a>00599 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 513 | <a name="l00600"></a><a class="code" href="classCInstructionJumpA.html">00600</a> <span class="keyword">class </span><a class="code" href="classCInstructionJumpA.html">CInstructionJumpA</a> | ||
| 514 | <a name="l00601"></a>00601 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 515 | <a name="l00602"></a>00602 { | ||
| 516 | <a name="l00603"></a>00603 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 517 | <a name="l00604"></a>00604 | ||
| 518 | <a name="l00605"></a>00605 <span class="keyword">public</span>: | ||
| 519 | <a name="l00606"></a>00606 <a class="code" href="classCInstructionJumpA.html">CInstructionJumpA</a>() | ||
| 520 | <a name="l00607"></a>00607 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"jumpa"</span>), m_addr(<span class="stringliteral">""</span>) | ||
| 521 | <a name="l00608"></a>00608 {} | ||
| 522 | <a name="l00609"></a>00609 | ||
| 523 | <a name="l00610"></a><a class="code" href="classCInstructionJumpA.html#ee967e2ff6d2851ce4950e20716f7803">00610</a> <a class="code" href="classCInstructionJumpA.html">CInstructionJumpA</a> *<a class="code" href="classCInstructionTest.html#9d9f28f5be45f089259032bbf947b06e" title="creates a new instance of this instruction">factory</a>() | ||
| 524 | <a name="l00611"></a>00611 { | ||
| 525 | <a name="l00612"></a>00612 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionJumpA.html">CInstructionJumpA</a>; | ||
| 526 | <a name="l00613"></a>00613 } | ||
| 527 | <a name="l00614"></a>00614 | ||
| 528 | <a name="l00615"></a>00615 <span class="keywordtype">void</span> <a class="code" href="classCInstructionTest.html#e986a4a3a2f445cb672e056a263e02f4" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 529 | <a name="l00616"></a>00616 <span class="keywordtype">void</span> <a class="code" href="classCInstructionTest.html#9f219f782c3752f53b60d3e37477a128" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 530 | <a name="l00617"></a>00617 | ||
| 531 | <a name="l00618"></a>00618 <span class="keyword">protected</span>: | ||
| 532 | <a name="l00620"></a><a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">00620</a> std::string m_addr; | ||
| 533 | <a name="l00621"></a>00621 }; | ||
| 534 | <a name="l00622"></a>00622 | ||
| 535 | <a name="l00623"></a>00623 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 536 | <a name="l00624"></a>00624 | ||
| 537 | <a name="l00625"></a>00625 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 538 | <a name="l00626"></a><a class="code" href="classCInstructionJumpA.html#f942c3cfc7e69c5a888ee4a6b6d7cc15">00626</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpA.html#f942c3cfc7e69c5a888ee4a6b6d7cc15" title="parses instruction parameters and prepares the instruction for executing">CInstructionJumpA<T>::compile</a>(std::list<std::string>& params) | ||
| 539 | <a name="l00627"></a>00627 { | ||
| 540 | <a name="l00628"></a>00628 <span class="keywordflow">if</span> (params.size() != 1) | ||
| 541 | <a name="l00629"></a>00629 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 1"</span>); | ||
| 542 | <a name="l00630"></a>00630 <a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a> = params.front(); | ||
| 543 | <a name="l00631"></a>00631 params.pop_front(); | ||
| 544 | <a name="l00632"></a>00632 } | ||
| 545 | <a name="l00633"></a>00633 | ||
| 546 | <a name="l00634"></a>00634 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 547 | <a name="l00635"></a>00635 | ||
| 548 | <a name="l00636"></a>00636 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 549 | <a name="l00637"></a><a class="code" href="classCInstructionJumpA.html#8b3d178c2ababca94db12a117ca31f8c">00637</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpA.html#8b3d178c2ababca94db12a117ca31f8c" title="executes the instruction">CInstructionJumpA<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 550 | <a name="l00638"></a>00638 { | ||
| 551 | <a name="l00639"></a>00639 assert(cpu != NULL); | ||
| 552 | <a name="l00640"></a>00640 assert(cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>() != NULL); | ||
| 553 | <a name="l00641"></a>00641 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a>.empty()) | ||
| 554 | <a name="l00642"></a>00642 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty address"</span>); | ||
| 555 | <a name="l00643"></a>00643 <span class="keywordflow">try</span> | ||
| 556 | <a name="l00644"></a>00644 { | ||
| 557 | <a name="l00645"></a>00645 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ 0 ] = cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>()->findLabel(<a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a>); | ||
| 558 | <a name="l00646"></a>00646 } | ||
| 559 | <a name="l00647"></a>00647 <span class="keywordflow">catch</span>(<a class="code" href="classCProgramError.html">CProgramError</a>& ex) | ||
| 560 | <a name="l00648"></a>00648 { | ||
| 561 | <a name="l00649"></a>00649 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(ex.what()); | ||
| 562 | <a name="l00650"></a>00650 } | ||
| 563 | <a name="l00651"></a>00651 } | ||
| 564 | <a name="l00652"></a>00652 | ||
| 565 | <a name="l00653"></a>00653 <span class="comment">/*============================================================================*/</span> | ||
| 566 | <a name="l00654"></a>00654 | ||
| 567 | <a name="l00662"></a>00662 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 568 | <a name="l00663"></a><a class="code" href="classCInstructionJumpZ.html">00663</a> <span class="keyword">class </span><a class="code" href="classCInstructionJumpZ.html">CInstructionJumpZ</a> | ||
| 569 | <a name="l00664"></a>00664 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 570 | <a name="l00665"></a>00665 { | ||
| 571 | <a name="l00666"></a>00666 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 572 | <a name="l00667"></a>00667 | ||
| 573 | <a name="l00668"></a>00668 <span class="keyword">public</span>: | ||
| 574 | <a name="l00669"></a>00669 <a class="code" href="classCInstructionJumpZ.html">CInstructionJumpZ</a>() | ||
| 575 | <a name="l00670"></a>00670 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"jumpz"</span>), <a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a>(<span class="stringliteral">""</span>) | ||
| 576 | <a name="l00671"></a>00671 {} | ||
| 577 | <a name="l00672"></a>00672 | ||
| 578 | <a name="l00673"></a><a class="code" href="classCInstructionJumpZ.html#f5e15d121589a1e3545f260cd7ee4363">00673</a> <a class="code" href="classCInstructionJumpZ.html">CInstructionJumpZ</a> *<a class="code" href="classCInstructionJumpA.html#ee967e2ff6d2851ce4950e20716f7803" title="creates a new instance of this instruction">factory</a>() | ||
| 579 | <a name="l00674"></a>00674 { | ||
| 580 | <a name="l00675"></a>00675 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionJumpZ.html">CInstructionJumpZ</a>; | ||
| 581 | <a name="l00676"></a>00676 } | ||
| 582 | <a name="l00677"></a>00677 | ||
| 583 | <a name="l00678"></a>00678 <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpA.html#f942c3cfc7e69c5a888ee4a6b6d7cc15" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 584 | <a name="l00679"></a>00679 <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpA.html#8b3d178c2ababca94db12a117ca31f8c" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 585 | <a name="l00680"></a>00680 | ||
| 586 | <a name="l00681"></a>00681 <span class="keyword">protected</span>: | ||
| 587 | <a name="l00683"></a><a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">00683</a> std::string <a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a>; | ||
| 588 | <a name="l00684"></a>00684 }; | ||
| 589 | <a name="l00685"></a>00685 | ||
| 590 | <a name="l00686"></a>00686 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 591 | <a name="l00687"></a>00687 | ||
| 592 | <a name="l00688"></a>00688 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 593 | <a name="l00689"></a><a class="code" href="classCInstructionJumpZ.html#a7bc6b0a7fba975d8b3a2b7c15f6485e">00689</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpZ.html#a7bc6b0a7fba975d8b3a2b7c15f6485e" title="parses instruction parameters and prepares the instruction for executing">CInstructionJumpZ<T>::compile</a>(std::list<std::string>& params) | ||
| 594 | <a name="l00690"></a>00690 { | ||
| 595 | <a name="l00691"></a>00691 <span class="keywordflow">if</span> (params.size() != 1) | ||
| 596 | <a name="l00692"></a>00692 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 1"</span>); | ||
| 597 | <a name="l00693"></a>00693 <a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a> = params.front(); | ||
| 598 | <a name="l00694"></a>00694 params.pop_front(); | ||
| 599 | <a name="l00695"></a>00695 } | ||
| 600 | <a name="l00696"></a>00696 | ||
| 601 | <a name="l00697"></a>00697 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 602 | <a name="l00698"></a>00698 | ||
| 603 | <a name="l00699"></a>00699 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 604 | <a name="l00700"></a><a class="code" href="classCInstructionJumpZ.html#966b002a12af320fab9ccd3576ddfac4">00700</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpZ.html#966b002a12af320fab9ccd3576ddfac4" title="executes the instruction">CInstructionJumpZ<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 605 | <a name="l00701"></a>00701 { | ||
| 606 | <a name="l00702"></a>00702 assert(cpu != NULL); | ||
| 607 | <a name="l00703"></a>00703 assert(cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>() != NULL); | ||
| 608 | <a name="l00704"></a>00704 <span class="keywordflow">if</span> (!cpu-><a class="code" href="classCCPU.html#5141a97f658340c1dc0c6b518044dfb8" title="get value of zero flag">getFlagZero</a>()) | ||
| 609 | <a name="l00705"></a>00705 <span class="keywordflow">return</span>; | ||
| 610 | <a name="l00706"></a>00706 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a>.empty()) | ||
| 611 | <a name="l00707"></a>00707 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty address"</span>); | ||
| 612 | <a name="l00708"></a>00708 <span class="keywordflow">try</span> | ||
| 613 | <a name="l00709"></a>00709 { | ||
| 614 | <a name="l00710"></a>00710 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ 0 ] = cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>()->findLabel(<a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a>); | ||
| 615 | <a name="l00711"></a>00711 } | ||
| 616 | <a name="l00712"></a>00712 <span class="keywordflow">catch</span>(<a class="code" href="classCProgramError.html">CProgramError</a>& ex) | ||
| 617 | <a name="l00713"></a>00713 { | ||
| 618 | <a name="l00714"></a>00714 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(ex.what()); | ||
| 619 | <a name="l00715"></a>00715 } | ||
| 620 | <a name="l00716"></a>00716 } | ||
| 621 | <a name="l00717"></a>00717 | ||
| 622 | <a name="l00718"></a>00718 <span class="comment">/*============================================================================*/</span> | ||
| 623 | <a name="l00719"></a>00719 | ||
| 624 | <a name="l00727"></a>00727 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 625 | <a name="l00728"></a><a class="code" href="classCInstructionJumpS.html">00728</a> <span class="keyword">class </span><a class="code" href="classCInstructionJumpS.html">CInstructionJumpS</a> | ||
| 626 | <a name="l00729"></a>00729 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 627 | <a name="l00730"></a>00730 { | ||
| 628 | <a name="l00731"></a>00731 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 629 | <a name="l00732"></a>00732 | ||
| 630 | <a name="l00733"></a>00733 <span class="keyword">public</span>: | ||
| 631 | <a name="l00734"></a>00734 <a class="code" href="classCInstructionJumpS.html">CInstructionJumpS</a>() | ||
| 632 | <a name="l00735"></a>00735 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"jumps"</span>), <a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a>(<span class="stringliteral">""</span>) | ||
| 633 | <a name="l00736"></a>00736 {} | ||
| 634 | <a name="l00737"></a>00737 | ||
| 635 | <a name="l00738"></a><a class="code" href="classCInstructionJumpS.html#8b57e4f536aa12e46e90b240a28be7e4">00738</a> <a class="code" href="classCInstructionJumpS.html">CInstructionJumpS</a> *<a class="code" href="classCInstructionJumpZ.html#f5e15d121589a1e3545f260cd7ee4363" title="creates a new instance of this instruction">factory</a>() | ||
| 636 | <a name="l00739"></a>00739 { | ||
| 637 | <a name="l00740"></a>00740 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionJumpS.html">CInstructionJumpS</a>; | ||
| 638 | <a name="l00741"></a>00741 } | ||
| 639 | <a name="l00742"></a>00742 | ||
| 640 | <a name="l00743"></a>00743 <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpZ.html#a7bc6b0a7fba975d8b3a2b7c15f6485e" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 641 | <a name="l00744"></a>00744 <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpZ.html#966b002a12af320fab9ccd3576ddfac4" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 642 | <a name="l00745"></a>00745 | ||
| 643 | <a name="l00746"></a>00746 <span class="keyword">protected</span>: | ||
| 644 | <a name="l00748"></a><a class="code" href="classCInstructionJumpS.html#a83315af4999ec3f345fa84e0a8e86f5">00748</a> std::string <a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a>; | ||
| 645 | <a name="l00749"></a>00749 }; | ||
| 646 | <a name="l00750"></a>00750 | ||
| 647 | <a name="l00751"></a>00751 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 648 | <a name="l00752"></a>00752 | ||
| 649 | <a name="l00753"></a>00753 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 650 | <a name="l00754"></a><a class="code" href="classCInstructionJumpS.html#faa43fddd5272a085b84b5e67a6021fc">00754</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpS.html#faa43fddd5272a085b84b5e67a6021fc" title="parses instruction parameters and prepares the instruction for executing">CInstructionJumpS<T>::compile</a>(std::list<std::string>& params) | ||
| 651 | <a name="l00755"></a>00755 { | ||
| 652 | <a name="l00756"></a>00756 <span class="keywordflow">if</span> (params.size() != 1) | ||
| 653 | <a name="l00757"></a>00757 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 1"</span>); | ||
| 654 | <a name="l00758"></a>00758 <a class="code" href="classCInstructionJumpS.html#a83315af4999ec3f345fa84e0a8e86f5">m_addr</a> = params.front(); | ||
| 655 | <a name="l00759"></a>00759 params.pop_front(); | ||
| 656 | <a name="l00760"></a>00760 } | ||
| 657 | <a name="l00761"></a>00761 | ||
| 658 | <a name="l00762"></a>00762 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 659 | <a name="l00763"></a>00763 | ||
| 660 | <a name="l00764"></a>00764 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 661 | <a name="l00765"></a><a class="code" href="classCInstructionJumpS.html#371031231e11febb40fea15078f6869e">00765</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpS.html#371031231e11febb40fea15078f6869e" title="executes the instruction">CInstructionJumpS<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 662 | <a name="l00766"></a>00766 { | ||
| 663 | <a name="l00767"></a>00767 assert(cpu != NULL); | ||
| 664 | <a name="l00768"></a>00768 assert(cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>() != NULL); | ||
| 665 | <a name="l00769"></a>00769 <span class="keywordflow">if</span> (!cpu-><a class="code" href="classCCPU.html#74092bf7b34a75b25870d3f79efab331" title="get value of sign flag">getFlagSign</a>()) | ||
| 666 | <a name="l00770"></a>00770 <span class="keywordflow">return</span>; | ||
| 667 | <a name="l00771"></a>00771 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionJumpS.html#a83315af4999ec3f345fa84e0a8e86f5">m_addr</a>.empty()) | ||
| 668 | <a name="l00772"></a>00772 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty address"</span>); | ||
| 669 | <a name="l00773"></a>00773 <span class="keywordflow">try</span> | ||
| 670 | <a name="l00774"></a>00774 { | ||
| 671 | <a name="l00775"></a>00775 cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ 0 ] = cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>()->findLabel(<a class="code" href="classCInstructionJumpS.html#a83315af4999ec3f345fa84e0a8e86f5">m_addr</a>); | ||
| 672 | <a name="l00776"></a>00776 } | ||
| 673 | <a name="l00777"></a>00777 <span class="keywordflow">catch</span>(<a class="code" href="classCProgramError.html">CProgramError</a>& ex) | ||
| 674 | <a name="l00778"></a>00778 { | ||
| 675 | <a name="l00779"></a>00779 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(ex.what()); | ||
| 676 | <a name="l00780"></a>00780 } | ||
| 677 | <a name="l00781"></a>00781 } | ||
| 678 | <a name="l00782"></a>00782 | ||
| 679 | <a name="l00783"></a>00783 <span class="comment">/*============================================================================*/</span> | ||
| 680 | <a name="l00784"></a>00784 | ||
| 681 | <a name="l00792"></a>00792 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 682 | <a name="l00793"></a><a class="code" href="classCInstructionWrite.html">00793</a> <span class="keyword">class </span><a class="code" href="classCInstructionWrite.html">CInstructionWrite</a> | ||
| 683 | <a name="l00794"></a>00794 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T> | ||
| 684 | <a name="l00795"></a>00795 { | ||
| 685 | <a name="l00796"></a>00796 <span class="keyword">typedef</span> <a class="code" href="classCInstruction.html">CInstruction<T></a> <a class="code" href="classCInstruction.html">super</a>; | ||
| 686 | <a name="l00797"></a>00797 <span class="keyword">typedef</span> <span class="keyword">typename</span> std::set<CDisplay<T> *>::iterator setiterator; | ||
| 687 | <a name="l00798"></a>00798 | ||
| 688 | <a name="l00799"></a>00799 <span class="keyword">public</span>: | ||
| 689 | <a name="l00800"></a>00800 <a class="code" href="classCInstructionWrite.html">CInstructionWrite</a>() | ||
| 690 | <a name="l00801"></a>00801 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"write"</span>), m_dev(<span class="stringliteral">""</span>) | ||
| 691 | <a name="l00802"></a>00802 {} | ||
| 692 | <a name="l00803"></a>00803 | ||
| 693 | <a name="l00804"></a><a class="code" href="classCInstructionWrite.html#dc63f42b44fb552b9e091270b14a4eb6">00804</a> <a class="code" href="classCInstructionWrite.html">CInstructionWrite</a> *<a class="code" href="classCInstructionJumpS.html#8b57e4f536aa12e46e90b240a28be7e4" title="creates a new instance of this instruction">factory</a>() | ||
| 694 | <a name="l00805"></a>00805 { | ||
| 695 | <a name="l00806"></a>00806 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionWrite.html">CInstructionWrite</a>; | ||
| 696 | <a name="l00807"></a>00807 } | ||
| 697 | <a name="l00808"></a>00808 | ||
| 698 | <a name="l00809"></a>00809 <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpS.html#faa43fddd5272a085b84b5e67a6021fc" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list<std::string>& params); | ||
| 699 | <a name="l00810"></a>00810 <span class="keywordtype">void</span> <a class="code" href="classCInstructionJumpS.html#371031231e11febb40fea15078f6869e" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu); | ||
| 700 | <a name="l00811"></a>00811 | ||
| 701 | <a name="l00812"></a>00812 <span class="keyword">protected</span>: | ||
| 702 | <a name="l00814"></a><a class="code" href="classCInstructionWrite.html#2d13271929d0f7ab9c13bd9ba5044775">00814</a> <span class="keywordtype">unsigned</span> m_regidx1; | ||
| 703 | <a name="l00816"></a><a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">00816</a> std::string m_dev; | ||
| 704 | <a name="l00817"></a>00817 }; | ||
| 705 | <a name="l00818"></a>00818 | ||
| 706 | <a name="l00819"></a>00819 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 707 | <a name="l00820"></a>00820 | ||
| 708 | <a name="l00821"></a>00821 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 709 | <a name="l00822"></a><a class="code" href="classCInstructionWrite.html#b18bcbc02a62090f97d2085cdc0ffe01">00822</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionWrite.html#b18bcbc02a62090f97d2085cdc0ffe01" title="parses instruction parameters and prepares the instruction for executing">CInstructionWrite<T>::compile</a>(std::list<std::string>& params) | ||
| 710 | <a name="l00823"></a>00823 { | ||
| 711 | <a name="l00824"></a>00824 <span class="keywordflow">if</span> (params.size() != 2) | ||
| 712 | <a name="l00825"></a>00825 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid paramater count - must be 2"</span>); | ||
| 713 | <a name="l00826"></a>00826 <a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">m_dev</a> = params.front(); | ||
| 714 | <a name="l00827"></a>00827 params.pop_front(); | ||
| 715 | <a name="l00828"></a>00828 <a class="code" href="classCInstructionWrite.html#2d13271929d0f7ab9c13bd9ba5044775">m_regidx1</a> = <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &quot;R1&quot;)">super::parseRegister</a>(params.front()); | ||
| 716 | <a name="l00829"></a>00829 params.pop_front(); | ||
| 717 | <a name="l00830"></a>00830 } | ||
| 718 | <a name="l00831"></a>00831 | ||
| 719 | <a name="l00832"></a>00832 <span class="comment">/*----------------------------------------------------------------------------*/</span> | ||
| 720 | <a name="l00833"></a>00833 | ||
| 721 | <a name="l00834"></a>00834 <span class="keyword">template</span> <<span class="keyword">class</span> T> | ||
| 722 | <a name="l00835"></a><a class="code" href="classCInstructionWrite.html#b2961a0e0bcbe69cc51601dab7278085">00835</a> <span class="keywordtype">void</span> <a class="code" href="classCInstructionWrite.html#b2961a0e0bcbe69cc51601dab7278085" title="executes the instruction">CInstructionWrite<T>::execute</a>(<a class="code" href="classCCPU.html">CCPU<T></a> *cpu) | ||
| 723 | <a name="l00836"></a>00836 { | ||
| 724 | <a name="l00837"></a>00837 assert(cpu != NULL); | ||
| 725 | <a name="l00838"></a>00838 <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">super::checkRegister</a>(cpu, <a class="code" href="classCInstructionWrite.html#2d13271929d0f7ab9c13bd9ba5044775">m_regidx1</a>); | ||
| 726 | <a name="l00839"></a>00839 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">m_dev</a>.empty()) | ||
| 727 | <a name="l00840"></a>00840 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty device"</span>); | ||
| 728 | <a name="l00841"></a>00841 | ||
| 729 | <a name="l00842"></a>00842 <a class="code" href="classCDisplay.html">CDisplay<T></a> *display = NULL; | ||
| 730 | <a name="l00843"></a>00843 std::set<CDisplay<T> *> displays = cpu-><a class="code" href="classCCPU.html#7b4b09766e49b66ce0fc325b7ba86142" title="get set of pointers to displays">getDisplays</a>(); | ||
| 731 | <a name="l00844"></a>00844 <span class="keywordflow">for</span>(setiterator it = displays.begin(); it != displays.end(); ++it) | ||
| 732 | <a name="l00845"></a>00845 { | ||
| 733 | <a name="l00846"></a>00846 <span class="keywordflow">if</span> ((*it)->getName() == <a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">m_dev</a>) | ||
| 734 | <a name="l00847"></a>00847 { | ||
| 735 | <a name="l00848"></a>00848 display = *it; | ||
| 736 | <a name="l00849"></a>00849 <span class="keywordflow">break</span>; | ||
| 737 | <a name="l00850"></a>00850 } | ||
| 738 | <a name="l00851"></a>00851 } | ||
| 739 | <a name="l00852"></a>00852 <span class="keywordflow">if</span> (display == NULL) | ||
| 740 | <a name="l00853"></a>00853 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Unknown display"</span>); | ||
| 741 | <a name="l00854"></a>00854 | ||
| 742 | <a name="l00855"></a>00855 display-><a class="code" href="classCDisplay.html#d82ef2fb165299abc3bd625cc357c36e" title="prints value to display">display</a>(cpu-><a class="code" href="classCCPU.html#8fde9e088a664b1c65d0f7d462d2bc83" title="get reference to registers vector">getRegisters</a>()[ <a class="code" href="classCInstructionWrite.html#2d13271929d0f7ab9c13bd9ba5044775">m_regidx1</a> ]); | ||
| 743 | <a name="l00856"></a>00856 } | ||
| 744 | <a name="l00857"></a>00857 | ||
| 745 | <a name="l00858"></a>00858 <span class="preprocessor">#endif</span> | ||
| 746 | <a name="l00859"></a>00859 <span class="preprocessor"></span> | ||
| 747 | <a name="l00860"></a>00860 <span class="comment">/* vim: set et sw=2 ts=2: */</span> | ||
| 748 | </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sat May 30 16:32:35 2009 for mycpu by | ||
| 749 | <a href="http://www.doxygen.org/index.html"> | ||
| 750 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> | ||
| 751 | </body> | ||
| 752 | </html> | ||
