diff options
| author | manuel <manuel@nc8430.lan> | 2009-05-13 04:09:39 +0200 |
|---|---|---|
| committer | manuel <manuel@nc8430.lan> | 2009-05-13 04:09:39 +0200 |
| commit | 89e202f49b9857dcd3627fbc4e0262125d729bbc (patch) | |
| tree | dbe69dd8498eb0a489bc7b7e24f2b73580c598d2 /ue3/mycpu/ccpu.h | |
| parent | 45581d3d376e8deed84952cb838ae330549e5241 (diff) | |
| download | ooprog-89e202f49b9857dcd3627fbc4e0262125d729bbc.tar.gz ooprog-89e202f49b9857dcd3627fbc4e0262125d729bbc.tar.bz2 ooprog-89e202f49b9857dcd3627fbc4e0262125d729bbc.zip | |
adding all instructions and displays
Diffstat (limited to 'ue3/mycpu/ccpu.h')
| -rw-r--r-- | ue3/mycpu/ccpu.h | 84 |
1 files changed, 78 insertions, 6 deletions
diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h index e28a7cc..1ef1923 100644 --- a/ue3/mycpu/ccpu.h +++ b/ue3/mycpu/ccpu.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #ifndef CCPU_H | 8 | #ifndef CCPU_H |
| 9 | #define CCPU_H 1 | 9 | #define CCPU_H 1 |
| 10 | 10 | ||
| 11 | #include <vector> | ||
| 12 | #include <iostream> | 11 | #include <iostream> |
| 12 | #include <set> | ||
| 13 | #include "cdat.h" | 13 | #include "cdat.h" |
| 14 | #include "cmem.h" | 14 | #include "cmem.h" |
| 15 | #include "cprogram.h" | 15 | #include "cprogram.h" |
| 16 | #include "cdisplay.h" | ||
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| 18 | * @class CCPU | 19 | * @class CCPU |
| @@ -53,7 +54,7 @@ class CCPU | |||
| 53 | * @exception none | 54 | * @exception none |
| 54 | * @conditions none | 55 | * @conditions none |
| 55 | */ | 56 | */ |
| 56 | const unsigned getRegisterCount() | 57 | const unsigned getRegisterCount() const |
| 57 | { | 58 | { |
| 58 | return m_regcnt; | 59 | return m_regcnt; |
| 59 | } | 60 | } |
| @@ -67,7 +68,7 @@ class CCPU | |||
| 67 | * @exception none | 68 | * @exception none |
| 68 | * @conditions none | 69 | * @conditions none |
| 69 | */ | 70 | */ |
| 70 | CDat *getRegisters() | 71 | CDat *getRegisters() const |
| 71 | { | 72 | { |
| 72 | return m_registers; | 73 | return m_registers; |
| 73 | } | 74 | } |
| @@ -81,7 +82,7 @@ class CCPU | |||
| 81 | * @exception none | 82 | * @exception none |
| 82 | * @conditions none | 83 | * @conditions none |
| 83 | */ | 84 | */ |
| 84 | void setMemory(const CMem *memory) | 85 | void setMemory(CMem *memory) |
| 85 | { | 86 | { |
| 86 | m_memory = memory; | 87 | m_memory = memory; |
| 87 | } | 88 | } |
| @@ -95,7 +96,7 @@ class CCPU | |||
| 95 | * @exception none | 96 | * @exception none |
| 96 | * @conditions none | 97 | * @conditions none |
| 97 | */ | 98 | */ |
| 98 | const CMem *getMemory() | 99 | CMem *getMemory() const |
| 99 | { | 100 | { |
| 100 | return m_memory; | 101 | return m_memory; |
| 101 | } | 102 | } |
| @@ -129,6 +130,76 @@ class CCPU | |||
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | /** | 132 | /** |
| 133 | * @method getDisplays | ||
| 134 | * @brief get set of pointers to displays | ||
| 135 | * @param - | ||
| 136 | * @return reference to set of pointers to displays | ||
| 137 | * @globalvars none | ||
| 138 | * @exception none | ||
| 139 | * @conditions none | ||
| 140 | */ | ||
| 141 | const std::set<CDisplay *>& getDisplays() | ||
| 142 | { | ||
| 143 | return m_displays; | ||
| 144 | } | ||
| 145 | |||
| 146 | /** | ||
| 147 | * @method setFlagZero | ||
| 148 | * @brief set zero flag | ||
| 149 | * @param value new value of zero flag | ||
| 150 | * @return - | ||
| 151 | * @globalvars none | ||
| 152 | * @exception none | ||
| 153 | * @conditions none | ||
| 154 | */ | ||
| 155 | void setFlagZero(const bool value) | ||
| 156 | { | ||
| 157 | m_flagzero = value; | ||
| 158 | } | ||
| 159 | |||
| 160 | /** | ||
| 161 | * @method getFlagZero | ||
| 162 | * @brief get value of zero flag | ||
| 163 | * @param - | ||
| 164 | * @return value of zero flag | ||
| 165 | * @globalvars none | ||
| 166 | * @exception none | ||
| 167 | * @conditions none | ||
| 168 | */ | ||
| 169 | const bool getFlagZero() | ||
| 170 | { | ||
| 171 | return m_flagzero; | ||
| 172 | } | ||
| 173 | |||
| 174 | /** | ||
| 175 | * @method setFlagSign | ||
| 176 | * @brief set sign flag | ||
| 177 | * @param value new value of sign flag | ||
| 178 | * @return - | ||
| 179 | * @globalvars none | ||
| 180 | * @exception none | ||
| 181 | * @conditions none | ||
| 182 | */ | ||
| 183 | void setFlagSign(const bool value) | ||
| 184 | { | ||
| 185 | m_flagsign = value; | ||
| 186 | } | ||
| 187 | |||
| 188 | /** | ||
| 189 | * @method getFlagSign | ||
| 190 | * @brief get value of sign flag | ||
| 191 | * @param - | ||
| 192 | * @return value of sign flag | ||
| 193 | * @globalvars none | ||
| 194 | * @exception none | ||
| 195 | * @conditions none | ||
| 196 | */ | ||
| 197 | const bool getFlagSign() | ||
| 198 | { | ||
| 199 | return m_flagsign; | ||
| 200 | } | ||
| 201 | |||
| 202 | /** | ||
| 132 | * @method run | 203 | * @method run |
| 133 | * @brief execute current program | 204 | * @brief execute current program |
| 134 | * @param - | 205 | * @param - |
| @@ -156,8 +227,9 @@ class CCPU | |||
| 156 | /* members */ | 227 | /* members */ |
| 157 | CDat *m_registers; | 228 | CDat *m_registers; |
| 158 | unsigned m_regcnt; | 229 | unsigned m_regcnt; |
| 159 | const CMem *m_memory; | 230 | CMem *m_memory; |
| 160 | const CProgram *m_program; | 231 | const CProgram *m_program; |
| 232 | std::set<CDisplay *> m_displays; | ||
| 161 | bool m_flagzero; | 233 | bool m_flagzero; |
| 162 | bool m_flagsign; | 234 | bool m_flagsign; |
| 163 | }; | 235 | }; |
