From 239ee7648658b77b217f5c8142ef887612516af4 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Tue, 10 Jan 2017 18:10:52 -0600 Subject: Add table of instructions and their encodings --- mnemonics.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 mnemonics.h (limited to 'mnemonics.h') 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 + +/* 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 + -- cgit v1.2.3