| ... | ... |
@@ -27,7 +27,7 @@ Instruction::Instruction() |
| 27 | 27 |
/** |
| 28 | 28 |
* Constructor using for create an instruction with a defined opcode |
| 29 | 29 |
* |
| 30 |
- * @param opCode Opcode number |
|
| 30 |
+ * @param opcode Opcode number |
|
| 31 | 31 |
* @param arg0 First argument type |
| 32 | 32 |
* @param arg1 Second argument type |
| 33 | 33 |
* @param arg2 Third argument type |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,127 @@ |
| 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 |
+#include "instruction.h" |
|
| 13 |
+ |
|
| 14 |
+//! Default constructor for creating an empty instruction |
|
| 15 |
+Instruction::Instruction() |
|
| 16 |
+{
|
|
| 17 |
+ this->opcode = 0; |
|
| 18 |
+ |
|
| 19 |
+ this->arg0 = Arg::None; |
|
| 20 |
+ this->arg1 = Arg::None; |
|
| 21 |
+ this->arg2 = Arg::None; |
|
| 22 |
+ |
|
| 23 |
+ this->c = Flag::Any; |
|
| 24 |
+ this->z = Flag::Any; |
|
| 25 |
+} |
|
| 26 |
+ |
|
| 27 |
+/** |
|
| 28 |
+ * Constructor using for create an instruction with a defined opcode |
|
| 29 |
+ * |
|
| 30 |
+ * @param opCode Opcode number |
|
| 31 |
+ * @param arg0 First argument type |
|
| 32 |
+ * @param arg1 Second argument type |
|
| 33 |
+ * @param arg2 Third argument type |
|
| 34 |
+ * @param c Which status of the carry flag is accepted |
|
| 35 |
+ * @param z Which status of the zero flag is accepted |
|
| 36 |
+ */ |
|
| 37 |
+Instruction::Instruction(unsigned char opcode, Arg arg0, Arg arg1, Arg arg2, Flag c, Flag z) |
|
| 38 |
+{
|
|
| 39 |
+ this->opcode = opcode; |
|
| 40 |
+ |
|
| 41 |
+ this->arg0 = arg0; |
|
| 42 |
+ this->arg1 = arg1; |
|
| 43 |
+ this->arg2 = arg2; |
|
| 44 |
+ |
|
| 45 |
+ this->c = c; |
|
| 46 |
+ this->z = z; |
|
| 47 |
+} |
|
| 48 |
+ |
|
| 49 |
+/** |
|
| 50 |
+ * Add step to the step list of the instruction |
|
| 51 |
+ * |
|
| 52 |
+ * @param step Single step of the instruction |
|
| 53 |
+ */ |
|
| 54 |
+void Instruction::addStep(const Step &step) |
|
| 55 |
+{
|
|
| 56 |
+ this->stepList.append(step); |
|
| 57 |
+} |
|
| 58 |
+ |
|
| 59 |
+/** |
|
| 60 |
+ * Get an opcode number of the instruction |
|
| 61 |
+ * |
|
| 62 |
+ * @return Opcode of the instruction |
|
| 63 |
+ */ |
|
| 64 |
+unsigned char Instruction::getOpcode() const |
|
| 65 |
+{
|
|
| 66 |
+ return(this->opcode); |
|
| 67 |
+} |
|
| 68 |
+ |
|
| 69 |
+/** |
|
| 70 |
+ * Get a first argument type of the instruction |
|
| 71 |
+ * |
|
| 72 |
+ * @return Argument type |
|
| 73 |
+ */ |
|
| 74 |
+Instruction::Arg Instruction::getArg0() const |
|
| 75 |
+{
|
|
| 76 |
+ return(this->arg0); |
|
| 77 |
+} |
|
| 78 |
+ |
|
| 79 |
+/** |
|
| 80 |
+ * Get a second argument type of the instruction |
|
| 81 |
+ * |
|
| 82 |
+ * @return Argument type |
|
| 83 |
+ */ |
|
| 84 |
+Instruction::Arg Instruction::getArg1() const |
|
| 85 |
+{
|
|
| 86 |
+ return(this->arg1); |
|
| 87 |
+} |
|
| 88 |
+ |
|
| 89 |
+/** |
|
| 90 |
+ * Get a third argument type of the instruction |
|
| 91 |
+ * |
|
| 92 |
+ * @return Argument type |
|
| 93 |
+ */ |
|
| 94 |
+Instruction::Arg Instruction::getArg2() const |
|
| 95 |
+{
|
|
| 96 |
+ return(this->arg2); |
|
| 97 |
+} |
|
| 98 |
+ |
|
| 99 |
+/** |
|
| 100 |
+ * Get a status of accepting the carry flag |
|
| 101 |
+ * |
|
| 102 |
+ * @return Accepting status of the carry flag |
|
| 103 |
+ */ |
|
| 104 |
+Instruction::Flag Instruction::getC() const |
|
| 105 |
+{
|
|
| 106 |
+ return(this->c); |
|
| 107 |
+} |
|
| 108 |
+ |
|
| 109 |
+/** |
|
| 110 |
+ * Get a status of accepting the zero flag |
|
| 111 |
+ * |
|
| 112 |
+ * @return Accepting status of the zero flag |
|
| 113 |
+ */ |
|
| 114 |
+Instruction::Flag Instruction::getZ() const |
|
| 115 |
+{
|
|
| 116 |
+ return(this->z); |
|
| 117 |
+} |
|
| 118 |
+ |
|
| 119 |
+/** |
|
| 120 |
+ * Get a step list of the instruction |
|
| 121 |
+ * |
|
| 122 |
+ * @return Step list of the instruction |
|
| 123 |
+ */ |
|
| 124 |
+const QList<Step> &Instruction::getStepList() const |
|
| 125 |
+{
|
|
| 126 |
+ return(this->stepList); |
|
| 127 |
+} |