Exemplo n.º 1
0
void adjust_timer(unsigned z80_cycles)
{
	if (!initted)
	       free_all_timer();
	double tm=((double)(NEOGEO_NB_INTERLACE));
	double diff= (((double)NEO4ALL_Z80_NORMAL_CYCLES) - ((double)z80_cycles)) / ((double)(NEO4ALL_Z80_OVER_CYCLES-NEO4ALL_Z80_NORMAL_CYCLES));
	double ratio = diff / 12.0;
	tm += tm * ratio;
//	timer_inc = 0.014 / tm;
	timer_inc = 0.01666 / tm;
//	timer_inc = 0.02 / tm;
}
Exemplo n.º 2
0
void my_timer()
{
    static int init = 1;
    int i;

    if (init)
		{
			timer_init_save_state();
			init = 0;


			if (conf.pal) 
			{
					inc = ((double) (0.02) / nb_interlace);/* *(1<<TIMER_SH);*/
					//(conf.sound ? (double) nb_interlace : 1.0);
			} 
			else
			{
				inc = ((double) (0.01666) / nb_interlace); /* *(1<<TIMER_SH); */
				//(conf.sound ? (double) nb_interlace : 1.0);
			}
			free_all_timer();
    }

    timer_count += inc;		/* 16ms par frame */

    for (i = 0; i < MAX_TIMER; i++)
		 {
			if ( (timer_count >= timers[i].time) && (timers[i].del_it == 0) )
			{
	    //printf("Timer_expire %d duration=%f param=%d\n",i,timers[i].time,timers[i].param); fflush(NULL);
	    if (timers[i].func) timers[i].func(timers[i].param);
	    timers[i].del_it = 1;
			}
    }

}