diff options
| author | 2008-08-07 15:53:58 +0000 | |
|---|---|---|
| committer | 2008-08-07 15:53:58 +0000 | |
| commit | 9df01a28965b68eededf472e609bb2615ab11dcb (patch) | |
| tree | e02609e61b7fd26d2d796122cc1e4b55c51481e6 /src/emu/debug/debugcpu.c | |
| parent | 3107dc2dffe23f7e52b4f46d35d8e458c6b663b4 (diff) | |
Added expression validation callback to verify names for CPUs and
memory regions. Extended error codes to report incorrect memory
spaces, memory names, or memory sizes. Added verification callback
to the debugger to validate CPU and memory region names, as well
as verifying that a requested address space exists for a given
CPU.
Added support for oneshot cheats (those with only an "on" script).
They are activated via UI_SELECT in the cheat menu, and pop up a
message when activated. Also added a "Reset All" item in the cheat
menu to reset all cheats back to their default state, and added
support for UI_SELECT on a non-oneshot cheat so that it resets that
cheat to its default value.
Restored previous behavior that allowed popmessage() messages to
overlay menus and other UI.
Diffstat (limited to 'src/emu/debug/debugcpu.c')
| -rw-r--r-- | src/emu/debug/debugcpu.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index d8bd632ac4c..c1b3ec97b4f 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -108,6 +108,7 @@ static void expression_write_address_space(int cpuindex, int space, offs_t addre static void expression_write_program_direct(int cpuindex, int opcode, offs_t address, int size, UINT64 data); static void expression_write_memory_region(const char *rgntag, offs_t address, int size, UINT64 data); static void expression_write_eeprom(offs_t address, int size, UINT64 data); +static EXPRERR expression_validate(const char *name, int space); /* variable getters/setters */ static UINT64 get_wpaddr(void *ref); @@ -132,7 +133,8 @@ static void set_cpu_reg(void *ref, UINT64 value); const express_callbacks debug_expression_callbacks = { expression_read_memory, - expression_write_memory + expression_write_memory, + expression_validate }; @@ -2573,6 +2575,51 @@ static void expression_write_eeprom(offs_t address, int size, UINT64 data) /*------------------------------------------------- + expression_validate - validate that the + provided expression references an + appropriate name +-------------------------------------------------*/ + +static EXPRERR expression_validate(const char *name, int space) +{ + int cpuindex; + + switch (space) + { + case EXPSPACE_PROGRAM: + case EXPSPACE_DATA: + case EXPSPACE_IO: + cpuindex = (name != NULL) ? mame_find_cpu_index(Machine, name) : cpu_getactivecpu(); + if (cpuindex < 0) + return (name == NULL) ? EXPRERR_MISSING_MEMORY_NAME : EXPRERR_INVALID_MEMORY_NAME; + if (cpunum_addrbus_width(cpuindex, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)) == 0) + return EXPRERR_NO_SUCH_MEMORY_SPACE; + break; + + case EXPSPACE_OPCODE: + case EXPSPACE_RAMWRITE: + cpuindex = (name != NULL) ? mame_find_cpu_index(Machine, name) : cpu_getactivecpu(); + if (cpuindex < 0) + return (name == NULL) ? EXPRERR_MISSING_MEMORY_NAME : EXPRERR_INVALID_MEMORY_NAME; + break; + + case EXPSPACE_EEPROM: + if (name != NULL) + return EXPRERR_INVALID_MEMORY_NAME; + break; + + case EXPSPACE_REGION: + if (name == NULL) + return EXPRERR_MISSING_MEMORY_NAME; + if (memory_region(Machine, name) == NULL) + return EXPRERR_INVALID_MEMORY_NAME; + break; + } + return EXPRERR_NONE; +} + + +/*------------------------------------------------- debug_cpu_trace_printf - writes text to a given CPU's trace file -------------------------------------------------*/ |
