summaryrefslogtreecommitdiffstats
path: root/ue3/mycpu/cmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue3/mycpu/cmem.h')
-rw-r--r--ue3/mycpu/cmem.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/ue3/mycpu/cmem.h b/ue3/mycpu/cmem.h
new file mode 100644
index 0000000..923ed01
--- /dev/null
+++ b/ue3/mycpu/cmem.h
@@ -0,0 +1,94 @@
1/**
2 * @module cmem
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief class for providing 256 registers.
5 * @date 11.05.2009
6 */
7
8#ifndef CMEM_H
9#define CMEM_H
10
11#include <stdexcept>
12#include <string>
13
14#include <set>
15#ifdef DEBUG
16# include <iostream>
17#endif
18 #include "cdat.h"
19
20
21#define MAX_REGISTER 256;
22/**
23 * @class CMem
24 *
25 * Parses a simple line based scriptfile with some limitations:
26 * first function (starting a block) must be a read-command,
27 * last must be a write-command (ending this block).
28 *
29 * read- and write-commands have hard coded parameters, number#1 being a filetype.
30 * Classes handling certain filetypes must be of type CFile.
31 * Custom functions will be passed to CFile::callFunc().
32 *
33 * On error ParserError will be thrown.
34 */
35class CMem
36{
37 public:
38
39 /**
40 * @method CMem
41 * @brief Default ctor
42 * @param memoryfile filename
43 * @return -
44 * @globalvars none
45 * @exception bad_alloc
46 * @conditions none
47 */
48 CMem(const std::string& memfile);
49
50 /**
51 * @method ~CMem
52 * @brief Default dtor
53 * @param -
54 * @return -
55 * @globalvars none
56 * @exception none
57 * @conditions none
58 */
59 ~CMem();
60
61 CDat& getRegister(const std::string reg);
62
63 CDat& getMem(const std::string addr)
64 {
65 return getRegister("R0");
66 }
67 void setMem(const std::string addr, const CDat& value)
68 {}
69
70#ifdef DEBUG
71 /**
72 * @method dump
73 * @brief Dumps the resgister contnent to ostream
74 * @param out output stream
75 * @return -
76 * @globalvars
77 * @exception
78 * @conditions
79 */
80 void dump(std::ostream& out);
81#endif
82
83
84 private:
85 /* members */
86 std::string m_memfile;
87
88
89 std::vector<CDat> m_registers;
90};
91
92#endif
93
94/* vim: set et sw=2 ts=2: */