radare2/libr/asm/p/asm_gb.c

41 lines
847 B
C
Raw Normal View History

2015-10-21 19:45:54 +02:00
/* radare - LGPL - Copyright 2012-2015 - pancake, condret */
2013-11-14 16:23:58 +01:00
// fork of asm_z80.c
#include <r_types.h>
#include <r_util.h>
#include <r_asm.h>
#include <r_lib.h>
#include "../arch/gb/gbdis.c"
2015-10-21 18:18:31 +00:00
#include "../arch/gb/gbasm.c"
2013-11-14 16:23:58 +01:00
2014-01-23 04:00:01 +01:00
static int disassemble(RAsm *a, RAsmOp *r_op, const ut8 *buf, int len) {
2013-11-14 16:23:58 +01:00
int dlen = gbDisass(r_op,buf,len);
if(dlen<0) dlen=0;
2014-01-23 04:00:01 +01:00
r_op->size = dlen;
2013-11-14 16:23:58 +01:00
return dlen;
}
2015-10-21 18:18:31 +00:00
static int assemble(RAsm *a, RAsmOp *r_op, const char *buf) {
return gbAsm (a, r_op, buf);
}
2013-11-14 16:23:58 +01:00
RAsmPlugin r_asm_plugin_gb = {
.name = "gb",
.desc = "GameBoy(TM) (z80-like)",
.arch = "z80",
2013-12-02 04:44:26 +01:00
.license = "LGPL3",
2015-03-19 23:45:24 +01:00
.bits = 16,
.endian = R_SYS_ENDIAN_LITTLE,
2013-11-14 16:23:58 +01:00
.disassemble = &disassemble,
2015-10-21 18:18:31 +00:00
.assemble = &assemble,
2013-11-14 16:23:58 +01:00
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_ASM,
2015-07-12 16:04:10 +02:00
.data = &r_asm_plugin_gb,
.version = R2_VERSION
2013-11-14 16:23:58 +01:00
};
#endif