From 89e202f49b9857dcd3627fbc4e0262125d729bbc Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 04:09:39 +0200 Subject: adding all instructions and displays --- ue3/mycpu/instructions.h | 399 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 373 insertions(+), 26 deletions(-) (limited to 'ue3/mycpu/instructions.h') diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h index ebd1533..8c62e0b 100644 --- a/ue3/mycpu/instructions.h +++ b/ue3/mycpu/instructions.h @@ -20,45 +20,392 @@ class CInstructionInc : public CInstruction { public: - /** - * @method CInstruction - * @brief Default ctor - * @param - - * @return - - * @globalvars none - * @exception none - * @conditions none - */ CInstructionInc() : CInstruction("inc") - {}; - - /** - * @method ~CInstruction - * @brief Default dtor - * @param - - * @return - - * @globalvars none - * @exception none - * @conditions none - */ - ~CInstructionInc() - {}; - - /* TODO */ + {} + CInstructionInc *factory() { return new CInstructionInc; } - /* TODO */ void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +/*============================================================================*/ + +/** + * @class CInstructionDec + * + * TODO + */ +class CInstructionDec + : public CInstruction +{ + public: + CInstructionDec() + : CInstruction("dec") + {} + + CInstructionDec *factory() + { + return new CInstructionDec; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +/*============================================================================*/ + +/** + * @class CInstructionAdd + * + * TODO + */ +class CInstructionAdd + : public CInstruction +{ + public: + CInstructionAdd() + : CInstruction("add") + {} + + CInstructionAdd *factory() + { + return new CInstructionAdd; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; + +/*============================================================================*/ + +/** + * @class CInstructionSub + * + * TODO + */ +class CInstructionSub + : public CInstruction +{ + public: + CInstructionSub() + : CInstruction("sub") + {} + + CInstructionSub *factory() + { + return new CInstructionSub; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; - /* TODO */ +/*============================================================================*/ + +/** + * @class CInstructionMul + * + * TODO + */ +class CInstructionMul + : public CInstruction +{ + public: + CInstructionMul() + : CInstruction("mul") + {} + + CInstructionMul *factory() + { + return new CInstructionMul; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; + +/*============================================================================*/ + +/** + * @class CInstructionDiv + * + * TODO + */ +class CInstructionDiv + : public CInstruction +{ + public: + CInstructionDiv() + : CInstruction("div") + {} + + CInstructionDiv *factory() + { + return new CInstructionDiv; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; + +/*============================================================================*/ + +/** + * @class CInstructionLoad + * + * TODO + */ +class CInstructionLoad + : public CInstruction +{ + public: + CInstructionLoad() + : CInstruction("load") + {} + + CInstructionLoad *factory() + { + return new CInstructionLoad; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; +}; + +/*============================================================================*/ + +/** + * @class CInstructionStore + * + * TODO + */ +class CInstructionStore + : public CInstruction +{ + public: + CInstructionStore() + : CInstruction("store") + {} + + CInstructionStore *factory() + { + return new CInstructionStore; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; +}; + +/*============================================================================*/ + +/** + * @class CInstructionTest + * + * TODO + */ +class CInstructionTest + : public CInstruction +{ + public: + CInstructionTest() + : CInstruction("test") + {} + + CInstructionTest *factory() + { + return new CInstructionTest; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +/*============================================================================*/ + +/** + * @class CInstructionLabel + * + * TODO + */ +class CInstructionLabel + : public CInstruction +{ + public: + CInstructionLabel() + : CInstruction("label"), m_label("") + {} + + const bool isLabel() + { + return true; + } + + const std::string getLabelName() + { + return m_label; + } + + CInstructionLabel *factory() + { + return new CInstructionLabel; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_label; +}; + +/*============================================================================*/ + +/** + * @class CInstructionJumpA + * + * TODO + */ +class CInstructionJumpA + : public CInstruction +{ + public: + CInstructionJumpA() + : CInstruction("jumpa"), m_addr("") + {} + + CInstructionJumpA *factory() + { + return new CInstructionJumpA; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_addr; +}; + +/*============================================================================*/ + +/** + * @class CInstructionJumpZ + * + * TODO + */ +class CInstructionJumpZ + : public CInstruction +{ + public: + CInstructionJumpZ() + : CInstruction("jumpz"), m_addr("") + {} + + CInstructionJumpZ *factory() + { + return new CInstructionJumpZ; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_addr; +}; + +/*============================================================================*/ + +/** + * @class CInstructionJumpS + * + * TODO + */ +class CInstructionJumpS + : public CInstruction +{ + public: + CInstructionJumpS() + : CInstruction("jumps"), m_addr("") + {} + + CInstructionJumpS *factory() + { + return new CInstructionJumpS; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_addr; +}; + +/*============================================================================*/ + +/** + * @class CInstructionWrite + * + * TODO + */ +class CInstructionWrite + : public CInstruction +{ + public: + CInstructionWrite() + : CInstruction("write"), m_dev("") + {} + + CInstructionWrite *factory() + { + return new CInstructionWrite; + } + + void compile(std::list& params); void execute(CCPU *cpu); protected: unsigned m_regidx1; + std::string m_dev; }; #endif -- cgit v1.2.3