mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-20 14:21:25 +00:00

- Adds endian aware functions - Removes references to host endian - Uses binary detected endianness else tries LE and restricts by RAsmPlugin - Fixes gdb debugger endianness when debugging BE qemu gdbserver Signed-off-by: Damien Zammit <damien@zamaudio.com>
39 lines
830 B
C
39 lines
830 B
C
/* radare - LGPL - Copyright 2012-2013 - pancake */
|
|
|
|
#include <r_types.h>
|
|
#include <r_util.h>
|
|
#include <r_lib.h>
|
|
#include <r_asm.h>
|
|
|
|
#include "../arch/z80/z80.c"
|
|
|
|
static int do_assemble(RAsm *a, RAsmOp *op, const char *buf) {
|
|
return op->size = z80asm (op->buf, buf);
|
|
}
|
|
|
|
static int do_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
|
int dlen = z80dis (0, buf, op->buf_asm, len);
|
|
if (dlen<0) dlen = 0;
|
|
op->size = dlen;
|
|
return op->size;
|
|
}
|
|
|
|
RAsmPlugin r_asm_plugin_z80 = {
|
|
.name = "z80",
|
|
.desc = "Zilog Z80",
|
|
.license = "NC-GPL2", //NON-COMMERCIAL",
|
|
.arch = "z80",
|
|
.bits = 8,
|
|
.endian = R_SYS_ENDIAN_NONE,
|
|
.disassemble = &do_disassemble,
|
|
.assemble = &do_assemble,
|
|
};
|
|
|
|
#ifndef CORELIB
|
|
struct r_lib_struct_t radare_plugin = {
|
|
.type = R_LIB_TYPE_ASM,
|
|
.data = &r_asm_plugin_z80,
|
|
.version = R2_VERSION
|
|
};
|
|
#endif
|