Rizin
unix-like reverse engineering framework and cli tools
asm_gb.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012-2018 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2012-2018 condret <condr3t@protonmail.com>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 // fork of asm_z80.c
6 
7 #include <rz_types.h>
8 #include <rz_util.h>
9 #include <rz_asm.h>
10 #include <rz_lib.h>
11 #include "../arch/gb/gbdis.c"
12 #include "../arch/gb/gbasm.c"
13 
14 static int disassemble(RzAsm *a, RzAsmOp *rz_op, const ut8 *buf, int len) {
15  int dlen = gbDisass(rz_op, buf, len);
16  return rz_op->size = RZ_MAX(0, dlen);
17 }
18 
19 static int assemble(RzAsm *a, RzAsmOp *rz_op, const char *buf) {
20  return gbAsm(a, rz_op, buf);
21 }
22 
24  .name = "gb",
25  .desc = "GameBoy(TM) (z80-like)",
26  .arch = "z80",
27  .author = "condret",
28  .license = "LGPL3",
29  .bits = 16,
30  .endian = RZ_SYS_ENDIAN_LITTLE,
31  .disassemble = &disassemble,
32  .assemble = &assemble,
33 };
34 
35 #ifndef RZ_PLUGIN_INCORE
38  .data = &rz_asm_plugin_gb,
40 };
41 #endif
size_t len
Definition: 6502dis.c:15
RzAsmPlugin rz_asm_plugin_gb
Definition: asm_gb.c:23
static int assemble(RzAsm *a, RzAsmOp *rz_op, const char *buf)
Definition: asm_gb.c:19
RZ_API RzLibStruct rizin_plugin
Definition: asm_gb.c:36
static int disassemble(RzAsm *a, RzAsmOp *rz_op, const ut8 *buf, int len)
Definition: asm_gb.c:14
#define RZ_API
static int gbAsm(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: gbasm.c:206
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526
#define RZ_MAX(x, y)
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
int size
Definition: rz_asm.h:67
const char * name
Definition: rz_asm.h:130
const char * version
Definition: rz_asm.h:133