summaryrefslogtreecommitdiffstats
path: root/ue3/mycpu/cinstruction.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue3/mycpu/cinstruction.h')
-rw-r--r--ue3/mycpu/cinstruction.h47
1 files changed, 17 insertions, 30 deletions
diff --git a/ue3/mycpu/cinstruction.h b/ue3/mycpu/cinstruction.h
index 57fcff1..40e9ddc 100644
--- a/ue3/mycpu/cinstruction.h
+++ b/ue3/mycpu/cinstruction.h
@@ -62,45 +62,32 @@ class CInstruction
62 } 62 }
63 63
64 /** 64 /**
65 * @method getName 65 * @method operator()
66 * @brief returns instruction name 66 * @brief implementation of operator (CCPU)
67 * @param - 67 * @param cpu pointer to cpu
68 * @return name of instruction 68 * @return -
69 * @globalvars none
70 * @exception none
71 * @conditions none
72 */
73 virtual const std::string& getName()
74 {
75 return m_name;
76 }
77
78 /**
79 * @method isLabel
80 * @brief returns true if the instruction defines a label
81 * @param -
82 * @return true if the instruction defines a label
83 * @globalvars none 69 * @globalvars none
84 * @exception none 70 * @exception std::runtime_error
85 * @conditions none 71 * @conditions none
86 */ 72 */
87 virtual const bool isLabel() 73 virtual CInstruction& operator()(CCPU *cpu)
88 { 74 {
89 return false; 75 execute(cpu);
76 return *this;
90 } 77 }
91 78
92 /** 79 /**
93 * @method getLabelName 80 * @method getName
94 * @brief returns labelname if the instruction defines a label 81 * @brief returns instruction name
95 * @param - 82 * @param -
96 * @return labelname if the instruction defines a label 83 * @return name of instruction
97 * @globalvars none 84 * @globalvars none
98 * @exception none 85 * @exception none
99 * @conditions none 86 * @conditions none
100 */ 87 */
101 virtual const std::string getLabelName() 88 virtual const std::string& getName()
102 { 89 {
103 return ""; 90 return m_name;
104 } 91 }
105 92
106 /** 93 /**
@@ -139,7 +126,7 @@ class CInstruction
139 * @param str register in assembler syntax 126 * @param str register in assembler syntax
140 * @return registernumber 127 * @return registernumber
141 * @globalvars none 128 * @globalvars none
142 * @exception runtime_error 129 * @exception std::runtime_error
143 * @conditions none 130 * @conditions none
144 */ 131 */
145 virtual const unsigned parseRegister(const std::string& str); 132 virtual const unsigned parseRegister(const std::string& str);
@@ -152,7 +139,7 @@ class CInstruction
152 * @param regidx registernumber 139 * @param regidx registernumber
153 * @return - 140 * @return -
154 * @globalvars none 141 * @globalvars none
155 * @exception runtime_error 142 * @exception std::runtime_error
156 * @conditions none 143 * @conditions none
157 */ 144 */
158 virtual void checkRegister(CCPU *cpu, const unsigned regidx); 145 virtual void checkRegister(CCPU *cpu, const unsigned regidx);
@@ -175,7 +162,7 @@ class CInstruction
175 * @param params list of parameters of this instruction 162 * @param params list of parameters of this instruction
176 * @return - 163 * @return -
177 * @globalvars none 164 * @globalvars none
178 * @exception runtime_error 165 * @exception std::runtime_error
179 * @conditions none 166 * @conditions none
180 */ 167 */
181 virtual void compile(std::list<std::string>& params) = 0; 168 virtual void compile(std::list<std::string>& params) = 0;
@@ -186,7 +173,7 @@ class CInstruction
186 * @param cpu pointer to cpu 173 * @param cpu pointer to cpu
187 * @return - 174 * @return -
188 * @globalvars none 175 * @globalvars none
189 * @exception runtime_error 176 * @exception std::runtime_error
190 * @conditions none 177 * @conditions none
191 */ 178 */
192 virtual void execute(CCPU *cpu) = 0; 179 virtual void execute(CCPU *cpu) = 0;