mirror of
https://github.com/holub/mame
synced 2025-05-18 11:39:29 +03:00
Added 'options' parameter to the CPU_DISASSEMBLE prototype. For now, the
debugger always passes 0 for this. unidasm has been updated to accept a mode parameter, which is passed for the options.
This commit is contained in:
parent
f60bbef070
commit
03b5da1a55
@ -1283,7 +1283,7 @@ static UINT32 decode_opcode(UINT32 pc, const M68HC11_OPCODE *op_table)
|
||||
return flags;
|
||||
}
|
||||
|
||||
offs_t hc11_disasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
|
||||
CPU_DISASSEMBLE( hc11 )
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
UINT8 opcode;
|
||||
|
@ -582,7 +582,7 @@ CPU_GET_INFO( mc68hc11 )
|
||||
case CPUINFO_FCT_EXIT: info->exit = CPU_EXIT_NAME(hc11); break;
|
||||
case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(hc11); break;
|
||||
case CPUINFO_FCT_BURN: info->burn = NULL; break;
|
||||
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = hc11_disasm; break;
|
||||
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(hc11); break;
|
||||
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
|
||||
|
||||
/* --- the following bits of info are returned as NULL-terminated strings --- */
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "cpuintrf.h"
|
||||
|
||||
offs_t hc11_disasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
|
||||
CPU_DISASSEMBLE( hc11 );
|
||||
|
||||
CPU_GET_INFO( mc68hc11 );
|
||||
#define CPU_MC68HC11 CPU_GET_INFO_NAME( mc68hc11 )
|
||||
|
@ -2748,7 +2748,7 @@ static void sharcop_idle(SHARC_REGS *cpustate)
|
||||
static void sharcop_unimplemented(SHARC_REGS *cpustate)
|
||||
{
|
||||
char dasm[1000];
|
||||
CPU_DISASSEMBLE_NAME(sharc)(NULL, dasm, cpustate->pc, NULL, NULL);
|
||||
CPU_DISASSEMBLE_NAME(sharc)(NULL, dasm, cpustate->pc, NULL, NULL, 0);
|
||||
mame_printf_debug("SHARC: %08X: %s\n", cpustate->pc, dasm);
|
||||
fatalerror("SHARC: Unimplemented opcode %04X%08X at %08X", (UINT16)(cpustate->opcode >> 32), (UINT32)(cpustate->opcode), cpustate->pc);
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ static void tms57002_decode_error(tms57002_t *s, UINT32 opcode)
|
||||
opr[1] = opcode >> 8;
|
||||
opr[2] = opcode >> 16;
|
||||
|
||||
CPU_DISASSEMBLE_NAME(tms57002)(0, buf, s->pc, opr, opr);
|
||||
CPU_DISASSEMBLE_NAME(tms57002)(0, buf, s->pc, opr, opr, 0);
|
||||
popmessage("tms57002: %s - Contact Mamedev", buf);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ enum
|
||||
CPUINFO_FCT_EXIT, /* R/O: void (*exit)(const device_config *device) */
|
||||
CPUINFO_FCT_EXECUTE, /* R/O: int (*execute)(const device_config *device, int cycles) */
|
||||
CPUINFO_FCT_BURN, /* R/O: void (*burn)(const device_config *device, int cycles) */
|
||||
CPUINFO_FCT_DISASSEMBLE, /* R/O: offs_t (*disassemble)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) */
|
||||
CPUINFO_FCT_DISASSEMBLE, /* R/O: offs_t (*disassemble)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) */
|
||||
CPUINFO_FCT_TRANSLATE, /* R/O: int (*translate)(const device_config *device, int space, int intention, offs_t *address) */
|
||||
CPUINFO_FCT_READ, /* R/O: int (*read)(const device_config *device, int space, UINT32 offset, int size, UINT64 *value) */
|
||||
CPUINFO_FCT_WRITE, /* R/O: int (*write)(const device_config *device, int space, UINT32 offset, int size, UINT64 value) */
|
||||
@ -286,8 +286,8 @@ enum
|
||||
#define CPU_DEBUG_INIT_CALL(name) CPU_DEBUG_INIT_NAME(name)(device)
|
||||
|
||||
#define CPU_DISASSEMBLE_NAME(name) cpu_disassemble_##name
|
||||
#define CPU_DISASSEMBLE(name) offs_t CPU_DISASSEMBLE_NAME(name)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
|
||||
#define CPU_DISASSEMBLE_CALL(name) CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram)
|
||||
#define CPU_DISASSEMBLE(name) offs_t CPU_DISASSEMBLE_NAME(name)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options)
|
||||
#define CPU_DISASSEMBLE_CALL(name) CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram, options)
|
||||
|
||||
#define CPU_VALIDITY_CHECK_NAME(name) cpu_validity_check_##name
|
||||
#define CPU_VALIDITY_CHECK(name) int CPU_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const void *config)
|
||||
@ -379,7 +379,7 @@ typedef int (*cpu_read_func)(const device_config *device, int space, UINT32 offs
|
||||
typedef int (*cpu_write_func)(const device_config *device, int space, UINT32 offset, int size, UINT64 value);
|
||||
typedef int (*cpu_readop_func)(const device_config *device, UINT32 offset, int size, UINT64 *value);
|
||||
typedef void (*cpu_debug_init_func)(const device_config *device);
|
||||
typedef offs_t (*cpu_disassemble_func)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
|
||||
typedef offs_t (*cpu_disassemble_func)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
typedef int (*cpu_validity_check_func)(const game_driver *driver, const void *config);
|
||||
typedef void (*cpu_state_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry);
|
||||
typedef void (*cpu_string_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *string);
|
||||
|
@ -391,11 +391,11 @@ offs_t debug_cpu_disassemble(const device_config *device, char *buffer, offs_t p
|
||||
|
||||
/* check for disassembler override */
|
||||
if (info->dasm_override != NULL)
|
||||
result = (*info->dasm_override)(device, buffer, pc, oprom, opram);
|
||||
result = (*info->dasm_override)(device, buffer, pc, oprom, opram, 0);
|
||||
|
||||
/* if we have a disassembler, run it */
|
||||
if (result == 0 && info->disassemble != NULL)
|
||||
result = (*info->disassemble)(device, buffer, pc, oprom, opram);
|
||||
result = (*info->disassemble)(device, buffer, pc, oprom, opram, 0);
|
||||
|
||||
/* if we still have nothing, output vanilla bytes */
|
||||
if (result == 0)
|
||||
|
@ -53,6 +53,7 @@ struct _options
|
||||
UINT8 norawbytes;
|
||||
UINT8 lower;
|
||||
UINT8 upper;
|
||||
int mode;
|
||||
const dasm_table_entry *dasm;
|
||||
};
|
||||
|
||||
@ -329,6 +330,7 @@ int parse_options(int argc, char *argv[], options *opts)
|
||||
{
|
||||
int pending_base = FALSE;
|
||||
int pending_arch = FALSE;
|
||||
int pending_mode = FALSE;
|
||||
int curarch;
|
||||
int numrows;
|
||||
int arg;
|
||||
@ -343,7 +345,7 @@ int parse_options(int argc, char *argv[], options *opts)
|
||||
// is it a switch?
|
||||
if (curarg[0] == '-')
|
||||
{
|
||||
if (pending_base || pending_arch)
|
||||
if (pending_base || pending_arch || pending_mode)
|
||||
goto usage;
|
||||
|
||||
if (tolower((UINT8)curarg[1]) == 'a')
|
||||
@ -352,6 +354,8 @@ int parse_options(int argc, char *argv[], options *opts)
|
||||
pending_base = TRUE;
|
||||
else if (tolower((UINT8)curarg[1]) == 'l')
|
||||
opts->lower = TRUE;
|
||||
else if (tolower((UINT8)curarg[1]) == 'm')
|
||||
pending_mode = TRUE;
|
||||
else if (tolower((UINT8)curarg[1]) == 'n')
|
||||
opts->norawbytes = TRUE;
|
||||
else if (tolower((UINT8)curarg[1]) == 'u')
|
||||
@ -363,15 +367,26 @@ int parse_options(int argc, char *argv[], options *opts)
|
||||
// base PC
|
||||
else if (pending_base)
|
||||
{
|
||||
int result;
|
||||
if (curarg[0] == '0' && curarg[1] == 'x')
|
||||
sscanf(&curarg[2], "%x", &opts->basepc);
|
||||
result = sscanf(&curarg[2], "%x", &opts->basepc);
|
||||
else if (curarg[0] == '$')
|
||||
sscanf(&curarg[1], "%x", &opts->basepc);
|
||||
result = sscanf(&curarg[1], "%x", &opts->basepc);
|
||||
else
|
||||
sscanf(&curarg[0], "%x", &opts->basepc);
|
||||
result = sscanf(&curarg[0], "%x", &opts->basepc);
|
||||
if (result != 1)
|
||||
goto usage;
|
||||
pending_base = FALSE;
|
||||
}
|
||||
|
||||
// mode
|
||||
else if (pending_mode)
|
||||
{
|
||||
if (sscanf(curarg, "%d", &opts->mode) != 1)
|
||||
goto usage;
|
||||
pending_mode = FALSE;
|
||||
}
|
||||
|
||||
// architecture
|
||||
else if (pending_arch)
|
||||
{
|
||||
@ -393,13 +408,17 @@ int parse_options(int argc, char *argv[], options *opts)
|
||||
goto usage;
|
||||
}
|
||||
|
||||
// if we have a dangling option, error
|
||||
if (pending_base || pending_arch || pending_mode)
|
||||
goto usage;
|
||||
|
||||
// if no file or no architecture, fail
|
||||
if (opts->filename == NULL || opts->dasm == NULL)
|
||||
goto usage;
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
printf("Usage: %s <filename> -arch <architecture> [-basepc <pc>] [-norawbytes] [-upper] [-lower]\n", argv[0]);
|
||||
printf("Usage: %s <filename> -arch <architecture> [-basepc <pc>] [-mode <n>] [-norawbytes] [-upper] [-lower]\n", argv[0]);
|
||||
printf("\n");
|
||||
printf("Supported architectures:");
|
||||
numrows = (ARRAY_LENGTH(dasm_table) + 6) / 7;
|
||||
@ -463,7 +482,7 @@ int main(int argc, char *argv[])
|
||||
int numchunks;
|
||||
|
||||
// disassemble
|
||||
pcdelta = (*opts.dasm->func)(NULL, buffer, curpc, oprom, oprom) & DASMFLAG_LENGTHMASK;
|
||||
pcdelta = (*opts.dasm->func)(NULL, buffer, curpc, oprom, oprom, opts.mode) & DASMFLAG_LENGTHMASK;
|
||||
if (opts.dasm->pcshift < 0)
|
||||
numbytes = pcdelta << -opts.dasm->pcshift;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user