1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
|