summaryrefslogtreecommitdiff
path: root/mnemonics.h
diff options
context:
space:
mode:
Diffstat (limited to 'mnemonics.h')
-rw-r--r--mnemonics.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/mnemonics.h b/mnemonics.h
new file mode 100644
index 0000000..969926e
--- /dev/null
+++ b/mnemonics.h
@@ -0,0 +1,64 @@
+#ifndef NQ_MNEMONICS_H
+#define NQ_MNEMONICS_H
+
+#include <stdint.h>
+
+/* operand types */
+#define REG 1
+#define REGPTR 2
+#define IMM 3
+#define PCOFF 4
+
+enum {
+ MNEM_ADD,
+ MNEM_SUB,
+ MNEM_MUL,
+ MNEM_DIV,
+ MNEM_AND,
+ MNEM_OR,
+ MNEM_XOR,
+ MNEM_LSL,
+ MNEM_LSR,
+ MNEM_ASL,
+ MNEM_ASR,
+ MNEM_ROL,
+ MNEM_ROR,
+ MNEM_NOT,
+ MNEM_NEG,
+ MNEM_BTC,
+ MNEM_BTS,
+ MNEM_MOV,
+ MNEM_ST_B,
+ MNEM_ST_W,
+ MNEM_LD_BL,
+ MNEM_LD_BH,
+ MNEM_LD_W,
+ MNEM_LDI_BL,
+ MNEM_LDI_BH,
+ MNEM_BEQ,
+ MNEM_BNE,
+ MNEM_BGT,
+ MNEM_BGE,
+ MNEM_BLT,
+ MNEM_BLE,
+ MNEM_BRA,
+ MNEM_JMP,
+ MNEM_ADDPC,
+ MNEM_NOP,
+};
+
+struct operand {
+ uint8_t type;
+ uint8_t shift;
+};
+
+struct mnemonic {
+ const char *mnem;
+ uint16_t bits;
+ struct operand operands[3];
+};
+
+extern const struct mnemonic mnemonics[];
+
+#endif
+