2018-08-19 01:24:10 +00:00
|
|
|
/* radare - LGPL - Copyright 2014-2018 - fedor.sakharov */
|
|
|
|
|
2014-03-12 07:42:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <r_types.h>
|
|
|
|
#include <r_lib.h>
|
|
|
|
#include <r_asm.h>
|
|
|
|
#include <cr16_disas.h>
|
|
|
|
|
2018-08-19 01:24:10 +00:00
|
|
|
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
2014-03-12 07:42:36 +00:00
|
|
|
struct cr16_cmd cmd;
|
2020-07-16 12:48:20 +00:00
|
|
|
int ret = cr16_decode_command (buf, &cmd, len);
|
2018-08-19 01:24:10 +00:00
|
|
|
r_strbuf_set (&op->buf_asm, sdb_fmt ("%s %s", cmd.instr, cmd.operands));
|
|
|
|
return op->size = ret;
|
2014-03-12 07:42:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RAsmPlugin r_asm_plugin_cr16 = {
|
|
|
|
.name = "cr16",
|
|
|
|
.license = "LGPL3",
|
|
|
|
.desc = "cr16 disassembly plugin",
|
|
|
|
.arch = "cr16",
|
|
|
|
.bits = 16,
|
2016-04-26 09:09:15 +00:00
|
|
|
.endian = R_SYS_ENDIAN_LITTLE,
|
|
|
|
.disassemble = &disassemble
|
2014-03-12 07:42:36 +00:00
|
|
|
};
|
|
|
|
|
2019-06-13 17:12:51 +00:00
|
|
|
#ifndef R2_PLUGIN_INCORE
|
2018-09-15 20:52:12 +00:00
|
|
|
R_API RLibStruct radare_plugin = {
|
2014-03-12 07:42:36 +00:00
|
|
|
.type = R_LIB_TYPE_ASM,
|
2015-07-12 14:04:10 +00:00
|
|
|
.data = &r_asm_plugin_cr16,
|
|
|
|
.version = R2_VERSION
|
2014-03-12 07:42:36 +00:00
|
|
|
};
|
|
|
|
#endif
|