summaryrefslogtreecommitdiffstats
path: root/ue3/mycpu/mycpu.cpp
diff options
context:
space:
mode:
authormanuel <manuel@nc8430.lan>2009-05-13 16:55:17 +0200
committermanuel <manuel@nc8430.lan>2009-05-13 16:55:17 +0200
commit3c6f886d5a8bfd36c796b963d6e3178ad9577742 (patch)
tree7a65d184e66c810777d18ea208931910c91b7e43 /ue3/mycpu/mycpu.cpp
parent431bbac5a99abbccf33500e22aa353ec792eff94 (diff)
downloadooprog-3c6f886d5a8bfd36c796b963d6e3178ad9577742.tar.gz
ooprog-3c6f886d5a8bfd36c796b963d6e3178ad9577742.tar.bz2
ooprog-3c6f886d5a8bfd36c796b963d6e3178ad9577742.zip
* added documentation (no more TODOs)
* added testsuite + testcase * used copyctor instead of assign operator more often
Diffstat (limited to 'ue3/mycpu/mycpu.cpp')
-rw-r--r--ue3/mycpu/mycpu.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/ue3/mycpu/mycpu.cpp b/ue3/mycpu/mycpu.cpp
index 08861a4..b25e721 100644
--- a/ue3/mycpu/mycpu.cpp
+++ b/ue3/mycpu/mycpu.cpp
@@ -1,10 +1,14 @@
1/** 1/**
2 * @module mycpu 2 * @module mycpu
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) 3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief TODO 4 * @brief mycpu executes a programfile (in simple assembler) by parsing the
5 * @date 11.05.2009 5 * programfile first. This creates a vector of instructions, which will
6 * be executed in linear order (except jumps) afterwards. In order to
7 * initialize the memory of the cpu before execution an optional
8 * memoryfile can be passed as commandline option.
9 * @date 13.05.2009
6 * @par Exercise 10 * @par Exercise
7 * 3 11 * 4
8 */ 12 */
9 13
10#include <boost/program_options.hpp> 14#include <boost/program_options.hpp>
@@ -29,7 +33,11 @@ namespace po = boost::program_options;
29 * @exception none 33 * @exception none
30 * @conditions none 34 * @conditions none
31 * 35 *
32 * TODO 36 * parse commandline options, create and initialize memory,
37 * create cprogram instance, which parses the programfile and
38 * execute CCPU::run()
39 * On error print error message to stderr.
40 * Unknown commandline options will print a usage message.
33 */ 41 */
34int main(int argc, char* argv[]) 42int main(int argc, char* argv[])
35{ 43{
@@ -88,7 +96,7 @@ int main(int argc, char* argv[])
88 } 96 }
89 97
90#if DEBUG 98#if DEBUG
91 memory.dump(cout); 99 memory.dump(cerr);
92#endif 100#endif
93 } 101 }
94 102
@@ -116,7 +124,7 @@ int main(int argc, char* argv[])
116 } 124 }
117 125
118#if DEBUG 126#if DEBUG
119 program.dump(cout); 127 program.dump(cerr);
120#endif 128#endif
121 129
122 130
@@ -128,7 +136,7 @@ int main(int argc, char* argv[])
128 cpu.setProgram(&program); 136 cpu.setProgram(&program);
129 cpu.run(); 137 cpu.run();
130#if DEBUG 138#if DEBUG
131 //cpu.dumpRegisters(cout); 139 //cpu.dumpRegisters(cerr);
132#endif 140#endif
133 } 141 }
134 catch(runtime_error& ex) 142 catch(runtime_error& ex)
@@ -136,8 +144,7 @@ int main(int argc, char* argv[])
136 cerr << me << ": Error while executing program:" << endl 144 cerr << me << ": Error while executing program:" << endl
137 << " " << ex.what() << endl; 145 << " " << ex.what() << endl;
138#if DEBUG 146#if DEBUG
139 memory.dump(cout); 147 memory.dump(cerr);
140 //cpu.dumpRegisters(cout);
141#endif 148#endif
142 return 1; 149 return 1;
143 } 150 }