1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>mycpu: mycpu/instructions.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>mycpu/instructions.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef INSTRUCTIONS_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define INSTRUCTIONS_H 1</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include "cinstruction.h"</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include "ccpu.h"</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include "cprogram.h"</span>
<a name="l00014"></a>00014
<a name="l00022"></a>00022 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00024"></a>00024 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00025"></a>00025 {
<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>;
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="keyword">public</span>:
<a name="l00029"></a>00029 <a class="code" href="classCInstructionInc.html">CInstructionInc</a>()
<a name="l00030"></a>00030 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"inc"</span>)
<a name="l00031"></a>00031 {}
<a name="l00032"></a>00032
<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>()
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionInc.html">CInstructionInc</a>;
<a name="l00036"></a>00036 }
<a name="l00037"></a>00037
<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);
<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);
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="keyword">protected</span>:
<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>;
<a name="l00044"></a>00044 };
<a name="l00045"></a>00045
<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00047"></a>00047
<a name="l00048"></a>00048 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00050"></a>00050 {
<a name="l00051"></a>00051 <span class="keywordflow">if</span> (params.size() != 1)
<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>);
<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());
<a name="l00054"></a>00054 params.pop_front();
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056
<a name="l00057"></a>00057 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00058"></a>00058
<a name="l00059"></a>00059 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062 assert(cpu != NULL);
<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>);
<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> ]++;
<a name="l00065"></a>00065 }
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <span class="comment">/*============================================================================*/</span>
<a name="l00068"></a>00068
<a name="l00076"></a>00076 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00078"></a>00078 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00079"></a>00079 {
<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>;
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <span class="keyword">public</span>:
<a name="l00083"></a>00083 <a class="code" href="classCInstructionDec.html">CInstructionDec</a>()
<a name="l00084"></a>00084 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"dec"</span>)
<a name="l00085"></a>00085 {}
<a name="l00086"></a>00086
<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>()
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionDec.html">CInstructionDec</a>;
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091
<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);
<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);
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="keyword">protected</span>:
<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>;
<a name="l00098"></a>00098 };
<a name="l00099"></a>00099
<a name="l00100"></a>00100 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105 <span class="keywordflow">if</span> (params.size() != 1)
<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>);
<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());
<a name="l00108"></a>00108 params.pop_front();
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110
<a name="l00111"></a>00111 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00115"></a>00115 {
<a name="l00116"></a>00116 assert(cpu != NULL);
<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>);
<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> ]--;
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120
<a name="l00121"></a>00121 <span class="comment">/*============================================================================*/</span>
<a name="l00122"></a>00122
<a name="l00130"></a>00130 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00132"></a>00132 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00133"></a>00133 {
<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>;
<a name="l00135"></a>00135
<a name="l00136"></a>00136 <span class="keyword">public</span>:
<a name="l00137"></a>00137 <a class="code" href="classCInstructionAdd.html">CInstructionAdd</a>()
<a name="l00138"></a>00138 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"add"</span>)
<a name="l00139"></a>00139 {}
<a name="l00140"></a>00140
<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>()
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionAdd.html">CInstructionAdd</a>;
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145
<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);
<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);
<a name="l00148"></a>00148
<a name="l00149"></a>00149 <span class="keyword">protected</span>:
<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>;
<a name="l00153"></a><a class="code" href="classCInstructionAdd.html#25f0fab0bae358796643b1e33b0074a8">00153</a> <span class="keywordtype">unsigned</span> m_regidx2;
<a name="l00155"></a><a class="code" href="classCInstructionAdd.html#5c66a8d18ca4575d92a3e6d2263045c8">00155</a> <span class="keywordtype">unsigned</span> m_regidx3;
<a name="l00156"></a>00156 };
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00159"></a>00159
<a name="l00160"></a>00160 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00162"></a>00162 {
<a name="l00163"></a>00163 <span class="keywordflow">if</span> (params.size() != 3)
<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>);
<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());
<a name="l00166"></a>00166 params.pop_front();
<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());
<a name="l00168"></a>00168 params.pop_front();
<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());
<a name="l00170"></a>00170 params.pop_front();
<a name="l00171"></a>00171 }
<a name="l00172"></a>00172
<a name="l00173"></a>00173 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00174"></a>00174
<a name="l00175"></a>00175 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00177"></a>00177 {
<a name="l00178"></a>00178 assert(cpu != NULL);
<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>);
<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>);
<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>);
<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> ]
<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> ];
<a name="l00184"></a>00184 }
<a name="l00185"></a>00185
<a name="l00186"></a>00186 <span class="comment">/*============================================================================*/</span>
<a name="l00187"></a>00187
<a name="l00195"></a>00195 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00197"></a>00197 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00198"></a>00198 {
<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>;
<a name="l00200"></a>00200
<a name="l00201"></a>00201 <span class="keyword">public</span>:
<a name="l00202"></a>00202 <a class="code" href="classCInstructionSub.html">CInstructionSub</a>()
<a name="l00203"></a>00203 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"sub"</span>)
<a name="l00204"></a>00204 {}
<a name="l00205"></a>00205
<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>()
<a name="l00207"></a>00207 {
<a name="l00208"></a>00208 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionSub.html">CInstructionSub</a>;
<a name="l00209"></a>00209 }
<a name="l00210"></a>00210
<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);
<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);
<a name="l00213"></a>00213
<a name="l00214"></a>00214 <span class="keyword">protected</span>:
<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>;
<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>;
<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>;
<a name="l00221"></a>00221 };
<a name="l00222"></a>00222
<a name="l00223"></a>00223 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00224"></a>00224
<a name="l00225"></a>00225 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00227"></a>00227 {
<a name="l00228"></a>00228 <span class="keywordflow">if</span> (params.size() != 3)
<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>);
<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());
<a name="l00231"></a>00231 params.pop_front();
<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());
<a name="l00233"></a>00233 params.pop_front();
<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());
<a name="l00235"></a>00235 params.pop_front();
<a name="l00236"></a>00236 }
<a name="l00237"></a>00237
<a name="l00238"></a>00238 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00239"></a>00239
<a name="l00240"></a>00240 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00242"></a>00242 {
<a name="l00243"></a>00243 assert(cpu != NULL);
<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>);
<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>);
<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>);
<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> ]
<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> ];
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250
<a name="l00251"></a>00251 <span class="comment">/*============================================================================*/</span>
<a name="l00252"></a>00252
<a name="l00260"></a>00260 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00262"></a>00262 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00263"></a>00263 {
<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>;
<a name="l00265"></a>00265
<a name="l00266"></a>00266 <span class="keyword">public</span>:
<a name="l00267"></a>00267 <a class="code" href="classCInstructionMul.html">CInstructionMul</a>()
<a name="l00268"></a>00268 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"mul"</span>)
<a name="l00269"></a>00269 {}
<a name="l00270"></a>00270
<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>()
<a name="l00272"></a>00272 {
<a name="l00273"></a>00273 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionMul.html">CInstructionMul</a>;
<a name="l00274"></a>00274 }
<a name="l00275"></a>00275
<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);
<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);
<a name="l00278"></a>00278
<a name="l00279"></a>00279 <span class="keyword">protected</span>:
<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>;
<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>;
<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>;
<a name="l00286"></a>00286 };
<a name="l00287"></a>00287
<a name="l00288"></a>00288 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00289"></a>00289
<a name="l00290"></a>00290 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00292"></a>00292 {
<a name="l00293"></a>00293 <span class="keywordflow">if</span> (params.size() != 3)
<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>);
<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());
<a name="l00296"></a>00296 params.pop_front();
<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());
<a name="l00298"></a>00298 params.pop_front();
<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());
<a name="l00300"></a>00300 params.pop_front();
<a name="l00301"></a>00301 }
<a name="l00302"></a>00302
<a name="l00303"></a>00303 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00304"></a>00304
<a name="l00305"></a>00305 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00307"></a>00307 {
<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>);
<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>);
<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>);
<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> ]
<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> ];
<a name="l00313"></a>00313 }
<a name="l00314"></a>00314
<a name="l00315"></a>00315 <span class="comment">/*============================================================================*/</span>
<a name="l00316"></a>00316
<a name="l00324"></a>00324 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00326"></a>00326 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00327"></a>00327 {
<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>;
<a name="l00329"></a>00329
<a name="l00330"></a>00330 <span class="keyword">public</span>:
<a name="l00331"></a>00331 <a class="code" href="classCInstructionDiv.html">CInstructionDiv</a>()
<a name="l00332"></a>00332 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"div"</span>)
<a name="l00333"></a>00333 {}
<a name="l00334"></a>00334
<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>()
<a name="l00336"></a>00336 {
<a name="l00337"></a>00337 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionDiv.html">CInstructionDiv</a>;
<a name="l00338"></a>00338 }
<a name="l00339"></a>00339
<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);
<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);
<a name="l00342"></a>00342
<a name="l00343"></a>00343 <span class="keyword">protected</span>:
<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>;
<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>;
<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>;
<a name="l00350"></a>00350 };
<a name="l00351"></a>00351
<a name="l00352"></a>00352 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00353"></a>00353
<a name="l00354"></a>00354 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00356"></a>00356 {
<a name="l00357"></a>00357 <span class="keywordflow">if</span> (params.size() != 3)
<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>);
<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());
<a name="l00360"></a>00360 params.pop_front();
<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());
<a name="l00362"></a>00362 params.pop_front();
<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());
<a name="l00364"></a>00364 params.pop_front();
<a name="l00365"></a>00365 }
<a name="l00366"></a>00366
<a name="l00367"></a>00367 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00368"></a>00368
<a name="l00369"></a>00369 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00371"></a>00371 {
<a name="l00372"></a>00372 assert(cpu != NULL);
<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>);
<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>);
<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>);
<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> ]
<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> ];
<a name="l00378"></a>00378 }
<a name="l00379"></a>00379
<a name="l00380"></a>00380 <span class="comment">/*============================================================================*/</span>
<a name="l00381"></a>00381
<a name="l00389"></a>00389 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00391"></a>00391 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00392"></a>00392 {
<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>;
<a name="l00394"></a>00394
<a name="l00395"></a>00395 <span class="keyword">public</span>:
<a name="l00396"></a>00396 <a class="code" href="classCInstructionLoad.html">CInstructionLoad</a>()
<a name="l00397"></a>00397 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"load"</span>)
<a name="l00398"></a>00398 {}
<a name="l00399"></a>00399
<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>()
<a name="l00401"></a>00401 {
<a name="l00402"></a>00402 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionLoad.html">CInstructionLoad</a>;
<a name="l00403"></a>00403 }
<a name="l00404"></a>00404
<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);
<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);
<a name="l00407"></a>00407
<a name="l00408"></a>00408 <span class="keyword">protected</span>:
<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>;
<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>;
<a name="l00413"></a>00413 };
<a name="l00414"></a>00414
<a name="l00415"></a>00415 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00416"></a>00416
<a name="l00417"></a>00417 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00419"></a>00419 {
<a name="l00420"></a>00420 <span class="keywordflow">if</span> (params.size() != 2)
<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>);
<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());
<a name="l00423"></a>00423 params.pop_front();
<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());
<a name="l00425"></a>00425 params.pop_front();
<a name="l00426"></a>00426 }
<a name="l00427"></a>00427
<a name="l00428"></a>00428 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00429"></a>00429
<a name="l00430"></a>00430 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00432"></a>00432 {
<a name="l00433"></a>00433 assert(cpu != NULL);
<a name="l00434"></a>00434 assert(cpu-><a class="code" href="classCCPU.html#8fcad8b71caaf9874d2619783568a67c" title="get pointer to memory">getMemory</a>() != NULL);
<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>);
<a name="l00436"></a>00436 super::checkRegister(cpu, <a class="code" href="classCInstructionLoad.html#b06960ae11173791614e2cd276b05f75">m_regidx2</a>);
<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> ]);
<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 ];
<a name="l00439"></a>00439 }
<a name="l00440"></a>00440
<a name="l00441"></a>00441 <span class="comment">/*============================================================================*/</span>
<a name="l00442"></a>00442
<a name="l00450"></a>00450 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00452"></a>00452 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00453"></a>00453 {
<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>;
<a name="l00455"></a>00455
<a name="l00456"></a>00456 <span class="keyword">public</span>:
<a name="l00457"></a>00457 <a class="code" href="classCInstructionStore.html">CInstructionStore</a>()
<a name="l00458"></a>00458 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"store"</span>)
<a name="l00459"></a>00459 {}
<a name="l00460"></a>00460
<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>()
<a name="l00462"></a>00462 {
<a name="l00463"></a>00463 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionStore.html">CInstructionStore</a>;
<a name="l00464"></a>00464 }
<a name="l00465"></a>00465
<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);
<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);
<a name="l00468"></a>00468
<a name="l00469"></a>00469 <span class="keyword">protected</span>:
<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>;
<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>;
<a name="l00474"></a>00474 };
<a name="l00475"></a>00475
<a name="l00476"></a>00476 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00477"></a>00477
<a name="l00478"></a>00478 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00480"></a>00480 {
<a name="l00481"></a>00481 <span class="keywordflow">if</span> (params.size() != 2)
<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>);
<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());
<a name="l00484"></a>00484 params.pop_front();
<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());
<a name="l00486"></a>00486 params.pop_front();
<a name="l00487"></a>00487 }
<a name="l00488"></a>00488
<a name="l00489"></a>00489 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00490"></a>00490
<a name="l00491"></a>00491 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00493"></a>00493 {
<a name="l00494"></a>00494 assert(cpu != NULL);
<a name="l00495"></a>00495 assert(cpu-><a class="code" href="classCCPU.html#8fcad8b71caaf9874d2619783568a67c" title="get pointer to memory">getMemory</a>() != NULL);
<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>);
<a name="l00497"></a>00497 super::checkRegister(cpu, <a class="code" href="classCInstructionStore.html#113e2d972fe34263bceb7550e863a8ca">m_regidx2</a>);
<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> ]);
<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> ];
<a name="l00500"></a>00500 }
<a name="l00501"></a>00501
<a name="l00502"></a>00502 <span class="comment">/*============================================================================*/</span>
<a name="l00503"></a>00503
<a name="l00511"></a>00511 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00513"></a>00513 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00514"></a>00514 {
<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>;
<a name="l00516"></a>00516
<a name="l00517"></a>00517 <span class="keyword">public</span>:
<a name="l00518"></a>00518 <a class="code" href="classCInstructionTest.html">CInstructionTest</a>()
<a name="l00519"></a>00519 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"test"</span>)
<a name="l00520"></a>00520 {}
<a name="l00521"></a>00521
<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>()
<a name="l00523"></a>00523 {
<a name="l00524"></a>00524 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionTest.html">CInstructionTest</a>;
<a name="l00525"></a>00525 }
<a name="l00526"></a>00526
<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);
<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);
<a name="l00529"></a>00529
<a name="l00530"></a>00530 <span class="keyword">protected</span>:
<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>;
<a name="l00533"></a>00533 };
<a name="l00534"></a>00534
<a name="l00535"></a>00535 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00536"></a>00536
<a name="l00537"></a>00537 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00539"></a>00539 {
<a name="l00540"></a>00540 <span class="keywordflow">if</span> (params.size() != 1)
<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>);
<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());
<a name="l00543"></a>00543 params.pop_front();
<a name="l00544"></a>00544 }
<a name="l00545"></a>00545
<a name="l00546"></a>00546 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00547"></a>00547
<a name="l00548"></a>00548 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00550"></a>00550 {
<a name="l00551"></a>00551 assert(cpu != NULL);
<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>);
<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))
<a name="l00554"></a>00554 cpu-><a class="code" href="classCCPU.html#e3f54dc93c58891c8a1d8a78680fcc95" title="set zero flag">setFlagZero</a>(<span class="keyword">true</span>);
<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))
<a name="l00556"></a>00556 cpu-><a class="code" href="classCCPU.html#2d6f448d0fb64f3b466b2f9fea621e81" title="set sign flag">setFlagSign</a>(<span class="keyword">true</span>);
<a name="l00557"></a>00557 }
<a name="l00558"></a>00558
<a name="l00559"></a>00559 <span class="comment">/*============================================================================*/</span>
<a name="l00560"></a>00560
<a name="l00567"></a>00567 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00569"></a>00569 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00570"></a>00570 {
<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>;
<a name="l00572"></a>00572
<a name="l00573"></a>00573 <span class="keyword">public</span>:
<a name="l00574"></a>00574 <a class="code" href="classCInstructionLabel.html">CInstructionLabel</a>()
<a name="l00575"></a>00575 : <a class="code" href="classCInstruction.html">CInstruction<T></a>(<span class="stringliteral">"label"</span>)
<a name="l00576"></a>00576 {}
<a name="l00577"></a>00577
<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>()
<a name="l00579"></a>00579 {
<a name="l00580"></a>00580 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionLabel.html">CInstructionLabel</a>;
<a name="l00581"></a>00581 }
<a name="l00582"></a>00582
<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)
<a name="l00584"></a>00584 {}
<a name="l00585"></a>00585
<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)
<a name="l00587"></a>00587 {}
<a name="l00588"></a>00588 };
<a name="l00589"></a>00589
<a name="l00590"></a>00590 <span class="comment">/*============================================================================*/</span>
<a name="l00591"></a>00591
<a name="l00599"></a>00599 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00601"></a>00601 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00602"></a>00602 {
<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>;
<a name="l00604"></a>00604
<a name="l00605"></a>00605 <span class="keyword">public</span>:
<a name="l00606"></a>00606 <a class="code" href="classCInstructionJumpA.html">CInstructionJumpA</a>()
<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>)
<a name="l00608"></a>00608 {}
<a name="l00609"></a>00609
<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>()
<a name="l00611"></a>00611 {
<a name="l00612"></a>00612 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionJumpA.html">CInstructionJumpA</a>;
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614
<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);
<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);
<a name="l00617"></a>00617
<a name="l00618"></a>00618 <span class="keyword">protected</span>:
<a name="l00620"></a><a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">00620</a> std::string m_addr;
<a name="l00621"></a>00621 };
<a name="l00622"></a>00622
<a name="l00623"></a>00623 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00624"></a>00624
<a name="l00625"></a>00625 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00627"></a>00627 {
<a name="l00628"></a>00628 <span class="keywordflow">if</span> (params.size() != 1)
<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>);
<a name="l00630"></a>00630 <a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a> = params.front();
<a name="l00631"></a>00631 params.pop_front();
<a name="l00632"></a>00632 }
<a name="l00633"></a>00633
<a name="l00634"></a>00634 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00635"></a>00635
<a name="l00636"></a>00636 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00638"></a>00638 {
<a name="l00639"></a>00639 assert(cpu != NULL);
<a name="l00640"></a>00640 assert(cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>() != NULL);
<a name="l00641"></a>00641 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionJumpA.html#375bfe6012ec34943ebaa718e11fb035">m_addr</a>.empty())
<a name="l00642"></a>00642 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty address"</span>);
<a name="l00643"></a>00643 <span class="keywordflow">try</span>
<a name="l00644"></a>00644 {
<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>);
<a name="l00646"></a>00646 }
<a name="l00647"></a>00647 <span class="keywordflow">catch</span>(<a class="code" href="classCProgramError.html">CProgramError</a>& ex)
<a name="l00648"></a>00648 {
<a name="l00649"></a>00649 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(ex.what());
<a name="l00650"></a>00650 }
<a name="l00651"></a>00651 }
<a name="l00652"></a>00652
<a name="l00653"></a>00653 <span class="comment">/*============================================================================*/</span>
<a name="l00654"></a>00654
<a name="l00662"></a>00662 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00664"></a>00664 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00665"></a>00665 {
<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>;
<a name="l00667"></a>00667
<a name="l00668"></a>00668 <span class="keyword">public</span>:
<a name="l00669"></a>00669 <a class="code" href="classCInstructionJumpZ.html">CInstructionJumpZ</a>()
<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>)
<a name="l00671"></a>00671 {}
<a name="l00672"></a>00672
<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>()
<a name="l00674"></a>00674 {
<a name="l00675"></a>00675 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionJumpZ.html">CInstructionJumpZ</a>;
<a name="l00676"></a>00676 }
<a name="l00677"></a>00677
<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);
<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);
<a name="l00680"></a>00680
<a name="l00681"></a>00681 <span class="keyword">protected</span>:
<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>;
<a name="l00684"></a>00684 };
<a name="l00685"></a>00685
<a name="l00686"></a>00686 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00687"></a>00687
<a name="l00688"></a>00688 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00690"></a>00690 {
<a name="l00691"></a>00691 <span class="keywordflow">if</span> (params.size() != 1)
<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>);
<a name="l00693"></a>00693 <a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a> = params.front();
<a name="l00694"></a>00694 params.pop_front();
<a name="l00695"></a>00695 }
<a name="l00696"></a>00696
<a name="l00697"></a>00697 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00698"></a>00698
<a name="l00699"></a>00699 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00701"></a>00701 {
<a name="l00702"></a>00702 assert(cpu != NULL);
<a name="l00703"></a>00703 assert(cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>() != NULL);
<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>())
<a name="l00705"></a>00705 <span class="keywordflow">return</span>;
<a name="l00706"></a>00706 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionJumpZ.html#436e66736beba455ab59afaf27b86ca0">m_addr</a>.empty())
<a name="l00707"></a>00707 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty address"</span>);
<a name="l00708"></a>00708 <span class="keywordflow">try</span>
<a name="l00709"></a>00709 {
<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>);
<a name="l00711"></a>00711 }
<a name="l00712"></a>00712 <span class="keywordflow">catch</span>(<a class="code" href="classCProgramError.html">CProgramError</a>& ex)
<a name="l00713"></a>00713 {
<a name="l00714"></a>00714 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(ex.what());
<a name="l00715"></a>00715 }
<a name="l00716"></a>00716 }
<a name="l00717"></a>00717
<a name="l00718"></a>00718 <span class="comment">/*============================================================================*/</span>
<a name="l00719"></a>00719
<a name="l00727"></a>00727 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00729"></a>00729 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00730"></a>00730 {
<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>;
<a name="l00732"></a>00732
<a name="l00733"></a>00733 <span class="keyword">public</span>:
<a name="l00734"></a>00734 <a class="code" href="classCInstructionJumpS.html">CInstructionJumpS</a>()
<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>)
<a name="l00736"></a>00736 {}
<a name="l00737"></a>00737
<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>()
<a name="l00739"></a>00739 {
<a name="l00740"></a>00740 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionJumpS.html">CInstructionJumpS</a>;
<a name="l00741"></a>00741 }
<a name="l00742"></a>00742
<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);
<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);
<a name="l00745"></a>00745
<a name="l00746"></a>00746 <span class="keyword">protected</span>:
<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>;
<a name="l00749"></a>00749 };
<a name="l00750"></a>00750
<a name="l00751"></a>00751 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00752"></a>00752
<a name="l00753"></a>00753 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00755"></a>00755 {
<a name="l00756"></a>00756 <span class="keywordflow">if</span> (params.size() != 1)
<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>);
<a name="l00758"></a>00758 <a class="code" href="classCInstructionJumpS.html#a83315af4999ec3f345fa84e0a8e86f5">m_addr</a> = params.front();
<a name="l00759"></a>00759 params.pop_front();
<a name="l00760"></a>00760 }
<a name="l00761"></a>00761
<a name="l00762"></a>00762 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00763"></a>00763
<a name="l00764"></a>00764 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00766"></a>00766 {
<a name="l00767"></a>00767 assert(cpu != NULL);
<a name="l00768"></a>00768 assert(cpu-><a class="code" href="classCCPU.html#60a0a2350910afb24929152ed2ebd51b" title="get pointer to program">getProgram</a>() != NULL);
<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>())
<a name="l00770"></a>00770 <span class="keywordflow">return</span>;
<a name="l00771"></a>00771 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionJumpS.html#a83315af4999ec3f345fa84e0a8e86f5">m_addr</a>.empty())
<a name="l00772"></a>00772 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty address"</span>);
<a name="l00773"></a>00773 <span class="keywordflow">try</span>
<a name="l00774"></a>00774 {
<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>);
<a name="l00776"></a>00776 }
<a name="l00777"></a>00777 <span class="keywordflow">catch</span>(<a class="code" href="classCProgramError.html">CProgramError</a>& ex)
<a name="l00778"></a>00778 {
<a name="l00779"></a>00779 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(ex.what());
<a name="l00780"></a>00780 }
<a name="l00781"></a>00781 }
<a name="l00782"></a>00782
<a name="l00783"></a>00783 <span class="comment">/*============================================================================*/</span>
<a name="l00784"></a>00784
<a name="l00792"></a>00792 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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>
<a name="l00794"></a>00794 : <span class="keyword">public</span> <a class="code" href="classCInstruction.html">CInstruction</a><T>
<a name="l00795"></a>00795 {
<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>;
<a name="l00797"></a>00797 <span class="keyword">typedef</span> <span class="keyword">typename</span> std::set<CDisplay<T> *>::iterator setiterator;
<a name="l00798"></a>00798
<a name="l00799"></a>00799 <span class="keyword">public</span>:
<a name="l00800"></a>00800 <a class="code" href="classCInstructionWrite.html">CInstructionWrite</a>()
<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>)
<a name="l00802"></a>00802 {}
<a name="l00803"></a>00803
<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>()
<a name="l00805"></a>00805 {
<a name="l00806"></a>00806 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCInstructionWrite.html">CInstructionWrite</a>;
<a name="l00807"></a>00807 }
<a name="l00808"></a>00808
<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);
<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);
<a name="l00811"></a>00811
<a name="l00812"></a>00812 <span class="keyword">protected</span>:
<a name="l00814"></a><a class="code" href="classCInstructionWrite.html#2d13271929d0f7ab9c13bd9ba5044775">00814</a> <span class="keywordtype">unsigned</span> m_regidx1;
<a name="l00816"></a><a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">00816</a> std::string m_dev;
<a name="l00817"></a>00817 };
<a name="l00818"></a>00818
<a name="l00819"></a>00819 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00820"></a>00820
<a name="l00821"></a>00821 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00823"></a>00823 {
<a name="l00824"></a>00824 <span class="keywordflow">if</span> (params.size() != 2)
<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>);
<a name="l00826"></a>00826 <a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">m_dev</a> = params.front();
<a name="l00827"></a>00827 params.pop_front();
<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());
<a name="l00829"></a>00829 params.pop_front();
<a name="l00830"></a>00830 }
<a name="l00831"></a>00831
<a name="l00832"></a>00832 <span class="comment">/*----------------------------------------------------------------------------*/</span>
<a name="l00833"></a>00833
<a name="l00834"></a>00834 <span class="keyword">template</span> <<span class="keyword">class</span> T>
<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)
<a name="l00836"></a>00836 {
<a name="l00837"></a>00837 assert(cpu != NULL);
<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>);
<a name="l00839"></a>00839 <span class="keywordflow">if</span> (<a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">m_dev</a>.empty())
<a name="l00840"></a>00840 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Empty device"</span>);
<a name="l00841"></a>00841
<a name="l00842"></a>00842 <a class="code" href="classCDisplay.html">CDisplay<T></a> *display = NULL;
<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>();
<a name="l00844"></a>00844 <span class="keywordflow">for</span>(setiterator it = displays.begin(); it != displays.end(); ++it)
<a name="l00845"></a>00845 {
<a name="l00846"></a>00846 <span class="keywordflow">if</span> ((*it)->getName() == <a class="code" href="classCInstructionWrite.html#d68b6432bab4c1a18b598914b48dd613">m_dev</a>)
<a name="l00847"></a>00847 {
<a name="l00848"></a>00848 display = *it;
<a name="l00849"></a>00849 <span class="keywordflow">break</span>;
<a name="l00850"></a>00850 }
<a name="l00851"></a>00851 }
<a name="l00852"></a>00852 <span class="keywordflow">if</span> (display == NULL)
<a name="l00853"></a>00853 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Unknown display"</span>);
<a name="l00854"></a>00854
<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> ]);
<a name="l00856"></a>00856 }
<a name="l00857"></a>00857
<a name="l00858"></a>00858 <span class="preprocessor">#endif</span>
<a name="l00859"></a>00859 <span class="preprocessor"></span>
<a name="l00860"></a>00860 <span class="comment">/* vim: set et sw=2 ts=2: */</span>
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sat May 30 16:32:35 2009 for mycpu by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>
|