Rizin
unix-like reverse engineering framework and cli tools
asm_cr16.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2014-2018 fedor.sakharov <fedor.sakharov@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <stdio.h>
5 #include <string.h>
6 #include <rz_types.h>
7 #include <rz_lib.h>
8 #include <rz_asm.h>
9 #include <cr16_disas.h>
10 
11 static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
12  struct cr16_cmd cmd;
13  int ret = cr16_decode_command(buf, &cmd, len);
14  rz_strbuf_set(&op->buf_asm, sdb_fmt("%s %s", cmd.instr, cmd.operands));
15  return op->size = ret;
16 }
17 
19  .name = "cr16",
20  .license = "LGPL3",
21  .desc = "cr16 disassembly plugin",
22  .arch = "cr16",
23  .bits = 16,
24  .endian = RZ_SYS_ENDIAN_LITTLE,
25  .disassemble = &disassemble
26 };
27 
28 #ifndef RZ_PLUGIN_INCORE
31  .data = &rz_asm_plugin_cr16,
33 };
34 #endif
size_t len
Definition: 6502dis.c:15
RZ_API RzLibStruct rizin_plugin
Definition: asm_cr16.c:29
RzAsmPlugin rz_asm_plugin_cr16
Definition: asm_cr16.c:18
static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_cr16.c:11
#define RZ_API
int cr16_decode_command(const ut8 *instr, struct cr16_cmd *cmd, int len)
Definition: cr16_disas.c:1184
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 cmd
Definition: sflib.h:79
RZ_API char * sdb_fmt(const char *fmt,...)
Definition: fmt.c:26
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
Definition: strbuf.c:153
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
const char * name
Definition: rz_asm.h:130
const char * version
Definition: rz_asm.h:133
Definition: dis.c:32