* Fix build + initial work on z80 asm/dis

This commit is contained in:
pancake 2012-02-03 10:57:45 +01:00
parent aeb29106d7
commit 3eb9a85872
8 changed files with 34 additions and 9 deletions

View File

@ -1,2 +1,4 @@
all:
${CC} -DVERSION=\"0.1\" *.c
${CC} -o a -DVERSION=\"0.1\" *.c
#${CC} -o a -DMAIN_ASM -DVERSION=\"0.1\" *.c
#${CC} -o d -DMAIN_DIS -DVERSION=\"0.1\" *.c

View File

@ -1,3 +1,5 @@
// comercial builds cannot support z80!
assembler:
http://www.nongnu.org/z80asm

View File

@ -89,7 +89,7 @@
// Sprüngen im Debugger. Siehe auch oben.
// Speicher für den Programmcode
UBYTE Opcodes[CODESIZE];
static UBYTE *Opcodes; //[CODESIZE];
// Flag pro Speicherstelle, ob Opcode, Operand, Daten
// Bit 4 = 1, d.h. hier wird per JR o.ä. hingesprungen.
@ -370,8 +370,10 @@ void ParseOpcodes(ULONG adr) {
}
// Disassemblieren
void Disassemble(UWORD adr,STR s)
void Disassemble(const UBYTE *code, STR s)
{
Opcodes = code;
UWORD adr = 0;
UBYTE a = Opcodes[adr];
UBYTE d = (a >> 3) & 7;
UBYTE e = a & 7;
@ -933,6 +935,7 @@ CHAR ireg[3]; // temp.Indexregister
}
}
#if MAIN_DIS
// Einlesen, Parsen, Disassemblieren und Ausgeben
int main(void)
{
@ -1026,4 +1029,4 @@ CHAR s[80]; // Ausgabestring
return 0;
}
#endif

10
libr/asm/arch/z80/test.c Normal file
View File

@ -0,0 +1,10 @@
main() {
int i;
char buf[32], str[1024];
for (i=0; i<255; i++) {
buf[0] = i;
Disassemble (buf, str);
printf ("%s\n", str);
}
}

View File

@ -2799,7 +2799,7 @@ assemble (void)
free (infile);
}
#if 0
#ifdef MAIN_ASM
int
main (int argc, char **argv)
{

View File

@ -248,6 +248,14 @@ struct mach_header_64 {
#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
/* ARM subtypes */
#define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
/*
* 680x0 subtypes
*

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2012 pancake<nopcode.org> */
#include <r_debug.h>
#include <r_anal.h>

View File

@ -1777,7 +1777,7 @@ static RList *r_debug_native_frames(RDebug *dbg) {
// XXX: Do this work correctly?
static RList *r_debug_native_frames(RDebug *dbg) {
int i;
ut8 buf[4];
ut8 buf[8];
ut64 ptr, ebp2;
ut64 _rip, _rsp, _rbp;
RList *list;
@ -1790,11 +1790,11 @@ static RList *r_debug_native_frames(RDebug *dbg) {
list = r_list_new ();
list->free = free;
bio->read_at (bio->io, _rip, (ut8*)&buf, 4);
bio->read_at (bio->io, _rip, (ut8*)&buf, 8);
/* %rbp=old rbp, %rbp+4 points to ret */
/* Plugin before function prelude: push %rbp ; mov %rsp, %rbp */
if (!memcmp (buf, "\x55\x89\xe5", 3) || !memcmp (buf, "\x89\xe5\x57", 3)) {
if (bio->read_at (bio->io, _rsp, (ut8*)&ptr, 4) != 4) {
if (bio->read_at (bio->io, _rsp, (ut8*)&ptr, 8) != 8) {
eprintf ("read error at 0x%08"PFMT64x"\n", _rsp);
return R_FALSE;
}