X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=3c_disasm%2FIinstr.hpp;fp=3c_disasm%2FIinstr.hpp;h=416db47a869cb6041163165d5e96d968b6477e78;hb=12d2a7c14a42e01b6caf2a097db32404a403d213;hp=d590dc70720c2a52dbdb5b41a52580b6414731e9;hpb=31d88f201bf427d70924b9737ecdb6e0611939d3;p=calu.git diff --git a/3c_disasm/Iinstr.hpp b/3c_disasm/Iinstr.hpp index d590dc7..416db47 100644 --- a/3c_disasm/Iinstr.hpp +++ b/3c_disasm/Iinstr.hpp @@ -1,10 +1,15 @@ +#ifndef __IINSTR_I_ +#define __IINSTR_I_ + #include #include #include #include -#ifndef __IINSTR_I_ -#define __IINSTR_I_ +class CCpu; + +#include "ccpu.hpp" + /* concept from https://groups.google.com/group/comp.arch.embedded/msg/9d430b6d3da12c8f */ #define to_HEX__(x) 0x##x##LU @@ -16,6 +21,7 @@ +((x & 0xF0000UL) ? 16 : 0) #define B5(x) ((unsigned char)to_B5__(to_HEX__(x))) +/* end concept */ using namespace std; using namespace boost; @@ -107,7 +113,12 @@ class Iinstr { return bits.to_ulong(); } + static CCpu* m_cpu; + public: + + static void setCPU(CCpu* cpu) { m_cpu = cpu; } + virtual ~Iinstr() {} virtual short getOpcode() { return this->opcode; } virtual std::string getName() { return this->name; } @@ -115,6 +126,11 @@ class Iinstr { virtual void evalInstr() = 0; virtual void execInstr() = 0; virtual std::string toString() = 0; + virtual Iinstr* getNew() = 0; + + short getCondition() { + return m_cond; + } void decodeCondition(short condition) { if(condition >= 0 && condition <= 15) { @@ -126,6 +142,7 @@ class Iinstr { } protected: + std::string getConditionFlag() { stringstream cond; @@ -185,4 +202,5 @@ class Iinstr { return cond.str(); } }; + #endif