From 3c6f886d5a8bfd36c796b963d6e3178ad9577742 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 16:55:17 +0200 Subject: * added documentation (no more TODOs) * added testsuite + testcase * used copyctor instead of assign operator more often --- ue3/mycpu/mycpu.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'ue3/mycpu/mycpu.cpp') 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 @@ /** * @module mycpu * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO - * @date 11.05.2009 + * @brief mycpu executes a programfile (in simple assembler) by parsing the + * programfile first. This creates a vector of instructions, which will + * be executed in linear order (except jumps) afterwards. In order to + * initialize the memory of the cpu before execution an optional + * memoryfile can be passed as commandline option. + * @date 13.05.2009 * @par Exercise - * 3 + * 4 */ #include @@ -29,7 +33,11 @@ namespace po = boost::program_options; * @exception none * @conditions none * - * TODO + * parse commandline options, create and initialize memory, + * create cprogram instance, which parses the programfile and + * execute CCPU::run() + * On error print error message to stderr. + * Unknown commandline options will print a usage message. */ int main(int argc, char* argv[]) { @@ -88,7 +96,7 @@ int main(int argc, char* argv[]) } #if DEBUG - memory.dump(cout); + memory.dump(cerr); #endif } @@ -116,7 +124,7 @@ int main(int argc, char* argv[]) } #if DEBUG - program.dump(cout); + program.dump(cerr); #endif @@ -128,7 +136,7 @@ int main(int argc, char* argv[]) cpu.setProgram(&program); cpu.run(); #if DEBUG - //cpu.dumpRegisters(cout); + //cpu.dumpRegisters(cerr); #endif } catch(runtime_error& ex) @@ -136,8 +144,7 @@ int main(int argc, char* argv[]) cerr << me << ": Error while executing program:" << endl << " " << ex.what() << endl; #if DEBUG - memory.dump(cout); - //cpu.dumpRegisters(cout); + memory.dump(cerr); #endif return 1; } -- cgit v1.2.3