| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,92 @@ |
| 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 |
+/** |
|
| 15 |
+ * Constructor using for create an instruction with a defined opcode |
|
| 16 |
+ * |
|
| 17 |
+ * @param name Name of the instruction |
|
| 18 |
+ * @param opcode Opcode number |
|
| 19 |
+ * @param arg0 First argument type |
|
| 20 |
+ * @param arg1 Second argument type |
|
| 21 |
+ * @param arg2 Third argument type |
|
| 22 |
+ * @param opcodeSecond Second optional opcode number |
|
| 23 |
+ * @param arg0Second First argument type of the second optional opcode |
|
| 24 |
+ * @param arg1Second Second argument type of the second optional opcode |
|
| 25 |
+ * @param arg2Second Third argument type of the second optional opcode |
|
| 26 |
+ */ |
|
| 27 |
+Instruction::Instruction(const QString &name, unsigned char opcode, Instruction::Arg arg0, Instruction::Arg arg1, Instruction::Arg arg2, unsigned char opcodeSecond, Arg arg0Second, Arg arg1Second, Arg arg2Second) |
|
| 28 |
+{
|
|
| 29 |
+ this->name = name; |
|
| 30 |
+ this->opcode = opcode; |
|
| 31 |
+ |
|
| 32 |
+ this->argList.append(arg0); |
|
| 33 |
+ this->argList.append(arg1); |
|
| 34 |
+ this->argList.append(arg2); |
|
| 35 |
+ |
|
| 36 |
+ this->opcodeSecond = opcodeSecond; |
|
| 37 |
+ |
|
| 38 |
+ this->argSecondList.append(arg0Second); |
|
| 39 |
+ this->argSecondList.append(arg1Second); |
|
| 40 |
+ this->argSecondList.append(arg2Second); |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+/** |
|
| 44 |
+ * Get the name of the instruction |
|
| 45 |
+ * |
|
| 46 |
+ * @return Name of the instruction |
|
| 47 |
+ */ |
|
| 48 |
+const QString &Instruction::getName() const |
|
| 49 |
+{
|
|
| 50 |
+ return(this->name); |
|
| 51 |
+} |
|
| 52 |
+ |
|
| 53 |
+/** |
|
| 54 |
+ * Get the opcode number of the instruction |
|
| 55 |
+ * |
|
| 56 |
+ * @return Opcode of the instruction |
|
| 57 |
+ */ |
|
| 58 |
+unsigned char Instruction::getOpcode() const |
|
| 59 |
+{
|
|
| 60 |
+ return(this->opcode); |
|
| 61 |
+} |
|
| 62 |
+ |
|
| 63 |
+/** |
|
| 64 |
+ * Get the argument type list of the instruction |
|
| 65 |
+ * |
|
| 66 |
+ * @return Argument type list |
|
| 67 |
+ */ |
|
| 68 |
+const QList<Instruction::Arg> &Instruction::getArgList() const |
|
| 69 |
+{
|
|
| 70 |
+ return(this->argList); |
|
| 71 |
+} |
|
| 72 |
+ |
|
| 73 |
+/** |
|
| 74 |
+ * Get the second optional opcode number of the instruction |
|
| 75 |
+ * |
|
| 76 |
+ * @return Second optional opcode of the instruction |
|
| 77 |
+ */ |
|
| 78 |
+unsigned char Instruction::getOpcodeSecond() const |
|
| 79 |
+{
|
|
| 80 |
+ return(this->opcodeSecond); |
|
| 81 |
+} |
|
| 82 |
+ |
|
| 83 |
+/** |
|
| 84 |
+ * Get the second optional argument type list of the instruction |
|
| 85 |
+ * |
|
| 86 |
+ * @return Second optional argument type list |
|
| 87 |
+ */ |
|
| 88 |
+const QList<Instruction::Arg> &Instruction::getArgSecondList() const |
|
| 89 |
+{
|
|
| 90 |
+ return(this->argSecondList); |
|
| 91 |
+} |
|
| 92 |
+ |