26 static char *
fsr[] = {
"fsr0",
"fsr1",
"fsr2",
"reserved" };
35 { 0xf000, 0xffff,
"nop",
NO_ARG },
36 { 0xef00, 0xefff,
"goto",
GOTO_T },
37 { 0xee00, 0xee3f,
"lfsr",
LFSR_T },
38 { 0xec00, 0xedff,
"call",
CALL_T },
39 { 0xe700, 0xe7ff,
"bnn",
N_T },
40 { 0xe600, 0xe6ff,
"bn",
N_T },
41 { 0xe500, 0xe5ff,
"bnov",
N_T },
42 { 0xe400, 0xe4ff,
"bov",
N_T },
43 { 0xe300, 0xe3ff,
"bnc",
N_T },
44 { 0xe200, 0xe2ff,
"bc",
N_T },
45 { 0xe100, 0xe1ff,
"bnz",
N_T },
46 { 0xe000, 0xe0ff,
"bz",
N_T },
47 { 0xd800, 0xdfff,
"rcall",
NEX_T },
48 { 0xd000, 0xd7ff,
"bra",
NEX_T },
49 { 0xc000, 0xcfff,
"movff",
F32_T },
50 { 0xb000, 0xbfff,
"btfsc",
BAF_T },
51 { 0xa000, 0xafff,
"btfss",
BAF_T },
52 { 0x9000, 0x9fff,
"bcf",
BAF_T },
53 { 0x8000, 0x8fff,
"bsf",
BAF_T },
54 { 0x7000, 0x7fff,
"btg",
BAF_T },
55 { 0x6e00, 0x6fff,
"movwf",
AF_T },
56 { 0x6c00, 0x6dff,
"negf",
AF_T },
57 { 0x6a00, 0x6bff,
"clrf",
AF_T },
58 { 0x6800, 0x69ff,
"setf",
AF_T },
59 { 0x6600, 0x67ff,
"tstfsz",
AF_T },
60 { 0x6400, 0x65ff,
"cpfsgt",
AF_T },
61 { 0x6200, 0x63ff,
"cpfseq",
AF_T },
62 { 0x6000, 0x61ff,
"cpfslt",
AF_T },
63 { 0x5c00, 0x5fff,
"subwf",
DAF_T },
64 { 0x5800, 0x5bff,
"subwfb",
DAF_T },
65 { 0x5400, 0x57ff,
"subfwb",
DAF_T },
66 { 0x5000, 0x53ff,
"movf",
DAF_T },
67 { 0x4c00, 0x4fff,
"dcfsnz",
DAF_T },
68 { 0x4800, 0x4bff,
"infsnz",
DAF_T },
69 { 0x4400, 0x47ff,
"rlncf",
DAF_T },
70 { 0x4000, 0x43ff,
"rrncf",
DAF_T },
71 { 0x3c00, 0x3fff,
"incfsz",
DAF_T },
72 { 0x3800, 0x3bff,
"swapf",
DAF_T },
73 { 0x3400, 0x37ff,
"rlcf",
DAF_T },
74 { 0x3000, 0x33ff,
"rrcf",
DAF_T },
75 { 0x2c00, 0x2fff,
"decfsz",
DAF_T },
76 { 0x2800, 0x2bff,
"incf",
DAF_T },
77 { 0x2400, 0x27ff,
"addwf",
DAF_T },
78 { 0x2000, 0x23ff,
"addwfc",
DAF_T },
79 { 0x1c00, 0x1fff,
"comf",
DAF_T },
80 { 0x1800, 0x1bff,
"xorwf",
DAF_T },
81 { 0x1400, 0x17ff,
"andwf",
DAF_T },
82 { 0x1000, 0x13ff,
"iorwf",
DAF_T },
83 { 0xf00, 0xfff,
"addlw",
K_T },
84 { 0xe00, 0xeff,
"movlw",
K_T },
85 { 0xd00, 0xdff,
"mullw",
K_T },
86 { 0xc00, 0xcff,
"retlw",
K_T },
87 { 0xb00, 0xbff,
"andlw",
K_T },
88 { 0xa00, 0xaff,
"xorlw",
K_T },
89 { 0x900, 0x9ff,
"iorlw",
K_T },
90 { 0x800, 0x8ff,
"sublw",
K_T },
91 { 0x400, 0x7ff,
"decf",
DAF_T },
92 { 0x200, 0x3ff,
"mulwf",
AF_T },
93 { 0x100, 0x10f,
"movlb",
SHK_T },
94 { 0xff, 0xff,
"reset",
NO_ARG },
95 { 0x12, 0x13,
"return",
S_T },
96 { 0x10, 0x11,
"retfie",
S_T },
97 { 0xf, 0xf,
"tblwt+*",
NO_ARG },
98 { 0xe, 0xe,
"tblwt*-",
NO_ARG },
99 { 0xd, 0xd,
"tblwt*+",
NO_ARG },
100 { 0xc, 0xc,
"tblwt*",
NO_ARG },
101 { 0xb, 0xb,
"tblrd+*",
NO_ARG },
102 { 0xa, 0xa,
"tblrd*-",
NO_ARG },
103 { 0x9, 0x9,
"tblrd*+",
NO_ARG },
104 { 0x8, 0x8,
"tblrd*",
NO_ARG },
105 { 0x7, 0x7,
"daw",
NO_ARG },
106 { 0x6, 0x6,
"pop",
NO_ARG },
107 { 0x5, 0x5,
"push",
NO_ARG },
108 { 0x4, 0x4,
"clrwdt",
NO_ARG },
109 { 0x3, 0x3,
"sleep",
NO_ARG },
110 { 0x0, 0x0,
"nop",
NO_ARG },
111 { 0x0, 0xffff,
"invalid",
NO_ARG },
117 strcpy(opbuf,
"invalid");
123 const char *buf_asm =
"invalid";
124 strcpy(opbuf, buf_asm);
137 buf_asm =
ops[
i].name;
144 buf_asm =
sdb_fmt(
"%s 0x%x, %d, %d",
ops[
i].
name, instr & 0xff, (instr >> 9) & 1, (instr >> 8) & 1);
147 buf_asm =
sdb_fmt(
"%s 0x%x, %d",
ops[
i].
name, instr & 0xff, (instr >> 8) & 1);
150 buf_asm =
sdb_fmt(
"%s 0x%x, %d, %d",
ops[
i].
name, instr & 0xff, (instr >> 9) & 0x7, (instr >> 8) & 0x1);
164 if (dword_instr >> 28 != 0xf) {
168 (dword_instr & 0xff) | (dword_instr >> 8 & 0xfff00), (dword_instr >> 8) & 0x1);
178 if (dword_instr >> 28 != 0xf) {
182 ((dword_instr & 0xff) | ((dword_instr & 0xfff0000) >> 8)) * 2);
192 if (dword_instr >> 28 != 0xf) {
196 dword_instr & 0xfff, (dword_instr >> 16) & 0xfff);
211 if (dword_instr >> 28 != 0xf) {
214 ut8 reg_n = (dword_instr >> 4) & 0x3;
216 (dword_instr & 0xf) << 8 | ((dword_instr >> 16) & 0xff));
220 buf_asm =
"unknown args";
222 strcpy(opbuf, buf_asm);
RZ_API char * sdb_fmt(const char *fmt,...)
int pic_pic18_disassemble(RzAsmOp *op, char *opbuf, const ut8 *b, int blen)
static ut16 rz_read_le16(const void *src)
static ut32 rz_read_le32(const void *src)