void evalInstr();
void execInstr();
std::string toString();
+ Iinstr* getNew();
};
/**
return new Cadd();
}
+Iinstr* Cadd::getNew() {
+ return new Cadd();
+}
+
/**
* Name: destroy_instruction
* Purpose: if compiled as shared library, this functions destoys the
void Cadd::execInstr()
{
- cout << "should exec" << this->toString() << endl;
+ //cout << "should exec " << this->toString() << endl;
+ CDat ra = this->m_cpu->getRegister(m_ra);
+ CDat rb = this->m_cpu->getRegister(m_rb);
+ CDatd val = ra + rb;
+ this->m_cpu->setRegister(m_rd, val);
+ if(!this->m_d) {
+ this->m_cpu->updateFlags(val, ra, rb);
+ }
}
std::string Cadd::toString()
if(m_d) op << 'D';
if(m_c) op << 'C';
- op << " r" << m_rd << ", r" << m_ra << ", r" << m_rb;
+ op << this->getConditionFlag() << " r" << m_rd << ", r" << m_ra << ", r" << m_rb;
return op.str();
}