summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-11-05 16:04:56 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-11-05 16:04:56 +0000
commita33640f46d16c62ace042db3d788279006e5319e (patch)
tree550b75365697963288c5abb3bb161aaa4f0d9732 /src
parent82c3ffc15337feabd3407f3dc5fce04f98279f71 (diff)
Added concept of scheduling quanta to the timer system. Also added
means of setting the minimum useful scheduling quantum, and clamping all quanta to that value. Changed interleave/boost handling to use scheduling quanta instead of timers. Added machine parameter to cpu_boost_interleave. Updated cpuexec to compute the "perfect" interleave value taking into account the minimum number of cycles per instruction specified by the CPU core. Updated Z80 core to indicate that the minimum cpi is 2. Fixed incorrect minimum cpi in the 68020+ cores. Simplified a bit of logic in cpuexec_timeslice.
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/m68000/m68kmame.c4
-rw-r--r--src/emu/cpu/z80/z80.c2
-rw-r--r--src/emu/cpuexec.c179
-rw-r--r--src/emu/cpuexec.h3
-rw-r--r--src/emu/machine/ldv1000.c2
-rw-r--r--src/emu/machine/ldvp931.c4
-rw-r--r--src/emu/mame.c2
-rw-r--r--src/emu/mconfig.c5
-rw-r--r--src/emu/timer.c120
-rw-r--r--src/emu/timer.h7
-rw-r--r--src/mame/audio/dcs.c4
-rw-r--r--src/mame/audio/mcr.c6
-rw-r--r--src/mame/audio/segag80r.c2
-rw-r--r--src/mame/audio/segasnd.c2
-rw-r--r--src/mame/audio/snes.c2
-rw-r--r--src/mame/audio/starwars.c4
-rw-r--r--src/mame/audio/williams.c2
-rw-r--r--src/mame/drivers/coolpool.c2
-rw-r--r--src/mame/drivers/fuukifg2.c2
-rw-r--r--src/mame/drivers/galaga.c2
-rw-r--r--src/mame/drivers/gameplan.c4
-rw-r--r--src/mame/drivers/itech32.c8
-rw-r--r--src/mame/drivers/m72.c4
-rw-r--r--src/mame/drivers/neogeo.c2
-rw-r--r--src/mame/drivers/pgm.c10
-rw-r--r--src/mame/drivers/pipeline.c2
-rw-r--r--src/mame/drivers/segag80r.c2
-rw-r--r--src/mame/drivers/segaorun.c2
-rw-r--r--src/mame/drivers/segas16a.c2
-rw-r--r--src/mame/drivers/segas18.c2
-rw-r--r--src/mame/drivers/segaxbd.c6
-rw-r--r--src/mame/drivers/segaybd.c2
-rw-r--r--src/mame/drivers/stv.c4
-rw-r--r--src/mame/drivers/superqix.c2
-rw-r--r--src/mame/drivers/tumbleb.c2
-rw-r--r--src/mame/drivers/xain.c2
-rw-r--r--src/mame/machine/arkanoid.c2
-rw-r--r--src/mame/machine/asic65.c6
-rw-r--r--src/mame/machine/atarigen.c4
-rw-r--r--src/mame/machine/pitnrun.c2
-rw-r--r--src/mame/machine/qix.c2
-rw-r--r--src/mame/machine/slikshot.c2
-rw-r--r--src/mame/machine/snes.c2
-rw-r--r--src/mame/machine/taitosj.c4
-rw-r--r--src/mame/machine/vertigo.c2
45 files changed, 253 insertions, 185 deletions
diff --git a/src/emu/cpu/m68000/m68kmame.c b/src/emu/cpu/m68000/m68kmame.c
index 46df696283a..b4bc9ef0dca 100644
--- a/src/emu/cpu/m68000/m68kmame.c
+++ b/src/emu/cpu/m68000/m68kmame.c
@@ -862,7 +862,7 @@ void m68020_get_info(UINT32 state, cpuinfo *info)
case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break;
case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 2; break;
case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 20; break;
- case CPUINFO_INT_MIN_CYCLES: info->i = 4; break;
+ case CPUINFO_INT_MIN_CYCLES: info->i = 2; break;
case CPUINFO_INT_MAX_CYCLES: info->i = 158; break;
case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32; break;
@@ -1100,7 +1100,7 @@ void m68040_get_info(UINT32 state, cpuinfo *info)
case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break;
case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 2; break;
case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 20; break;
- case CPUINFO_INT_MIN_CYCLES: info->i = 4; break;
+ case CPUINFO_INT_MIN_CYCLES: info->i = 2; break;
case CPUINFO_INT_MAX_CYCLES: info->i = 158; break;
case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32; break;
diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c
index 20bf8b779f6..139c7043b8c 100644
--- a/src/emu/cpu/z80/z80.c
+++ b/src/emu/cpu/z80/z80.c
@@ -3768,7 +3768,7 @@ void z80_get_info(UINT32 state, cpuinfo *info)
case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break;
case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 1; break;
case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 4; break;
- case CPUINFO_INT_MIN_CYCLES: info->i = 1; break;
+ case CPUINFO_INT_MIN_CYCLES: info->i = 2; break;
case CPUINFO_INT_MAX_CYCLES: info->i = 16; break;
case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 8; break;
diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c
index e502d940df9..4ad6fff0187 100644
--- a/src/emu/cpuexec.c
+++ b/src/emu/cpuexec.c
@@ -51,7 +51,6 @@
/* internal trigger IDs */
enum
{
- TRIGGER_TIMESLICE = -1000,
TRIGGER_INT = -2000,
TRIGGER_YIELDTIME = -3000,
TRIGGER_SUSPENDTIME = -4000
@@ -99,15 +98,6 @@ static int cycles_running;
static int cycles_stolen;
-/* timer variables */
-static emu_timer *timeslice_timer;
-static attotime timeslice_period;
-
-static emu_timer *interleave_boost_timer;
-static emu_timer *interleave_boost_timer_end;
-static attotime perfect_interleave;
-
-
/***************************************************************************
FUNCTION PROTOTYPES
@@ -117,7 +107,6 @@ static void cpuexec_exit(running_machine *machine);
static void cpuexec_reset(running_machine *machine);
static void cpu_inittimers(running_machine *machine);
static void update_clock_information(running_machine *machine, int cpunum);
-static TIMER_CALLBACK( end_interleave_boost );
static TIMER_CALLBACK( trigger_partial_frame_interrupt );
static void compute_perfect_interleave(running_machine *machine);
@@ -189,10 +178,6 @@ void cpuexec_init(running_machine *machine)
}
add_reset_callback(machine, cpuexec_reset);
add_exit_callback(machine, cpuexec_exit);
-
- /* allocate timers to handle interleave boosts */
- interleave_boost_timer = timer_alloc(NULL, NULL);
- interleave_boost_timer_end = timer_alloc(end_interleave_boost, NULL);
}
@@ -254,32 +239,28 @@ void cpuexec_timeslice(running_machine *machine)
LOG(("------------------\n"));
LOG(("cpu_timeslice: target = %s\n", attotime_string(target, 9)));
- /* process any pending suspends */
+ /* apply pending suspension changes */
for (cpunum = 0; machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{
- if (cpu[cpunum].suspend != cpu[cpunum].nextsuspend)
- LOG(("--> updated CPU%d suspend from %X to %X\n", cpunum, cpu[cpunum].suspend, cpu[cpunum].nextsuspend));
- cpu[cpunum].suspend = cpu[cpunum].nextsuspend;
- cpu[cpunum].eatcycles = cpu[cpunum].nexteatcycles;
+ cpuexec_data *cpudata = &cpu[cpunum];
+ cpudata->suspend = cpudata->nextsuspend;
+ cpudata->nextsuspend &= ~SUSPEND_REASON_TIMESLICE;
+ cpudata->eatcycles = cpudata->nexteatcycles;
}
- /* loop over CPUs */
+ /* loop over non-suspended CPUs */
for (cpunum = 0; machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{
- /* only process if we're not suspended */
- if (!cpu[cpunum].suspend)
+ cpuexec_data *cpudata = &cpu[cpunum];
+ if (cpudata->suspend == 0)
{
- attotime delta = attotime_sub(target, cpu[cpunum].localtime);
- if (delta.seconds >= 0)
+ attotime delta = attotime_sub(target, cpudata->localtime);
+ if (delta.seconds >= 0 && delta.attoseconds >= attoseconds_per_cycle[cpunum])
{
-
- /* compute how long to run */
- cycles_running = ATTOTIME_TO_CYCLES(cpunum, attotime_sub(target, cpu[cpunum].localtime));
- LOG((" cpu %d: %d cycles\n", cpunum, cycles_running));
+ /* compute how long to run */
+ cycles_running = ATTOTIME_TO_CYCLES(cpunum, delta);
+ LOG((" cpu %d: %d cycles\n", cpunum, cycles_running));
- /* run for the requested number of cycles */
- if (cycles_running > 0)
- {
profiler_mark(PROFILER_CPU1 + cpunum);
/* note that this global variable cycles_stolen can be modified */
@@ -298,44 +279,36 @@ void cpuexec_timeslice(running_machine *machine)
profiler_mark(PROFILER_END);
/* account for these cycles */
- cpu[cpunum].totalcycles += ran;
- cpu[cpunum].localtime = attotime_add(cpu[cpunum].localtime, ATTOTIME_IN_CYCLES(ran, cpunum));
- LOG((" %d ran, %d total, time = %s\n", ran, (INT32)cpu[cpunum].totalcycles, attotime_string(cpu[cpunum].localtime, 9)));
+ cpudata->totalcycles += ran;
+ cpudata->localtime = attotime_add_attoseconds(cpudata->localtime, ran * attoseconds_per_cycle[cpunum]);
+ LOG((" %d ran, %d total, time = %s\n", ran, (INT32)cpudata->totalcycles, attotime_string(cpudata->localtime, 9)));
/* if the new local CPU time is less than our target, move the target up */
- if (attotime_compare(cpu[cpunum].localtime, target) < 0)
+ if (attotime_compare(cpudata->localtime, target) < 0)
{
- if (attotime_compare(cpu[cpunum].localtime, base) > 0)
- target = cpu[cpunum].localtime;
- else
- target = base;
+ target = attotime_max(cpudata->localtime, base);
LOG((" (new target)\n"));
}
}
- }
}
}
/* update the local times of all CPUs */
for (cpunum = 0; machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{
+ cpuexec_data *cpudata = &cpu[cpunum];
+
/* if we're suspended and counting, process */
- if (cpu[cpunum].suspend && cpu[cpunum].eatcycles && attotime_compare(cpu[cpunum].localtime, target) < 0)
+ if (cpudata->suspend != 0 && cpudata->eatcycles && attotime_compare(cpudata->localtime, target) < 0)
{
/* compute how long to run */
- cycles_running = ATTOTIME_TO_CYCLES(cpunum, attotime_sub(target, cpu[cpunum].localtime));
+ cycles_running = ATTOTIME_TO_CYCLES(cpunum, attotime_sub(target, cpudata->localtime));
LOG((" cpu %d: %d cycles (suspended)\n", cpunum, cycles_running));
- cpu[cpunum].totalcycles += cycles_running;
- cpu[cpunum].localtime = attotime_add(cpu[cpunum].localtime, ATTOTIME_IN_CYCLES(cycles_running, cpunum));
- LOG((" %d skipped, %d total, time = %s\n", cycles_running, (INT32)cpu[cpunum].totalcycles, attotime_string(cpu[cpunum].localtime, 9)));
+ cpudata->totalcycles += cycles_running;
+ cpudata->localtime = attotime_add(cpudata->localtime, ATTOTIME_IN_CYCLES(cycles_running, cpunum));
+ LOG((" %d skipped, %d total, time = %s\n", cycles_running, (INT32)cpudata->totalcycles, attotime_string(cpudata->localtime, 9)));
}
-
- /* update the suspend state */
- if (cpu[cpunum].suspend != cpu[cpunum].nextsuspend)
- LOG(("--> updated CPU%d suspend from %X to %X\n", cpunum, cpu[cpunum].suspend, cpu[cpunum].nextsuspend));
- cpu[cpunum].suspend = cpu[cpunum].nextsuspend;
- cpu[cpunum].eatcycles = cpu[cpunum].nexteatcycles;
}
/* update the global time */
@@ -353,20 +326,12 @@ void cpuexec_timeslice(running_machine *machine)
interleave factor
-------------------------------------------------*/
-void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration)
+void cpu_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration)
{
- /* if you pass 0 for the timeslice_time, it means pick something reasonable */
- if (attotime_compare(timeslice_time, perfect_interleave) < 0)
- timeslice_time = perfect_interleave;
-
- LOG(("cpu_boost_interleave(%s, %s)\n", attotime_string(timeslice_time, 9), attotime_string(boost_duration, 9)));
-
- /* adjust the interleave timer */
- timer_adjust_periodic(interleave_boost_timer, timeslice_time, 0, timeslice_time);
-
- /* adjust the end timer, but only if we are going to extend it */
- if (!timer_enabled(interleave_boost_timer_end) || attotime_compare(timer_timeleft(interleave_boost_timer_end), boost_duration) < 0)
- timer_adjust_oneshot(interleave_boost_timer_end, boost_duration, 0);
+ /* ignore timeslices > 1 second */
+ if (timeslice_time.seconds > 0)
+ return;
+ timer_add_scheduling_quantum(machine, timeslice_time.attoseconds, boost_duration);
}
@@ -400,12 +365,8 @@ 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();
}
@@ -418,11 +379,7 @@ 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();
}
@@ -612,8 +569,8 @@ static void cpunum_suspend_until_trigger(int cpunum, int trigger, int eatcycles)
void cpu_yield(void)
{
int cpunum = cpu_getexecutingcpu();
- VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger);
- cpunum_suspend_until_trigger(cpunum, TRIGGER_TIMESLICE, FALSE);
+ VERIFY_EXECUTINGCPU(cpu_yield);
+ cpunum_suspend(cpunum, SUSPEND_REASON_TIMESLICE, FALSE);
}
@@ -625,8 +582,8 @@ void cpu_yield(void)
void cpu_spin(void)
{
int cpunum = cpu_getexecutingcpu();
- VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger);
- cpunum_suspend_until_trigger(cpunum, TRIGGER_TIMESLICE, TRUE);
+ VERIFY_EXECUTINGCPU(cpu_spin);
+ cpunum_suspend(cpunum, SUSPEND_REASON_TIMESLICE, TRUE);
}
@@ -873,59 +830,39 @@ static TIMER_CALLBACK( cpu_timedintcallback )
/*-------------------------------------------------
- cpu_timeslicecallback - timer callback for
- timeslicing
--------------------------------------------------*/
-
-static TIMER_CALLBACK( cpu_timeslicecallback )
-{
- cpu_trigger(machine, TRIGGER_TIMESLICE);
-}
-
-
-/*-------------------------------------------------
- end_interleave_boost - timer callback to end
- temporary interleave boost
--------------------------------------------------*/
-
-static TIMER_CALLBACK( end_interleave_boost )
-{
- timer_adjust_oneshot(interleave_boost_timer, attotime_never, 0);
- LOG(("end_interleave_boost\n"));
-}
-
-
-/*-------------------------------------------------
compute_perfect_interleave - compute the
"perfect" interleave interval
-------------------------------------------------*/
static void compute_perfect_interleave(running_machine *machine)
{
- attoseconds_t smallest = attoseconds_per_cycle[0];
- int cpunum;
+ if (attoseconds_per_cycle[0] != 0)
+ {
+ attoseconds_t smallest = attoseconds_per_cycle[0] * cputype_min_cycles(machine->config->cpu[0].type);
+ attoseconds_t perfect = ATTOSECONDS_PER_SECOND - 1;
+ int cpunum;
- /* start with a huge time factor and find the 2nd smallest cycle time */
- perfect_interleave = attotime_zero;
- perfect_interleave.attoseconds = ATTOSECONDS_PER_SECOND - 1;
- for (cpunum = 1; machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum++)
- if (attoseconds_per_cycle[cpunum] != 0)
- {
- /* find the 2nd smallest cycle interval */
- if (attoseconds_per_cycle[cpunum] < smallest)
+ /* start with a huge time factor and find the 2nd smallest cycle time */
+ for (cpunum = 1; machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum++)
+ if (attoseconds_per_cycle[cpunum] != 0)
{
- perfect_interleave.attoseconds = smallest;
- smallest = attoseconds_per_cycle[cpunum];
+ attoseconds_t curtime = attoseconds_per_cycle[cpunum] * cputype_min_cycles(machine->config->cpu[cpunum].type);
+
+ /* find the 2nd smallest cycle interval */
+ if (curtime < smallest)
+ {
+ perfect = smallest;
+ smallest = curtime;
+ }
+ else if (curtime < perfect)
+ perfect = attoseconds_per_cycle[cpunum];
}
- else if (attoseconds_per_cycle[cpunum] < perfect_interleave.attoseconds)
- perfect_interleave.attoseconds = attoseconds_per_cycle[cpunum];
- }
- /* adjust the final value */
- if (perfect_interleave.attoseconds == ATTOSECONDS_PER_SECOND - 1)
- perfect_interleave.attoseconds = attoseconds_per_cycle[0];
+ /* adjust the final value */
+ timer_set_minimum_quantum(machine, perfect);
- LOG(("Perfect interleave = %s, smallest = %.9f\n", attotime_string(perfect_interleave, 9), ATTOSECONDS_TO_DOUBLE(smallest)));
+ LOG(("Perfect interleave = %.9f, smallest = %.9f\n", ATTOSECONDS_TO_DOUBLE(perfect), ATTOSECONDS_TO_DOUBLE(smallest)));
+ }
}
@@ -944,9 +881,7 @@ static void cpu_inittimers(running_machine *machine)
if (ipf <= 0)
ipf = 1;
refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : video_screen_get_frame_period(machine->primary_screen).attoseconds;
- timeslice_period = attotime_make(0, refresh_attosecs / ipf);
- timeslice_timer = timer_alloc(cpu_timeslicecallback, NULL);
- timer_adjust_periodic(timeslice_timer, timeslice_period, 0, timeslice_period);
+ timer_add_scheduling_quantum(machine, refresh_attosecs / ipf, attotime_never);
/* register the interrupt handler callbacks */
for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
diff --git a/src/emu/cpuexec.h b/src/emu/cpuexec.h
index 5dbad532151..5e0a28ea54e 100644
--- a/src/emu/cpuexec.h
+++ b/src/emu/cpuexec.h
@@ -39,6 +39,7 @@ enum
SUSPEND_REASON_SPIN = 0x0004,
SUSPEND_REASON_TRIGGER = 0x0008,
SUSPEND_REASON_DISABLE = 0x0010,
+ SUSPEND_REASON_TIMESLICE= 0x0020,
SUSPEND_ANY_REASON = ~0
};
@@ -311,7 +312,7 @@ void cpuexec_timeslice(running_machine *machine);
/* ----- CPU scheduling----- */
/* temporarily boosts the interleave factor */
-void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration);
+void cpu_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration);
/* aborts the timeslice for the active CPU */
void activecpu_abort_timeslice(void);
diff --git a/src/emu/machine/ldv1000.c b/src/emu/machine/ldv1000.c
index e57f8de5733..4bbbafbf9d1 100644
--- a/src/emu/machine/ldv1000.c
+++ b/src/emu/machine/ldv1000.c
@@ -277,7 +277,7 @@ static void ldv1000_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fiel
timer_set(video_screen_get_time_until_pos(ld->screen, 19*2, 0), ld, 0, vbi_data_fetch);
/* boost interleave for the first 1ms to improve communications */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_MSEC(1));
+ cpu_boost_interleave(ld->device->machine, attotime_zero, ATTOTIME_IN_MSEC(1));
}
diff --git a/src/emu/machine/ldvp931.c b/src/emu/machine/ldvp931.c
index 88ac93f2259..5ecdcddb114 100644
--- a/src/emu/machine/ldvp931.c
+++ b/src/emu/machine/ldvp931.c
@@ -298,7 +298,7 @@ static UINT8 vp931_data_r(laserdisc_state *ld)
}
/* also boost interleave for 4 scanlines to ensure proper communications */
- cpu_boost_interleave(attotime_zero, attotime_mul(video_screen_get_scan_period(ld->screen), 4));
+ cpu_boost_interleave(ld->device->machine, attotime_zero, attotime_mul(video_screen_get_scan_period(ld->screen), 4));
return player->tocontroller;
}
@@ -632,7 +632,7 @@ static WRITE8_HANDLER( to_controller_w )
(*player->data_ready_cb)(ld->device, TRUE);
/* also boost interleave for 4 scanlines to ensure proper communications */
- cpu_boost_interleave(attotime_zero, attotime_mul(video_screen_get_scan_period(ld->screen), 4));
+ cpu_boost_interleave(ld->device->machine, attotime_zero, attotime_mul(video_screen_get_scan_period(ld->screen), 4));
}
diff --git a/src/emu/mame.c b/src/emu/mame.c
index 066190731f4..a2a05482096 100644
--- a/src/emu/mame.c
+++ b/src/emu/mame.c
@@ -349,7 +349,7 @@ int mame_execute(core_options *options)
video_frame_update(machine, FALSE);
/* handle save/load */
- if (mame->saveload_schedule_callback)
+ if (mame->saveload_schedule_callback != NULL)
(*mame->saveload_schedule_callback)(machine);
profiler_mark(PROFILER_END);
diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c
index 3e0dbe3db87..af235ac14fa 100644
--- a/src/emu/mconfig.c
+++ b/src/emu/mconfig.c
@@ -13,6 +13,11 @@
#include "devintrf.h"
#include <ctype.h>
+#if defined(_MSC_VER)
+#pragma optimize ("", off)
+#endif
+
+
/***************************************************************************
FUNCTION PROTOTYPES
diff --git a/src/emu/timer.c b/src/emu/timer.c
index 0a11d42c3e7..2144e8adee1 100644
--- a/src/emu/timer.c
+++ b/src/emu/timer.c
@@ -30,6 +30,7 @@
***************************************************************************/
#define MAX_TIMERS 256
+#define MAX_QUANTA 16
@@ -77,6 +78,21 @@ struct _timer_state
};
+/*-------------------------------------------------
+ quantum_slot - a single minimum quantum
+ request
+-------------------------------------------------*/
+
+typedef struct _quantum_slot quantum_slot;
+struct _quantum_slot
+{
+ attoseconds_t actual; /* actual duration of the quantum */
+ attoseconds_t requested; /* duration of the requested quantum */
+ attotime expire; /* absolute expiration time of this quantum */
+};
+
+
+
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
@@ -97,6 +113,11 @@ static emu_timer *callback_timer;
static int callback_timer_modified;
static attotime callback_timer_expire_time;
+/* scheduling quanta */
+static quantum_slot quantum_list[MAX_QUANTA];
+static quantum_slot *quantum_current;
+static attoseconds_t quantum_minimum;
+
/***************************************************************************
@@ -292,6 +313,14 @@ void timer_init(running_machine *machine)
timers[i].next = &timers[i+1];
timers[MAX_TIMERS-1].next = NULL;
timer_free_tail = &timers[MAX_TIMERS-1];
+
+ /* reset the quanta */
+ memset(quantum_list, 0, sizeof(quantum_list));
+ quantum_list[0].requested = ATTOSECONDS_IN_MSEC(100);
+ quantum_list[0].actual = ATTOSECONDS_IN_MSEC(100);
+ quantum_list[0].expire = attotime_never;
+ quantum_current = &quantum_list[0];
+ quantum_minimum = ATTOSECONDS_IN_NSEC(1) / 1000;
}
@@ -318,7 +347,21 @@ void timer_destructor(void *ptr, size_t size)
attotime timer_next_fire_time(void)
{
- return timer_head->expire;
+ attotime quantum_time;
+
+ /* if the current quantum has expired, find a new one */
+ if (attotime_compare(global_basetime, quantum_current->expire) >= 0)
+ {
+ int curr;
+
+ quantum_current->requested = 0;
+ quantum_current = &quantum_list[0];
+ for (curr = 1; curr < ARRAY_LENGTH(quantum_list); curr++)
+ if (quantum_list[curr].requested < quantum_current->requested)
+ quantum_current = &quantum_list[curr];
+ }
+ quantum_time = attotime_add_attoseconds(global_basetime, quantum_current->actual);
+ return attotime_min(quantum_time, timer_head->expire);
}
@@ -384,6 +427,81 @@ void timer_set_global_time(running_machine *machine, attotime newbase)
}
+/*-------------------------------------------------
+ timer_add_scheduling_quantum - add a
+ scheduling quantum; the smallest active one
+ is the one that is in use
+-------------------------------------------------*/
+
+void timer_add_scheduling_quantum(running_machine *machine, attoseconds_t quantum, attotime duration)
+{
+ attotime curtime = timer_get_time();
+ attotime expire = attotime_add(curtime, duration);
+ int curr, blank = -1;
+
+ /* a 0 request (minimum) needs to be non-zero to occupy a slot */
+ if (quantum == 0)
+ quantum = 1;
+
+ /* find an equal-duration slot or an empty slot */
+ for (curr = 1; curr < ARRAY_LENGTH(quantum_list); curr++)
+ {
+ quantum_slot *slot = &quantum_list[curr];
+
+ /* look for a matching quantum and extend it */
+ if (slot->requested == quantum)
+ {
+ slot->expire = attotime_max(slot->expire, expire);
+ return;
+ }
+
+ /* remember any empty slots in case of no match */
+ if (slot->requested == 0)
+ {
+ if (blank == -1)
+ blank = curr;
+ }
+
+ /* otherwise, expire any expired slots */
+ else if (attotime_compare(curtime, slot->expire) >= 0)
+ slot->requested = 0;
+ }
+
+ /* fatal error if no slots left */
+ assert_always(blank != -1, "Out of scheduling quantum slots!");
+
+ /* fill in the item */
+ quantum_list[blank].requested = quantum;
+ quantum_list[blank].actual = MAX(quantum_list[curr].requested, quantum_minimum);
+ quantum_list[blank].expire = expire;
+
+ /* update the minimum */
+ if (quantum < quantum_current->requested)
+ quantum_current = &quantum_list[blank];
+}
+
+
+/*-------------------------------------------------
+ timer_set_minimum_quantum - control the
+ minimum useful quantum (used by cpuexec only)
+-------------------------------------------------*/
+
+void timer_set_minimum_quantum(running_machine *machine, attoseconds_t quantum)
+{
+ int curr;
+
+ /* do nothing if nothing changed */
+ if (quantum_minimum == quantum)
+ return;
+ quantum_minimum = quantum;
+
+ /* adjust all the actuals; this doesn't affect the current */
+ for (curr = 0; curr < ARRAY_LENGTH(quantum_list); curr++)
+ if (quantum_list[curr].requested != 0)
+ quantum_list[curr].actual = MAX(quantum_list[curr].requested, quantum_minimum);
+}
+
+
/***************************************************************************
SAVE/RESTORE HELPERS
diff --git a/src/emu/timer.h b/src/emu/timer.h
index f729e3b14f2..234c1f9f398 100644
--- a/src/emu/timer.h
+++ b/src/emu/timer.h
@@ -33,6 +33,7 @@ enum
};
+
/***************************************************************************
MACROS
***************************************************************************/
@@ -178,6 +179,12 @@ attotime timer_next_fire_time(void);
/* adjust the global time; this is also where we fire the timers */
void timer_set_global_time(running_machine *machine, attotime newbase);
+/* add a scheduling quantum; the smallest active one is the one that is in use */
+void timer_add_scheduling_quantum(running_machine *machine, attoseconds_t quantum, attotime duration);
+
+/* control the minimum useful quantum (used by cpuexec only) */
+void timer_set_minimum_quantum(running_machine *machine, attoseconds_t quantum);
+
/* ----- save/restore helpers ----- */
diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c
index d136529702d..55ab3f6ebd8 100644
--- a/src/mame/audio/dcs.c
+++ b/src/mame/audio/dcs.c
@@ -1476,7 +1476,7 @@ int dcs_control_r(void)
{
/* only boost for DCS2 boards */
if (!dcs.auto_ack && !transfer.hle_enabled)
- cpu_boost_interleave(ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
+ cpu_boost_interleave(Machine, ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
return dcs.latch_control;
}
@@ -1534,7 +1534,7 @@ static void dcs_delayed_data_w(running_machine *machine, int data)
logerror("%08X:dcs_data_w(%04X)\n", activecpu_get_pc(), data);
/* boost the interleave temporarily */
- cpu_boost_interleave(ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
+ cpu_boost_interleave(machine, ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
/* set the IRQ line on the ADSP */
cpunum_set_input_line(machine, dcs.cpunum, ADSP2105_IRQ2, ASSERT_LINE);
diff --git a/src/mame/audio/mcr.c b/src/mame/audio/mcr.c
index 99b244c8e2d..5feaa562803 100644
--- a/src/mame/audio/mcr.c
+++ b/src/mame/audio/mcr.c
@@ -544,7 +544,7 @@ static TIMER_CALLBACK( csdeluxe_delayed_data_w )
/* oftentimes games will write one nibble at a time; the sync on this is very */
/* important, so we boost the interleave briefly while this happens */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
static READ16_HANDLER( csdeluxe_pia_r )
@@ -667,7 +667,7 @@ static TIMER_CALLBACK( soundsgood_delayed_data_w )
/* oftentimes games will write one nibble at a time; the sync on this is very */
/* important, so we boost the interleave briefly while this happens */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(250));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(250));
}
@@ -761,7 +761,7 @@ static TIMER_CALLBACK( turbocs_delayed_data_w )
/* oftentimes games will write one nibble at a time; the sync on this is very */
/* important, so we boost the interleave briefly while this happens */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
diff --git a/src/mame/audio/segag80r.c b/src/mame/audio/segag80r.c
index d99c8b07f33..ac1e3e23539 100644
--- a/src/mame/audio/segag80r.c
+++ b/src/mame/audio/segag80r.c
@@ -934,7 +934,7 @@ static WRITE8_DEVICE_HANDLER( n7751_command_w )
*/
n7751_command = data & 0x07;
cpunum_set_input_line(device->machine, 1, 0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(device->machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
diff --git a/src/mame/audio/segasnd.c b/src/mame/audio/segasnd.c
index 4ff54aca396..dee83f63c3f 100644
--- a/src/mame/audio/segasnd.c
+++ b/src/mame/audio/segasnd.c
@@ -363,7 +363,7 @@ WRITE8_HANDLER( sega_usb_data_w )
timer_call_after_resynch(NULL, data, delayed_usb_data_w);
/* boost the interleave so that sequences can be sent */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(250));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(250));
}
diff --git a/src/mame/audio/snes.c b/src/mame/audio/snes.c
index adc54b08d56..9828e047b36 100644
--- a/src/mame/audio/snes.c
+++ b/src/mame/audio/snes.c
@@ -1311,7 +1311,7 @@ WRITE8_HANDLER( spc_io_w )
case 0x7: /* Port 3 */
// mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset&3, activecpu_get_pc());
spc_port_out[offset - 4] = data;
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(20));
break;
case 0xA: /* Timer 0 */
case 0xB: /* Timer 1 */
diff --git a/src/mame/audio/starwars.c b/src/mame/audio/starwars.c
index 0cbf0b51add..51d4dbdd203 100644
--- a/src/mame/audio/starwars.c
+++ b/src/mame/audio/starwars.c
@@ -89,7 +89,7 @@ static TIMER_CALLBACK( sound_callback )
{
riot6532_porta_in_set(riot, 0x40, 0x40);
main_data = param;
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
@@ -132,7 +132,7 @@ static TIMER_CALLBACK( main_callback )
riot6532_porta_in_set(riot, 0x80, 0x80);
sound_data = param;
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
WRITE8_HANDLER( starwars_main_wr_w )
diff --git a/src/mame/audio/williams.c b/src/mame/audio/williams.c
index 78ab8a1a42e..fbee6504658 100644
--- a/src/mame/audio/williams.c
+++ b/src/mame/audio/williams.c
@@ -666,7 +666,7 @@ void williams_adpcm_data_w(int data)
{
cpunum_set_input_line(Machine, sound_cpunum, M6809_IRQ_LINE, ASSERT_LINE);
williams_sound_int_state = 1;
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(Machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
}
diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c
index 4a487796d8a..32189e0ac63 100644
--- a/src/mame/drivers/coolpool.c
+++ b/src/mame/drivers/coolpool.c
@@ -316,7 +316,7 @@ static TIMER_CALLBACK( deferred_iop_w )
cpunum_set_input_line(machine, 1, 0, HOLD_LINE); /* ??? I have no idea who should generate this! */
/* the DSP polls the status bit so it isn't strictly */
/* necessary to also have an IRQ */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(50));
}
diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c
index a6ccb63aa9c..830a9966795 100644
--- a/src/mame/drivers/fuukifg2.c
+++ b/src/mame/drivers/fuukifg2.c
@@ -84,7 +84,7 @@ static WRITE16_HANDLER( fuuki16_sound_command_w )
soundlatch_w(machine,0,data & 0xff);
cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
// cpu_spinuntil_time(ATTOTIME_IN_USEC(50)); // Allow the other CPU to reply
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50)); // Fixes glitching in rasters
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(50)); // Fixes glitching in rasters
}
}
diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c
index 12df6ab05e3..22b0619209f 100644
--- a/src/mame/drivers/galaga.c
+++ b/src/mame/drivers/galaga.c
@@ -899,6 +899,8 @@ static MACHINE_RESET( digdug )
{
int i;
+cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_SEC(1000));
+
/* Reset all latches */
for (i = 0;i < 8;i++)
bosco_latch_w(machine,i,0);
diff --git a/src/mame/drivers/gameplan.c b/src/mame/drivers/gameplan.c
index d2c5ff4e508..e74ddc47cf1 100644
--- a/src/mame/drivers/gameplan.c
+++ b/src/mame/drivers/gameplan.c
@@ -132,7 +132,7 @@ static WRITE8_HANDLER( audio_reset_w )
if (data == 0)
{
device_reset(state->riot);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(10));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(10));
}
}
@@ -172,7 +172,7 @@ static void r6532_irq(const device_config *device, int state)
{
cpunum_set_input_line(device->machine, 1, 0, state);
if (state == ASSERT_LINE)
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(10));
+ cpu_boost_interleave(device->machine, attotime_zero, ATTOTIME_IN_USEC(10));
}
diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c
index c60af5da96d..2ccc0dc83f2 100644
--- a/src/mame/drivers/itech32.c
+++ b/src/mame/drivers/itech32.c
@@ -788,7 +788,7 @@ static WRITE32_HANDLER( tms1_68k_ram_w )
if (offset == 0) COMBINE_DATA(tms1_boot);
if (offset == 0x382 && tms_spinning[0]) STOP_TMS_SPINNING(machine, 0);
if (!tms_spinning[0])
- cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
}
@@ -797,21 +797,21 @@ static WRITE32_HANDLER( tms2_68k_ram_w )
COMBINE_DATA(&tms2_ram[offset]);
if (offset == 0x382 && tms_spinning[1]) STOP_TMS_SPINNING(machine, 1);
if (!tms_spinning[1])
- cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
}
static WRITE32_HANDLER( tms1_trigger_w )
{
COMBINE_DATA(&tms1_ram[offset]);
- cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
}
static WRITE32_HANDLER( tms2_trigger_w )
{
COMBINE_DATA(&tms2_ram[offset]);
- cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
}
diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c
index dd47a1810e4..7f9ef341713 100644
--- a/src/mame/drivers/m72.c
+++ b/src/mame/drivers/m72.c
@@ -113,8 +113,8 @@ static MACHINE_START( m72 )
static TIMER_CALLBACK( synch_callback )
{
- //cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(8000000));
- cpu_boost_interleave(ATTOTIME_IN_HZ(MASTER_CLOCK/4/12), ATTOTIME_IN_SEC(25));
+ //cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(8000000));
+ cpu_boost_interleave(machine, ATTOTIME_IN_HZ(MASTER_CLOCK/4/12), ATTOTIME_IN_SEC(25));
}
static MACHINE_RESET( m72 )
diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c
index dd7bb7d833c..cb6e6cc812e 100644
--- a/src/mame/drivers/neogeo.c
+++ b/src/mame/drivers/neogeo.c
@@ -559,7 +559,7 @@ static WRITE16_HANDLER( audio_command_w )
audio_cpu_assert_nmi(machine);
/* boost the interleave to let the audio CPU read the command */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(50));
if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", activecpu_get_pc(), data, mem_mask);
}
diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c
index 95c40694406..2ce85d72af0 100644
--- a/src/mame/drivers/pgm.c
+++ b/src/mame/drivers/pgm.c
@@ -319,11 +319,11 @@ static WRITE32_HANDLER( arm7_latch_arm_w )
COMBINE_DATA(&arm7_latch);
#ifdef PGMARM7SPEEDHACK
-// cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+// cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
if (data!=0xaa) cpu_spinuntil_trigger(1000);
cpu_trigger(machine, 1002);
#else
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
cpu_spinuntil_time(ATTOTIME_IN_CYCLES(100, 0));
#endif
}
@@ -357,7 +357,7 @@ static WRITE16_HANDLER( arm7_latch_68k_w )
cpu_spinuntil_trigger(1002);
#else
cpunum_set_input_line(machine, 2, ARM7_FIRQ_LINE, PULSE_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(200));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(200));
cpu_spinuntil_time(ATTOTIME_IN_CYCLES(200, 2)); // give the arm time to respond (just boosting the interleave doesn't help
#endif
}
@@ -739,13 +739,13 @@ static WRITE32_HANDLER( kovsh_arm7_protlatch_w )
kovsh_lowlatch = data;
}
-// cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+// cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
// cpu_spinuntil_time(ATTOTIME_IN_CYCLES(100, 0));
}
static READ16_HANDLER( kovsh_68k_protlatch_r )
{
- //cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(200));
+ //cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(200));
cpu_spinuntil_time(ATTOTIME_IN_CYCLES(600, 0));
switch (offset)
diff --git a/src/mame/drivers/pipeline.c b/src/mame/drivers/pipeline.c
index dae5aa48de4..74e3396b91e 100644
--- a/src/mame/drivers/pipeline.c
+++ b/src/mame/drivers/pipeline.c
@@ -210,7 +210,7 @@ static TIMER_CALLBACK( protection_deferred_w )
static WRITE8_DEVICE_HANDLER(protection_w)
{
timer_call_after_resynch(NULL, data, protection_deferred_w);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(device->machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
static ADDRESS_MAP_START( cpu0_mem, ADDRESS_SPACE_PROGRAM, 8 )
diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c
index 428a744437d..449e6561151 100644
--- a/src/mame/drivers/segag80r.c
+++ b/src/mame/drivers/segag80r.c
@@ -304,7 +304,7 @@ static WRITE8_DEVICE_HANDLER( sindbadm_soundport_w )
{
soundlatch_w(device->machine,0,data);
cpunum_set_input_line(device->machine, 1, INPUT_LINE_NMI, PULSE_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50));
+ cpu_boost_interleave(device->machine, attotime_zero, ATTOTIME_IN_USEC(50));
}
diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c
index f2fb7b9f4aa..d885785a1a0 100644
--- a/src/mame/drivers/segaorun.c
+++ b/src/mame/drivers/segaorun.c
@@ -174,7 +174,7 @@ static void update_main_irqs(running_machine *machine)
cpunum_set_input_line(machine, 0, 6, vblank_irq_state && irq2_state ? ASSERT_LINE : CLEAR_LINE);
if(vblank_irq_state || irq2_state)
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c
index de3111dc1fb..9458df18ded 100644
--- a/src/mame/drivers/segas16a.c
+++ b/src/mame/drivers/segas16a.c
@@ -437,7 +437,7 @@ static WRITE8_HANDLER( n7751_control_w )
*/
cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
cpunum_set_input_line(machine, 2, 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c
index abbfe1026e8..1f26764d0ae 100644
--- a/src/mame/drivers/segas18.c
+++ b/src/mame/drivers/segas18.c
@@ -190,7 +190,7 @@ static void system18_generic_init(running_machine *machine, int _rom_board)
static TIMER_CALLBACK( boost_interleave )
{
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_MSEC(10));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_MSEC(10));
}
diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c
index e8e47d81d46..5e1acb2adac 100644
--- a/src/mame/drivers/segaxbd.c
+++ b/src/mame/drivers/segaxbd.c
@@ -107,7 +107,7 @@ static void update_main_irqs(running_machine *machine)
if (irq)
{
cpunum_set_input_line(machine, 0, irq, ASSERT_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
}
@@ -199,7 +199,7 @@ static READ8_HANDLER( sound_data_r )
static void xboard_reset(void)
{
cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, PULSE_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(Machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
@@ -455,7 +455,7 @@ static UINT16 *loffire_sync;
static WRITE16_HANDLER( loffire_sync0_w )
{
COMBINE_DATA(&loffire_sync[offset]);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(10));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(10));
}
diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c
index ef5e27fce7b..6d16a515e9b 100644
--- a/src/mame/drivers/segaybd.c
+++ b/src/mame/drivers/segaybd.c
@@ -77,7 +77,7 @@ static void update_main_irqs(running_machine *machine)
cpunum_set_input_line(machine, 2, 6, timer_irq_state && vblank_irq_state ? ASSERT_LINE : CLEAR_LINE);
if(timer_irq_state || vblank_irq_state)
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(50));
}
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index 7d6c5ddf6c5..bca98bf84eb 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -2012,7 +2012,7 @@ static WRITE32_HANDLER( stv_scsp_regs_w32 )
static WRITE32_HANDLER( minit_w )
{
logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data);
- cpu_boost_interleave(minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost));
+ cpu_boost_interleave(machine, minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost));
cpu_trigger(machine, 1000);
cpunum_set_info_int(1, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
}
@@ -2020,7 +2020,7 @@ static WRITE32_HANDLER( minit_w )
static WRITE32_HANDLER( sinit_w )
{
logerror("cpu #%d (PC=%08X) SINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data);
- cpu_boost_interleave(sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost));
+ cpu_boost_interleave(machine, sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost));
cpunum_set_info_int(0, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
}
diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c
index 13741f2f4b8..2892ed171a2 100644
--- a/src/mame/drivers/superqix.c
+++ b/src/mame/drivers/superqix.c
@@ -347,7 +347,7 @@ logerror("Z80 sends command %02x\n",param);
from_z80 = param;
from_mcu_pending = 0;
cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(200));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(200));
}
static TIMER_CALLBACK( delayed_mcu_z80_w )
diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c
index 9f259bc89a4..fd3e5fc59a7 100644
--- a/src/mame/drivers/tumbleb.c
+++ b/src/mame/drivers/tumbleb.c
@@ -839,7 +839,7 @@ static WRITE16_HANDLER( semicom_soundcmd_w )
soundlatch_w(machine,0,data & 0xff);
// needed for Super Trio which reads the sound with polling
// cpu_spinuntil_time(ATTOTIME_IN_USEC(100));
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(20));
}
}
diff --git a/src/mame/drivers/xain.c b/src/mame/drivers/xain.c
index 478b230583e..ab46ef17065 100644
--- a/src/mame/drivers/xain.c
+++ b/src/mame/drivers/xain.c
@@ -175,7 +175,7 @@ static WRITE8_HANDLER( xain_sharedram_w )
/* so let's resync every time they are changed to avoid deadlocks */
if ((offset == 0x003d || offset == 0x003e)
&& xain_sharedram[offset] != data)
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(20));
xain_sharedram[offset] = data;
}
diff --git a/src/mame/machine/arkanoid.c b/src/mame/machine/arkanoid.c
index 581dafa4a17..18a99f507dd 100644
--- a/src/mame/machine/arkanoid.c
+++ b/src/mame/machine/arkanoid.c
@@ -62,7 +62,7 @@ WRITE8_HANDLER( arkanoid_Z80_mcu_w )
{
timer_call_after_resynch(NULL, data, test);
/* boost the interleave for a few usecs to make sure it is read successfully */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(10));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(10));
}
READ8_HANDLER( arkanoid_68705_portA_r )
diff --git a/src/mame/machine/asic65.c b/src/mame/machine/asic65.c
index 6db88a92fa3..ed3e98978f3 100644
--- a/src/mame/machine/asic65.c
+++ b/src/mame/machine/asic65.c
@@ -196,7 +196,7 @@ WRITE16_HANDLER( asic65_data_w )
if (asic65.type == ASIC65_ROMBASED)
{
timer_call_after_resynch(NULL, data | (offset << 16), m68k_asic65_deferred_w);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(20));
return;
}
@@ -234,7 +234,7 @@ READ16_HANDLER( asic65_r )
if (asic65.type == ASIC65_ROMBASED)
{
asic65._68full = 0;
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(5));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(5));
return asic65._68data;
}
@@ -452,7 +452,7 @@ READ16_HANDLER( asic65_io_r )
/* bit 14 = 68FULL */
/* bit 13 = XFLG */
/* bit 12 = controlled by jumper */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(5));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(5));
return (asic65.tfull << 15) | (asic65._68full << 14) | (asic65.xflg << 13) | 0x0000;
}
else
diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c
index 5ade1ff9843..e69c27acb98 100644
--- a/src/mame/machine/atarigen.c
+++ b/src/mame/machine/atarigen.c
@@ -811,7 +811,7 @@ static TIMER_CALLBACK( delayed_sound_reset )
/* allocate a high frequency timer until a response is generated */
/* the main CPU is *very* sensistive to the timing of the response */
- cpu_boost_interleave(SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
+ cpu_boost_interleave(machine, SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
}
@@ -833,7 +833,7 @@ static TIMER_CALLBACK( delayed_sound_w )
/* allocate a high frequency timer until a response is generated */
/* the main CPU is *very* sensistive to the timing of the response */
- cpu_boost_interleave(SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
+ cpu_boost_interleave(machine, SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
}
diff --git a/src/mame/machine/pitnrun.c b/src/mame/machine/pitnrun.c
index f4d21e8f758..8f90ce5f698 100644
--- a/src/mame/machine/pitnrun.c
+++ b/src/mame/machine/pitnrun.c
@@ -43,7 +43,7 @@ static TIMER_CALLBACK( pitnrun_mcu_real_data_w )
WRITE8_HANDLER( pitnrun_mcu_data_w )
{
timer_call_after_resynch(NULL, data,pitnrun_mcu_real_data_w);
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(5));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(5));
}
READ8_HANDLER( pitnrun_mcu_status_r )
diff --git a/src/mame/machine/qix.c b/src/mame/machine/qix.c
index 74115248090..4e67c91a043 100644
--- a/src/mame/machine/qix.c
+++ b/src/mame/machine/qix.c
@@ -428,7 +428,7 @@ static WRITE8_HANDLER( qixmcu_coinctrl_w )
cpunum_set_input_line(machine, 3, M68705_IRQ_LINE, ASSERT_LINE);
/* temporarily boost the interleave to sync things up */
/* note: I'm using 50 because 30 is not enough for space dungeon at game over */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(50));
}
else
cpunum_set_input_line(machine, 3, M68705_IRQ_LINE, CLEAR_LINE);
diff --git a/src/mame/machine/slikshot.c b/src/mame/machine/slikshot.c
index e4210ec4bed..6049c086aae 100644
--- a/src/mame/machine/slikshot.c
+++ b/src/mame/machine/slikshot.c
@@ -516,7 +516,7 @@ static TIMER_CALLBACK( delayed_z80_control_w )
}
/* boost the interleave whenever this is written to */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
/* stash the new value */
z80_ctrl = data;
diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c
index a133ce0850e..e015fe952fa 100644
--- a/src/mame/machine/snes.c
+++ b/src/mame/machine/snes.c
@@ -593,7 +593,7 @@ WRITE8_HANDLER( snes_w_io )
{
// printf("816: %02x to APU @ %d\n", data, offset&3);
spc_port_in[offset & 0x3] = data;
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(20));
return;
}
diff --git a/src/mame/machine/taitosj.c b/src/mame/machine/taitosj.c
index 42aa79913a0..55c3b9310fb 100644
--- a/src/mame/machine/taitosj.c
+++ b/src/mame/machine/taitosj.c
@@ -121,13 +121,13 @@ WRITE8_HANDLER( taitosj_mcu_data_w )
LOG(("%04x: protection write %02x\n",activecpu_get_pc(),data));
timer_call_after_resynch(NULL, data,taitosj_mcu_real_data_w);
/* temporarily boost the interleave to sync things up */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(10));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(10));
}
READ8_HANDLER( taitosj_mcu_status_r )
{
/* temporarily boost the interleave to sync things up */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(10));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(10));
/* bit 0 = the 68705 has read data from the Z80 */
/* bit 1 = the 68705 has written data for the Z80 */
diff --git a/src/mame/machine/vertigo.c b/src/mame/machine/vertigo.c
index 66766023e0a..a58d5bf2872 100644
--- a/src/mame/machine/vertigo.c
+++ b/src/mame/machine/vertigo.c
@@ -181,7 +181,7 @@ static TIMER_CALLBACK( sound_command_w )
quickly. Otherwise the main CPU gives up with sound. Boosting
the interleave for a while helps. */
- cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(100));
}