summaryrefslogtreecommitdiff
path: root/mnemonics.c
diff options
context:
space:
mode:
Diffstat (limited to 'mnemonics.c')
-rw-r--r--mnemonics.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/mnemonics.c b/mnemonics.c
new file mode 100644
index 0000000..4a21992
--- /dev/null
+++ b/mnemonics.c
@@ -0,0 +1,40 @@
+#include "mnemonics.h"
+
+const struct mnemonic mnemonics[] = {
+ { "add", 0x0000, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* add */
+ { "sub", 0x0001, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* subtract */
+ { "mul", 0x0002, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* multiply */
+ { "div", 0x0003, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* divide */
+ { "and", 0x0100, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* bitwise and */
+ { "or", 0x0101, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* bitwise or */
+ { "xor", 0x0102, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* bitwise exclusive or */
+ { "lsl", 0x1000, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* logical shift left */
+ { "lsr", 0x1100, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* logical shift right */
+ { "asl", 0x1002, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* arithmetic shift left (fills with lsb) */
+ { "asr", 0x1102, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* arithmetic shift right (fills with msb) */
+ { "rol", 0x1003, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* rotate left */
+ { "ror", 0x1103, { {REG, 9}, {REG, 5}, {REG, 2} } }, /* rotate right */
+ { "not", 0x2000, { {REG, 9}, {REG, 2} } }, /* bitwise inverse */
+ { "neg", 0x2100, { {REG, 9}, {REG, 2} } }, /* negate */
+ { "btc", 0x3000, { {REG, 9}, {REG, 2} } }, /* bit clear */
+ { "bts", 0x3100, { {REG, 9}, {REG, 2} } }, /* bit set */
+ { "mov", 0x4004, { {REG, 9}, {REG, 5} } }, /* register move */
+ { "st.b", 0x4100, { {REGPTR, 9}, {REG, 5} } }, /* store byte */
+ { "st.w", 0x4104, { {REGPTR, 9}, {REG, 5} } }, /* store word */
+ { "ld.bl", 0x4101, { {REG, 9}, {REGPTR, 5} } }, /* load byte into low byte of register */
+ { "ld.bh", 0x4111, { {REG, 9}, {REGPTR, 5} } }, /* load byte into high byte of register */
+ { "ld.w", 0x4105, { {REG, 9}, {REGPTR, 5} } }, /* load word */
+ { "ldi.bl", 0x5000, { {REG, 9}, {IMM, 0} } }, /* load immediate into low byte of register */
+ { "ldi.bh", 0x5100, { {REG, 9}, {IMM, 0} } }, /* load immediate into high byte of register */
+ { "beq", 0x6000, { {PCOFF, 0}, } }, /* branch if equal */
+ { "bne", 0x6200, { {PCOFF, 0}, } }, /* branch if not equal */
+ { "bgt", 0x6400, { {PCOFF, 0}, } }, /* branch if greater than */
+ { "bge", 0x6600, { {PCOFF, 0}, } }, /* branch if greater than or equal */
+ { "blt", 0x6800, { {PCOFF, 0}, } }, /* branch if less than */
+ { "ble", 0x6a00, { {PCOFF, 0}, } }, /* branch if less than or equal */
+ { "bra", 0x6e00, { {PCOFF, 0}, } }, /* branch always */
+ { "jmp", 0x7000, { {REGPTR, 5}, } }, /* branch always */
+ { "addpc", 0x8000, { {REG, 9}, {IMM, 0} } }, /* add program counter and immediate */
+ { "nop", 0xffff, { } }, /* no operation */
+};
+