diff options
Diffstat (limited to 'ue3/mycpu/mycpu.cpp')
| -rw-r--r-- | ue3/mycpu/mycpu.cpp | 25 |
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 | */ |
| 34 | int main(int argc, char* argv[]) | 42 | int 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 | } |
