Пример #1
0
/*
    should be called after any change to int_state or enabled_ints.
*/
void tms9901_device::field_interrupts()
{
	int current_ints;

	// m_int_state: inverted state of lines INT1*-INT15*. Bits are set by set_single_int only.
	current_ints = m_int_state;
	if (m_clock_register != 0)
	{
		// if timer is enabled, INT3 pin is overridden by timer
		if (m_timer_int_pending)
		{
			LOGMASKED(LOG_INT, "INT3 (timer) asserted\n");
			current_ints |= INT3;
		}
		else
		{
			LOGMASKED(LOG_INT, "INT3 (timer) cleared\n");
			current_ints &= ~INT3;
		}
	}

	// enabled_ints: enabled interrupts
	// Remove all settings from pins that are set as outputs (INT7*-INT15* share the same pins as P15-P7)
	current_ints &= m_enabled_ints & (~m_pio_direction_mirror);

	// Check whether we have a new state. For systems that use level-triggered
	// interrupts it should not do any harm if the line is re-asserted
	// but we may as well avoid this.
	if (current_ints == m_old_int_state)
		return;

	m_old_int_state = current_ints;

	if (current_ints != 0)
	{
		// find which interrupt tripped us:
		// the number of the first (i.e. least significant) non-zero bit among
		// the 16 first bits
		// we simply look for the first bit set to 1 in current_ints...
		int level = 0;

		while ((current_ints & 1)==0)
		{
			current_ints >>= 1; /* try next bit */
			level++;
		}
		LOGMASKED(LOG_INT, "Triggering interrupt, level %d\n", level);
		m_int_pending = true;
		if (!m_interrupt.isnull())
			m_interrupt(level, 1, 0xff);  // the offset carries the IC0-3 level
	}
Пример #2
0
/*
    should be called after any change to int_state or enabled_ints.
*/
void tms9901_device::field_interrupts(void)
{
	int current_ints;

	/* int_state: state of lines int1-int15 */
	current_ints = m_int_state;
	if (m_clock_register != 0)
	{   /* if timer is enabled, INT3 pin is overriden by timer */
		if (m_timer_int_pending)
		{
			if (VERBOSE>8) LOG("tms9901: timer fires\n");
			current_ints |= TMS9901_INT3;
		}
		else
		{
			if (VERBOSE>8) LOG("tms9901: timer clear\n");
			current_ints &= ~TMS9901_INT3;
		}
	}

	/* enabled_ints: enabled interrupts */
	/* mask out all int pins currently set as output */
	current_ints &= m_enabled_ints & (~m_pio_direction_mirror);

	// Check whether we have a new state. For systems that use level-triggered
	// interrupts it should not do any harm if the line is re-asserted
	// but we may as well avoid this.
	if (current_ints == m_old_int_state)
		return;

	m_old_int_state = current_ints;

	if (current_ints)
	{
		// find which interrupt tripped us:
		// the number of the first (i.e. least significant) non-zero bit among
		// the 16 first bits
		// we simply look for the first bit set to 1 in current_ints... */
		int level = 0;

		while ((current_ints & 1)==0)
		{
			current_ints >>= 1; /* try next bit */
			level++;
		}
		m_int_pending = true;
		if (!m_interrupt.isnull())
			m_interrupt(level, 1);  // the offset carries the IC0-3 level
	}
	else
	{
Пример #3
0
void BaseIndex::Interrupt()
{
    m_interrupt();
}