sim: added special moves
[calu.git] / 3b_sim / ccpu.hpp
1 #ifndef __CPU__H__
2 #define __CPU__H__
3
4 #include "cdat.hpp"
5 #include "cmem.hpp"
6 #include "cpmem.hpp"
7
8 class Iinstr;
9
10 #include "Iinstr.hpp"
11
12
13 class CCpu {
14         private:
15
16                 bool m_Z, m_S, m_C, m_O;
17
18                 CDat m_pc, m_pc_next;
19                 CMem<CDat> m_reg, m_ram;
20                 CPMem<Iinstr*> m_prog;
21
22                 CDat m_stack;
23
24         public:
25                 void registerExtension() {};
26                 void tick();
27
28                 CDat getRegister(const int) const;
29                 void setRegister(const int, CDat);
30
31                 CDat getRAM(const int) const;
32                 void setRAM(const int, CDat);
33
34                 Iinstr* getProg(const int) const;
35                 void setProg(const int, Iinstr*);
36
37                 CDat getCurPC() const;
38                 CDat getNextPC() const;
39                 void setNextPC(CDat);
40
41                 CDat getFlags() const;
42                 void setFlags(CDat);
43                 /* will only change zero and sign */
44                 void updateFlags(CDat);
45                 /* will change all flags */
46                 void updateFlags(CDatd, CDat, CDat);
47                 /* will change all flags */
48                 void updateFlags(bool z, bool o, bool c, bool s);
49                 /* will change carry */
50                 void updateCarry(bool c);
51
52                 bool getCarry();
53
54                 bool conditionMet(short);
55
56                 int getStack() const;
57                 void setStack(const int);
58
59                 CCpu(int,int,int);
60
61 };
62
63
64 #endif