Rizin
unix-like reverse engineering framework and cli tools
asm_z80.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012-2018 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_types.h>
5 #include <rz_util.h>
6 #include <rz_lib.h>
7 #include <rz_asm.h>
8 
9 #include "../arch/z80/z80.c"
10 #include "../arch/z80/z80asm.c"
11 
12 static int do_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
13  return op->size = z80Disass(op, buf, len);
14 }
15 
16 static int do_assemble(RzAsm *a, RzAsmOp *op, const char *buf) {
17  return op->size = z80asm((ut8 *)rz_strbuf_get(&op->buf), buf);
18 }
19 
21  .name = "z80",
22  .desc = "Zilog Z80",
23  .license = "GPL3",
24  .author = "condret",
25  .arch = "z80",
26  .bits = 8,
27  .endian = RZ_SYS_ENDIAN_NONE,
28  .disassemble = &do_disassemble,
29  .assemble = &do_assemble,
30 };
31 
32 #ifndef RZ_PLUGIN_INCORE
35  .data = &rz_asm_plugin_z80,
37 };
38 #endif
size_t len
Definition: 6502dis.c:15
RzAsmPlugin rz_asm_plugin_z80
Definition: asm_z80.c:20
static int do_assemble(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: asm_z80.c:16
RZ_API RzLibStruct rizin_plugin
Definition: asm_z80.c:33
static int do_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_z80.c:12
#define RZ_API
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 char * rz_strbuf_get(RzStrBuf *sb)
Definition: strbuf.c:321
#define RZ_SYS_ENDIAN_NONE
Definition: rz_types.h:525
#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
static FUNC_ATTR_USED int z80Disass(RzAsmOp *op, const ut8 *buf, int len)
Definition: z80.c:71
RZ_API_I int z80asm(unsigned char *outbuf, const char *s)
Definition: z80asm.c:1526