4 #ifdef CAPSTONE_HAS_M680X
8 #include <capstone/platform.h>
10 #include "../../cs_priv.h"
11 #include "../../MCInst.h"
12 #include "../../SStream.h"
13 #include "../../MCRegisterInfo.h"
14 #include "../../utils.h"
21 "<invalid>",
"a",
"b",
"e",
"f",
"0",
"d",
"w",
"cc",
"dp",
"md",
22 "hx",
"h",
"x",
"y",
"s",
"u",
"v",
"q",
"pc",
"tmp2",
"tmp3",
26 "invld",
"aba",
"abx",
"aby",
"adc",
"adca",
"adcb",
"adcd",
"adcr",
27 "add",
"adda",
"addb",
"addd",
"adde",
"addf",
"addr",
"addw",
28 "aim",
"ais",
"aix",
"and",
"anda",
"andb",
"andcc",
"andd",
"andr",
29 "asl",
"asla",
"aslb",
"asld",
30 "asr",
"asra",
"asrb",
"asrd",
"asrx",
32 "bcc",
"bclr",
"bcs",
"beor",
"beq",
"bge",
"bgnd",
"bgt",
"bhcc",
34 "biand",
"bieor",
"bih",
"bil",
35 "bior",
"bit",
"bita",
"bitb",
"bitd",
"bitmd",
"ble",
"bls",
"blt",
38 "bne",
"bor",
"bpl",
"brclr",
"brset",
"bra",
"brn",
"bset",
"bsr",
40 "call",
"cba",
"cbeq",
"cbeqa",
"cbeqx",
"clc",
"cli",
41 "clr",
"clra",
"clrb",
"clrd",
"clre",
"clrf",
"clrh",
"clrw",
"clrx",
43 "cmpa",
"cmpb",
"cmpd",
"cmpe",
"cmpf",
"cmpr",
"cmps",
"cmpu",
"cmpw",
45 "com",
"coma",
"comb",
"comd",
"come",
"comf",
"comw",
"comx",
"cpd",
46 "cphx",
"cps",
"cpx",
"cpy",
47 "cwai",
"daa",
"dbeq",
"dbne",
"dbnz",
"dbnza",
"dbnzx",
48 "dec",
"deca",
"decb",
"decd",
"dece",
"decf",
"decw",
49 "decx",
"des",
"dex",
"dey",
50 "div",
"divd",
"divq",
"ediv",
"edivs",
"eim",
"emacs",
"emaxd",
51 "emaxm",
"emind",
"eminm",
"emul",
"emuls",
52 "eor",
"eora",
"eorb",
"eord",
"eorr",
"etbl",
53 "exg",
"fdiv",
"ibeq",
"ibne",
"idiv",
"idivs",
"illgl",
54 "inc",
"inca",
"incb",
"incd",
"ince",
"incf",
"incw",
"incx",
57 "lbcc",
"lbcs",
"lbeq",
"lbge",
"lbgt",
"lbhi",
"lble",
"lbls",
"lblt",
58 "lbmi",
"lbne",
"lbpl",
"lbra",
"lbrn",
"lbsr",
"lbvc",
"lbvs",
59 "lda",
"ldaa",
"ldab",
"ldb",
"ldbt",
"ldd",
"lde",
"ldf",
"ldhx",
61 "ldq",
"lds",
"ldu",
"ldw",
"ldx",
"ldy",
62 "leas",
"leau",
"leax",
"leay",
63 "lsl",
"lsla",
"lslb",
"lsld",
"lslx",
64 "lsr",
"lsra",
"lsrb",
"lsrd",
"lsrw",
"lsrx",
65 "maxa",
"maxm",
"mem",
"mina",
"minm",
"mov",
"movb",
"movw",
"mul",
67 "neg",
"nega",
"negb",
"negd",
"negx",
68 "nop",
"nsa",
"oim",
"ora",
"oraa",
"orab",
"orb",
"orcc",
"ord",
"orr",
69 "psha",
"pshb",
"pshc",
"pshd",
"pshh",
"pshs",
"pshsw",
"pshu",
70 "pshuw",
"pshx",
"pshy",
71 "pula",
"pulb",
"pulc",
"puld",
"pulh",
"puls",
"pulsw",
"pulu",
72 "puluw",
"pulx",
"puly",
"rev",
"revw",
73 "rol",
"rola",
"rolb",
"rold",
"rolw",
"rolx",
74 "ror",
"rora",
"rorb",
"rord",
"rorw",
"rorx",
75 "rsp",
"rtc",
"rti",
"rts",
"sba",
"sbc",
"sbca",
"sbcb",
"sbcd",
77 "sec",
"sei",
"sev",
"sex",
"sexw",
"slp",
"sta",
"staa",
"stab",
"stb",
78 "stbt",
"std",
"ste",
"stf",
"stop",
"sthx",
79 "stq",
"sts",
"stu",
"stw",
"stx",
"sty",
80 "sub",
"suba",
"subb",
"subd",
"sube",
"subf",
"subr",
"subw",
81 "swi",
"swi2",
"swi3",
82 "sync",
"tab",
"tap",
"tax",
"tba",
"tbeq",
"tbl",
"tbne",
"test",
85 "tst",
"tsta",
"tstb",
"tstd",
"tste",
"tstf",
"tstw",
"tstx",
86 "tsx",
"tsy",
"txa",
"txs",
"tys",
"wai",
"wait",
"wav",
"wavr",
104 #ifndef CAPSTONE_DIET
112 #ifndef CAPSTONE_DIET
135 static const char s_inc_dec[][3] = {
"--",
"-",
"",
"+",
"++" };
137 if (!
op->idx.inc_dec)
142 const char *prePostfix =
"";
145 prePostfix = (
op->idx.inc_dec < 0) ?
"-" :
"+";
146 else if (
op->idx.inc_dec >= -2 && (
op->idx.inc_dec <= 2)) {
147 prePostfix = (
char *)s_inc_dec[
op->idx.inc_dec + 2];
159 printRegName(MI->
csh,
O,
op->reg);
169 get_unsigned(
op->imm,
op->size));
180 printRegName(MI->
csh,
O,
op->idx.offset_reg);
181 else if (
op->idx.offset_bits > 0) {
187 else if (
op->idx.inc_dec != 0 &&
194 printIncDec(
false,
O,
info,
op);
196 printRegName(MI->
csh,
O,
op->idx.base_reg);
199 (
op->idx.offset_bits > 0))
202 printIncDec(
true,
O,
info,
op);
218 if (
op->ext.indirect)
221 if (
op->ext.address < 256) {
264 int suppress_operands = 0;
265 const char *delimiter = getDelimiter(
info, m680x);
280 printInstructionName(MI->
csh,
O,
info->insn);
290 if (
i >= suppress_operands) {
301 #ifndef CAPSTONE_DIET
314 #ifndef CAPSTONE_DIET
328 #ifndef CAPSTONE_DIET
337 #ifndef CAPSTONE_DIET
cs_err M680X_instprinter_init(cs_struct *ud)
const char * M680X_reg_name(csh handle, unsigned int reg)
const char * M680X_insn_name(csh handle, unsigned int id)
const char * M680X_group_name(csh handle, unsigned int id)
void M680X_printInst(MCInst *MI, struct SStream *O, void *Info)
static const char * s_instruction_names[]
static const char * s_reg_names[]
void SStream_concat(SStream *ss, const char *fmt,...)
static mcore_handle handle
RzBinInfo * info(RzBinFile *bf)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
#define M680X_IDX_INDIRECT
#define M680X_IDX_NO_COMMA
#define M680X_FIRST_OP_IN_MNEM
@ M680X_REG_ENDING
<– mark the end of the list of registers
@ M680X_REG_PC
M6800/1/2/3/9, M6301/9.
#define M680X_IDX_POST_INC_DEC
@ M680X_OP_EXTENDED
= Extended addressing operand.
@ M680X_OP_INDEXED
= Indexed addressing operand.
@ M680X_OP_CONSTANT
Used e.g. for a bit index or page number.
@ M680X_OP_IMMEDIATE
= Immediate operand.
@ M680X_OP_REGISTER
= Register operand.
@ M680X_OP_RELATIVE
= Relative addressing operand.
@ M680X_OP_DIRECT
= Direct addressing operand.
#define M680X_SECOND_OP_IN_MNEM
@ M680X_GRP_PRIV
= CS_GRP_PRIVILEDGE; not used
@ M680X_GRP_BRAREL
= CS_GRP_BRANCH_RELATIVE
@ M680X_GRP_IRET
= CS_GRP_IRET
@ M680X_GRP_RET
= CS_GRP_RET
@ M680X_GRP_INT
= CS_GRP_INT
@ M680X_GRP_JUMP
= CS_GRP_INVALID
@ M680X_GRP_CALL
= CS_GRP_CALL
int32_t imm
immediate value for IMM operand
The M680X instruction and it's operands.
uint8_t flags
See: M680X instruction flags.
cs_m680x_op operands[M680X_OPERAND_COUNT]
operands for this insn.
uint8_t op_count
number of operands for the instruction or 0
cs_opt_value imm_unsigned
const char * id2name(const name_map *map, int max, const unsigned int id)