summaryrefslogtreecommitdiffstats
path: root/ue3/mycpu/instructions.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue3/mycpu/instructions.h')
-rw-r--r--ue3/mycpu/instructions.h399
1 files changed, 373 insertions, 26 deletions
diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h
index ebd1533..8c62e0b 100644
--- a/ue3/mycpu/instructions.h
+++ b/ue3/mycpu/instructions.h
@@ -20,45 +20,392 @@ class CInstructionInc
20 : public CInstruction 20 : public CInstruction
21{ 21{
22 public: 22 public:
23 /**
24 * @method CInstruction
25 * @brief Default ctor
26 * @param -
27 * @return -
28 * @globalvars none
29 * @exception none
30 * @conditions none
31 */
32 CInstructionInc() 23 CInstructionInc()
33 : CInstruction("inc") 24 : CInstruction("inc")
34 {}; 25 {}
35 26
36 /**
37 * @method ~CInstruction
38 * @brief Default dtor
39 * @param -
40 * @return -
41 * @globalvars none
42 * @exception none
43 * @conditions none
44 */
45 ~CInstructionInc()
46 {};
47
48 /* TODO */
49 CInstructionInc *factory() 27 CInstructionInc *factory()
50 { 28 {
51 return new CInstructionInc; 29 return new CInstructionInc;
52 } 30 }
53 31
54 /* TODO */
55 void compile(std::list<std::string>& params); 32 void compile(std::list<std::string>& params);
33 void execute(CCPU *cpu);
34
35 protected:
36 unsigned m_regidx1;
37};
38
39/*============================================================================*/
40
41/**
42 * @class CInstructionDec
43 *
44 * TODO
45 */
46class CInstructionDec
47 : public CInstruction
48{
49 public:
50 CInstructionDec()
51 : CInstruction("dec")
52 {}
53
54 CInstructionDec *factory()
55 {
56 return new CInstructionDec;
57 }
58
59 void compile(std::list<std::string>& params);
60 void execute(CCPU *cpu);
61
62 protected:
63 unsigned m_regidx1;
64};
65
66/*============================================================================*/
67
68/**
69 * @class CInstructionAdd
70 *
71 * TODO
72 */
73class CInstructionAdd
74 : public CInstruction
75{
76 public:
77 CInstructionAdd()
78 : CInstruction("add")
79 {}
80
81 CInstructionAdd *factory()
82 {
83 return new CInstructionAdd;
84 }
85
86 void compile(std::list<std::string>& params);
87 void execute(CCPU *cpu);
88
89 protected:
90 unsigned m_regidx1;
91 unsigned m_regidx2;
92 unsigned m_regidx3;
93};
94
95/*============================================================================*/
96
97/**
98 * @class CInstructionSub
99 *
100 * TODO
101 */
102class CInstructionSub
103 : public CInstruction
104{
105 public:
106 CInstructionSub()
107 : CInstruction("sub")
108 {}
109
110 CInstructionSub *factory()
111 {
112 return new CInstructionSub;
113 }
114
115 void compile(std::list<std::string>& params);
116 void execute(CCPU *cpu);
117
118 protected:
119 unsigned m_regidx1;
120 unsigned m_regidx2;
121 unsigned m_regidx3;
122};
56 123
57 /* TODO */ 124/*============================================================================*/
125
126/**
127 * @class CInstructionMul
128 *
129 * TODO
130 */
131class CInstructionMul
132 : public CInstruction
133{
134 public:
135 CInstructionMul()
136 : CInstruction("mul")
137 {}
138
139 CInstructionMul *factory()
140 {
141 return new CInstructionMul;
142 }
143
144 void compile(std::list<std::string>& params);
145 void execute(CCPU *cpu);
146
147 protected:
148 unsigned m_regidx1;
149 unsigned m_regidx2;
150 unsigned m_regidx3;
151};
152
153/*============================================================================*/
154
155/**
156 * @class CInstructionDiv
157 *
158 * TODO
159 */
160class CInstructionDiv
161 : public CInstruction
162{
163 public:
164 CInstructionDiv()
165 : CInstruction("div")
166 {}
167
168 CInstructionDiv *factory()
169 {
170 return new CInstructionDiv;
171 }
172
173 void compile(std::list<std::string>& params);
174 void execute(CCPU *cpu);
175
176 protected:
177 unsigned m_regidx1;
178 unsigned m_regidx2;
179 unsigned m_regidx3;
180};
181
182/*============================================================================*/
183
184/**
185 * @class CInstructionLoad
186 *
187 * TODO
188 */
189class CInstructionLoad
190 : public CInstruction
191{
192 public:
193 CInstructionLoad()
194 : CInstruction("load")
195 {}
196
197 CInstructionLoad *factory()
198 {
199 return new CInstructionLoad;
200 }
201
202 void compile(std::list<std::string>& params);
203 void execute(CCPU *cpu);
204
205 protected:
206 unsigned m_regidx1;
207 unsigned m_regidx2;
208};
209
210/*============================================================================*/
211
212/**
213 * @class CInstructionStore
214 *
215 * TODO
216 */
217class CInstructionStore
218 : public CInstruction
219{
220 public:
221 CInstructionStore()
222 : CInstruction("store")
223 {}
224
225 CInstructionStore *factory()
226 {
227 return new CInstructionStore;
228 }
229
230 void compile(std::list<std::string>& params);
231 void execute(CCPU *cpu);
232
233 protected:
234 unsigned m_regidx1;
235 unsigned m_regidx2;
236};
237
238/*============================================================================*/
239
240/**
241 * @class CInstructionTest
242 *
243 * TODO
244 */
245class CInstructionTest
246 : public CInstruction
247{
248 public:
249 CInstructionTest()
250 : CInstruction("test")
251 {}
252
253 CInstructionTest *factory()
254 {
255 return new CInstructionTest;
256 }
257
258 void compile(std::list<std::string>& params);
259 void execute(CCPU *cpu);
260
261 protected:
262 unsigned m_regidx1;
263};
264
265/*============================================================================*/
266
267/**
268 * @class CInstructionLabel
269 *
270 * TODO
271 */
272class CInstructionLabel
273 : public CInstruction
274{
275 public:
276 CInstructionLabel()
277 : CInstruction("label"), m_label("")
278 {}
279
280 const bool isLabel()
281 {
282 return true;
283 }
284
285 const std::string getLabelName()
286 {
287 return m_label;
288 }
289
290 CInstructionLabel *factory()
291 {
292 return new CInstructionLabel;
293 }
294
295 void compile(std::list<std::string>& params);
296 void execute(CCPU *cpu);
297
298 protected:
299 std::string m_label;
300};
301
302/*============================================================================*/
303
304/**
305 * @class CInstructionJumpA
306 *
307 * TODO
308 */
309class CInstructionJumpA
310 : public CInstruction
311{
312 public:
313 CInstructionJumpA()
314 : CInstruction("jumpa"), m_addr("")
315 {}
316
317 CInstructionJumpA *factory()
318 {
319 return new CInstructionJumpA;
320 }
321
322 void compile(std::list<std::string>& params);
323 void execute(CCPU *cpu);
324
325 protected:
326 std::string m_addr;
327};
328
329/*============================================================================*/
330
331/**
332 * @class CInstructionJumpZ
333 *
334 * TODO
335 */
336class CInstructionJumpZ
337 : public CInstruction
338{
339 public:
340 CInstructionJumpZ()
341 : CInstruction("jumpz"), m_addr("")
342 {}
343
344 CInstructionJumpZ *factory()
345 {
346 return new CInstructionJumpZ;
347 }
348
349 void compile(std::list<std::string>& params);
350 void execute(CCPU *cpu);
351
352 protected:
353 std::string m_addr;
354};
355
356/*============================================================================*/
357
358/**
359 * @class CInstructionJumpS
360 *
361 * TODO
362 */
363class CInstructionJumpS
364 : public CInstruction
365{
366 public:
367 CInstructionJumpS()
368 : CInstruction("jumps"), m_addr("")
369 {}
370
371 CInstructionJumpS *factory()
372 {
373 return new CInstructionJumpS;
374 }
375
376 void compile(std::list<std::string>& params);
377 void execute(CCPU *cpu);
378
379 protected:
380 std::string m_addr;
381};
382
383/*============================================================================*/
384
385/**
386 * @class CInstructionWrite
387 *
388 * TODO
389 */
390class CInstructionWrite
391 : public CInstruction
392{
393 public:
394 CInstructionWrite()
395 : CInstruction("write"), m_dev("")
396 {}
397
398 CInstructionWrite *factory()
399 {
400 return new CInstructionWrite;
401 }
402
403 void compile(std::list<std::string>& params);
58 void execute(CCPU *cpu); 404 void execute(CCPU *cpu);
59 405
60 protected: 406 protected:
61 unsigned m_regidx1; 407 unsigned m_regidx1;
408 std::string m_dev;
62}; 409};
63 410
64#endif 411#endif