Exemple #1
0
UINT16 psxrcnt_device::root_current( int n_counter )
{
	psx_root *root = &root_counter[ n_counter ];

	if( ( root->n_mode & PSX_RC_STOP ) != 0 )
	{
		return root->n_count;
	}
	else
	{
		UINT64 n_current;
		n_current = gettotalcycles() - root->n_start;
		n_current /= root_divider( n_counter );
		n_current += root->n_count;
		if( n_current > 0xffff )
		{
			/* TODO: use timer for wrap on 0x10000. */
			root->n_count = n_current;
			root->n_start = gettotalcycles();
		}
		return n_current;
	}
}
Exemple #2
0
void psxrcnt_device::root_timer_adjust( int n_counter )
{
	psx_root *root = &root_counter[ n_counter ];

	if( ( root->n_mode & PSX_RC_STOP ) != 0 )
	{
		root->timer->adjust( attotime::never, n_counter);
	}
	else
	{
		int n_duration;

		n_duration = root_target( n_counter ) - root_current( n_counter );
		if( n_duration < 1 )
		{
			n_duration += 0x10000;
		}

		n_duration *= root_divider( n_counter );

		root->timer->adjust( attotime::from_hz(33868800) * n_duration, n_counter);
	}
}
Exemple #3
0
void psxrcnt_device::root_timer_adjust( int n_counter )
{
	psx_root *root = &root_counter[ n_counter ];

	if( ( root->n_mode & PSX_RC_STOP ) != 0 )
	{
		root->timer->adjust( attotime::never, n_counter);
	}
	else
	{
		int n_duration;

		n_duration = root_target( n_counter ) - root_current( n_counter );
		if( n_duration < 1 )
		{
			n_duration += 0x10000;
		}

		n_duration *= root_divider( n_counter );

		// TODO: figure out if this should be calculated from the cpu clock for 50mhz boards?
		root->timer->adjust( attotime::from_hz(33868800) * n_duration, n_counter);
	}
}