mycpu/instructions.h

00001 
00008 #ifndef INSTRUCTIONS_H
00009 #define INSTRUCTIONS_H 1
00010 
00011 #include "cinstruction.h"
00012 #include "ccpu.h"
00013 
00021 class CInstructionInc
00022  : public CInstruction
00023 {
00024   public:
00025     CInstructionInc()
00026       : CInstruction("inc")
00027     {}
00028 
00029     CInstructionInc *factory()
00030     {
00031       return new CInstructionInc;
00032     }
00033 
00034     void compile(std::list<std::string>& params);
00035     void execute(CCPU *cpu);
00036 
00037   protected:
00039     unsigned m_regidx1;
00040 };
00041 
00042 /*============================================================================*/
00043 
00051 class CInstructionDec
00052  : public CInstruction
00053 {
00054   public:
00055     CInstructionDec()
00056       : CInstruction("dec")
00057     {}
00058 
00059     CInstructionDec *factory()
00060     {
00061       return new CInstructionDec;
00062     }
00063 
00064     void compile(std::list<std::string>& params);
00065     void execute(CCPU *cpu);
00066 
00067   protected:
00069     unsigned m_regidx1;
00070 };
00071 
00072 /*============================================================================*/
00073 
00081 class CInstructionAdd
00082  : public CInstruction
00083 {
00084   public:
00085     CInstructionAdd()
00086       : CInstruction("add")
00087     {}
00088 
00089     CInstructionAdd *factory()
00090     {
00091       return new CInstructionAdd;
00092     }
00093 
00094     void compile(std::list<std::string>& params);
00095     void execute(CCPU *cpu);
00096 
00097   protected:
00099     unsigned m_regidx1;
00101     unsigned m_regidx2;
00103     unsigned m_regidx3;
00104 };
00105 
00106 /*============================================================================*/
00107 
00115 class CInstructionSub
00116  : public CInstruction
00117 {
00118   public:
00119     CInstructionSub()
00120       : CInstruction("sub")
00121     {}
00122 
00123     CInstructionSub *factory()
00124     {
00125       return new CInstructionSub;
00126     }
00127 
00128     void compile(std::list<std::string>& params);
00129     void execute(CCPU *cpu);
00130 
00131   protected:
00133     unsigned m_regidx1;
00135     unsigned m_regidx2;
00137     unsigned m_regidx3;
00138 };
00139 
00140 /*============================================================================*/
00141 
00149 class CInstructionMul
00150  : public CInstruction
00151 {
00152   public:
00153     CInstructionMul()
00154       : CInstruction("mul")
00155     {}
00156 
00157     CInstructionMul *factory()
00158     {
00159       return new CInstructionMul;
00160     }
00161 
00162     void compile(std::list<std::string>& params);
00163     void execute(CCPU *cpu);
00164 
00165   protected:
00167     unsigned m_regidx1;
00169     unsigned m_regidx2;
00171     unsigned m_regidx3;
00172 };
00173 
00174 /*============================================================================*/
00175 
00183 class CInstructionDiv
00184  : public CInstruction
00185 {
00186   public:
00187     CInstructionDiv()
00188       : CInstruction("div")
00189     {}
00190 
00191     CInstructionDiv *factory()
00192     {
00193       return new CInstructionDiv;
00194     }
00195 
00196     void compile(std::list<std::string>& params);
00197     void execute(CCPU *cpu);
00198 
00199   protected:
00201     unsigned m_regidx1;
00203     unsigned m_regidx2;
00205     unsigned m_regidx3;
00206 };
00207 
00208 /*============================================================================*/
00209 
00217 class CInstructionLoad
00218  : public CInstruction
00219 {
00220   public:
00221     CInstructionLoad()
00222       : CInstruction("load")
00223     {}
00224 
00225     CInstructionLoad *factory()
00226     {
00227       return new CInstructionLoad;
00228     }
00229 
00230     void compile(std::list<std::string>& params);
00231     void execute(CCPU *cpu);
00232 
00233   protected:
00235     unsigned m_regidx1;
00237     unsigned m_regidx2;
00238 };
00239 
00240 /*============================================================================*/
00241 
00249 class CInstructionStore
00250  : public CInstruction
00251 {
00252   public:
00253     CInstructionStore()
00254       : CInstruction("store")
00255     {}
00256 
00257     CInstructionStore *factory()
00258     {
00259       return new CInstructionStore;
00260     }
00261 
00262     void compile(std::list<std::string>& params);
00263     void execute(CCPU *cpu);
00264 
00265   protected:
00267     unsigned m_regidx1;
00269     unsigned m_regidx2;
00270 };
00271 
00272 /*============================================================================*/
00273 
00281 class CInstructionTest
00282  : public CInstruction
00283 {
00284   public:
00285     CInstructionTest()
00286       : CInstruction("test")
00287     {}
00288 
00289     CInstructionTest *factory()
00290     {
00291       return new CInstructionTest;
00292     }
00293 
00294     void compile(std::list<std::string>& params);
00295     void execute(CCPU *cpu);
00296 
00297   protected:
00299     unsigned m_regidx1;
00300 };
00301 
00302 /*============================================================================*/
00303 
00310 class CInstructionLabel
00311  : public CInstruction
00312 {
00313   public:
00314     CInstructionLabel()
00315       : CInstruction("label")
00316     {}
00317 
00318     CInstructionLabel *factory()
00319     {
00320       return new CInstructionLabel;
00321     }
00322 
00323     void compile(std::list<std::string>& params)
00324     {}
00325 
00326     void execute(CCPU *cpu)
00327     {}
00328 };
00329 
00330 /*============================================================================*/
00331 
00339 class CInstructionJumpA
00340  : public CInstruction
00341 {
00342   public:
00343     CInstructionJumpA()
00344       : CInstruction("jumpa"), m_addr("")
00345     {}
00346 
00347     CInstructionJumpA *factory()
00348     {
00349       return new CInstructionJumpA;
00350     }
00351 
00352     void compile(std::list<std::string>& params);
00353     void execute(CCPU *cpu);
00354 
00355   protected:
00357     std::string m_addr;
00358 };
00359 
00360 /*============================================================================*/
00361 
00369 class CInstructionJumpZ
00370  : public CInstruction
00371 {
00372   public:
00373     CInstructionJumpZ()
00374       : CInstruction("jumpz"), m_addr("")
00375     {}
00376 
00377     CInstructionJumpZ *factory()
00378     {
00379       return new CInstructionJumpZ;
00380     }
00381 
00382     void compile(std::list<std::string>& params);
00383     void execute(CCPU *cpu);
00384 
00385   protected:
00387     std::string m_addr;
00388 };
00389 
00390 /*============================================================================*/
00391 
00399 class CInstructionJumpS
00400  : public CInstruction
00401 {
00402   public:
00403     CInstructionJumpS()
00404       : CInstruction("jumps"), m_addr("")
00405     {}
00406 
00407     CInstructionJumpS *factory()
00408     {
00409       return new CInstructionJumpS;
00410     }
00411 
00412     void compile(std::list<std::string>& params);
00413     void execute(CCPU *cpu);
00414 
00415   protected:
00417     std::string m_addr;
00418 };
00419 
00420 /*============================================================================*/
00421 
00429 class CInstructionWrite
00430  : public CInstruction
00431 {
00432   public:
00433     CInstructionWrite()
00434       : CInstruction("write"), m_dev("")
00435     {}
00436 
00437     CInstructionWrite *factory()
00438     {
00439       return new CInstructionWrite;
00440     }
00441 
00442     void compile(std::list<std::string>& params);
00443     void execute(CCPU *cpu);
00444 
00445   protected:
00447     unsigned m_regidx1;
00449     std::string m_dev;
00450 };
00451 
00452 #endif
00453 
00454 /* vim: set et sw=2 ts=2: */

Generated on Thu May 14 18:19:16 2009 for mycpu by  doxygen 1.5.3