diff options
| author | 2008-12-04 09:34:38 +0000 | |
|---|---|---|
| committer | 2008-12-04 09:34:38 +0000 | |
| commit | 8169eeefca210990fe254215c4b2f0f961d222f4 (patch) | |
| tree | 55df317b6055d9f3be3afbeef8324fcd547ab62f | |
| parent | 013e6eff0049fa2447a318ece71d31ac9fefff3e (diff) | |
02687: emuopts.c: CORE INPUT AUTOMATIC ENABLE OPTIONS
02683: Pressing F5 while running debugger causes access violation
02669: pandoras: music tempo is too fast
02691: Some drivers with z80/ay8910 Audio: Audio tempo has changed
Also fixed debugger memory leak.
Added a number of new cputag_* macros to cpuexec.h.
| -rw-r--r-- | src/emu/cpuexec.h | 43 | ||||
| -rw-r--r-- | src/emu/debug/debugcpu.c | 39 | ||||
| -rw-r--r-- | src/emu/emuopts.c | 16 | ||||
| -rw-r--r-- | src/mame/audio/timeplt.c | 2 | ||||
| -rw-r--r-- | src/mame/drivers/gyruss.c | 2 | ||||
| -rw-r--r-- | src/mame/drivers/jack.c | 2 | ||||
| -rw-r--r-- | src/mame/drivers/junofrst.c | 2 | ||||
| -rw-r--r-- | src/mame/drivers/megazone.c | 2 | ||||
| -rw-r--r-- | src/mame/drivers/nemesis.c | 2 | ||||
| -rw-r--r-- | src/mame/drivers/pandoras.c | 2 | ||||
| -rw-r--r-- | src/osd/windows/debugwin.c | 27 |
11 files changed, 51 insertions, 88 deletions
diff --git a/src/emu/cpuexec.h b/src/emu/cpuexec.h index bc942a5354b..cd287ea6947 100644 --- a/src/emu/cpuexec.h +++ b/src/emu/cpuexec.h @@ -74,6 +74,19 @@ struct _cpu_config #define INTERRUPT_GEN(func) void func(const device_config *device) +/* helpers for using machine/cputag instead of cpu objects */ +#define cputag_suspend(mach, tag, reason, eat) cpu_suspend(cputag_get_cpu(mach, tag), reason, eat) +#define cputag_resume(mach, tag, reason) cpu_resume(cputag_get_cpu(mach, tag), reason) +#define cputag_is_suspended(mach, tag, reason) cpu_is_suspended(cputag_get_cpu(mach, tag), reason) +#define cputag_get_clock(mach, tag) cpu_get_clock(cputag_get_cpu(mach, tag)) +#define cputag_set_clock(mach, tag, clock) cpu_set_clock(cputag_get_cpu(mach, tag), clock) +#define cputag_clocks_to_attotime(mach, tag, clocks) cpu_clocks_to_attotime(cputag_get_cpu(mach, tag), clocks) +#define cputag_attotime_to_clocks(mach, tag, duration) cpu_attotime_to_clocks(cputag_get_cpu(mach, tag), duration) +#define cputag_get_local_time(mach, tag) cpu_get_local_time(cputag_get_cpu(mach, tag)) +#define cputag_get_total_cycles(mach, tag) cpu_get_total_cycles(cputag_get_cpu(mach, tag)) +#define cputag_set_input_line(mach, tag, line, state) cpu_set_input_line(cputag_get_cpu(mach, tag), line, state) +#define cputag_set_input_line_and_vector(mach, tag, line, state, vec) cpu_set_input_line_and_vector(cputag_get_cpu(mach, tag), line, state, vec) + /*************************************************************************** @@ -204,34 +217,4 @@ void cpu_set_input_line_and_vector(const device_config *cpu, int line, int state void cpu_set_irq_callback(const device_config *cpu, cpu_irq_callback callback); - -/*************************************************************************** - INLINE FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - cputag_set_input_line - set the logical state - (ASSERT_LINE/CLEAR_LINE) of an input line - on a CPU specified by machine/tag --------------------------------------------------*/ - -INLINE void cputag_set_input_line(running_machine *machine, const char *tag, int line, int state) -{ - cpu_set_input_line(cputag_get_cpu(machine, tag), line, state); -} - - -/*------------------------------------------------- - cputag_set_input_line_and_vector - set the - logical state (ASSERT_LINE/CLEAR_LINE) of an - input line on a CPU and its associated vector --------------------------------------------------*/ - -INLINE void cputag_set_input_line_and_vector(running_machine *machine, const char *tag, int line, int state, int vector) -{ - cpu_set_input_line_and_vector(cputag_get_cpu(machine, tag), line, state, vector); -} - - - #endif /* __CPUEXEC_H__ */ diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 8a340b45d26..f46efe694c8 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -691,9 +691,6 @@ void debug_cpu_ignore_cpu(const device_config *device, int ignore) debugcpu_private *global = device->machine->debugcpu_data; cpu_debug_data *info = cpu_get_debug_data(device); - if (!global->within_instruction_hook) - return; - if (ignore) info->flags &= ~DEBUG_FLAG_OBSERVING; else @@ -712,10 +709,8 @@ void debug_cpu_ignore_cpu(const device_config *device, int ignore) void debug_cpu_single_step(running_machine *machine, int numsteps) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stepsleft = numsteps; @@ -734,10 +729,8 @@ void debug_cpu_single_step(running_machine *machine, int numsteps) void debug_cpu_single_step_over(running_machine *machine, int numsteps) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stepsleft = numsteps; @@ -755,10 +748,8 @@ void debug_cpu_single_step_over(running_machine *machine, int numsteps) void debug_cpu_single_step_out(running_machine *machine) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stepsleft = 100; @@ -776,10 +767,8 @@ void debug_cpu_single_step_out(running_machine *machine) void debug_cpu_go(running_machine *machine, offs_t targetpc) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stopaddr = targetpc; @@ -796,10 +785,8 @@ void debug_cpu_go(running_machine *machine, offs_t targetpc) void debug_cpu_go_vblank(running_machine *machine) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); global->vblank_occurred = FALSE; @@ -816,10 +803,8 @@ void debug_cpu_go_vblank(running_machine *machine) void debug_cpu_go_interrupt(running_machine *machine, int irqline) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stopirq = irqline; @@ -836,10 +821,8 @@ void debug_cpu_go_interrupt(running_machine *machine, int irqline) void debug_cpu_go_exception(running_machine *machine, int exception) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stopexception = exception; @@ -856,10 +839,8 @@ void debug_cpu_go_exception(running_machine *machine, int exception) void debug_cpu_go_milliseconds(running_machine *machine, UINT64 milliseconds) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->stoptime = attotime_add(timer_get_time(machine), ATTOTIME_IN_MSEC(milliseconds)); @@ -876,10 +857,8 @@ void debug_cpu_go_milliseconds(running_machine *machine, UINT64 milliseconds) void debug_cpu_next_cpu(running_machine *machine) { debugcpu_private *global = machine->debugcpu_data; - cpu_debug_data *info = cpu_get_debug_data(global->livecpu); + cpu_debug_data *info = cpu_get_debug_data(global->visiblecpu); - if (!global->within_instruction_hook) - return; assert(info != NULL); info->flags |= DEBUG_FLAG_STOP_CONTEXT; diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 1af6f81d7d8..4cd69904ead 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -132,14 +132,14 @@ const options_entry mame_core_options[] = /* input autoenable options */ { NULL, NULL, OPTION_HEADER, "CORE INPUT AUTOMATIC ENABLE OPTIONS" }, - { "paddle_device;paddle", "keyboard", 0, "enable (keyboard|mouse|joystick) if a paddle control is present" }, - { "adstick_device;adstick", "keyboard", 0, "enable (keyboard|mouse|joystick) if an analog joystick control is present" }, - { "pedal_device;pedal", "keyboard", 0, "enable (keyboard|mouse|joystick) if a pedal control is present" }, - { "dial_device;dial", "keyboard", 0, "enable (keyboard|mouse|joystick) if a dial control is present" }, - { "trackball_device;trackball", "keyboard", 0, "enable (keyboard|mouse|joystick) if a trackball control is present" }, - { "lightgun_device", "keyboard", 0, "enable (keyboard|mouse|joystick) if a lightgun control is present" }, - { "positional_device", "keyboard", 0, "enable (keyboard|mouse|joystick) if a positional control is present" }, - { "mouse_device", "mouse", 0, "enable (keyboard|mouse|joystick) if a mouse control is present" }, + { "paddle_device;paddle", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a paddle control is present" }, + { "adstick_device;adstick", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if an analog joystick control is present" }, + { "pedal_device;pedal", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a pedal control is present" }, + { "dial_device;dial", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a dial control is present" }, + { "trackball_device;trackball", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a trackball control is present" }, + { "lightgun_device", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a lightgun control is present" }, + { "positional_device", "keyboard", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a positional control is present" }, + { "mouse_device", "mouse", 0, "enable (none|keyboard|mouse|lightgun|joystick) if a mouse control is present" }, /* debugging options */ { NULL, NULL, OPTION_HEADER, "CORE DEBUGGING OPTIONS" }, diff --git a/src/mame/audio/timeplt.c b/src/mame/audio/timeplt.c index 3b6dbb93572..d497e1c1860 100644 --- a/src/mame/audio/timeplt.c +++ b/src/mame/audio/timeplt.c @@ -65,7 +65,7 @@ static READ8_HANDLER( timeplt_portB_r ) { 0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0 }; - return timeplt_timer[(cpu_get_total_cycles(space->cpu) / 512) % 10]; + return timeplt_timer[(cputag_get_total_cycles(space->machine, "tpsound") / 512) % 10]; } diff --git a/src/mame/drivers/gyruss.c b/src/mame/drivers/gyruss.c index 8986cb6cf97..a95e6fc09af 100644 --- a/src/mame/drivers/gyruss.c +++ b/src/mame/drivers/gyruss.c @@ -96,7 +96,7 @@ static const int gyruss_timer[10] = static READ8_HANDLER( gyruss_portA_r ) { - return gyruss_timer[(cpu_get_total_cycles(space->cpu)/1024) % 10]; + return gyruss_timer[(cputag_get_total_cycles(space->machine, "audio") / 1024) % 10]; } diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index 921cbb5dfc6..11b2fd45bea 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -66,7 +66,7 @@ static READ8_HANDLER( timer_r ) { /* wrong! there should be no need for timer_rate, the same function */ /* should work for both games */ - return cpu_get_total_cycles(space->cpu) / timer_rate; + return cputag_get_total_cycles(space->machine, "audio") / timer_rate; } diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c index a86d39ea5a0..4fc18a7430c 100644 --- a/src/mame/drivers/junofrst.c +++ b/src/mame/drivers/junofrst.c @@ -105,7 +105,7 @@ static READ8_HANDLER( junofrst_portA_r ) /* divided by 1024 to get this timer */ /* (divide by (1024/2), and not 1024, because the CPU cycle counter is */ /* incremented every other state change of the clock) */ - timer = (cpu_get_total_cycles(space->cpu) / (1024/2)) & 0x0f; + timer = (cputag_get_total_cycles(space->machine, "audio") / (1024/2)) & 0x0f; /* low three bits come from the 8039 */ diff --git a/src/mame/drivers/megazone.c b/src/mame/drivers/megazone.c index efa4f78889c..d77fea804ec 100644 --- a/src/mame/drivers/megazone.c +++ b/src/mame/drivers/megazone.c @@ -46,7 +46,7 @@ static READ8_HANDLER( megazone_portA_r ) /* (divide by (1024/2), and not 1024, because the CPU cycle counter is */ /* incremented every other state change of the clock) */ - clock = cpu_get_total_cycles(space->cpu) * 7159/12288; /* = (14318/8)/(18432/6) */ + clock = cputag_get_total_cycles(space->machine, "audio") * 7159/12288; /* = (14318/8)/(18432/6) */ timer = (clock / (1024/2)) & 0x0f; /* low three bits come from the 8039 */ diff --git a/src/mame/drivers/nemesis.c b/src/mame/drivers/nemesis.c index 6b4e47a62b2..4aaa1c5175d 100644 --- a/src/mame/drivers/nemesis.c +++ b/src/mame/drivers/nemesis.c @@ -315,7 +315,7 @@ static READ8_HANDLER( nemesis_portA_r ) bit 7: unused by this software version. Bubble Memory version uses this bit. */ - int res = (cpu_get_total_cycles(space->cpu) / 1024) & 0x2f; // this should be 0x0f, but it doesn't work + int res = (cputag_get_total_cycles(space->machine, "audio") / 1024) & 0x2f; // this should be 0x0f, but it doesn't work res |= 0xd0; diff --git a/src/mame/drivers/pandoras.c b/src/mame/drivers/pandoras.c index 9574863d6b3..827ea93fc35 100644 --- a/src/mame/drivers/pandoras.c +++ b/src/mame/drivers/pandoras.c @@ -361,7 +361,7 @@ static READ8_HANDLER( pandoras_portA_r ) static READ8_HANDLER( pandoras_portB_r ) { - return (cpu_get_total_cycles(space->cpu) / 512) & 0x0f; + return (cputag_get_total_cycles(space->machine, "audio") / 512) & 0x0f; } static const ay8910_interface ay8910_config = diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index 64b8f8eb122..6373ec26850 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -430,8 +430,12 @@ void debugwin_init_windows(void) void debugwin_destroy_windows(void) { // loop over windows and free them - while (window_list) + while (window_list != NULL) + { + // clear the view list because they will be freed by the core + memset(window_list->view, 0, sizeof(window_list->view)); DestroyWindow(window_list->wnd); + } main_console = NULL; } @@ -447,7 +451,7 @@ void debugwin_show(int type) debugwin_info *info; // loop over windows and show/hide them - for (info = window_list; info; info = info->next) + for (info = window_list; info != NULL; info = info->next) ShowWindow(info->wnd, type); } @@ -471,7 +475,7 @@ void debugwin_update_during_game(running_machine *machine) debug_cpu_halt_on_next_instruction(debug_cpu_get_visible_cpu(machine), "User-initiated break\n"); // if we were focused on some window's edit box, reset it to default - for (info = window_list; info; info = info->next) + for (info = window_list; info != NULL; info = info->next) if (focuswnd == info->editwnd) { SendMessage(focuswnd, WM_SETTEXT, (WPARAM)0, (LPARAM)info->edit_defstr); @@ -538,23 +542,20 @@ cleanup: static void debugwin_window_free(debugwin_info *info) { - debugwin_info *prev, *curr; + debugwin_info **scanptr; int viewnum; // first unlink us from the list - for (curr = window_list, prev = NULL; curr; prev = curr, curr = curr->next) - if (curr == info) + for (scanptr = &window_list; *scanptr != NULL; scanptr = &(*scanptr)->next) + if (*scanptr == info) { - if (prev) - prev->next = curr->next; - else - window_list = curr->next; + *scanptr = info->next; break; } // free any views - for (viewnum = 0; viewnum < MAX_VIEWS; viewnum++) - if (info->view[viewnum].view) + for (viewnum = 0; viewnum < ARRAY_LENGTH(info->view); viewnum++) + if (info->view[viewnum].view != NULL) { debug_view_free(info->view[viewnum].view); info->view[viewnum].view = NULL; @@ -2809,6 +2810,6 @@ static void smart_show_all(BOOL show) debugwin_info *info; if (!show) SetForegroundWindow(win_window_list->hwnd); - for (info = window_list; info; info = info->next) + for (info = window_list; info != NULL; info = info->next) smart_show_window(info->wnd, show); } |
