Rizin
unix-like reverse engineering framework and cli tools
asm_lh5801.c File Reference
#include "../../arch/lh5801/lh5801.c"
#include <rz_asm.h>
#include <rz_types.h>
#include <rz_lib.h>

Go to the source code of this file.

Functions

static int disassemble (RzAsm *as, RzAsmOp *op, const ut8 *buf, int len)
 

Variables

RzAsmPlugin rz_asm_plugin_lh5801
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ disassemble()

static int disassemble ( RzAsm as,
RzAsmOp op,
const ut8 buf,
int  len 
)
static

Definition at line 9 of file asm_lh5801.c.

9  {
10  struct lh5801_insn insn = { 0 };
11  if (!op) {
12  return 0;
13  }
14  int consumed = lh5801_decode(&insn, buf, len);
15  if (consumed == -1 || consumed == 0) {
16  rz_strbuf_set(&op->buf_asm, "invalid");
17  op->size = 1;
18  return 0;
19  }
20  char buf_asm[128] = { 0 };
21  lh5801_print_insn(buf_asm, sizeof(buf_asm), &insn);
22  rz_strbuf_set(&op->buf_asm, buf_asm);
23  op->size = consumed;
24  // op->payload = lh5801_insn_descs[insn.type].format & 3;
25  // ^ MAYBE?
26  return op->size;
27 }
size_t len
Definition: 6502dis.c:15
voidpf void * buf
Definition: ioapi.h:138
void lh5801_print_insn(char *out, int size, const struct lh5801_insn *insn)
Definition: lh5801.c:792
int lh5801_decode(struct lh5801_insn *insn, const ut8 *buf, int len)
Definition: lh5801.c:674
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
Definition: strbuf.c:153
Definition: dis.c:32

References len, lh5801_decode(), lh5801_print_insn(), and rz_strbuf_set().

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_lh5801
Definition: asm_lh5801.c:29
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define RZ_VERSION
Definition: rz_version.h:8
const char * version
Definition: rz_asm.h:133

Definition at line 40 of file asm_lh5801.c.

◆ rz_asm_plugin_lh5801

RzAsmPlugin rz_asm_plugin_lh5801
Initial value:
= {
.name = "lh5801",
.arch = "LH5801",
.license = "LGPL3",
.bits = 8,
.endian = RZ_SYS_ENDIAN_NONE,
.desc = "SHARP LH5801 disassembler",
.disassemble = &disassemble
}
static int disassemble(RzAsm *as, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_lh5801.c:9
#define RZ_SYS_ENDIAN_NONE
Definition: rz_types.h:525

Definition at line 29 of file asm_lh5801.c.