6 #include <capstone/capstone.h>
8 #if CS_API_MAJOR >= 4 && CS_API_MINOR >= 0
9 #define CAPSTONE_HAS_M680X 1
11 #define CAPSTONE_HAS_M680X 0
14 #if CAPSTONE_HAS_M680X
18 static int m680xmode(
const char *
str) {
23 if (strstr(
str,
"6800")) {
26 if (strstr(
str,
"6801")) {
28 }
else if (strstr(
str,
"6805")) {
30 }
else if (strstr(
str,
"6808")) {
32 }
else if (strstr(
str,
"6809")) {
34 }
else if (strstr(
str,
"6811")) {
36 }
else if (strstr(
str,
"cpu12")) {
38 }
else if (strstr(
str,
"6301")) {
41 if (strstr(
str,
"6309")) {
44 if (strstr(
str,
"hcs08")) {
63 mode = m680xmode(
a->cpu);
80 op->size = insn->size;
81 char *buf_asm =
sdb_fmt(
"%s%s%s",
82 insn->mnemonic, insn->op_str[0] ?
" " :
"",
84 char *ptrstr = strstr(buf_asm,
"ptr ");
86 memmove(ptrstr, ptrstr + 4, strlen(ptrstr + 4) + 1);
97 .cpus =
"6800,6801,6805,6808,6809,6811,cpu12,6301,6309,hcs08",
98 .desc =
"Capstone M680X Disassembler",
110 .desc =
"Capstone M680X Disassembler (Not supported)",
117 #ifndef RZ_PLUGIN_INCORE
RZ_API void rz_asm_op_set_asm(RzAsmOp *op, const char *str)
static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
RZ_API RzLibStruct rizin_plugin
RzAsmPlugin rz_asm_plugin_m680x_cs
static bool the_end(void *p)
@ CS_ARCH_M680X
680X architecture
@ CS_MODE_M680X_6811
M680X Motorola/Freescale/NXP 68HC11 mode.
@ CS_MODE_M680X_6805
M680X Motorola/Freescale 6805 mode.
@ CS_MODE_M680X_HCS08
M680X Freescale/NXP HCS08 mode.
@ CS_MODE_M680X_6309
M680X Hitachi 6309 mode.
@ CS_MODE_M680X_CPU12
used on M68HC12/HCS12
@ CS_MODE_M680X_6301
M680X Hitachi 6301,6303 mode.
@ CS_MODE_M680X_6801
M680X Motorola 6801,6803 mode.
@ CS_MODE_M680X_6800
M680X Motorola 6800,6802 mode.
@ CS_MODE_M680X_6808
M680X Motorola/Freescale/NXP 68HC08 mode.
@ CS_MODE_M680X_6809
M680X Motorola 6809 mode.
@ CS_OPT_DETAIL
Break down instruction structure into details.
@ CS_OPT_OFF
Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED.
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
RZ_API char * sdb_fmt(const char *fmt,...)
#define RZ_SYS_ENDIAN_LITTLE
ut64(WINAPI *w32_GetEnabledXStateFeatures)()