mirror of
https://github.com/holub/mame
synced 2025-06-06 21:03:47 +03:00
Removed globals from cpuexec.
Removed ATTOTIME_TO_CYCLES() and ATTOTIME_IN_CYCLES(). Replaced them with functions in cpuexec: cpu_clocks_to_attotime() and cpu_attotime_to_clocks(), both of which take CPU devices instead of indexes. Updated all callers, many of which were using the functions dubiously.
This commit is contained in:
parent
dd87df6926
commit
ca3478a1fc
@ -607,7 +607,7 @@ static void adjust_timer_interrupt(void)
|
||||
{
|
||||
UINT64 clocks_until_int = hyperstone.tr_clocks_per_tick - (clocks_since_base % hyperstone.tr_clocks_per_tick);
|
||||
UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock;
|
||||
timer_adjust_oneshot(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int + 1, cpunum), cpunum * 2 + 1);
|
||||
timer_adjust_oneshot(hyperstone.timer, cpu_clocks_to_attotime(Machine->activecpu, cycles_until_int + 1), cpunum * 2 + 1);
|
||||
}
|
||||
|
||||
/* else if the timer interrupt is enabled, configure it to fire at the appropriate time */
|
||||
@ -624,7 +624,7 @@ static void adjust_timer_interrupt(void)
|
||||
{
|
||||
UINT64 clocks_until_int = mulu_32x32(delta, hyperstone.tr_clocks_per_tick);
|
||||
UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock;
|
||||
timer_adjust_oneshot(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int, cpunum), cpunum * 2 + 0);
|
||||
timer_adjust_oneshot(hyperstone.timer, cpu_clocks_to_attotime(Machine->activecpu, cycles_until_int), cpunum * 2 + 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ void mips3com_update_cycle_counting(mips3_state *mips)
|
||||
UINT32 count = (cpu_get_total_cycles(mips->device) - mips->count_zero_time) / 2;
|
||||
UINT32 compare = mips->cpr[0][COP0_Compare];
|
||||
UINT32 delta = compare - count;
|
||||
attotime newtime = ATTOTIME_IN_CYCLES(((UINT64)delta * 2), cpu_get_index(mips->device));
|
||||
attotime newtime = cpu_clocks_to_attotime(mips->device, (UINT64)delta * 2);
|
||||
timer_adjust_oneshot(mips->compare_int_timer, newtime, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ INLINE void set_decrementer(powerpc_state *ppc, UINT32 newdec)
|
||||
}
|
||||
|
||||
ppc->dec_zero_cycles = cpu_get_total_cycles(Machine->cpu[ppc->cpunum]) + cycles_until_done;
|
||||
timer_adjust_oneshot(ppc->decrementer_int_timer, ATTOTIME_IN_CYCLES(cycles_until_done, ppc->cpunum), 0);
|
||||
timer_adjust_oneshot(ppc->decrementer_int_timer, cpu_clocks_to_attotime(ppc->device, cycles_until_done), 0);
|
||||
|
||||
if ((INT32)curdec >= 0 && (INT32)newdec < 0)
|
||||
ppc->irq_pending |= 0x02;
|
||||
@ -1256,7 +1256,7 @@ static TIMER_CALLBACK( decrementer_int_callback )
|
||||
/* advance by another full rev */
|
||||
ppc->dec_zero_cycles += (UINT64)ppc->tb_divisor << 32;
|
||||
cycles_until_next = ppc->dec_zero_cycles - cpu_get_total_cycles(machine->cpu[ppc->cpunum]);
|
||||
timer_adjust_oneshot(ppc->decrementer_int_timer, ATTOTIME_IN_CYCLES(cycles_until_next, ppc->cpunum), 0);
|
||||
timer_adjust_oneshot(ppc->decrementer_int_timer, cpu_clocks_to_attotime(ppc->device, cycles_until_next), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1526,7 +1526,7 @@ static TIMER_CALLBACK( ppc4xx_fit_callback )
|
||||
UINT32 timebase = get_timebase(ppc);
|
||||
UINT32 interval = 0x200 << (4 * ((ppc->spr[SPR4XX_TCR] & PPC4XX_TCR_FP_MASK) >> 24));
|
||||
UINT32 target = (timebase + interval) & ~(interval - 1);
|
||||
timer_adjust_oneshot(ppc->fit_timer, ATTOTIME_IN_CYCLES((target + 1 - timebase) / ppc->tb_divisor, ppc->cpunum), TRUE);
|
||||
timer_adjust_oneshot(ppc->fit_timer, cpu_clocks_to_attotime(ppc->device, (target + 1 - timebase) / ppc->tb_divisor), TRUE);
|
||||
}
|
||||
|
||||
/* otherwise, turn ourself off */
|
||||
@ -1557,7 +1557,7 @@ static TIMER_CALLBACK( ppc4xx_pit_callback )
|
||||
UINT32 timebase = get_timebase(ppc);
|
||||
UINT32 interval = ppc->pit_reload;
|
||||
UINT32 target = timebase + interval;
|
||||
timer_adjust_oneshot(ppc->pit_timer, ATTOTIME_IN_CYCLES((target + 1 - timebase) / ppc->tb_divisor, ppc->cpunum), TRUE);
|
||||
timer_adjust_oneshot(ppc->pit_timer, cpu_clocks_to_attotime(ppc->device, (target + 1 - timebase) / ppc->tb_divisor), TRUE);
|
||||
}
|
||||
|
||||
/* otherwise, turn ourself off */
|
||||
|
@ -98,7 +98,7 @@ static void sh2_timer_activate(void)
|
||||
if(divider) {
|
||||
max_delta <<= divider;
|
||||
sh2->frc_base = cpu_get_total_cycles(sh2->device);
|
||||
timer_adjust_oneshot(sh2->timer, ATTOTIME_IN_CYCLES(max_delta, cpu_get_index(sh2->device)), 0);
|
||||
timer_adjust_oneshot(sh2->timer, cpu_clocks_to_attotime(sh2->device, max_delta), 0);
|
||||
} else {
|
||||
logerror("SH2.%d: Timer event in %d cycles of external clock", cpu_get_index(sh2->device), max_delta);
|
||||
}
|
||||
@ -176,7 +176,7 @@ static void sh2_dmac_check(int dma)
|
||||
LOG(("SH2: DMA %d start %x, %x, %x, %04x, %d, %d, %d\n", dma, src, dst, count, sh2->m[0x63+4*dma], incs, incd, size));
|
||||
|
||||
sh2->dma_timer_active[dma] = 1;
|
||||
timer_adjust_oneshot(sh2->dma_timer[dma], ATTOTIME_IN_CYCLES(2*count+1, cpu_get_index(sh2->device)), dma);
|
||||
timer_adjust_oneshot(sh2->dma_timer[dma], cpu_clocks_to_attotime(sh2->device, 2*count+1), dma);
|
||||
|
||||
src &= AM;
|
||||
dst &= AM;
|
||||
|
@ -462,7 +462,7 @@ static int sh4_dma_transfer(int channel, int timermode, UINT32 chcr, UINT32 *sar
|
||||
if (timermode == 1)
|
||||
{
|
||||
sh4.dma_timer_active[channel] = 1;
|
||||
timer_adjust_oneshot(sh4.dma_timer[channel], ATTOTIME_IN_CYCLES(2*count+1, sh4.cpu_number), (sh4.cpu_number << 8) | channel);
|
||||
timer_adjust_oneshot(sh4.dma_timer[channel], cpu_clocks_to_attotime(sh4.device, 2*count+1), (sh4.cpu_number << 8) | channel);
|
||||
}
|
||||
else if (timermode == 2)
|
||||
{
|
||||
|
@ -86,6 +86,7 @@ Other references can be found on spies.com:
|
||||
*/
|
||||
|
||||
#include "debugger.h"
|
||||
#include "cpuexec.h"
|
||||
#include "deprecat.h"
|
||||
#include "tms9900.h"
|
||||
|
||||
@ -933,7 +934,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
|
||||
/* read decrementer */
|
||||
if (I.decrementer_enabled && !(I.flag & 1))
|
||||
/* timer mode, timer enabled */
|
||||
return ceil(ATTOTIME_TO_CYCLES(cpunum_get_active(), attotime_div(timer_timeleft(I.timer), 16)));
|
||||
return ceil(cpu_attotime_to_clocks(I.device, attotime_div(timer_timeleft(I.timer), 16)));
|
||||
else
|
||||
/* event counter mode or timer mode, timer disabled */
|
||||
return I.decrementer_count;
|
||||
@ -997,7 +998,7 @@ WRITE8_HANDLER(tms9995_internal2_w)
|
||||
|
||||
if (I.decrementer_enabled && !(I.flag & 1))
|
||||
/* timer mode, timer enabled */
|
||||
value = ceil(ATTOTIME_TO_CYCLES(cpunum_get_active(), attotime_div(timer_timeleft(I.timer), 16)));
|
||||
value = ceil(cpu_attotime_to_clocks(I.device, attotime_div(timer_timeleft(I.timer), 16)));
|
||||
else
|
||||
/* event counter mode or timer mode, timer disabled */
|
||||
value = I.decrementer_count;
|
||||
@ -1830,7 +1831,7 @@ static void reset_decrementer(void)
|
||||
|
||||
if (I.decrementer_enabled && ! (I.flag & 1))
|
||||
{ /* timer */
|
||||
attotime period = ATTOTIME_IN_CYCLES(I.decrementer_interval * 16L, cpunum_get_active());
|
||||
attotime period = cpu_clocks_to_attotime(I.device, I.decrementer_interval * 16L);
|
||||
timer_adjust_periodic(I.timer, period, 0, period);
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +64,11 @@ struct _cpu_class_data
|
||||
/* this item must remain first */
|
||||
cpu_class_header header; /* header containing public data */
|
||||
|
||||
/* core interface */
|
||||
/* cycle counting and executing */
|
||||
UINT8 executing; /* TRUE if the values below are valid */
|
||||
int * icount; /* pointer to the icount */
|
||||
int cycles_running; /* number of cycles we are executing */
|
||||
int cycles_stolen; /* number of cycles we artificially stole */
|
||||
|
||||
/* input states and IRQ callbacks */
|
||||
cpu_irq_callback driver_irq; /* driver-specific IRQ callback */
|
||||
@ -87,6 +90,8 @@ struct _cpu_class_data
|
||||
INT32 divisor; /* 32-bit attoseconds_per_cycle divisor */
|
||||
UINT8 divshift; /* right shift amount to fit the divisor into 32 bits */
|
||||
emu_timer * timedint_timer; /* reference to this CPU's periodic interrupt timer */
|
||||
UINT32 cycles_per_second; /* cycles per second, adjusted for multipliers */
|
||||
attoseconds_t attoseconds_per_cycle; /* attoseconds per adjusted clock cycle */
|
||||
|
||||
/* these below are hacks to support multiple interrupts per frame */
|
||||
INT32 iloops; /* number of interrupts remaining this frame */
|
||||
@ -96,17 +101,6 @@ struct _cpu_class_data
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
GLOBAL VARIABLES
|
||||
***************************************************************************/
|
||||
|
||||
/* general CPU variables */
|
||||
static int cycles_running;
|
||||
static int cycles_stolen;
|
||||
static const device_config *executingcpu;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
@ -375,39 +369,39 @@ void cpuexec_timeslice(running_machine *machine)
|
||||
if (classdata->suspend == 0)
|
||||
{
|
||||
attotime delta = attotime_sub(target, classdata->localtime);
|
||||
if (delta.seconds >= 0 && delta.attoseconds >= attoseconds_per_cycle[cpunum])
|
||||
if (delta.seconds >= 0 && delta.attoseconds >= classdata->attoseconds_per_cycle)
|
||||
{
|
||||
/* compute how long to run */
|
||||
cycles_running = div_64x32(delta.attoseconds >> classdata->divshift, classdata->divisor);
|
||||
LOG((" cpu %d: %d cycles\n", cpunum, cycles_running));
|
||||
classdata->cycles_running = div_64x32(delta.attoseconds >> classdata->divshift, classdata->divisor);
|
||||
LOG((" cpu %d: %d cycles\n", cpunum, classdata->cycles_running));
|
||||
|
||||
profiler_mark(PROFILER_CPU1 + cpunum);
|
||||
|
||||
/* note that this global variable cycles_stolen can be modified */
|
||||
/* via the call to the cpunum_execute */
|
||||
cycles_stolen = 0;
|
||||
executingcpu = machine->cpu[cpunum];
|
||||
classdata->cycles_stolen = 0;
|
||||
classdata->executing = TRUE;
|
||||
if (!call_debugger)
|
||||
ran = cpu_execute(machine->cpu[cpunum], cycles_running);
|
||||
ran = cpu_execute(machine->cpu[cpunum], classdata->cycles_running);
|
||||
else
|
||||
{
|
||||
debugger_start_cpu_hook(machine->cpu[cpunum], target);
|
||||
ran = cpu_execute(machine->cpu[cpunum], cycles_running);
|
||||
ran = cpu_execute(machine->cpu[cpunum], classdata->cycles_running);
|
||||
debugger_stop_cpu_hook(machine->cpu[cpunum]);
|
||||
}
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
if (ran < cycles_stolen)
|
||||
if (ran < classdata->cycles_stolen)
|
||||
fatalerror("Negative CPU cycle count!");
|
||||
#endif /* MAME_DEBUG */
|
||||
|
||||
executingcpu = NULL;
|
||||
ran -= cycles_stolen;
|
||||
classdata->executing = FALSE;
|
||||
ran -= classdata->cycles_stolen;
|
||||
profiler_mark(PROFILER_END);
|
||||
|
||||
/* account for these cycles */
|
||||
classdata->totalcycles += ran;
|
||||
classdata->localtime = attotime_add_attoseconds(classdata->localtime, ran * attoseconds_per_cycle[cpunum]);
|
||||
classdata->localtime = attotime_add_attoseconds(classdata->localtime, ran * classdata->attoseconds_per_cycle);
|
||||
LOG((" %d ran, %d total, time = %s\n", ran, (INT32)classdata->totalcycles, attotime_string(classdata->localtime, 9)));
|
||||
|
||||
/* if the new local CPU time is less than our target, move the target up */
|
||||
@ -431,12 +425,12 @@ void cpuexec_timeslice(running_machine *machine)
|
||||
attotime delta = attotime_sub(target, classdata->localtime);
|
||||
|
||||
/* compute how long to run */
|
||||
cycles_running = div_64x32(delta.attoseconds >> classdata->divshift, classdata->divisor);
|
||||
LOG((" cpu %d: %d cycles (suspended)\n", cpunum, cycles_running));
|
||||
classdata->cycles_running = div_64x32(delta.attoseconds >> classdata->divshift, classdata->divisor);
|
||||
LOG((" cpu %d: %d cycles (suspended)\n", cpunum, classdata->cycles_running));
|
||||
|
||||
classdata->totalcycles += cycles_running;
|
||||
classdata->localtime = attotime_add_attoseconds(classdata->localtime, cycles_running * attoseconds_per_cycle[cpunum]);
|
||||
LOG((" %d skipped, %d total, time = %s\n", cycles_running, (INT32)classdata->totalcycles, attotime_string(classdata->localtime, 9)));
|
||||
classdata->totalcycles += classdata->cycles_running;
|
||||
classdata->localtime = attotime_add_attoseconds(classdata->localtime, classdata->cycles_running * classdata->attoseconds_per_cycle);
|
||||
LOG((" %d skipped, %d total, time = %s\n", classdata->cycles_running, (INT32)classdata->totalcycles, attotime_string(classdata->localtime, 9)));
|
||||
}
|
||||
|
||||
/* update the suspend state (breaks steeltal if we don't) */
|
||||
@ -499,7 +493,7 @@ void cpu_suspend(const device_config *device, int reason, int eatcycles)
|
||||
classdata->nexteatcycles = eatcycles;
|
||||
|
||||
/* if we're active, synchronize */
|
||||
if (device == executingcpu)
|
||||
if (classdata->executing)
|
||||
cpu_abort_timeslice(device);
|
||||
}
|
||||
|
||||
@ -517,7 +511,7 @@ void cpu_resume(const device_config *device, int reason)
|
||||
classdata->nextsuspend &= ~reason;
|
||||
|
||||
/* if we're active, synchronize */
|
||||
if (device == executingcpu)
|
||||
if (classdata->executing)
|
||||
cpu_abort_timeslice(device);
|
||||
}
|
||||
|
||||
@ -600,6 +594,33 @@ void cpu_set_clockscale(const device_config *device, double clockscale)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
cpu_clocks_to_attotime - converts a number of
|
||||
clock ticks to an attotime
|
||||
-------------------------------------------------*/
|
||||
|
||||
attotime cpu_clocks_to_attotime(const device_config *device, UINT32 clocks)
|
||||
{
|
||||
cpu_class_data *classdata = get_safe_classtoken(device);
|
||||
if (clocks < classdata->cycles_per_second)
|
||||
return attotime_make(0, clocks * classdata->attoseconds_per_cycle);
|
||||
else
|
||||
return attotime_make(clocks / classdata->cycles_per_second, (clocks % classdata->cycles_per_second) * classdata->attoseconds_per_cycle);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
cpu_attotime_to_clocks - converts a duration
|
||||
as attotime to CPU clock ticks
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT32 cpu_attotime_to_clocks(const device_config *device, attotime duration)
|
||||
{
|
||||
cpu_class_data *classdata = get_safe_classtoken(device);
|
||||
return duration.seconds * classdata->cycles_per_second + duration.attoseconds / classdata->attoseconds_per_cycle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CPU TIMING
|
||||
@ -617,10 +638,10 @@ attotime cpu_get_local_time(const device_config *device)
|
||||
|
||||
/* if we're active, add in the time from the current slice */
|
||||
result = classdata->localtime;
|
||||
if (device == executingcpu)
|
||||
if (classdata->executing)
|
||||
{
|
||||
int cycles = cycles_running - *classdata->icount;
|
||||
result = attotime_add(result, ATTOTIME_IN_CYCLES(cycles, classdata->header.index));
|
||||
int cycles = classdata->cycles_running - *classdata->icount;
|
||||
result = attotime_add(result, cpu_clocks_to_attotime(device, cycles));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -636,8 +657,8 @@ UINT64 cpu_get_total_cycles(const device_config *device)
|
||||
{
|
||||
cpu_class_data *classdata = get_safe_classtoken(device);
|
||||
|
||||
if (device == executingcpu)
|
||||
return classdata->totalcycles + cycles_running - *classdata->icount;
|
||||
if (classdata->executing)
|
||||
return classdata->totalcycles + classdata->cycles_running - *classdata->icount;
|
||||
else
|
||||
return classdata->totalcycles;
|
||||
}
|
||||
@ -653,7 +674,7 @@ void cpu_eat_cycles(const device_config *device, int cycles)
|
||||
cpu_class_data *classdata = get_safe_classtoken(device);
|
||||
|
||||
/* ignore if not the executing CPU */
|
||||
if (device != executingcpu)
|
||||
if (!classdata->executing)
|
||||
return;
|
||||
|
||||
if (cycles > *classdata->icount)
|
||||
@ -672,7 +693,7 @@ void cpu_adjust_icount(const device_config *device, int delta)
|
||||
cpu_class_data *classdata = get_safe_classtoken(device);
|
||||
|
||||
/* ignore if not the executing CPU */
|
||||
if (device != executingcpu)
|
||||
if (!classdata->executing)
|
||||
return;
|
||||
|
||||
*classdata->icount += delta;
|
||||
@ -691,15 +712,15 @@ void cpu_abort_timeslice(const device_config *device)
|
||||
int delta;
|
||||
|
||||
/* ignore if not the executing CPU */
|
||||
if (device != executingcpu)
|
||||
if (!classdata->executing)
|
||||
return;
|
||||
|
||||
/* swallow the remaining cycles */
|
||||
if (classdata->icount != NULL)
|
||||
{
|
||||
delta = *classdata->icount + 1;
|
||||
cycles_stolen += delta;
|
||||
cycles_running -= delta;
|
||||
classdata->cycles_stolen += delta;
|
||||
classdata->cycles_running -= delta;
|
||||
*classdata->icount -= delta;
|
||||
}
|
||||
}
|
||||
@ -791,15 +812,15 @@ void cpuexec_trigger(running_machine *machine, int trigger)
|
||||
{
|
||||
int cpunum;
|
||||
|
||||
/* cause an immediate resynchronization */
|
||||
if (executingcpu != NULL)
|
||||
cpu_abort_timeslice(executingcpu);
|
||||
|
||||
/* look for suspended CPUs waiting for this trigger and unsuspend them */
|
||||
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL; cpunum++)
|
||||
{
|
||||
cpu_class_data *classdata = machine->cpu[cpunum]->classtoken;
|
||||
|
||||
/* if we're executing, for an immediate abort */
|
||||
if (classdata->executing)
|
||||
cpu_abort_timeslice(machine->cpu[cpunum]);
|
||||
|
||||
/* see if this is a matching trigger */
|
||||
if (classdata->suspend != 0 && classdata->trigger == trigger)
|
||||
{
|
||||
@ -1067,11 +1088,11 @@ static void update_clock_information(const device_config *device)
|
||||
INT64 attos;
|
||||
|
||||
/* recompute cps and spc */
|
||||
cycles_per_second[classdata->header.index] = (double)classdata->clock * classdata->clockscale;
|
||||
attoseconds_per_cycle[classdata->header.index] = ATTOSECONDS_PER_SECOND / ((double)classdata->clock * classdata->clockscale);
|
||||
classdata->cycles_per_second = (double)classdata->clock * classdata->clockscale;
|
||||
classdata->attoseconds_per_cycle = ATTOSECONDS_PER_SECOND / ((double)classdata->clock * classdata->clockscale);
|
||||
|
||||
/* update the CPU's divisor */
|
||||
attos = attoseconds_per_cycle[classdata->header.index];
|
||||
attos = classdata->attoseconds_per_cycle;
|
||||
classdata->divshift = 0;
|
||||
while (attos >= (1UL << 31))
|
||||
{
|
||||
@ -1092,17 +1113,19 @@ static void update_clock_information(const device_config *device)
|
||||
|
||||
static void compute_perfect_interleave(running_machine *machine)
|
||||
{
|
||||
if (attoseconds_per_cycle[0] != 0)
|
||||
if (machine->cpu[0] != NULL && machine->cpu[0]->classtoken != NULL)
|
||||
{
|
||||
attoseconds_t smallest = attoseconds_per_cycle[0] * cputype_get_min_cycles(machine->config->cpu[0].type);
|
||||
cpu_class_data *classdata = machine->cpu[0]->classtoken;
|
||||
attoseconds_t smallest = classdata->attoseconds_per_cycle * cputype_get_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 */
|
||||
for (cpunum = 1; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL; cpunum++)
|
||||
if (attoseconds_per_cycle[cpunum] != 0)
|
||||
if (machine->cpu[cpunum] != NULL && machine->cpu[cpunum]->classtoken != NULL)
|
||||
{
|
||||
attoseconds_t curtime = attoseconds_per_cycle[cpunum] * cputype_get_min_cycles(machine->config->cpu[cpunum].type);
|
||||
cpu_class_data *classdata = machine->cpu[cpunum]->classtoken;
|
||||
attoseconds_t curtime = classdata->attoseconds_per_cycle * cputype_get_min_cycles(machine->config->cpu[cpunum].type);
|
||||
|
||||
/* find the 2nd smallest cycle interval */
|
||||
if (curtime < smallest)
|
||||
@ -1111,7 +1134,7 @@ static void compute_perfect_interleave(running_machine *machine)
|
||||
smallest = curtime;
|
||||
}
|
||||
else if (curtime < perfect)
|
||||
perfect = attoseconds_per_cycle[cpunum];
|
||||
perfect = classdata->attoseconds_per_cycle;
|
||||
}
|
||||
|
||||
/* adjust the final value */
|
||||
|
@ -127,6 +127,12 @@ double cpu_get_clockscale(const device_config *device);
|
||||
/* sets the current scaling factor for a CPU's clock speed */
|
||||
void cpu_set_clockscale(const device_config *device, double clockscale);
|
||||
|
||||
/* converts a number of clock ticks to an attotime */
|
||||
attotime cpu_clocks_to_attotime(const device_config *device, UINT32 clocks);
|
||||
|
||||
/* converts a duration as attotime to CPU clock ticks */
|
||||
UINT32 cpu_attotime_to_clocks(const device_config *device, attotime duration);
|
||||
|
||||
|
||||
|
||||
/* ----- CPU timing ----- */
|
||||
|
@ -98,10 +98,6 @@ struct _quantum_slot
|
||||
GLOBAL VARIABLES
|
||||
***************************************************************************/
|
||||
|
||||
/* conversion constants */
|
||||
attoseconds_t attoseconds_per_cycle[MAX_CPU];
|
||||
UINT32 cycles_per_second[MAX_CPU];
|
||||
|
||||
/* list of active timers */
|
||||
static emu_timer timers[MAX_TIMERS];
|
||||
static emu_timer *timer_head;
|
||||
|
@ -38,10 +38,6 @@ enum
|
||||
MACROS
|
||||
***************************************************************************/
|
||||
|
||||
/* convert cycles on a given CPU to/from attotime */
|
||||
#define ATTOTIME_TO_CYCLES(cpu,t) ((t).seconds * cycles_per_second[cpu] + (t).attoseconds / attoseconds_per_cycle[cpu])
|
||||
#define ATTOTIME_IN_CYCLES(c,cpu) (attotime_make((c) / cycles_per_second[cpu], (c) * attoseconds_per_cycle[cpu]))
|
||||
|
||||
/* macro for the RC time constant on a 74LS123 with C > 1000pF */
|
||||
/* R is in ohms, C is in farads */
|
||||
#define TIME_OF_74LS123(r,c) (0.45 * (double)(r) * (double)(c))
|
||||
@ -146,16 +142,6 @@ typedef struct _emu_timer emu_timer;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
GLOBAL VARIABLES
|
||||
***************************************************************************/
|
||||
|
||||
/* arrays containing mappings between CPU cycle times and timer values */
|
||||
extern attoseconds_t attoseconds_per_cycle[];
|
||||
extern UINT32 cycles_per_second[];
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
@ -1731,7 +1731,7 @@ static TIMER_CALLBACK( internal_timer_callback )
|
||||
|
||||
/* set the next timer, but only if it's for a reasonable number */
|
||||
if (!dcs.timer_ignore && (dcs.timer_period > 10 || dcs.timer_scale > 1))
|
||||
timer_adjust_oneshot(dcs.internal_timer, ATTOTIME_IN_CYCLES(target_cycles, cpu_get_index(dcs.cpu)), 0);
|
||||
timer_adjust_oneshot(dcs.internal_timer, cpu_clocks_to_attotime(dcs.cpu, target_cycles), 0);
|
||||
cpu_set_input_line(dcs.cpu, ADSP2105_TIMER, PULSE_LINE);
|
||||
}
|
||||
|
||||
@ -1766,7 +1766,7 @@ static void reset_timer(running_machine *machine)
|
||||
|
||||
/* adjust the timer if not optimized */
|
||||
if (!dcs.timer_ignore)
|
||||
timer_adjust_oneshot(dcs.internal_timer, ATTOTIME_IN_CYCLES(dcs.timer_scale * (dcs.timer_start_count + 1), cpu_get_index(dcs.cpu)), 0);
|
||||
timer_adjust_oneshot(dcs.internal_timer, cpu_clocks_to_attotime(dcs.cpu, dcs.timer_scale * (dcs.timer_start_count + 1)), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1776,7 +1776,7 @@ static void timer_enable_callback(int enable)
|
||||
dcs.timer_ignore = 0;
|
||||
if (enable)
|
||||
{
|
||||
// mame_printf_debug("Timer enabled @ %d cycles/int, or %f Hz\n", dcs.timer_scale * (dcs.timer_period + 1), 1.0 / ATTOTIME_IN_CYCLES(dcs.timer_scale * (dcs.timer_period + 1), cpu_get_index(dcs.cpu)));
|
||||
// mame_printf_debug("Timer enabled @ %d cycles/int, or %f Hz\n", dcs.timer_scale * (dcs.timer_period + 1), 1.0 / cpu_clocks_to_attotime(dcs.cpu, dcs.timer_scale * (dcs.timer_period + 1)));
|
||||
reset_timer(Machine);
|
||||
}
|
||||
else
|
||||
|
@ -120,7 +120,7 @@ WRITE16_HANDLER(f3_68681_w)
|
||||
case 3:
|
||||
logerror("Counter: X1/Clk - divided by 16, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter*16);
|
||||
timer_mode=TIMER_SINGLESHOT;
|
||||
timer_adjust_oneshot(timer_68681, ATTOTIME_IN_CYCLES((M68000_CLOCK/M68681_CLOCK)*counter*16,1), 0);
|
||||
timer_adjust_oneshot(timer_68681, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter*16), 0);
|
||||
break;
|
||||
case 4:
|
||||
logerror("Timer: Unimplemented external IP2\n");
|
||||
@ -131,7 +131,7 @@ WRITE16_HANDLER(f3_68681_w)
|
||||
case 6:
|
||||
logerror("Timer: X1/Clk, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter);
|
||||
timer_mode=TIMER_PULSE;
|
||||
timer_adjust_periodic(timer_68681, ATTOTIME_IN_CYCLES((M68000_CLOCK/M68681_CLOCK)*counter,1), 0, ATTOTIME_IN_CYCLES((M68000_CLOCK/M68681_CLOCK)*counter,1));
|
||||
timer_adjust_periodic(timer_68681, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter), 0, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter));
|
||||
break;
|
||||
case 7:
|
||||
logerror("Timer: Unimplemented X1/Clk - divided by 16\n");
|
||||
|
@ -246,7 +246,7 @@ static TIMER_CALLBACK( cadash_interrupt5 )
|
||||
|
||||
static INTERRUPT_GEN( cadash_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(500,0), NULL, 0, cadash_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(device,500), NULL, 0, cadash_interrupt5);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE); /* interrupt vector 4 */
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1365,7 @@ static WRITE8_HANDLER( meter_w )
|
||||
{
|
||||
int i;
|
||||
int changed = meter_latch ^ data;
|
||||
long cycles = ATTOTIME_TO_CYCLES(0, timer_get_time() );
|
||||
UINT64 cycles = cpu_get_total_cycles(space->cpu);
|
||||
|
||||
meter_latch = data;
|
||||
|
||||
@ -1378,7 +1378,7 @@ static WRITE8_HANDLER( meter_w )
|
||||
if (changed & (1 << i))
|
||||
{
|
||||
Mechmtr_update(i, cycles, data & (1 << i) );
|
||||
cpu_set_input_line(space->machine->cpu[1], M6809_FIRQ_LINE, PULSE_LINE );
|
||||
cpu_set_input_line(space->cpu, M6809_FIRQ_LINE, PULSE_LINE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ static WRITE8_HANDLER( mmtr_w )
|
||||
{
|
||||
int i;
|
||||
int changed = mmtr_latch ^ data;
|
||||
long cycles = ATTOTIME_TO_CYCLES(0, timer_get_time() );
|
||||
UINT64 cycles = cpu_get_total_cycles(space->cpu);
|
||||
|
||||
mmtr_latch = data;
|
||||
|
||||
|
@ -91,11 +91,11 @@ static TIMER_CALLBACK( reset_analog_bit )
|
||||
}
|
||||
|
||||
|
||||
static attotime compute_duration(int analog_pos)
|
||||
static attotime compute_duration(const device_config *device, int analog_pos)
|
||||
{
|
||||
/* the 58 comes from the length of the loop used to
|
||||
read the analog position */
|
||||
return ATTOTIME_IN_CYCLES(58 * analog_pos, 0);
|
||||
return cpu_clocks_to_attotime(device, 58 * analog_pos);
|
||||
}
|
||||
|
||||
|
||||
@ -107,8 +107,8 @@ static WRITE8_HANDLER( analog_reset_w )
|
||||
|
||||
analog_port_val = 0xff;
|
||||
|
||||
timer_adjust_oneshot(analog_timer_1, compute_duration(input_port_read(space->machine, "AN1")), 0x02);
|
||||
timer_adjust_oneshot(analog_timer_2, compute_duration(input_port_read(space->machine, "AN2")), 0x01);
|
||||
timer_adjust_oneshot(analog_timer_1, compute_duration(space->cpu, input_port_read(space->machine, "AN1")), 0x02);
|
||||
timer_adjust_oneshot(analog_timer_2, compute_duration(space->cpu, input_port_read(space->machine, "AN2")), 0x01);
|
||||
}
|
||||
|
||||
|
||||
|
@ -248,7 +248,7 @@ static READ8_HANDLER ( combasc_YM2203_status_port_0_r )
|
||||
if (boost)
|
||||
{
|
||||
boost = 0;
|
||||
timer_adjust_periodic(combasc_interleave_timer, attotime_zero, 0, ATTOTIME_IN_CYCLES(80,1));
|
||||
timer_adjust_periodic(combasc_interleave_timer, attotime_zero, 0, cpu_clocks_to_attotime(space->cpu,80));
|
||||
}
|
||||
else if (status & 2)
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ static READ32_HANDLER( galastrm_adstick_ctrl_r )
|
||||
|
||||
static WRITE32_HANDLER( galastrm_adstick_ctrl_w )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(1000,0), NULL, 0, galastrm_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,1000), NULL, 0, galastrm_interrupt6);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
|
@ -64,8 +64,8 @@ static INTERRUPT_GEN( gcpinbal_interrupt )
|
||||
{
|
||||
/* Unsure of actual sequence */
|
||||
|
||||
timer_set(ATTOTIME_IN_CYCLES(500,0), NULL, 0, gcpinbal_interrupt1);
|
||||
// timer_set(ATTOTIME_IN_CYCLES(1000,0), NULL, 0, gcpinbal_interrupt3);
|
||||
timer_set(cpu_clocks_to_attotime(device,500), NULL, 0, gcpinbal_interrupt1);
|
||||
// timer_set(cpu_clocks_to_attotime(device,1000), NULL, 0, gcpinbal_interrupt3);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ static WRITE32_HANDLER( groundfx_adc_w )
|
||||
{
|
||||
/* One interrupt per input port (4 per frame, though only 2 used).
|
||||
1000 cycle delay is arbitrary */
|
||||
timer_set(ATTOTIME_IN_CYCLES(1000,0), NULL, 0, groundfx_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,1000), NULL, 0, groundfx_interrupt5);
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( rotate_control_w ) /* only a guess that it's rotation */
|
||||
|
@ -69,7 +69,7 @@ static TIMER_CALLBACK( gunbustr_interrupt5 )
|
||||
|
||||
static INTERRUPT_GEN( gunbustr_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, gunbustr_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, gunbustr_interrupt5);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ static READ32_HANDLER( gunbustr_gun_r )
|
||||
static WRITE32_HANDLER( gunbustr_gun_w )
|
||||
{
|
||||
/* 10000 cycle delay is arbitrary */
|
||||
timer_set(ATTOTIME_IN_CYCLES(10000,0), NULL, 0, gunbustr_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,10000), NULL, 0, gunbustr_interrupt5);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1008,7 +1008,7 @@ static WRITE8_HANDLER( blitter_w )
|
||||
else
|
||||
{
|
||||
blitter_busy = 1;
|
||||
timer_adjust_oneshot(blitter_reset_timer, ATTOTIME_IN_CYCLES(100, 0), 0); // free blitter if no updates in 100 cycles
|
||||
timer_adjust_oneshot(blitter_reset_timer, cpu_clocks_to_attotime(space->cpu, 100), 0); // free blitter if no updates in 100 cycles
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ static READ16_HANDLER( jpmio_r )
|
||||
|
||||
static WRITE16_HANDLER( jpmio_w )
|
||||
{
|
||||
long cycles = ATTOTIME_TO_CYCLES(0, timer_get_time() );
|
||||
UINT64 cycles = cpu_get_total_cycles(space->cpu);
|
||||
switch (offset)
|
||||
{
|
||||
case 0x02:
|
||||
|
@ -509,7 +509,7 @@ static TIMER_CALLBACK( atapi_xfer_end )
|
||||
atapi_regs[ATAPI_REG_COUNTLOW] = atapi_xferlen & 0xff;
|
||||
atapi_regs[ATAPI_REG_COUNTHIGH] = (atapi_xferlen>>8)&0xff;
|
||||
|
||||
timer_adjust_oneshot(atapi_timer, ATTOTIME_IN_CYCLES((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048)), 0), 0);
|
||||
timer_adjust_oneshot(atapi_timer, cpu_clocks_to_attotime(machine->cpu[0], (ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -735,7 +735,7 @@ static WRITE32_HANDLER( atapi_w )
|
||||
|
||||
case 0x45: // PLAY
|
||||
atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_BSY;
|
||||
timer_adjust_oneshot( atapi_timer, ATTOTIME_IN_CYCLES( ATAPI_CYCLES_PER_SECTOR, 0 ), 0 );
|
||||
timer_adjust_oneshot( atapi_timer, cpu_clocks_to_attotime( space->cpu, ATAPI_CYCLES_PER_SECTOR ), 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -974,7 +974,7 @@ static void cdrom_dma_write( UINT32 n_address, INT32 n_size )
|
||||
verboselog( 2, "atapi_xfer_end: %d %d\n", atapi_xferlen, atapi_xfermod );
|
||||
|
||||
// set a transfer complete timer (Note: CYCLES_PER_SECTOR can't be lower than 2000 or the BIOS ends up "out of order")
|
||||
timer_adjust_oneshot(atapi_timer, ATTOTIME_IN_CYCLES((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048)), 0), 0);
|
||||
timer_adjust_oneshot(atapi_timer, cpu_clocks_to_attotime(Machine->cpu[0], (ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
|
||||
}
|
||||
|
||||
static UINT32 m_n_security_control;
|
||||
|
@ -222,8 +222,8 @@ static WRITE16_HANDLER( m72_main_mcu_w)
|
||||
protection_ram[offset] = val;
|
||||
cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE);
|
||||
/* Line driven, most likely by write line */
|
||||
//timer_set(ATTOTIME_IN_CYCLES(2, mame_find_cpu_index(space->machine, "mcu")), NULL, 0, mcu_irq0_clear);
|
||||
//timer_set(ATTOTIME_IN_CYCLES(0, mame_find_cpu_index(space->machine, "mcu")), NULL, 0, mcu_irq0_raise);
|
||||
//timer_set(cpu_clocks_to_attotime(cputag_get_cpu(space->machine, "mcu"), 2), NULL, 0, mcu_irq0_clear);
|
||||
//timer_set(cpu_clocks_to_attotime(cputag_get_cpu(space->machine, "mcu"), 0), NULL, 0, mcu_irq0_raise);
|
||||
}
|
||||
else
|
||||
timer_call_after_resynch( protection_ram, (offset<<16) | val, delayed_ram16_w);
|
||||
|
@ -2102,7 +2102,7 @@ static void megadrive_io_write_data_port_6button(int portnum, UINT16 data)
|
||||
if (((megadrive_io_data_regs[portnum]&0x40)==0x00) && ((data&0x40) == 0x40))
|
||||
{
|
||||
io_stage[portnum]++;
|
||||
timer_adjust_oneshot(io_timeout[portnum], ATTOTIME_IN_CYCLES(8192,0), 0);
|
||||
timer_adjust_oneshot(io_timeout[portnum], cpu_clocks_to_attotime(Machine->cpu[0],8192), 0);
|
||||
}
|
||||
|
||||
}
|
||||
@ -4051,7 +4051,7 @@ VIDEO_UPDATE(megadriv)
|
||||
/* reference */
|
||||
|
||||
// time_elapsed_since_crap = timer_timeelapsed(frame_timer);
|
||||
// xxx = ATTOTIME_TO_CYCLES(0,time_elapsed_since_crap);
|
||||
// xxx = cpu_attotime_to_clocks(screen->machine->cpu[0],time_elapsed_since_crap);
|
||||
// mame_printf_debug("update cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.attoseconds>>32),(UINT32)(time_elapsed_since_crap.attoseconds&0xffffffff));
|
||||
|
||||
return 0;
|
||||
@ -6226,7 +6226,7 @@ int megadrive_z80irq_hpos = 320;
|
||||
frametime = ATTOSECONDS_PER_SECOND/megadriv_framerate;
|
||||
|
||||
time_elapsed_since_crap = timer_timeelapsed(frame_timer);
|
||||
xxx = ATTOTIME_TO_CYCLES(0,time_elapsed_since_crap);
|
||||
xxx = cpu_attotime_to_clocks(machine->cpu[0],time_elapsed_since_crap);
|
||||
//mame_printf_debug("---------- cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.attoseconds>>32),(UINT32)(time_elapsed_since_crap.attoseconds&0xffffffff));
|
||||
//mame_printf_debug("---------- framet %d, %08x %08x\n",xxx, (UINT32)(frametime>>32),(UINT32)(frametime&0xffffffff));
|
||||
timer_adjust_oneshot(frame_timer, attotime_zero, 0);
|
||||
|
@ -887,7 +887,7 @@ static WRITE8_HANDLER( pia_ic7_porta_w )
|
||||
static WRITE8_HANDLER( pia_ic7_portb_w )
|
||||
{
|
||||
int meter;
|
||||
long cycles = ATTOTIME_TO_CYCLES(0, timer_get_time() );
|
||||
UINT64 cycles = cpu_get_total_cycles(space->cpu);
|
||||
|
||||
/* The meters are connected to a voltage drop sensor, where current
|
||||
flowing through them also passes through pin B7, meaning that when
|
||||
@ -928,7 +928,7 @@ static WRITE8_HANDLER( pia_ic7_cb2_w )
|
||||
{
|
||||
/* The eighth meter is connected here, because the voltage sensor
|
||||
is on PB7. */
|
||||
long cycles = ATTOTIME_TO_CYCLES(0, timer_get_time() );
|
||||
UINT64 cycles = cpu_get_total_cycles(space->cpu);
|
||||
if (data)
|
||||
{
|
||||
pia_set_input_b(4,mmtr_data|0x80);
|
||||
|
@ -181,7 +181,7 @@ static TIMER_CALLBACK( clear_irq_cb )
|
||||
static INTERRUPT_GEN( assert_irq )
|
||||
{
|
||||
cpu_set_input_line(device, 0, ASSERT_LINE);
|
||||
timer_set(ATTOTIME_IN_CYCLES(14288, 0), NULL, 0, clear_irq_cb);
|
||||
timer_set(cpu_clocks_to_attotime(device, 14288), NULL, 0, clear_irq_cb);
|
||||
/* Timing here is an educated GUESS, Z80 /INT must stay high so the irq
|
||||
fires no less than TWICE per frame, else game doesn't work right.
|
||||
6000000 / 56.747 = 105732.4616 cycles per frame, we'll call it A
|
||||
|
@ -893,7 +893,7 @@ static WRITE16_HANDLER( nbmcu_shared_w )
|
||||
// C74 BIOS has a very short window on the CPU sync signal, so immediately let the '020 at it
|
||||
if ((offset == 0x6000/2) && (data & 0x80))
|
||||
{
|
||||
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_CYCLES(300, 1)); // was 300
|
||||
cpu_spinuntil_time(space->cpu, cpu_clocks_to_attotime(space->cpu, 300)); // was 300
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ static WRITE32_HANDLER( arm7_latch_arm_w )
|
||||
cpuexec_trigger(space->machine, 1002);
|
||||
#else
|
||||
cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(100));
|
||||
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_CYCLES(100, 0));
|
||||
cpu_spinuntil_time(space->cpu, cpu_clocks_to_attotime(space->cpu, 100));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ static WRITE16_HANDLER( arm7_latch_68k_w )
|
||||
#else
|
||||
cpu_set_input_line(space->machine->cpu[2], ARM7_FIRQ_LINE, PULSE_LINE);
|
||||
cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(200));
|
||||
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_CYCLES(200, 2)); // give the arm time to respond (just boosting the interleave doesn't help
|
||||
cpu_spinuntil_time(space->cpu, cpu_clocks_to_attotime(space->machine->cpu[2], 200)); // give the arm time to respond (just boosting the interleave doesn't help
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -740,13 +740,13 @@ static WRITE32_HANDLER( kovsh_arm7_protlatch_w )
|
||||
}
|
||||
|
||||
// cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(100));
|
||||
// cpu_spinuntil_time(space->cpu, ATTOTIME_IN_CYCLES(100, 0));
|
||||
// cpu_spinuntil_time(space->cpu, cpu_clocks_to_attotime(space->machine->cpu[0], 100));
|
||||
}
|
||||
|
||||
static READ16_HANDLER( kovsh_68k_protlatch_r )
|
||||
{
|
||||
//cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(200));
|
||||
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_CYCLES(600, 0));
|
||||
cpu_spinuntil_time(space->cpu, cpu_clocks_to_attotime(space->machine->cpu[0], 600));
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ static TIMER_CALLBACK( slapshot_interrupt6 )
|
||||
|
||||
static INTERRUPT_GEN( slapshot_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, slapshot_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, slapshot_interrupt6);
|
||||
cpu_set_input_line(device,5,HOLD_LINE);
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ static MACHINE_RESET(skns)
|
||||
{
|
||||
timer_pulse(ATTOTIME_IN_MSEC(2), NULL, 15, interrupt_callback);
|
||||
timer_pulse(ATTOTIME_IN_MSEC(8), NULL, 11, interrupt_callback);
|
||||
timer_pulse(ATTOTIME_IN_CYCLES(1824, 0), NULL, 9, interrupt_callback);
|
||||
timer_pulse(cpu_clocks_to_attotime(machine->cpu[0], 1824), NULL, 9, interrupt_callback);
|
||||
|
||||
memory_set_bankptr(machine, 1,memory_region(machine, "user1"));
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ static TIMER_CALLBACK( rsaga2_interrupt2 )
|
||||
|
||||
static INTERRUPT_GEN( rastansaga2_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, rsaga2_interrupt2);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, rsaga2_interrupt2);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ static TIMER_CALLBACK( crimec_interrupt3 )
|
||||
|
||||
static INTERRUPT_GEN( crimec_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, crimec_interrupt3);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, crimec_interrupt3);
|
||||
cpu_set_input_line(device, 5, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ static TIMER_CALLBACK( hitice_interrupt6 )
|
||||
|
||||
static INTERRUPT_GEN( hitice_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, hitice_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, hitice_interrupt6);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ static TIMER_CALLBACK( rambo3_interrupt1 )
|
||||
|
||||
static INTERRUPT_GEN( rambo3_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, rambo3_interrupt1);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, rambo3_interrupt1);
|
||||
cpu_set_input_line(device, 6, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ static TIMER_CALLBACK( pbobble_interrupt5 )
|
||||
|
||||
static INTERRUPT_GEN( pbobble_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, pbobble_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, pbobble_interrupt5);
|
||||
cpu_set_input_line(device, 3, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ static TIMER_CALLBACK( viofight_interrupt1 )
|
||||
|
||||
static INTERRUPT_GEN( viofight_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, viofight_interrupt1);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, viofight_interrupt1);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ static TIMER_CALLBACK( masterw_interrupt4 )
|
||||
|
||||
static INTERRUPT_GEN( masterw_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, masterw_interrupt4);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, masterw_interrupt4);
|
||||
cpu_set_input_line(device, 5, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ static TIMER_CALLBACK( silentd_interrupt4 )
|
||||
|
||||
static INTERRUPT_GEN( silentd_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, silentd_interrupt4);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, silentd_interrupt4);
|
||||
cpu_set_input_line(device, 6, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ static TIMER_CALLBACK( selfeena_interrupt4 )
|
||||
|
||||
static INTERRUPT_GEN( selfeena_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(5000,0), NULL, 0, selfeena_interrupt4);
|
||||
timer_set(cpu_clocks_to_attotime(device,5000), NULL, 0, selfeena_interrupt4);
|
||||
cpu_set_input_line(device, 6, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ static TIMER_CALLBACK( sbm_interrupt5 )//4
|
||||
|
||||
static INTERRUPT_GEN( sbm_interrupt )//5
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(10000,0), NULL, 0, sbm_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(device,10000), NULL, 0, sbm_interrupt5);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ static TIMER_CALLBACK( taitof2_interrupt6 )
|
||||
|
||||
static INTERRUPT_GEN( taitof2_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(500,0), NULL, 0, taitof2_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,500), NULL, 0, taitof2_interrupt6);
|
||||
cpu_set_input_line(device, 5, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ static TIMER_CALLBACK( f3_interrupt3 )
|
||||
static INTERRUPT_GEN( f3_interrupt2 )
|
||||
{
|
||||
cpu_set_input_line(device, 2, HOLD_LINE); // vblank
|
||||
timer_set( ATTOTIME_IN_CYCLES(10000,0), NULL, 0, f3_interrupt3);
|
||||
timer_set( cpu_clocks_to_attotime(device,10000), NULL, 0, f3_interrupt3);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( f3 )
|
||||
|
@ -1000,7 +1000,7 @@ static INTERRUPT_GEN( sci_interrupt )
|
||||
sci_int6 = !sci_int6;
|
||||
|
||||
if (sci_int6)
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, taitoz_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, taitoz_interrupt6);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -1015,7 +1015,7 @@ static INTERRUPT_GEN( dblaxle_interrupt )
|
||||
dblaxle_int6 = !dblaxle_int6;
|
||||
|
||||
if (dblaxle_int6)
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, taitoz_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, taitoz_interrupt6);
|
||||
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
@ -1023,7 +1023,7 @@ static INTERRUPT_GEN( dblaxle_interrupt )
|
||||
static INTERRUPT_GEN( dblaxle_cpub_interrupt )
|
||||
{
|
||||
// Unsure how many int6's per frame
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, taitoz_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, taitoz_interrupt6);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -1254,7 +1254,7 @@ static WRITE16_HANDLER( bshark_stick_w )
|
||||
but we don't want CPUA to have an int6 before int4 is over (?)
|
||||
*/
|
||||
|
||||
timer_set(ATTOTIME_IN_CYCLES(10000,0), NULL, 0, taitoz_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,10000), NULL, 0, taitoz_interrupt6);
|
||||
}
|
||||
|
||||
|
||||
@ -1337,7 +1337,7 @@ static WRITE16_HANDLER( spacegun_lightgun_w )
|
||||
Four lightgun interrupts happen before the collected coords
|
||||
are moved to shared ram where CPUA can use them. */
|
||||
|
||||
timer_set(ATTOTIME_IN_CYCLES(10000,0), NULL, 0, taitoz_sg_cpub_interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,10000), NULL, 0, taitoz_sg_cpub_interrupt5);
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,7 +309,7 @@ static WRITE8_HANDLER( thunderx_1f98_w )
|
||||
calculate_collisions();
|
||||
|
||||
/* 100 cycle delay is arbitrary */
|
||||
timer_set(ATTOTIME_IN_CYCLES(100,0), NULL, 0, thunderx_firq_callback);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,100), NULL, 0, thunderx_firq_callback);
|
||||
}
|
||||
|
||||
thunderx_1f98_data = data;
|
||||
|
@ -310,14 +310,14 @@ static TIMER_CALLBACK( topspeed_cpub_interrupt6 )
|
||||
static INTERRUPT_GEN( topspeed_interrupt )
|
||||
{
|
||||
/* Unsure how many int6's per frame */
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, topspeed_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, topspeed_interrupt6);
|
||||
cpu_set_input_line(device, 5, HOLD_LINE);
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( topspeed_cpub_interrupt )
|
||||
{
|
||||
/* Unsure how many int6's per frame */
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, topspeed_cpub_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, topspeed_cpub_interrupt6);
|
||||
cpu_set_input_line(device, 5, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ static READ32_HANDLER( unknown_hardware_r )
|
||||
static WRITE32_HANDLER( unknown_int_req_w )
|
||||
{
|
||||
/* 10000 cycle delay is arbitrary */
|
||||
timer_set(ATTOTIME_IN_CYCLES(10000,0), NULL, 0, interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,10000), NULL, 0, interrupt5);
|
||||
}
|
||||
|
||||
|
||||
@ -482,7 +482,7 @@ static WRITE32_HANDLER( cbombers_adc_w )
|
||||
{
|
||||
/* One interrupt per input port (4 per frame, though only 2 used).
|
||||
1000 cycle delay is arbitrary */
|
||||
timer_set(ATTOTIME_IN_CYCLES(1000, 0), NULL, 0, interrupt5);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu, 1000), NULL, 0, interrupt5);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
|
@ -488,7 +488,7 @@ static TIMER_CALLBACK( wgp_cpub_interrupt6 )
|
||||
|
||||
static INTERRUPT_GEN( wgp_cpub_interrupt )
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(200000-500,0), NULL, 0, wgp_cpub_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(device,200000-500), NULL, 0, wgp_cpub_interrupt6);
|
||||
cpu_set_input_line(device, 4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ static WRITE16_HANDLER( wgp_adinput_w )
|
||||
hardware has got the next a/d conversion ready. We set a token
|
||||
delay of 10000 cycles although our inputs are always ready. */
|
||||
|
||||
timer_set(ATTOTIME_IN_CYCLES(10000,0), NULL, 0, wgp_interrupt6);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,10000), NULL, 0, wgp_interrupt6);
|
||||
}
|
||||
|
||||
|
||||
|
@ -293,7 +293,7 @@ static WRITE32_HANDLER( znsecsel_w )
|
||||
psx_sio_install_handler( 0, sio_dip_handler );
|
||||
psx_sio_input( space->machine, 0, PSX_SIO_IN_DSR, 0 );
|
||||
|
||||
timer_adjust_oneshot( dip_timer, ATTOTIME_IN_CYCLES( 100, 0 ), 1 );
|
||||
timer_adjust_oneshot( dip_timer, cpu_clocks_to_attotime( space->cpu, 100 ), 1 );
|
||||
}
|
||||
|
||||
verboselog( 2, "znsecsel_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
|
||||
@ -305,7 +305,7 @@ static TIMER_CALLBACK( dip_timer_fired )
|
||||
|
||||
if( param )
|
||||
{
|
||||
timer_adjust_oneshot( dip_timer, ATTOTIME_IN_CYCLES( 50, 0 ), 0 );
|
||||
timer_adjust_oneshot( dip_timer, cpu_clocks_to_attotime( machine->cpu[0], 50 ), 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ static void blitter_setup(void)
|
||||
CUSTOM_REG(REG_DMACON) |= 0x4000;
|
||||
|
||||
/* set a timer */
|
||||
timer_adjust_oneshot( amiga_blitter_timer, ATTOTIME_IN_CYCLES( blittime, 0 ), 0);
|
||||
timer_adjust_oneshot( amiga_blitter_timer, cpu_clocks_to_attotime( Machine->activecpu, blittime ), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1399,7 +1399,7 @@ WRITE16_HANDLER( amiga_custom_w )
|
||||
|
||||
/* if 'blitter-nasty' has been turned on and we have a blit pending, reschedule it */
|
||||
if ( ( data & 0x400 ) && ( CUSTOM_REG(REG_DMACON) & 0x4000 ) )
|
||||
timer_adjust_oneshot( amiga_blitter_timer, ATTOTIME_IN_CYCLES( BLITTER_NASTY_DELAY, 0 ), 0);
|
||||
timer_adjust_oneshot( amiga_blitter_timer, cpu_clocks_to_attotime( Machine->activecpu, BLITTER_NASTY_DELAY ), 0);
|
||||
|
||||
break;
|
||||
|
||||
@ -1410,7 +1410,7 @@ WRITE16_HANDLER( amiga_custom_w )
|
||||
CUSTOM_REG(offset) = data;
|
||||
|
||||
if ( temp & 0x8000 ) /* if we're enabling irq's, delay a bit */
|
||||
timer_adjust_oneshot( amiga_irq_timer, ATTOTIME_IN_CYCLES( AMIGA_IRQ_DELAY_CYCLES, 0 ), 0);
|
||||
timer_adjust_oneshot( amiga_irq_timer, cpu_clocks_to_attotime( Machine->activecpu, AMIGA_IRQ_DELAY_CYCLES ), 0);
|
||||
else /* if we're disabling irq's, process right away */
|
||||
update_irqs(space->machine);
|
||||
break;
|
||||
@ -1427,7 +1427,7 @@ WRITE16_HANDLER( amiga_custom_w )
|
||||
CUSTOM_REG(offset) = data;
|
||||
|
||||
if ( temp & 0x8000 ) /* if we're generating irq's, delay a bit */
|
||||
timer_adjust_oneshot( amiga_irq_timer, ATTOTIME_IN_CYCLES( AMIGA_IRQ_DELAY_CYCLES, 0 ), 0);
|
||||
timer_adjust_oneshot( amiga_irq_timer, cpu_clocks_to_attotime( Machine->activecpu, AMIGA_IRQ_DELAY_CYCLES ), 0);
|
||||
else /* if we're clearing irq's, process right away */
|
||||
update_irqs(space->machine);
|
||||
break;
|
||||
|
@ -695,7 +695,7 @@ static TIMER_CALLBACK( cchip_timer )
|
||||
{
|
||||
// Simulate time for command to execute (exact timing unknown, this is close)
|
||||
current_cmd=0xf5;
|
||||
timer_set(ATTOTIME_IN_CYCLES(80000,0), NULL, 0, opwolf_timer_callback);
|
||||
timer_set(cpu_clocks_to_attotime(machine->cpu[0],80000), NULL, 0, opwolf_timer_callback);
|
||||
}
|
||||
cchip_last_7a=cchip_ram[0x7a];
|
||||
|
||||
|
@ -170,7 +170,7 @@ static TIMER_CALLBACK( snes_scanline_tick )
|
||||
if( snes_ram[NMITIMEN] & 0x80 ) /* NMI only signaled if this bit set */
|
||||
{
|
||||
// NMI goes off about 12 cycles after this (otherwise Chrono Trigger, NFL QB Club, etc. lock up)
|
||||
timer_adjust_oneshot(snes_nmi_timer, ATTOTIME_IN_CYCLES(12, 0), 0);
|
||||
timer_adjust_oneshot(snes_nmi_timer, cpu_clocks_to_attotime(machine->cpu[0], 12), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ static void update_irq_encoder(int line, int state)
|
||||
static PIT8253_OUTPUT_CHANGED( v_irq4_w )
|
||||
{
|
||||
update_irq_encoder(INPUT_LINE_IRQ4, state);
|
||||
vertigo_vproc(ATTOTIME_TO_CYCLES(0, attotime_sub(timer_get_time(), irq4_time)), state);
|
||||
vertigo_vproc(cpu_attotime_to_clocks(device->machine->cpu[0], attotime_sub(timer_get_time(), irq4_time)), state);
|
||||
irq4_time = timer_get_time();
|
||||
}
|
||||
|
||||
|
@ -393,12 +393,12 @@ WRITE16_HANDLER( volfied_cchip_ram_w )
|
||||
// Palette request cmd - verified to take around 122242 68000 cycles to complete
|
||||
if (current_cmd >= 0x1 && current_cmd < 0x12)
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(122242,0), NULL, 0, volfied_timer_callback);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,122242), NULL, 0, volfied_timer_callback);
|
||||
}
|
||||
// Unknown cmd - verified to take around 105500 68000 cycles to complete
|
||||
else if (current_cmd >= 0x81 && current_cmd < 0x92)
|
||||
{
|
||||
timer_set(ATTOTIME_IN_CYCLES(105500,0), NULL, 0, volfied_timer_callback);
|
||||
timer_set(cpu_clocks_to_attotime(space->cpu,105500), NULL, 0, volfied_timer_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -448,7 +448,7 @@ static void astrocade_trigger_lightpen(running_machine *machine, UINT8 vfeedback
|
||||
else
|
||||
{
|
||||
cpu_set_input_line_and_vector(machine->cpu[0], 0, ASSERT_LINE, interrupt_vector & 0xf0);
|
||||
timer_set(ATTOTIME_IN_CYCLES(1, 0), NULL, 0, interrupt_off);
|
||||
timer_set(cpu_clocks_to_attotime(machine->cpu[0], 1), NULL, 0, interrupt_off);
|
||||
}
|
||||
|
||||
/* latch the feedback registers */
|
||||
@ -488,7 +488,7 @@ static TIMER_CALLBACK( scanline_callback )
|
||||
else
|
||||
{
|
||||
cpu_set_input_line_and_vector(machine->cpu[0], 0, ASSERT_LINE, interrupt_vector);
|
||||
timer_set(ATTOTIME_IN_CYCLES(1, 0), NULL, 0, interrupt_off);
|
||||
timer_set(cpu_clocks_to_attotime(machine->cpu[0], 1), NULL, 0, interrupt_off);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -891,7 +891,7 @@ logerror("vlbank starting\n");
|
||||
// a game can read the high bit of $2002 before the NMI is called (potentially resetting the bit
|
||||
// via a read from $2002 in the NMI handler).
|
||||
// B-Wings is an example game that needs this.
|
||||
timer_adjust_oneshot(this_ppu->nmi_timer, ATTOTIME_IN_CYCLES(4, 0), num);
|
||||
timer_adjust_oneshot(this_ppu->nmi_timer, cpu_clocks_to_attotime(machine->cpu[0], 4), num);
|
||||
}
|
||||
}
|
||||
|
||||
@ -942,7 +942,7 @@ logerror("vlbank ending\n");
|
||||
next_scanline = 0;
|
||||
|
||||
// Call us back when the hblank starts for this scanline
|
||||
timer_adjust_oneshot(this_ppu->hblank_timer, ATTOTIME_IN_CYCLES(86.67, 0), num); // ??? FIXME - hardcoding NTSC, need better calculation
|
||||
timer_adjust_oneshot(this_ppu->hblank_timer, cpu_clocks_to_attotime(machine->cpu[0], 86.67), num); // ??? FIXME - hardcoding NTSC, need better calculation
|
||||
|
||||
// trigger again at the start of the next scanline
|
||||
timer_adjust_oneshot(this_ppu->scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, next_scanline * this_ppu->scan_scale, 0), num);
|
||||
@ -973,7 +973,7 @@ void ppu2c0x_reset(running_machine *machine, int num, int scan_scale)
|
||||
timer_adjust_oneshot(chips[num].nmi_timer, attotime_never, num);
|
||||
|
||||
// Call us back when the hblank starts for this scanline
|
||||
timer_adjust_oneshot(chips[num].hblank_timer, ATTOTIME_IN_CYCLES(86.67, 0), num); // ??? FIXME - hardcoding NTSC, need better calculation
|
||||
timer_adjust_oneshot(chips[num].hblank_timer, cpu_clocks_to_attotime(machine->cpu[0], 86.67), num); // ??? FIXME - hardcoding NTSC, need better calculation
|
||||
|
||||
// Call us back at the start of the next scanline
|
||||
timer_adjust_oneshot(chips[num].scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0), num);
|
||||
|
Loading…
Reference in New Issue
Block a user