--- /dev/null
+#include "../Iinstr.hpp"
+
+
+class Cldi : public Iinstr {
+ public:
+ Cldi();
+ void evalInstr();
+ void execInstr();
+ std::string toString();
+};
+
+/**
+ * Name: create_instruction
+ * Purpose: if compiled as shared library, this functions creates the
+ instruction object
+
+ * Returns: pointer to instruction object
+ */
+extern "C" Iinstr* create_instruction() {
+ return new Cldi();
+}
+
+/**
+ * Name: destroy_instruction
+ * Purpose: if compiled as shared library, this functions destoys the
+ instruction object
+
+ * Parameter: IInstruction - the instruction object to delete
+ */
+extern "C" void destroy_instruction(Iinstr* p) {
+ delete p;
+}
+
+Cldi::Cldi()
+{
+ opcode = B5(11010);
+ name = "ldi";
+}
+
+void Cldi::evalInstr()
+{
+ this->m_s = argbits[2];
+ this->m_hl = argbits[1];
+
+ argbits >>= 3;
+ dynamic_bitset<> immb = argbits;
+ immb.resize(16);
+ this->m_imm = this->generate16ImmSign(immb.to_ulong());
+
+ argbits >>= 16;
+ m_rd = this->getRegister(argbits);
+}
+
+void Cldi::execInstr()
+{
+ cout << "should exec " << this->toString() << endl;
+}
+
+std::string Cldi::toString()
+{
+ stringstream op;
+ op << this->getName();
+
+ if(m_hl) op << 'H';
+ if(m_s) op << 'S';
+
+ op << this->getConditionFlag() << " r" << m_rd << ", " << m_imm;
+
+ return op.str();
+}