if(instr == NULL) {
throw string("Out of Instructions!");
}
- this->incPerf();
if(this->conditionMet(instr->getCondition())) {
cout << "Executing: " << instr->toString() << endl;
instr->execInstr();
+ this->incPerfBy(instr->getClockCount());
}
else {
cout << "Didn't Execute " << instr->toString() << "; condition wasn't met" << endl;
+ this->incPerf();
}
}
this->m_perf++;
}
+void CCpu::incPerfBy(short inc)
+{
+ this->m_perf += inc;
+}
+
CCpu::CCpu(int regs, int ram, int prog) : m_Z(false), m_S(false), m_C(false), m_O(false), m_pc(0), m_pc_next(0), m_perf(0), m_reg(regs), m_ram(ram), m_prog(prog), m_stack(0)
{
class Iinstr {
protected:
- short opcode;
+ short opcode, clockcount;
std::string name;
short m_ra, m_rb, m_rd;
bool m_c, m_d, m_hl, m_f, m_s;
short m_cond;
boost::dynamic_bitset<> argbits;
CDat hexdump;
- Iinstr() : opcode(0), name(""), m_ra(0), m_rb(0), m_rd(0), m_c(0), m_d(0), m_hl(0), m_f(0), m_s(0), m_imm(0), m_cond(ALWAYS), argbits(32), hexdump(0) {}
+ Iinstr() : opcode(0), clockcount(1), name(""), m_ra(0), m_rb(0), m_rd(0), m_c(0), m_d(0), m_hl(0), m_f(0), m_s(0), m_imm(0), m_cond(ALWAYS), argbits(32), hexdump(0) {}
CDat generate16ImmFill(const CDat value) const {
CDat i = value;
return m_cond;
}
+ short getClockCount() {
+ return clockcount;
+ }
+
void decodeCondition(short condition) {
if(condition >= 0 && condition <= 15) {
m_cond = condition;