1 #include "../Iinstr.hpp"
4 class Cldi : public Iinstr {
9 std::string toString();
14 * Name: create_instruction
15 * Purpose: if compiled as shared library, this functions creates the
18 * Returns: pointer to instruction object
20 extern "C" Iinstr* create_instruction() {
24 Iinstr* Cldi::getNew()
29 * Name: destroy_instruction
30 * Purpose: if compiled as shared library, this functions destoys the
33 * Parameter: IInstruction - the instruction object to delete
35 extern "C" void destroy_instruction(Iinstr* p) {
45 void Cldi::evalInstr()
47 this->m_s = argbits[2];
48 this->m_hl = argbits[1];
51 dynamic_bitset<> immb = argbits;
53 this->m_imm = this->generate16ImmSign(immb.to_ulong());
56 m_rd = this->getRegister(argbits);
59 void Cldi::execInstr()
61 //cout << "should exec " << this->toString() << endl;
62 CDat val = this->m_cpu->getRegister(this->m_rd);
63 if(this->m_s == false) {
64 if(this->m_hl == false) {
70 this->m_cpu->setRegister(this->m_rd, val + this->m_imm);
73 this->m_cpu->setRegister(this->m_rd, this->m_imm);
77 std::string Cldi::toString()
80 op << this->getName();
85 op << this->getConditionFlag() << " r" << m_rd << ", " << m_imm;