| ... | ... |
@@ -23,7 +23,7 @@ class Instruction |
| 23 | 23 |
//! Definitions of the instruction argument types |
| 24 | 24 |
enum class Arg |
| 25 | 25 |
{
|
| 26 |
- None, //!< Not argument |
|
| 26 |
+ None, //!< No argument |
|
| 27 | 27 |
ABXY, //!< Main and auxiliary registers |
| 28 | 28 |
AB, //!< Only main registers |
| 29 | 29 |
Val256, //!< 8 bit unsigned value |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,70 @@ |
| 1 |
+/* |
|
| 2 |
+ * Author: Pawel Jablonski |
|
| 3 |
+ * E-mail: pj@xirx.net |
|
| 4 |
+ * WWW: xirx.net |
|
| 5 |
+ * GIT: git.xirx.net |
|
| 6 |
+ * |
|
| 7 |
+ * License: You can use this code however you like |
|
| 8 |
+ * but leave information about the original author. |
|
| 9 |
+ * Code is free for non-commercial and commercial use. |
|
| 10 |
+ */ |
|
| 11 |
+ |
|
| 12 |
+#ifndef INSTRUCTION_H |
|
| 13 |
+#define INSTRUCTION_H |
|
| 14 |
+ |
|
| 15 |
+#include <QList> |
|
| 16 |
+ |
|
| 17 |
+#include "step.h" |
|
| 18 |
+ |
|
| 19 |
+//! This class contains atomic steps for the control unit of defined instruction |
|
| 20 |
+class Instruction |
|
| 21 |
+{
|
|
| 22 |
+ public: |
|
| 23 |
+ //! Definitions of the instruction argument types |
|
| 24 |
+ enum class Arg |
|
| 25 |
+ {
|
|
| 26 |
+ None, //!< Not argument |
|
| 27 |
+ ABXY, //!< Main and auxiliary registers |
|
| 28 |
+ AB, //!< Only main registers |
|
| 29 |
+ Val256, //!< 8 bit unsigned value |
|
| 30 |
+ Addr //!< 16 bit unsigned address |
|
| 31 |
+ }; |
|
| 32 |
+ |
|
| 33 |
+ //! Tristate flag definition for carry and zero control bits |
|
| 34 |
+ enum class Flag |
|
| 35 |
+ {
|
|
| 36 |
+ Disable, //!< Only accept the disable value |
|
| 37 |
+ Enable, //!< Only accept the enable value |
|
| 38 |
+ Any //!< Accept both values |
|
| 39 |
+ }; |
|
| 40 |
+ |
|
| 41 |
+ Instruction(); |
|
| 42 |
+ Instruction(unsigned char opcode, Arg arg0 = Arg::None, Arg arg1 = Arg::None, Arg arg2 = Arg::None, Flag c = Flag::Any, Flag z = Flag::Any); |
|
| 43 |
+ |
|
| 44 |
+ void addStep(const Step &step); |
|
| 45 |
+ |
|
| 46 |
+ unsigned char getOpcode() const; |
|
| 47 |
+ |
|
| 48 |
+ Arg getArg0() const; |
|
| 49 |
+ Arg getArg1() const; |
|
| 50 |
+ Arg getArg2() const; |
|
| 51 |
+ |
|
| 52 |
+ Flag getC() const; |
|
| 53 |
+ Flag getZ() const; |
|
| 54 |
+ |
|
| 55 |
+ const QList<Step> &getStepList() const; |
|
| 56 |
+ |
|
| 57 |
+ private: |
|
| 58 |
+ unsigned char opcode; //!< Opcode of defined instruction |
|
| 59 |
+ |
|
| 60 |
+ Arg arg0; //!< First argument type |
|
| 61 |
+ Arg arg1; //!< Second argument type |
|
| 62 |
+ Arg arg2; //!< Third argument type |
|
| 63 |
+ |
|
| 64 |
+ Flag c; //!< Carry flag accept status |
|
| 65 |
+ Flag z; //!< Zero flag accept status |
|
| 66 |
+ |
|
| 67 |
+ QList<Step> stepList; //!< Atomic list of steps for the control unit |
|
| 68 |
+}; |
|
| 69 |
+ |
|
| 70 |
+#endif |