From 19dc5dba41f3fe07f66f16ed250b903f120e41da Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Tue, 29 Jan 2008 23:27:24 +0000 Subject: [PATCH] Moved cpu_getiloops() and cpu_scalebyfcount() to deprecat.h. Added #include "deprecat.h" where necessary to make this happen. Cleaned up cpuexec.c/.h to latest core style. Cleaned up implementation of extended INP header in inptport.c. Removed external access to cycles_currently_ran(). Replaced use of cycles_currently_ran() in v9938 code with mame_rand(), since that is effectively the same thing. :) --- src/emu/cpuexec.c | 1215 +++++++++++++++-------------------- src/emu/cpuexec.h | 246 +++---- src/emu/deprecat.h | 22 +- src/emu/inptport.c | 57 +- src/emu/inptport.h | 19 +- src/emu/video.c | 5 +- src/emu/video/v9938.c | 8 +- src/mame/drivers/1942.c | 1 + src/mame/drivers/acommand.c | 1 + src/mame/drivers/bionicc.c | 1 + src/mame/drivers/cidelsa.c | 1 + src/mame/drivers/cinemat.c | 1 + src/mame/drivers/coolridr.c | 2 +- src/mame/drivers/cosmic.c | 1 + src/mame/drivers/darkhors.c | 1 + src/mame/drivers/darkmist.c | 1 + src/mame/drivers/deadang.c | 1 + src/mame/drivers/dwarfd.c | 1 + src/mame/drivers/eolithsp.c | 1 + src/mame/drivers/equites.c | 1 + src/mame/drivers/exedexes.c | 1 + src/mame/drivers/fastlane.c | 1 + src/mame/drivers/galpani2.c | 1 + src/mame/drivers/galpani3.c | 1 + src/mame/drivers/gberet.c | 1 + src/mame/drivers/goodejan.c | 1 + src/mame/drivers/gundealr.c | 1 + src/mame/drivers/hexion.c | 1 + src/mame/drivers/higemaru.c | 1 + src/mame/drivers/igs_180.c | 1 + src/mame/drivers/ikki.c | 1 + src/mame/drivers/jackpool.c | 1 + src/mame/drivers/labyrunr.c | 1 + src/mame/drivers/meijinsn.c | 1 + src/mame/drivers/olibochu.c | 1 + src/mame/drivers/panicr.c | 1 + src/mame/drivers/pingpong.c | 1 + src/mame/drivers/realbrk.c | 1 + src/mame/drivers/royalmah.c | 1 + src/mame/drivers/shaolins.c | 1 + src/mame/drivers/sprcros2.c | 1 + src/mame/drivers/srmp2.c | 1 + src/mame/drivers/srumbler.c | 1 + src/mame/drivers/st0016.c | 1 + src/mame/drivers/vulgus.c | 1 + src/mame/video/gyruss.c | 1 + src/mame/video/spdodgeb.c | 1 + src/mame/video/tp84.c | 1 + 48 files changed, 729 insertions(+), 885 deletions(-) diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index c7b2ae04cbf..725edd3a613 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -21,11 +21,9 @@ -/************************************* - * - * Debug logging - * - *************************************/ +/*************************************************************************** + DEBUGGING +***************************************************************************/ #define VERBOSE 0 @@ -33,11 +31,9 @@ -/************************************* - * - * Macros to help verify active CPU - * - *************************************/ +/*************************************************************************** + MACROS +***************************************************************************/ #define VERIFY_ACTIVECPU(name) \ int activecpu = cpu_getactivecpu(); \ @@ -52,12 +48,11 @@ -/************************************* - * - * Triggers for the timer system - * - *************************************/ +/*************************************************************************** + CONSTANTS +***************************************************************************/ +/* internal trigger IDs */ enum { TRIGGER_TIMESLICE = -1000, @@ -68,63 +63,54 @@ enum -/************************************* - * - * Internal CPU info structure - * - *************************************/ +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ +/* Internal CPU info structure */ typedef struct _cpuexec_data cpuexec_data; struct _cpuexec_data { - UINT8 saveable; /* true if saveable */ + UINT8 saveable; /* true if saveable */ - UINT8 suspend; /* suspend reason mask (0 = not suspended) */ - UINT8 nextsuspend; /* pending suspend reason mask */ - UINT8 eatcycles; /* true if we eat cycles while suspended */ - UINT8 nexteatcycles; /* pending value */ - INT32 trigger; /* pending trigger to release a trigger suspension */ + UINT8 suspend; /* suspend reason mask (0 = not suspended) */ + UINT8 nextsuspend; /* pending suspend reason mask */ + UINT8 eatcycles; /* true if we eat cycles while suspended */ + UINT8 nexteatcycles; /* pending value */ + INT32 trigger; /* pending trigger to release a trigger suspension */ - INT32 iloops; /* number of interrupts remaining this frame */ + INT32 iloops; /* number of interrupts remaining this frame */ - UINT64 totalcycles; /* total CPU cycles executed */ - attotime localtime; /* local time, relative to the timer system's global time */ - INT32 clock; /* current active clock */ - double clockscale; /* current active clock scale factor */ + UINT64 totalcycles; /* total CPU cycles executed */ + attotime localtime; /* local time, relative to the timer system's global time */ + INT32 clock; /* current active clock */ + double clockscale; /* current active clock scale factor */ - INT32 vblankint_countdown; /* number of vblank callbacks left until we interrupt */ - INT32 vblankint_multiplier; /* number of vblank callbacks per interrupt */ - void * vblankint_timer; /* reference to elapsed time counter */ + INT32 vblankint_countdown; /* number of vblank callbacks left until we interrupt */ + INT32 vblankint_multiplier; /* number of vblank callbacks per interrupt */ + emu_timer * vblankint_timer; /* reference to elapsed time counter */ - void * timedint_timer; /* reference to this CPU's timer */ - attotime timedint_period; /* timing period of the timed interrupt */ + emu_timer * timedint_timer; /* reference to this CPU's timer */ + attotime timedint_period; /* timing period of the timed interrupt */ }; -/************************************* - * - * General CPU variables - * - *************************************/ +/*************************************************************************** + GLOBAL VARIABLES +***************************************************************************/ +/* general CPU variables */ static cpuexec_data cpu[MAX_CPU]; static UINT8 vblank; static UINT32 current_frame; -static INT32 watchdog_counter; static int cycles_running; static int cycles_stolen; - -/************************************* - * - * Timer variables - * - *************************************/ - +/* timer variables */ static emu_timer *vblank_timer; static INT32 vblank_countdown; static INT32 vblank_multiplier; @@ -142,15 +128,16 @@ static emu_timer *interleave_boost_timer; static emu_timer *interleave_boost_timer_end; static attotime perfect_interleave; +/* watchdog state */ +static UINT8 watchdog_enabled; +static INT32 watchdog_counter; static emu_timer *watchdog_timer; -/************************************* - * - * Static prototypes - * - *************************************/ +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ static void cpuexec_exit(running_machine *machine); static void cpuexec_reset(running_machine *machine); @@ -160,33 +147,19 @@ static TIMER_CALLBACK( cpu_vblankcallback ); static TIMER_CALLBACK( cpu_updatecallback ); static TIMER_CALLBACK( end_interleave_boost ); static void compute_perfect_interleave(running_machine *machine); -static void watchdog_setup(running_machine *machine, int alloc_new); + +void cpu_compute_vblank_timing(running_machine *machine); -/************************************* - * - * Watchdog Flags - * - *************************************/ +/*************************************************************************** + CORE CPU EXECUTION +***************************************************************************/ -#define WATCHDOG_IS_STARTED_DISABLED -1 -#define WATCHDOG_IS_DISABLED -2 -#define WATCHDOG_IS_TIMER_BASED -3 -#define WATCHDOG_IS_INVALID -4 -#define WATCHDOG_IS_BEING_STARTED -5 - - - -#if 0 -#pragma mark CORE CPU -#endif - -/************************************* - * - * Initialize all the CPUs - * - *************************************/ +/*------------------------------------------------- + cpuexec_init - initialize internal states of + all CPUs +-------------------------------------------------*/ void cpuexec_init(running_machine *machine) { @@ -266,18 +239,17 @@ void cpuexec_init(running_machine *machine) state_save_push_tag(0); state_save_register_item("cpu", 0, vblank); state_save_register_item("cpu", 0, current_frame); + state_save_register_item("cpu", 0, watchdog_enabled); state_save_register_item("cpu", 0, watchdog_counter); state_save_register_item("cpu", 0, vblank_countdown); state_save_pop_tag(); } - -/************************************* - * - * Prepare the system for execution - * - *************************************/ +/*------------------------------------------------- + cpuexec_reset - reset CPU states on a soft + reset +-------------------------------------------------*/ static void cpuexec_reset(running_machine *machine) { @@ -285,8 +257,10 @@ static void cpuexec_reset(running_machine *machine) /* initialize the various timers (suspends all CPUs at startup) */ cpu_inittimers(machine); - watchdog_counter = WATCHDOG_IS_INVALID; - watchdog_setup(machine, TRUE); + + /* set up the watchdog timer; only start off enabled if explicitly configured */ + watchdog_enabled = (machine->drv->watchdog_vblank_count != 0 || attotime_compare(machine->drv->watchdog_time, attotime_zero) != 0); + watchdog_reset(machine); /* first pass over CPUs */ for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) @@ -311,12 +285,9 @@ static void cpuexec_reset(running_machine *machine) } - -/************************************* - * - * Deinitialize all the CPUs - * - *************************************/ +/*------------------------------------------------- + cpuexec_exit - cleanup all CPUs on exit +-------------------------------------------------*/ static void cpuexec_exit(running_machine *machine) { @@ -328,137 +299,10 @@ static void cpuexec_exit(running_machine *machine) } - - -#if 0 -#pragma mark - -#pragma mark WATCHDOG -#endif - -/************************************* - * - * Watchdog timer callback - * - *************************************/ - -static TIMER_CALLBACK( watchdog_callback ) -{ - logerror("reset caused by the (time) watchdog\n"); - mame_schedule_soft_reset(machine); -} - - - -/************************************* - * - * Watchdog setup routine - * - *************************************/ - -static void watchdog_setup(running_machine *machine, int alloc_new) -{ - if (watchdog_counter != WATCHDOG_IS_DISABLED) - { - if (machine->drv->watchdog_vblank_count) - { - /* Start a vblank based watchdog. */ - watchdog_counter = machine->drv->watchdog_vblank_count; - } - else if (attotime_compare(machine->drv->watchdog_time, attotime_zero) != 0) - { - /* Start a time based watchdog. */ - if (alloc_new) - watchdog_timer = timer_alloc(watchdog_callback, NULL); - timer_adjust(watchdog_timer, machine->drv->watchdog_time, 0, attotime_zero); - watchdog_counter = WATCHDOG_IS_TIMER_BASED; - } - else if (watchdog_counter == WATCHDOG_IS_INVALID) - { - /* The watchdog was not initialized in the MACHINE_DRIVER, - * so we will start with it disabled. - */ - watchdog_counter = WATCHDOG_IS_STARTED_DISABLED; - } - else - { - /* The watchdog was not initialized in the MACHINE_DRIVER. - * But it has been manually started, so we will default to - * using a vblank watchdog. We will set up a default time - * of 3 times the refresh rate. Which is 3 seconds @ 60Hz - * refresh. - - * The 3 seconds delay is targeted at qzshowby, which otherwise - * would reset at the start of a game. - */ - watchdog_counter = 3 * ATTOSECONDS_TO_HZ(machine->screen[0].refresh); - } - } -} - - - -/************************************* - * - * Watchdog reset - * - *************************************/ - -void watchdog_reset(running_machine *machine) -{ - if (watchdog_counter == WATCHDOG_IS_TIMER_BASED) - { - timer_reset(watchdog_timer, machine->drv->watchdog_time); - } - else - { - if (watchdog_counter == WATCHDOG_IS_STARTED_DISABLED) - { - watchdog_counter = WATCHDOG_IS_BEING_STARTED; - logerror("(vblank) watchdog armed by reset\n"); - } - - watchdog_setup(machine, FALSE); - } -} - - - -/************************************* - * - * Watchdog enable/disable - * - *************************************/ - -void watchdog_enable(running_machine *machine, int enable) -{ - if (!enable) - { - // Disable all timers - watchdog_counter = WATCHDOG_IS_DISABLED; - } - else - // Setup only on change from disable to enable. - // Do not setup if watchdog is disabled from machine init. - if (watchdog_counter == WATCHDOG_IS_DISABLED) - { - watchdog_counter = WATCHDOG_IS_BEING_STARTED; - watchdog_setup(machine, FALSE); - } -} - - - -#if 0 -#pragma mark - -#pragma mark CPU SCHEDULING -#endif - -/************************************* - * - * Execute all the CPUs for one - * timeslice - * - *************************************/ +/*------------------------------------------------- + cpuexec_timeslice - execute all CPUs for a + single timeslice +-------------------------------------------------*/ void cpuexec_timeslice(running_machine *machine) { @@ -552,201 +396,14 @@ void cpuexec_timeslice(running_machine *machine) -/************************************* - * - * Abort the timeslice for the - * active CPU - * - *************************************/ +/*************************************************************************** + CPU SCHEDULING +***************************************************************************/ -void activecpu_abort_timeslice(void) -{ - int current_icount; - - VERIFY_EXECUTINGCPU(activecpu_abort_timeslice); - LOG(("activecpu_abort_timeslice (CPU=%d, cycles_left=%d)\n", cpu_getexecutingcpu(), activecpu_get_icount() + 1)); - - /* swallow the remaining cycles */ - current_icount = activecpu_get_icount() + 1; - cycles_stolen += current_icount; - cycles_running -= current_icount; - activecpu_adjust_icount(-current_icount); -} - - - -/************************************* - * - * Return the current local time for - * a CPU, relative to the current - * timeslice - * - *************************************/ - -attotime cpunum_get_localtime(int cpunum) -{ - attotime result; - - VERIFY_CPUNUM(cpunum_get_localtime); - - /* if we're active, add in the time from the current slice */ - result = cpu[cpunum].localtime; - if (cpunum == cpu_getexecutingcpu()) - { - int cycles = cycles_currently_ran(); - result = attotime_add(result, ATTOTIME_IN_CYCLES(cycles, cpunum)); - } - return result; -} - - - -/************************************* - * - * Set a suspend reason for the - * given CPU - * - *************************************/ - -void cpunum_suspend(int cpunum, int reason, int eatcycles) -{ - VERIFY_CPUNUM(cpunum_suspend); - LOG(("cpunum_suspend (CPU=%d, r=%X, eat=%d)\n", cpunum, reason, eatcycles)); - - /* set the pending suspend bits, and force a resync */ - cpu[cpunum].nextsuspend |= reason; - cpu[cpunum].nexteatcycles = eatcycles; - if (cpu_getexecutingcpu() >= 0) - activecpu_abort_timeslice(); -} - - - -/************************************* - * - * Clear a suspend reason for a - * given CPU - * - *************************************/ - -void cpunum_resume(int cpunum, int reason) -{ - VERIFY_CPUNUM(cpunum_resume); - LOG(("cpunum_resume (CPU=%d, r=%X)\n", cpunum, reason)); - - /* clear the pending suspend bits, and force a resync */ - cpu[cpunum].nextsuspend &= ~reason; - if (cpu_getexecutingcpu() >= 0) - activecpu_abort_timeslice(); -} - - - -/************************************* - * - * Return true if a given CPU is - * suspended - * - *************************************/ - -int cpunum_is_suspended(int cpunum, int reason) -{ - VERIFY_CPUNUM(cpunum_suspend); - return ((cpu[cpunum].nextsuspend & reason) != 0); -} - - - -/************************************* - * - * Gets the current CPU's clock speed - * - *************************************/ - -int cpunum_get_clock(int cpunum) -{ - VERIFY_CPUNUM(cpunum_get_clock); - return cpu[cpunum].clock; -} - - - -/************************************* - * - * Sets the current CPU's clock speed - * - *************************************/ - -void cpunum_set_clock(running_machine *machine, int cpunum, int clock) -{ - VERIFY_CPUNUM(cpunum_set_clock); - - cpu[cpunum].clock = clock; - cycles_per_second[cpunum] = (double)clock * cpu[cpunum].clockscale; - attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)clock * cpu[cpunum].clockscale); - - /* re-compute the perfect interleave factor */ - compute_perfect_interleave(machine); -} - - - -void cpunum_set_clock_period(running_machine *machine, int cpunum, attoseconds_t clock_period) -{ - VERIFY_CPUNUM(cpunum_set_clock); - - cpu[cpunum].clock = ATTOSECONDS_PER_SECOND / clock_period; - cycles_per_second[cpunum] = (double) (ATTOSECONDS_PER_SECOND / clock_period) * cpu[cpunum].clockscale; - attoseconds_per_cycle[cpunum] = clock_period; - - /* re-compute the perfect interleave factor */ - compute_perfect_interleave(machine); -} - - - -/************************************* - * - * Returns the current scaling factor - * for a CPU's clock speed - * - *************************************/ - -double cpunum_get_clockscale(int cpunum) -{ - VERIFY_CPUNUM(cpunum_get_clockscale); - return cpu[cpunum].clockscale; -} - - - -/************************************* - * - * Sets the current scaling factor - * for a CPU's clock speed - * - *************************************/ - -void cpunum_set_clockscale(running_machine *machine, int cpunum, double clockscale) -{ - VERIFY_CPUNUM(cpunum_set_clockscale); - - cpu[cpunum].clockscale = clockscale; - cycles_per_second[cpunum] = (double)cpu[cpunum].clock * clockscale; - attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)cpu[cpunum].clock * clockscale); - - /* re-compute the perfect interleave factor */ - compute_perfect_interleave(machine); -} - - - -/************************************* - * - * Temporarily boosts the interleave - * factor - * - *************************************/ +/*------------------------------------------------- + cpu_boost_interleave - temporarily boosts the + interleave factor +-------------------------------------------------*/ void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration) { @@ -765,59 +422,211 @@ void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration) } +/*------------------------------------------------- + activecpu_abort_timeslice - abort execution + for the current timeslice, allowing other + CPUs to run before we run again +-------------------------------------------------*/ -#if 0 -#pragma mark - -#pragma mark TIMING HELPERS -#endif - -/************************************* - * - * Return cycles ran this iteration - * - *************************************/ - -int cycles_currently_ran(void) +void activecpu_abort_timeslice(void) { - VERIFY_EXECUTINGCPU(cycles_currently_ran); - return cycles_running - activecpu_get_icount(); + int current_icount; + + VERIFY_EXECUTINGCPU(activecpu_abort_timeslice); + LOG(("activecpu_abort_timeslice (CPU=%d, cycles_left=%d)\n", cpu_getexecutingcpu(), activecpu_get_icount() + 1)); + + /* swallow the remaining cycles */ + current_icount = activecpu_get_icount() + 1; + cycles_stolen += current_icount; + cycles_running -= current_icount; + activecpu_adjust_icount(-current_icount); +} + + +/*------------------------------------------------- + cpunum_suspend - set a suspend reason for the + given CPU +-------------------------------------------------*/ + +void cpunum_suspend(int cpunum, int reason, int eatcycles) +{ + VERIFY_CPUNUM(cpunum_suspend); + LOG(("cpunum_suspend (CPU=%d, r=%X, eat=%d)\n", cpunum, reason, eatcycles)); + + /* set the pending suspend bits, and force a resync */ + cpu[cpunum].nextsuspend |= reason; + cpu[cpunum].nexteatcycles = eatcycles; + if (cpu_getexecutingcpu() >= 0) + activecpu_abort_timeslice(); +} + + +/*------------------------------------------------- + cpunum_resume - clear a suspend reason for the + given CPU +-------------------------------------------------*/ + +void cpunum_resume(int cpunum, int reason) +{ + VERIFY_CPUNUM(cpunum_resume); + LOG(("cpunum_resume (CPU=%d, r=%X)\n", cpunum, reason)); + + /* clear the pending suspend bits, and force a resync */ + cpu[cpunum].nextsuspend &= ~reason; + if (cpu_getexecutingcpu() >= 0) + activecpu_abort_timeslice(); +} + + +/*------------------------------------------------- + cpunum_is_suspended - returns true if the + given CPU is suspended for any of the given + reasons +-------------------------------------------------*/ + +int cpunum_is_suspended(int cpunum, int reason) +{ + VERIFY_CPUNUM(cpunum_suspend); + return ((cpu[cpunum].nextsuspend & reason) != 0); } -/************************************* - * - * Return total number of CPU cycles - * for the active CPU or for a given CPU. - * - *************************************/ +/*************************************************************************** + CPU CLOCK MANAGEMENT +***************************************************************************/ + +/*------------------------------------------------- + update_clock_information - recomputes clock + information for the specified CPU +-------------------------------------------------*/ + +static void update_clock_information(running_machine *machine, int cpunum) +{ + /* recompute cps and spc */ + cycles_per_second[cpunum] = (double)cpu[cpunum].clock * cpu[cpunum].clockscale; + attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)cpu[cpunum].clock * cpu[cpunum].clockscale); + + /* re-compute the perfect interleave factor */ + compute_perfect_interleave(machine); +} + + +/*------------------------------------------------- + cpunum_get_clock - gets the given CPU's + clock speed +-------------------------------------------------*/ + +int cpunum_get_clock(int cpunum) +{ + VERIFY_CPUNUM(cpunum_get_clock); + return cpu[cpunum].clock; +} + + +/*------------------------------------------------- + cpunum_set_clock - sets the given CPU's + clock speed +-------------------------------------------------*/ + +void cpunum_set_clock(running_machine *machine, int cpunum, int clock) +{ + VERIFY_CPUNUM(cpunum_set_clock); + + cpu[cpunum].clock = clock; + update_clock_information(machine, cpunum); +} + + +/*------------------------------------------------- + cpunum_get_clockscale - returns the current + scaling factor for a CPU's clock speed +-------------------------------------------------*/ + +double cpunum_get_clockscale(int cpunum) +{ + VERIFY_CPUNUM(cpunum_get_clockscale); + return cpu[cpunum].clockscale; +} + + +/*------------------------------------------------- + cpunum_set_clockscale - sets the current + scaling factor for a CPU's clock speed +-------------------------------------------------*/ + +void cpunum_set_clockscale(running_machine *machine, int cpunum, double clockscale) +{ + VERIFY_CPUNUM(cpunum_set_clockscale); + + cpu[cpunum].clockscale = clockscale; + update_clock_information(machine, cpunum); +} + + + +/*************************************************************************** + CPU TIMING +***************************************************************************/ + +/*------------------------------------------------- + cpunum_get_localtime - returns the current + local time for a CPU +-------------------------------------------------*/ + +attotime cpunum_get_localtime(int cpunum) +{ + attotime result; + + VERIFY_CPUNUM(cpunum_get_localtime); + + /* if we're active, add in the time from the current slice */ + result = cpu[cpunum].localtime; + if (cpunum == cpu_getexecutingcpu()) + { + int cycles = cycles_running - activecpu_get_icount(); + result = attotime_add(result, ATTOTIME_IN_CYCLES(cycles, cpunum)); + } + return result; +} + + +/*------------------------------------------------- + activecpu_gettotalcycles - return the total + number of CPU cycles executed on the active + CPU +-------------------------------------------------*/ UINT64 activecpu_gettotalcycles(void) { VERIFY_ACTIVECPU(activecpu_gettotalcycles); if (activecpu == cpu_getexecutingcpu()) - return cpu[activecpu].totalcycles + cycles_currently_ran(); + return cpu[activecpu].totalcycles + cycles_running - activecpu_get_icount(); else return cpu[activecpu].totalcycles; } + +/*------------------------------------------------- + cpunum_gettotalcycles - return the total + number of CPU cycles executed on the + specified CPU +-------------------------------------------------*/ + UINT64 cpunum_gettotalcycles(int cpunum) { VERIFY_CPUNUM(cpunum_gettotalcycles); if (cpunum == cpu_getexecutingcpu()) - return cpu[cpunum].totalcycles + cycles_currently_ran(); + return cpu[cpunum].totalcycles + cycles_running - activecpu_get_icount(); else return cpu[cpunum].totalcycles; } - -/************************************* - * - * Safely eats cycles so we don't - * cross a timeslice boundary - * - *************************************/ +/*------------------------------------------------- + activecpu_eat_cycles - safely eats cycles so + we don't cross a timeslice boundary +-------------------------------------------------*/ void activecpu_eat_cycles(int cycles) { @@ -829,97 +638,112 @@ void activecpu_eat_cycles(int cycles) -/************************************* - * - * Scales a given value by the fraction - * of time elapsed between refreshes - * - *************************************/ +/*************************************************************************** + SYNCHRONIZATION HELPERS +***************************************************************************/ -int cpu_scalebyfcount(int value) +/*------------------------------------------------- + cpu_suspend_until_trigger - suspend execution + until the given trigger fires +-------------------------------------------------*/ + +static void cpunum_suspend_until_trigger(int cpunum, int trigger, int eatcycles) { - attotime refresh_elapsed = timer_timeelapsed(refresh_timer); - int result; + /* suspend the CPU immediately if it's not already */ + cpunum_suspend(cpunum, SUSPEND_REASON_TRIGGER, eatcycles); - /* shift off some bits to ensure no overflow */ - if (value < 65536) - result = value * (refresh_elapsed.attoseconds >> 16) / (refresh_period.attoseconds >> 16); - else - result = value * (refresh_elapsed.attoseconds >> 32) / (refresh_period.attoseconds >> 32); - if (value >= 0) - return (result < value) ? result : value; - else - return (result > value) ? result : value; + /* set the trigger */ + cpu[cpunum].trigger = TRIGGER_TIMESLICE; +} + + +/*------------------------------------------------- + cpu_yield - yield our current timeslice +-------------------------------------------------*/ + +void cpu_yield(void) +{ + int cpunum = cpu_getexecutingcpu(); + VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger); + cpunum_suspend_until_trigger(cpunum, TRIGGER_TIMESLICE, FALSE); +} + + +/*------------------------------------------------- + cpu_spin - burn CPU cycles until our timeslice + is up +-------------------------------------------------*/ + +void cpu_spin(void) +{ + int cpunum = cpu_getexecutingcpu(); + VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger); + cpunum_suspend_until_trigger(cpunum, TRIGGER_TIMESLICE, TRUE); +} + + +/*------------------------------------------------- + cpu_spinuntil_trigger - burn CPU cycles until + a timer trigger +-------------------------------------------------*/ + +void cpu_spinuntil_trigger(int trigger) +{ + int cpunum = cpu_getexecutingcpu(); + VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger); + cpunum_suspend_until_trigger(cpunum, trigger, TRUE); +} + + +/*------------------------------------------------- + cpunum_spinuntil_trigger - burn specified CPU + cycles until a timer trigger +-------------------------------------------------*/ + +void cpunum_spinuntil_trigger(int cpunum, int trigger) +{ + VERIFY_CPUNUM(cpunum_spinuntil_trigger); + cpunum_suspend_until_trigger(cpunum, trigger, TRUE); +} + + +/*------------------------------------------------- + cpu_spinuntil_int - burn CPU cycles until the + next interrupt +-------------------------------------------------*/ + +void cpu_spinuntil_int(void) +{ + int cpunum = cpu_getexecutingcpu(); + VERIFY_EXECUTINGCPU(cpu_spinuntil_int); + cpunum_suspend_until_trigger(cpunum, TRIGGER_INT + cpunum, TRUE); +} + + +/*------------------------------------------------- + cpu_spinuntil_time - burn CPU cycles for a + specific period of time +-------------------------------------------------*/ + +void cpu_spinuntil_time(attotime duration) +{ + static int timetrig = 0; + int cpunum = cpu_getexecutingcpu(); + VERIFY_EXECUTINGCPU(cpu_spinuntil_time); + cpunum_suspend_until_trigger(cpunum, TRIGGER_SUSPENDTIME + timetrig, TRUE); + cpu_triggertime(duration, TRIGGER_SUSPENDTIME + timetrig); + timetrig = (timetrig + 1) % 256; } -#if 0 -#pragma mark - -#pragma mark VIDEO TIMING -#endif +/*************************************************************************** + TRIGGERS +***************************************************************************/ -/************************************* - * - * Computes the VBLANK timing - * - *************************************/ - -void cpu_compute_vblank_timing(running_machine *machine) -{ - refresh_period = attotime_make(0, machine->screen[0].refresh); - - /* recompute the vblank period */ - vblank_period = attotime_make(0, machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1)); - if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE)) - { - attotime remaining = timer_timeleft(vblank_timer); - if (remaining.seconds == 0 && remaining.attoseconds == 0) - remaining = vblank_period; - timer_adjust(vblank_timer, remaining, 0, vblank_period); - } - - LOG(("cpu_compute_vblank_timing: refresh=%s vblank=%s\n", attotime_string(refresh_period, 9), attotime_string(vblank_period, 9))); -} - - - -/************************************* - * - * Returns the VBLANK state - * - *************************************/ - -int cpu_getvblank(void) -{ - return vblank; -} - - - -/************************************* - * - * Returns the current frame count - * - *************************************/ - -int cpu_getcurrentframe(void) -{ - return current_frame; -} - - - -#if 0 -#pragma mark - -#pragma mark SYNCHRONIZATION -#endif - -/************************************* - * - * Generate a specific trigger - * - *************************************/ +/*------------------------------------------------- + cpu_trigger - generate a trigger now +-------------------------------------------------*/ void cpu_trigger(running_machine *machine, int trigger) { @@ -946,12 +770,10 @@ void cpu_trigger(running_machine *machine, int trigger) } - -/************************************* - * - * Generate a trigger in the future - * - *************************************/ +/*------------------------------------------------- + cpu_triggertime - generate a trigger after a + specific period of time +-------------------------------------------------*/ static TIMER_CALLBACK( cpu_triggertime_callback ) { @@ -965,12 +787,10 @@ void cpu_triggertime(attotime duration, int trigger) } - -/************************************* - * - * Generate a trigger for an int - * - *************************************/ +/*------------------------------------------------- + cpu_triggerint - generate a trigger + corresponding to an interrupt on the given CPU +-------------------------------------------------*/ void cpu_triggerint(running_machine *machine, int cpunum) { @@ -979,121 +799,114 @@ void cpu_triggerint(running_machine *machine, int cpunum) -/************************************* - * - * Burn/yield CPU cycles until a trigger - * - *************************************/ +/*************************************************************************** + WATCHDOG TIMERS +***************************************************************************/ -void cpu_spinuntil_trigger(int trigger) +/*------------------------------------------------- + watchdog_callback - watchdog timer callback +-------------------------------------------------*/ + +static TIMER_CALLBACK( watchdog_callback ) { - int cpunum = cpu_getexecutingcpu(); - - VERIFY_EXECUTINGCPU(cpu_spinuntil_trigger); - - /* suspend the CPU immediately if it's not already */ - cpunum_suspend(cpunum, SUSPEND_REASON_TRIGGER, 1); - - /* set the trigger */ - cpu[cpunum].trigger = trigger; + logerror("reset caused by the (time) watchdog\n"); + mame_schedule_soft_reset(machine); } -void cpunum_spinuntil_trigger( int cpunum, int trigger ) + +/*------------------------------------------------- + watchdog_reset - reset the watchdog timer +-------------------------------------------------*/ + +void watchdog_reset(running_machine *machine) { - VERIFY_CPUNUM(cpunum_spinuntil_trigger); + /* if we're not enabled, skip it */ + if (!watchdog_enabled) + timer_adjust(watchdog_timer, attotime_never, 0, attotime_zero); + + /* VBLANK-based watchdog? */ + else if (machine->drv->watchdog_vblank_count != 0) + watchdog_counter = machine->drv->watchdog_vblank_count; - /* suspend the CPU immediately if it's not already */ - cpunum_suspend(cpunum, SUSPEND_REASON_TRIGGER, 1); + /* timer-based watchdog? */ + else if (attotime_compare(machine->drv->watchdog_time, attotime_zero) != 0) + timer_adjust(watchdog_timer, machine->drv->watchdog_time, 0, attotime_zero); + + /* default to an obscene amount of time (3 seconds) */ + else + timer_adjust(watchdog_timer, ATTOTIME_IN_SEC(3), 0, attotime_zero); +} - /* set the trigger */ - cpu[cpunum].trigger = trigger; + +/*------------------------------------------------- + watchdog_enable - reset the watchdog timer +-------------------------------------------------*/ + +void watchdog_enable(running_machine *machine, int enable) +{ + /* when re-enabled, we reset our state */ + if (watchdog_enabled != enable) + { + watchdog_enabled = enable; + watchdog_reset(machine); + } } -/************************************* - * - * Burn/yield CPU cycles until an - * interrupt - * - *************************************/ +/*************************************************************************** + CHEESY FAKE VIDEO TIMING +***************************************************************************/ -void cpu_spinuntil_int(void) +/*------------------------------------------------- + cpu_compute_vblank_timing - recompute cheesy + VBLANK timing after a video change +-------------------------------------------------*/ + +void cpu_compute_vblank_timing(running_machine *machine) { - VERIFY_EXECUTINGCPU(cpu_spinuntil_int); - cpu_spinuntil_trigger(TRIGGER_INT + activecpu); + refresh_period = attotime_make(0, machine->screen[0].refresh); + + /* recompute the vblank period */ + vblank_period = attotime_make(0, machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1)); + if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE)) + { + attotime remaining = timer_timeleft(vblank_timer); + if (remaining.seconds == 0 && remaining.attoseconds == 0) + remaining = vblank_period; + timer_adjust(vblank_timer, remaining, 0, vblank_period); + } + + LOG(("cpu_compute_vblank_timing: refresh=%s vblank=%s\n", attotime_string(refresh_period, 9), attotime_string(vblank_period, 9))); } +/*------------------------------------------------- + cpu_scalebyfcount - scale by time between + refresh timers +-------------------------------------------------*/ -/************************************* - * - * Burn/yield CPU cycles until the - * end of the current timeslice - * - *************************************/ - -void cpu_spin(void) +int cpu_scalebyfcount(int value) { - cpu_spinuntil_trigger(TRIGGER_TIMESLICE); + attotime refresh_elapsed = timer_timeelapsed(refresh_timer); + int result; + + /* shift off some bits to ensure no overflow */ + if (value < 65536) + result = value * (refresh_elapsed.attoseconds >> 16) / (refresh_period.attoseconds >> 16); + else + result = value * (refresh_elapsed.attoseconds >> 32) / (refresh_period.attoseconds >> 32); + if (value >= 0) + return (result < value) ? result : value; + else + return (result > value) ? result : value; } -void cpu_yield(void) -{ - int cpunum = cpu_getexecutingcpu(); - - VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger); - - /* suspend the CPU immediately if it's not already */ - cpunum_suspend(cpunum, SUSPEND_REASON_TRIGGER, 0); - - /* set the trigger */ - cpu[cpunum].trigger = TRIGGER_TIMESLICE; -} - - - -/************************************* - * - * Burn/yield CPU cycles for a - * specific period of time - * - *************************************/ - -void cpu_spinuntil_time(attotime duration) -{ - static int timetrig = 0; - - cpu_spinuntil_trigger(TRIGGER_SUSPENDTIME + timetrig); - cpu_triggertime(duration, TRIGGER_SUSPENDTIME + timetrig); - timetrig = (timetrig + 1) & 255; -} - - - -#if 0 -#pragma mark - -#pragma mark CORE TIMING -#endif - -/************************************* - * - * Returns the number of times the - * interrupt handler will be called - * before the end of the current - * video frame. - * - *************************************/ - -/*-------------------------------------------------------------- - - This can be useful to interrupt handlers to synchronize - their operation. If you call this from outside an interrupt - handler, add 1 to the result, i.e. if it returns 0, it means - that the interrupt handler will be called once. - ---------------------------------------------------------------*/ +/*------------------------------------------------- + cpu_getiloops - return the cheesy VBLANK + interrupt counter (deprecated) +-------------------------------------------------*/ int cpu_getiloops(void) { @@ -1102,13 +915,37 @@ int cpu_getiloops(void) } +/*------------------------------------------------- + cpu_getvblank - return the cheesy VBLANK + state (deprecated) +-------------------------------------------------*/ -/************************************* - * - * Hook for updating things on the - * real VBLANK (once per frame) - * - *************************************/ +int cpu_getvblank(void) +{ + return vblank; +} + + +/*------------------------------------------------- + cpu_getcurrentframe - return the current + frame count (deprecated) +-------------------------------------------------*/ + +int cpu_getcurrentframe(void) +{ + return current_frame; +} + + + +/*************************************************************************** + INTERNAL TIMING +***************************************************************************/ + +/*------------------------------------------------- + cpu_vblankreset - hook for updating things on + cheesy fake VBLANK (once per frame) +-------------------------------------------------*/ static void cpu_vblankreset(running_machine *machine) { @@ -1121,14 +958,8 @@ static void cpu_vblankreset(running_machine *machine) input_port_vblank_start(); /* check the watchdog */ - if (watchdog_counter > 0) - { - if (--watchdog_counter == 0) - { - logerror("reset caused by the (vblank) watchdog\n"); - mame_schedule_soft_reset(machine); - } - } + if (machine->drv->watchdog_vblank_count != 0 && --watchdog_counter == 0) + watchdog_callback(machine, NULL, 0); /* reset the cycle counters */ for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) @@ -1141,12 +972,10 @@ static void cpu_vblankreset(running_machine *machine) } - -/************************************* - * - * First-run callback for VBLANKs - * - *************************************/ +/*------------------------------------------------- + cpu_firstvblankcallback - timer callback for + the first fake VBLANK +-------------------------------------------------*/ static TIMER_CALLBACK( cpu_firstvblankcallback ) { @@ -1158,12 +987,10 @@ static TIMER_CALLBACK( cpu_firstvblankcallback ) } - -/************************************* - * - * VBLANK core handler - * - *************************************/ +/*------------------------------------------------- + cpu_vblankcallback - timer callback for + subsequent fake VBLANKs +-------------------------------------------------*/ static TIMER_CALLBACK( cpu_vblankcallback ) { @@ -1231,12 +1058,10 @@ static TIMER_CALLBACK( cpu_vblankcallback ) } - -/************************************* - * - * End-of-VBLANK callback - * - *************************************/ +/*------------------------------------------------- + cpu_updatecallback - timer callback for + the fake end of VBLANK +-------------------------------------------------*/ static TIMER_CALLBACK( cpu_updatecallback ) { @@ -1256,18 +1081,15 @@ static TIMER_CALLBACK( cpu_updatecallback ) } - -/************************************* - * - * Callback for timed interrupts - * (not tied to a VBLANK) - * - *************************************/ +/*------------------------------------------------- + cpu_timedintcallback - timer callback for + timed interrupts +-------------------------------------------------*/ static TIMER_CALLBACK( cpu_timedintcallback ) { /* bail if there is no routine */ - if (machine->drv->cpu[param].timed_interrupt && !cpunum_is_suspended(param, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) + if (machine->drv->cpu[param].timed_interrupt != NULL && !cpunum_is_suspended(param, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) { cpuintrf_push_context(param); (*machine->drv->cpu[param].timed_interrupt)(machine, param); @@ -1276,12 +1098,10 @@ static TIMER_CALLBACK( cpu_timedintcallback ) } - -/************************************* - * - * Callback to force a timeslice - * - *************************************/ +/*------------------------------------------------- + cpu_timeslicecallback - timer callback for + timeslicing +-------------------------------------------------*/ static TIMER_CALLBACK( cpu_timeslicecallback ) { @@ -1289,13 +1109,10 @@ static TIMER_CALLBACK( cpu_timeslicecallback ) } - -/************************************* - * - * Callback to end a temporary - * interleave boost - * - *************************************/ +/*------------------------------------------------- + end_interleave_boost - timer callback to end + temporary interleave boost +-------------------------------------------------*/ static TIMER_CALLBACK( end_interleave_boost ) { @@ -1304,13 +1121,10 @@ static TIMER_CALLBACK( end_interleave_boost ) } - -/************************************* - * - * Compute the "perfect" interleave - * interval - * - *************************************/ +/*------------------------------------------------- + compute_perfect_interleave - compute the + "perfect" interleave interval +-------------------------------------------------*/ static void compute_perfect_interleave(running_machine *machine) { @@ -1340,18 +1154,18 @@ static void compute_perfect_interleave(running_machine *machine) } - -/************************************* - * - * Setup all the core timers - * - *************************************/ +/*------------------------------------------------- + cpu_inittimers - set up all the core timers +-------------------------------------------------*/ static void cpu_inittimers(running_machine *machine) { attotime first_time; int cpunum, max, ipf; + /* allocate a timer for the watchdog */ + watchdog_timer = timer_alloc(watchdog_callback, NULL); + /* allocate a dummy timer at the minimum frequency to break things up */ ipf = machine->drv->cpu_slices_per_frame; if (ipf <= 0) @@ -1449,4 +1263,3 @@ static void cpu_inittimers(running_machine *machine) /* reset the refresh timer to get ourself back in sync */ timer_adjust(refresh_timer, attotime_never, 0, attotime_never); } - diff --git a/src/emu/cpuexec.h b/src/emu/cpuexec.h index 5edf502f804..c6d488e3332 100644 --- a/src/emu/cpuexec.h +++ b/src/emu/cpuexec.h @@ -18,7 +18,32 @@ #include "timer.h" -/* Enum listing all the CPUs */ +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +/* flags for MDRV_CPU_FLAGS */ +enum +{ + /* set this flag to disable execution of a CPU (if one is there for documentation */ + /* purposes only, for example */ + CPU_DISABLE = 0x0001 +}; + + +/* suspension reasons for cpunum_suspend */ +enum +{ + SUSPEND_REASON_HALT = 0x0001, + SUSPEND_REASON_RESET = 0x0002, + SUSPEND_REASON_SPIN = 0x0004, + SUSPEND_REASON_TRIGGER = 0x0008, + SUSPEND_REASON_DISABLE = 0x0010, + SUSPEND_ANY_REASON = ~0 +}; + + +/* list of all possible CPUs we might be compiled with */ enum _cpu_type { CPU_DUMMY, @@ -214,162 +239,102 @@ enum _cpu_type typedef enum _cpu_type cpu_type; -/************************************* - * - * CPU description for drivers - * - *************************************/ +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +/* CPU description for drivers */ typedef struct _cpu_config cpu_config; struct _cpu_config { - cpu_type type; /* index for the CPU type */ - int flags; /* flags; see #defines below */ - int clock; /* in Hertz */ + cpu_type type; /* index for the CPU type */ + int flags; /* flags; see #defines below */ + int clock; /* in Hertz */ construct_map_t construct_map[ADDRESS_SPACES][2]; /* 2 memory maps per address space */ - void (*vblank_interrupt)(running_machine *machine, int cpunum); /* for interrupts tied to VBLANK */ - int vblank_interrupts_per_frame;/* usually 1 */ - void (*timed_interrupt)(running_machine *machine, int cpunum); /* for interrupts not tied to VBLANK */ - attoseconds_t timed_interrupt_period; /* period for periodic interrupts */ - const void *reset_param; /* parameter for cpu_reset */ - const char *tag; + void (*vblank_interrupt)(running_machine *machine, int cpunum); /* for interrupts tied to VBLANK */ + int vblank_interrupts_per_frame;/* usually 1 */ + void (*timed_interrupt)(running_machine *machine, int cpunum); /* for interrupts not tied to VBLANK */ + attoseconds_t timed_interrupt_period; /* period for periodic interrupts */ + const void * reset_param; /* parameter for cpu_reset */ + const char * tag; }; -/************************************* - * - * CPU flag constants - * - *************************************/ - -enum -{ - /* set this flag to disable execution of a CPU (if one is there for documentation */ - /* purposes only, for example */ - CPU_DISABLE = 0x0001 -}; +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ +/* ----- core CPU execution ----- */ -/************************************* - * - * Core CPU execution - * - *************************************/ - -/* Prepare CPUs for execution */ +/* prepare CPUs for execution */ void cpuexec_init(running_machine *machine); -/* Execute for a single timeslice */ +/* execute for a single timeslice */ void cpuexec_timeslice(running_machine *machine); -/************************************* - * - * Optional watchdog - * - *************************************/ +/* ----- CPU scheduling----- */ -/* bang on the watchdog */ -void watchdog_reset(running_machine *machine); - -/* watchdog enabled when TRUE */ -/* timer is set to reset state when going from disable to enable */ -void watchdog_enable(running_machine *machine, int enable); - - - -/************************************* - * - * CPU scheduling - * - *************************************/ - -/* Suspension reasons */ -enum -{ - SUSPEND_REASON_HALT = 0x0001, - SUSPEND_REASON_RESET = 0x0002, - SUSPEND_REASON_SPIN = 0x0004, - SUSPEND_REASON_TRIGGER = 0x0008, - SUSPEND_REASON_DISABLE = 0x0010, - SUSPEND_ANY_REASON = ~0 -}; - -/* Suspend the given CPU for a specific reason */ -void cpunum_suspend(int cpunum, int reason, int eatcycles); - -/* Suspend the given CPU for a specific reason */ -void cpunum_resume(int cpunum, int reason); - -/* Returns true if the given CPU is suspended for any of the given reasons */ -int cpunum_is_suspended(int cpunum, int reason); - -/* Aborts the timeslice for the active CPU */ -void activecpu_abort_timeslice(void); - -/* Returns the current local time for a CPU */ -attotime cpunum_get_localtime(int cpunum); - -/* Returns the current CPU's unscaled running clock speed */ -/* If you want to know the current effective running clock - * after scaling it is just the double sec_to_cycles[cpunum] */ -int cpunum_get_clock(int cpunum); - -/* Sets the current CPU's clock speed and then adjusts for scaling */ -void cpunum_set_clock(running_machine *machine, int cpunum, int clock); -void cpunum_set_clock_period(running_machine *machine, int cpunum, attoseconds_t clock_period); - -/* Returns the current scaling factor for a CPU's clock speed */ -double cpunum_get_clockscale(int cpunum); - -/* Sets the current scaling factor for a CPU's clock speed */ -void cpunum_set_clockscale(running_machine *machine, int cpunum, double clockscale); - -/* Temporarily boosts the interleave factor */ +/* temporarily boosts the interleave factor */ void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration); +/* aborts the timeslice for the active CPU */ +void activecpu_abort_timeslice(void); + +/* suspend the given CPU for a specific reason */ +void cpunum_suspend(int cpunum, int reason, int eatcycles); + +/* resume the given CPU for a specific reason */ +void cpunum_resume(int cpunum, int reason); + +/* returns true if the given CPU is suspended for any of the given reasons */ +int cpunum_is_suspended(int cpunum, int reason); -/************************************* - * - * Timing helpers - * - *************************************/ -/* Returns the number of cycles run so far this timeslice */ -int cycles_currently_ran(void); +/* ----- CPU clock management ----- */ -/* Returns the total number of CPU cycles */ +/* returns the current CPU's unscaled running clock speed */ +int cpunum_get_clock(int cpunum); + +/* sets the current CPU's clock speed and then adjusts for scaling */ +void cpunum_set_clock(running_machine *machine, int cpunum, int clock); + +/* returns the current scaling factor for a CPU's clock speed */ +double cpunum_get_clockscale(int cpunum); + +/* sets the current scaling factor for a CPU's clock speed */ +void cpunum_set_clockscale(running_machine *machine, int cpunum, double clockscale); + + + +/* ----- CPU timing ----- */ + +/* returns the current local time for a CPU */ +attotime cpunum_get_localtime(int cpunum); + +/* returns the total number of CPU cycles */ UINT64 activecpu_gettotalcycles(void); -/* Returns the total number of CPU cycles for a given CPU */ +/* returns the total number of CPU cycles for a given CPU */ UINT64 cpunum_gettotalcycles(int cpunum); -/* Safely eats cycles so we don't cross a timeslice boundary */ +/* safely eats cycles so we don't cross a timeslice boundary */ void activecpu_eat_cycles(int cycles); -/* Scales a given value by the ratio of fcount / fperiod */ -int cpu_scalebyfcount(int value); +/* ----- synchronization helpers ----- */ -/************************************* - * - * Synchronization - * - *************************************/ +/* yield our current timeslice */ +void cpu_yield(void); -/* generate a trigger now */ -void cpu_trigger(running_machine *machine, int trigger); - -/* generate a trigger after a specific period of time */ -void cpu_triggertime(attotime duration, int trigger); - -/* generate a trigger corresponding to an interrupt on the given CPU */ -void cpu_triggerint(running_machine *machine, int cpunum); +/* burn CPU cycles until our timeslice is up */ +void cpu_spin(void); /* burn CPU cycles until a timer trigger */ void cpu_spinuntil_trigger(int trigger); @@ -380,29 +345,32 @@ void cpunum_spinuntil_trigger(int cpunum, int trigger); /* burn CPU cycles until the next interrupt */ void cpu_spinuntil_int(void); -/* burn CPU cycles until our timeslice is up */ -void cpu_spin(void); - -/* yield our current timeslice */ -void cpu_yield(void); - /* burn CPU cycles for a specific period of time */ void cpu_spinuntil_time(attotime duration); -/************************************* - * - * Core timing - * - *************************************/ +/* ----- triggers ----- */ + +/* generate a trigger now */ +void cpu_trigger(running_machine *machine, int trigger); + +/* generate a trigger after a specific period of time */ +void cpu_triggertime(attotime duration, int trigger); + +/* generate a trigger corresponding to an interrupt on the given CPU */ +void cpu_triggerint(running_machine *machine, int cpunum); + + + +/* ----- watchdog timers ----- */ + +/* reset the watchdog */ +void watchdog_reset(running_machine *machine); + +/* enable/disable the watchdog */ +void watchdog_enable(running_machine *machine, int enable); -/* Returns the number of times the interrupt handler will be called before - the end of the current video frame. This is can be useful to interrupt - handlers to synchronize their operation. If you call this from outside - an interrupt handler, add 1 to the result, i.e. if it returns 0, it means - that the interrupt handler will be called once. */ -int cpu_getiloops(void); #endif /* __CPUEXEC_H__ */ diff --git a/src/emu/deprecat.h b/src/emu/deprecat.h index 14397bd7bb7..5204d1a4af4 100644 --- a/src/emu/deprecat.h +++ b/src/emu/deprecat.h @@ -43,10 +43,26 @@ extern running_machine *Machine; * *************************************/ -/* Recomputes the VBLANK timing after, e.g., a visible area change */ -void cpu_compute_vblank_timing(running_machine *machine); - /* Returns the number of the video frame we are currently playing */ int cpu_getcurrentframe(void); + + +/************************************* + * + * Core timing + * + *************************************/ + +/* Returns the number of times the interrupt handler will be called before + the end of the current video frame. This is can be useful to interrupt + handlers to synchronize their operation. If you call this from outside + an interrupt handler, add 1 to the result, i.e. if it returns 0, it means + that the interrupt handler will be called once. */ +int cpu_getiloops(void); + +/* Scales a given value by the ratio of fcount / fperiod */ +int cpu_scalebyfcount(int value); + + #endif /* __DEPRECAT_H__ */ diff --git a/src/emu/inptport.c b/src/emu/inptport.c index 4e225625e41..9cc65c802bc 100644 --- a/src/emu/inptport.c +++ b/src/emu/inptport.c @@ -225,15 +225,6 @@ struct _input_port_init_params int current_port;/* current port index */ }; -/* Support for eXtended INP format */ -struct ext_header -{ - char header[7]; // must be "XINP" followed by NULLs - char shortname[9]; // game shortname - char version[32]; // MAME version string - UINT32 starttime; // approximate INP start time - char dummy[32]; // for possible future expansion -}; /*************************************************************************** @@ -272,14 +263,15 @@ static input_port_entry *input_ports_default; /* recorded speed read from an INP file */ static double rec_speed; -/* set to 1 if INP file being played is a standard MAME INP file */ -static int no_extended_inp; +/* set to TRUE if INP file being played is an extended INP file */ +static int extended_inp; /* for average speed calculations */ static int framecount; static double totalspeed; + /*************************************************************************** PORT HANDLER TABLES ***************************************************************************/ @@ -1155,10 +1147,10 @@ void input_port_init(running_machine *machine, const input_port_token *ipt) static void setup_playback(running_machine *machine) { const char *filename = options_get_string(mame_options(), OPTION_PLAYBACK); + ext_inp_header extinpheader; inp_header inpheader; file_error filerr; time_t started_time; - struct ext_header xheader; char check[7]; /* if no file, nothing to do */ @@ -1169,16 +1161,14 @@ static void setup_playback(running_machine *machine) filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_READ, &machine->playback_file); assert_always(filerr == FILERR_NONE, "Failed to open file for playback"); - // read first four bytes to check INP type - mame_fread(Machine->playback_file, check, 7); - mame_fseek(Machine->playback_file, 0, SEEK_SET); + /* read first four bytes to check INP type */ + mame_fread(machine->playback_file, check, 7); + mame_fseek(machine->playback_file, 0, SEEK_SET); /* Check if input file is an eXtended INP file */ - if (strncmp(check,"XINP\0\0\0",7) != 0) + extended_inp = (memcmp(check, "XINP\0\0\0", 7) == 0); + if (extended_inp) { - no_extended_inp = 1; - mame_printf_info("This INP file is not an extended INP file, extra info not available\n"); - /* read playback header */ mame_fread(machine->playback_file, &inpheader, sizeof(inpheader)); @@ -1196,24 +1186,21 @@ static void setup_playback(running_machine *machine) } else { - no_extended_inp = 0; + /* read playback header */ + mame_fread(machine->playback_file, &extinpheader, sizeof(extinpheader)); + + /* output info to console */ mame_printf_info("Extended INP file info:\n"); - - // read header - mame_fread(Machine->playback_file, &xheader, sizeof(struct ext_header)); - - // output info to console - mame_printf_info("Version string: %s\n",xheader.version); - started_time = (time_t)xheader.starttime; + mame_printf_info("Version string: %s\n", extinpheader.version); + started_time = (time_t)extinpheader.starttime; mame_printf_info("Start time: %s\n", ctime(&started_time)); - // verify header against current game - if (strcmp(machine->gamedrv->name, xheader.shortname) != 0) - fatalerror("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", xheader.shortname, machine->gamedrv->name); + /* verify header against current game */ + if (strcmp(machine->gamedrv->name, extinpheader.shortname) != 0) + fatalerror("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", extinpheader.shortname, machine->gamedrv->name); else mame_printf_info("Playing back previously recorded " GAMENOUN " %s\n", machine->gamedrv->name); } - } @@ -2790,12 +2777,12 @@ static void update_playback_record(int portnum, UINT32 portvalue) { mame_fclose(Machine->playback_file); Machine->playback_file = NULL; - if(no_extended_inp) + if (!extended_inp) popmessage("End of playback"); else { - popmessage("End of playback - %i frames - Average speed %f%%",framecount,(double)totalspeed/framecount); - printf("End of playback - %i frames - Average speed %f%%\n",framecount,(double)totalspeed/framecount); + popmessage("End of playback - %i frames - Average speed %f%%", framecount, (double)totalspeed/framecount); + printf("End of playback - %i frames - Average speed %f%%\n", framecount, (double)totalspeed/framecount); } } } @@ -3008,7 +2995,7 @@ profiler_mark(PROFILER_INPUT); } /* store speed read from INP file, if extended INP */ - if (Machine->playback_file != NULL && !no_extended_inp) + if (Machine->playback_file != NULL && extended_inp) { UINT32 dummy; mame_fread(Machine->playback_file, &rec_speed, sizeof(rec_speed)); diff --git a/src/emu/inptport.h b/src/emu/inptport.h index 299b16a855a..b0de99b0eba 100644 --- a/src/emu/inptport.h +++ b/src/emu/inptport.h @@ -597,7 +597,7 @@ struct _input_port_entry #ifdef MESS struct { - unicode_char chars[3];/* (MESS-specific) unicode key data */ + unicode_char chars[3]; /* (MESS-specific) unicode key data */ } keyboard; #endif /* MESS */ }; @@ -606,9 +606,20 @@ struct _input_port_entry typedef struct _inp_header inp_header; struct _inp_header { - char name[9]; /* 8 bytes for game->name + NUL */ - char version[3]; /* byte[0] = 0, byte[1] = version byte[2] = beta_version */ - char reserved[20]; /* for future use, possible store game options? */ + char name[9]; /* 8 bytes for game->name + NUL */ + char version[3]; /* byte[0] = 0, byte[1] = version byte[2] = beta_version */ + char reserved[20]; /* for future use, possible store game options? */ +}; + + +typedef struct _ext_inp_header ext_inp_header; +struct _ext_inp_header +{ + char header[7]; /* must be "XINP" followed by NULLs */ + char shortname[9]; /* game shortname */ + char version[32]; /* MAME version string */ + UINT32 starttime; /* approximate INP start time */ + char dummy[32]; /* for possible future expansion */ }; diff --git a/src/emu/video.c b/src/emu/video.c index c1c6c2701ef..81c77d129f3 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -756,7 +756,10 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle * } /* recompute the VBLANK timing */ - cpu_compute_vblank_timing(Machine); + { + extern void cpu_compute_vblank_timing(running_machine *machine); + cpu_compute_vblank_timing(Machine); + } /* if we are on scanline 0 already, reset the update timer immediately */ /* otherwise, defer until the next scanline 0 */ diff --git a/src/emu/video/v9938.c b/src/emu/video/v9938.c index 441ea9028aa..014ccfbc9ad 100644 --- a/src/emu/video/v9938.c +++ b/src/emu/video/v9938.c @@ -601,7 +601,7 @@ static void v9938_register_write (int reg, int data) READ8_HANDLER (v9938_status_r) { - int reg, n; + int reg; UINT8 ret; vdp.cmd_write_first = 0; @@ -625,9 +625,15 @@ static void v9938_register_write (int reg, int data) break; case 2: /*v9938_update_command ();*/ +/* + WTF is this? Whatever this was intended to do, it is nonsensical. + Might as well pick a random number.... n = cycles_currently_ran (); if ( (n < 28) || (n > 199) ) vdp.statReg[2] |= 0x20; else vdp.statReg[2] &= ~0x20; +*/ + if (mame_rand(Machine) & 1) vdp.statReg[2] |= 0x20; + else vdp.statReg[2] &= ~0x20; ret = vdp.statReg[2]; break; case 3: diff --git a/src/mame/drivers/1942.c b/src/mame/drivers/1942.c index 49f041c153f..d2716a4d5ad 100644 --- a/src/mame/drivers/1942.c +++ b/src/mame/drivers/1942.c @@ -73,6 +73,7 @@ There are no static local variables. ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" diff --git a/src/mame/drivers/acommand.c b/src/mame/drivers/acommand.c index 3c5476ea4ae..bed3e02f44b 100644 --- a/src/mame/drivers/acommand.c +++ b/src/mame/drivers/acommand.c @@ -53,6 +53,7 @@ JALCF1 BIN 1,048,576 02-07-99 1:11a JALCF1.BIN *******************************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/okim6295.h" static tilemap *tx_tilemap,*bg_tilemap; diff --git a/src/mame/drivers/bionicc.c b/src/mame/drivers/bionicc.c index 32acd667c9a..965545db45b 100644 --- a/src/mame/drivers/bionicc.c +++ b/src/mame/drivers/bionicc.c @@ -54,6 +54,7 @@ ToDo: ********************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/2151intf.h" diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c index fa873914525..7892f385e0c 100644 --- a/src/mame/drivers/cidelsa.c +++ b/src/mame/drivers/cidelsa.c @@ -1,4 +1,5 @@ #include "driver.h" +#include "deprecat.h" #include "cpu/cdp1802/cdp1802.h" #include "cpu/cop400/cop400.h" #include "video/cdp1869.h" diff --git a/src/mame/drivers/cinemat.c b/src/mame/drivers/cinemat.c index 0601fb8f8a5..488458e4f45 100644 --- a/src/mame/drivers/cinemat.c +++ b/src/mame/drivers/cinemat.c @@ -30,6 +30,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "video/vector.h" #include "cpu/ccpu/ccpu.h" #include "cinemat.h" diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c index 6c565510938..dba72dc5581 100644 --- a/src/mame/drivers/coolridr.c +++ b/src/mame/drivers/coolridr.c @@ -68,8 +68,8 @@ SEGA CUSTOM IC : */ -#include #include "driver.h" +#include "deprecat.h" #include "sound/scsp.h" /* video */ diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c index be430e5d5b8..5794d61050d 100644 --- a/src/mame/drivers/cosmic.c +++ b/src/mame/drivers/cosmic.c @@ -12,6 +12,7 @@ Devil Zone - 8022 #include "driver.h" +#include "deprecat.h" #include "cpu/z80/z80.h" #include "sound/samples.h" #include "sound/dac.h" diff --git a/src/mame/drivers/darkhors.c b/src/mame/drivers/darkhors.c index 5a24178202a..9bebb95e99e 100644 --- a/src/mame/drivers/darkhors.c +++ b/src/mame/drivers/darkhors.c @@ -55,6 +55,7 @@ To do: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "machine/eeprom.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c index 2ca54c06e34..1661a9fd8d9 100644 --- a/src/mame/drivers/darkmist.c +++ b/src/mame/drivers/darkmist.c @@ -24,6 +24,7 @@ TODO: */ #include "driver.h" +#include "deprecat.h" #include "audio/t5182.h" diff --git a/src/mame/drivers/deadang.c b/src/mame/drivers/deadang.c index 3ef1ed46331..723d1bca4c6 100644 --- a/src/mame/drivers/deadang.c +++ b/src/mame/drivers/deadang.c @@ -35,6 +35,7 @@ HSync 15.37kHz */ #include "driver.h" +#include "deprecat.h" #include "audio/seibu.h" #include "sound/2203intf.h" #include "sound/msm5205.h" diff --git a/src/mame/drivers/dwarfd.c b/src/mame/drivers/dwarfd.c index 6ac03ad878c..11700f2fc19 100644 --- a/src/mame/drivers/dwarfd.c +++ b/src/mame/drivers/dwarfd.c @@ -81,6 +81,7 @@ A ||| |______| | */ #include "driver.h" +#include "deprecat.h" #include "cpu/i8085/i8085.h" #include "sound/ay8910.h" diff --git a/src/mame/drivers/eolithsp.c b/src/mame/drivers/eolithsp.c index ac2c5bb8356..e94e7d90396 100644 --- a/src/mame/drivers/eolithsp.c +++ b/src/mame/drivers/eolithsp.c @@ -9,6 +9,7 @@ */ #include "driver.h" +#include "deprecat.h" #include "includes/eolithsp.h" static int eolith_speedup_address; diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index c473a1d36c7..78f33c36761 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -130,6 +130,7 @@ SNK/Eastern 1985 (ACT) Gekisoh ???? // Directives #include "driver.h" +#include "deprecat.h" #define HVOLTAGE_HACK 0 #define EASY_TEST_MODE 1 diff --git a/src/mame/drivers/exedexes.c b/src/mame/drivers/exedexes.c index b9ab4fd6fa0..3d380e5b0c7 100644 --- a/src/mame/drivers/exedexes.c +++ b/src/mame/drivers/exedexes.c @@ -10,6 +10,7 @@ Notes: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" #include "sound/sn76496.h" diff --git a/src/mame/drivers/fastlane.c b/src/mame/drivers/fastlane.c index 6e63d446db4..28668e6ba88 100644 --- a/src/mame/drivers/fastlane.c +++ b/src/mame/drivers/fastlane.c @@ -12,6 +12,7 @@ TODO: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "cpu/hd6309/hd6309.h" #include "video/konamiic.h" #include "sound/k007232.h" diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c index a737780ef9c..893f453a2c7 100644 --- a/src/mame/drivers/galpani2.c +++ b/src/mame/drivers/galpani2.c @@ -22,6 +22,7 @@ To Do: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "machine/eeprom.h" #include "kaneko16.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c index fd4fe6b0e6b..21750f5ec0a 100644 --- a/src/mame/drivers/galpani3.c +++ b/src/mame/drivers/galpani3.c @@ -64,6 +64,7 @@ Dumped by Uki */ #include "driver.h" +#include "deprecat.h" #include "sound/ymz280b.h" extern UINT32* skns_spc_regs; diff --git a/src/mame/drivers/gberet.c b/src/mame/drivers/gberet.c index 69626279ec8..f366c3665ee 100644 --- a/src/mame/drivers/gberet.c +++ b/src/mame/drivers/gberet.c @@ -66,6 +66,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/sn76496.h" diff --git a/src/mame/drivers/goodejan.c b/src/mame/drivers/goodejan.c index d964ebcc52f..6232bce8ed4 100644 --- a/src/mame/drivers/goodejan.c +++ b/src/mame/drivers/goodejan.c @@ -52,6 +52,7 @@ Notes: *******************************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "audio/seibu.h" #include "sound/3812intf.h" diff --git a/src/mame/drivers/gundealr.c b/src/mame/drivers/gundealr.c index bffc0b2bd10..ee5695af6b9 100644 --- a/src/mame/drivers/gundealr.c +++ b/src/mame/drivers/gundealr.c @@ -47,6 +47,7 @@ Runs in interrupt mode 0, the interrupt vectors are 0xcf (RST 08h) and ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/2203intf.h" diff --git a/src/mame/drivers/hexion.c b/src/mame/drivers/hexion.c index f43f1f058c1..da6dd5e2cc4 100644 --- a/src/mame/drivers/hexion.c +++ b/src/mame/drivers/hexion.c @@ -79,6 +79,7 @@ Notes: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/okim6295.h" #include "sound/k051649.h" diff --git a/src/mame/drivers/higemaru.c b/src/mame/drivers/higemaru.c index 66f4ceba285..c8e2f84ee61 100644 --- a/src/mame/drivers/higemaru.c +++ b/src/mame/drivers/higemaru.c @@ -7,6 +7,7 @@ driver by Mirko Buffoni ****************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" diff --git a/src/mame/drivers/igs_180.c b/src/mame/drivers/igs_180.c index 7ed59d93ec6..b2cd34e76ec 100644 --- a/src/mame/drivers/igs_180.c +++ b/src/mame/drivers/igs_180.c @@ -2,6 +2,7 @@ /* also see iqblock.c and tarzan.c */ #include "driver.h" +#include "deprecat.h" #include "cpu/z180/z180.h" #include "sound/2413intf.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/ikki.c b/src/mame/drivers/ikki.c index 9756aba3d4c..20a53859883 100644 --- a/src/mame/drivers/ikki.c +++ b/src/mame/drivers/ikki.c @@ -9,6 +9,7 @@ Ikki (c) 1985 Sun Electronics *****************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/sn76496.h" PALETTE_INIT( ikki ); diff --git a/src/mame/drivers/jackpool.c b/src/mame/drivers/jackpool.c index e2152e988e8..ac861f6f6c7 100644 --- a/src/mame/drivers/jackpool.c +++ b/src/mame/drivers/jackpool.c @@ -9,6 +9,7 @@ Copyright (C) 1992 HI-TECH Software..Brisbane, QLD Australia */ #include "driver.h" +#include "deprecat.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/labyrunr.c b/src/mame/drivers/labyrunr.c index 1dca315fec0..933481e9912 100644 --- a/src/mame/drivers/labyrunr.c +++ b/src/mame/drivers/labyrunr.c @@ -9,6 +9,7 @@ Driver by Nicola Salmoria ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "cpu/hd6309/hd6309.h" #include "video/konamiic.h" #include "sound/2203intf.h" diff --git a/src/mame/drivers/meijinsn.c b/src/mame/drivers/meijinsn.c index b6fb977e2c0..6dbbdb1efec 100644 --- a/src/mame/drivers/meijinsn.c +++ b/src/mame/drivers/meijinsn.c @@ -59,6 +59,7 @@ SOFT PSG & VOICE BY M.C & S.H */ #include "driver.h" +#include "deprecat.h" #include "video/resnet.h" #include "sound/ay8910.h" diff --git a/src/mame/drivers/olibochu.c b/src/mame/drivers/olibochu.c index c99ef94f949..d1112422c35 100644 --- a/src/mame/drivers/olibochu.c +++ b/src/mame/drivers/olibochu.c @@ -11,6 +11,7 @@ TODO: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" static tilemap *bg_tilemap; diff --git a/src/mame/drivers/panicr.c b/src/mame/drivers/panicr.c index 62aba44781f..704c09b9940 100644 --- a/src/mame/drivers/panicr.c +++ b/src/mame/drivers/panicr.c @@ -60,6 +60,7 @@ D.9B [f99cac4b] / */ #include "driver.h" +#include "deprecat.h" #include "audio/t5182.h" static tilemap *bgtilemap, *txttilemap; diff --git a/src/mame/drivers/pingpong.c b/src/mame/drivers/pingpong.c index 734825cf535..29f96c92648 100644 --- a/src/mame/drivers/pingpong.c +++ b/src/mame/drivers/pingpong.c @@ -1,4 +1,5 @@ #include "driver.h" +#include "deprecat.h" #include "sound/sn76496.h" extern WRITE8_HANDLER( pingpong_videoram_w ); diff --git a/src/mame/drivers/realbrk.c b/src/mame/drivers/realbrk.c index 15d5528afc9..95c232ab3fd 100644 --- a/src/mame/drivers/realbrk.c +++ b/src/mame/drivers/realbrk.c @@ -41,6 +41,7 @@ To Do: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "machine/tmp68301.h" #include "realbrk.h" #include "sound/2413intf.h" diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c index 240ca6d1b96..db856b45126 100644 --- a/src/mame/drivers/royalmah.c +++ b/src/mame/drivers/royalmah.c @@ -85,6 +85,7 @@ Stephh's notes (based on the games Z80 code and some tests) : ****************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "cpu/tlcs90/tlcs90.h" #include "machine/msm6242.h" #include "sound/ay8910.h" diff --git a/src/mame/drivers/shaolins.c b/src/mame/drivers/shaolins.c index 2f0e85ae3a6..6e8e8fb245d 100644 --- a/src/mame/drivers/shaolins.c +++ b/src/mame/drivers/shaolins.c @@ -7,6 +7,7 @@ driver by Allard Van Der Bas ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/sn76496.h" diff --git a/src/mame/drivers/sprcros2.c b/src/mame/drivers/sprcros2.c index 26bbcf9b595..d6db454d978 100644 --- a/src/mame/drivers/sprcros2.c +++ b/src/mame/drivers/sprcros2.c @@ -55,6 +55,7 @@ Notes: */ #include "driver.h" +#include "deprecat.h" #include "sound/sn76496.h" extern UINT8 *sprcros2_fgvideoram, *sprcros2_spriteram, *sprcros2_bgvideoram; diff --git a/src/mame/drivers/srmp2.c b/src/mame/drivers/srmp2.c index 5a5d8107e82..182e0735c4c 100644 --- a/src/mame/drivers/srmp2.c +++ b/src/mame/drivers/srmp2.c @@ -56,6 +56,7 @@ Note: #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" #include "sound/msm5205.h" diff --git a/src/mame/drivers/srumbler.c b/src/mame/drivers/srumbler.c index 6f67522d85c..f3ff615f537 100644 --- a/src/mame/drivers/srumbler.c +++ b/src/mame/drivers/srumbler.c @@ -9,6 +9,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "cpu/m6809/m6809.h" #include "sound/2203intf.h" diff --git a/src/mame/drivers/st0016.c b/src/mame/drivers/st0016.c index 9ee01c3228a..46eb7237cdc 100644 --- a/src/mame/drivers/st0016.c +++ b/src/mame/drivers/st0016.c @@ -8,6 +8,7 @@ Todo: */ #include "driver.h" +#include "deprecat.h" #include "cpu/z80/z80.h" #include "sound/st0016.h" #include "st0016.h" diff --git a/src/mame/drivers/vulgus.c b/src/mame/drivers/vulgus.c index 631a4dc73f3..8ea2697ab3e 100644 --- a/src/mame/drivers/vulgus.c +++ b/src/mame/drivers/vulgus.c @@ -40,6 +40,7 @@ c001 YM2203 #2 write ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" diff --git a/src/mame/video/gyruss.c b/src/mame/video/gyruss.c index e696975d626..833c0653b68 100644 --- a/src/mame/video/gyruss.c +++ b/src/mame/video/gyruss.c @@ -7,6 +7,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" static UINT8 flipscreen; diff --git a/src/mame/video/spdodgeb.c b/src/mame/video/spdodgeb.c index a666fc23f7e..e6c5073fae1 100644 --- a/src/mame/video/spdodgeb.c +++ b/src/mame/video/spdodgeb.c @@ -1,4 +1,5 @@ #include "driver.h" +#include "deprecat.h" #include "cpu/m6502/m6502.h" diff --git a/src/mame/video/tp84.c b/src/mame/video/tp84.c index d8f1aa39259..cb9dd59e3eb 100644 --- a/src/mame/video/tp84.c +++ b/src/mame/video/tp84.c @@ -7,6 +7,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" UINT8 *tp84_videoram2, *tp84_colorram2;