Пример #1
0
void cdp1852_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (get_mode())
	{
	case MODE_INPUT:
		// input data into register
		m_data = m_in_data_func(0);

		// signal processor
		set_sr_line(0);
		break;

	case MODE_OUTPUT:
		if (m_new_data)
		{
			m_new_data = 0;

			// latch data into register
			m_data = m_next_data;

			// output data
			m_out_data_func(0, m_data);

			// signal peripheral device
			set_sr_line(1);

			m_next_sr = 0;
		}
		else
		{
			set_sr_line(m_next_sr);
		}
		break;
	}
}
Пример #2
0
void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_CLOCK:
		advance_seconds();
		break;

	case TIMER_TP:
		m_tp = !m_tp;

		if (LOG) logerror("uPD1990A '%s' TP %u\n", tag(), m_tp);

		m_out_tp_func(m_tp);
		break;

	case TIMER_DATA_OUT:
		m_data_out = !m_data_out;

		if (LOG) logerror("uPD1990A '%s' DATA OUT TICK %u\n", tag(), m_data_out);

		m_out_data_func(m_data_out);
		break;
	}
}
Пример #3
0
void upd1990a_rtc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_CLOCK:
		advance_seconds();
		break;

	case TIMER_TP:
		m_tp = !m_tp;

		if (LOG) logerror("uPD1990A '%s' TP %u\n", tag(), m_tp);

		m_out_tp_func(m_tp);
		break;

	case TIMER_DATA_OUT:
		m_data_out = !m_data_out;

		if (LOG) logerror("uPD1990A '%s' DATA OUT TICK %u\n", tag(), m_data_out);

		m_out_data_func(m_data_out);
		break;

	case TIMER_TEST_MODE:
		if (m_oe)
		{
			/* TODO: completely untested */
			/* time counter is advanced at 1024 Hz from "Second" counter input */
			int i;

			m_data_out = (m_time_counter[4] == 0);

			for(i=0;i<5;i++)
			{
				m_time_counter[i]++;
				if(m_time_counter[i] != 0)
					return;
			}
		}
		else // parallel
		{
			int i;
			/* each counter is advanced at 1024 Hz in parallel, overflow carry does not affect next counter */
			m_time_counter[0]++;
			m_time_counter[1]++;
			m_time_counter[2]++;
			m_time_counter[3]++;
			m_time_counter[4]++;

			m_data_out = 0;

			for(i=0;i<5;i++)
				m_data_out |= (m_time_counter[i] == 0);
		}

		break;
	}
}
Пример #4
0
void cdp1852_device::device_reset()
{
	// reset data register
	m_data = 0;

	if (get_mode() == MODE_INPUT)
	{
		// reset service request flip-flop
		set_sr_line(1);
	}
	else
	{
		// output data
		m_out_data_func(0, m_data);

		// reset service request flip-flop
		set_sr_line(0);
	}
}
Пример #5
0
void pc_kbdc_device::update_data_state()
{
	int new_data_state = m_mb_data_state & m_kb_data_state;

	if ( new_data_state != m_data_state )
	{
		// We first set our state to prevent possible endless loops
		m_data_state = new_data_state;

		// Send state to keyboard interface logic on mainboard
		m_out_data_func( m_data_state );

		// Send state to keyboard
		if ( m_keyboard )
		{
			m_keyboard->data_write( m_data_state );
		}
	}
}
Пример #6
0
inline void econet_device::set_signal(device_t *device, int signal, int state)
{
	bool changed = false;

	if (device == this)
	{
		if (m_line[signal] != state)
		{
			if (LOG) logerror("Econet: '%s' %s %u\n", tag(), SIGNAL_NAME[signal], state);
			m_line[signal] = state;
			changed = true;
		}
	}
	else
	{
		daisy_entry *entry = m_device_list.first();

		while (entry)
		{
			if (!strcmp(entry->m_device->tag(), device->tag()))
			{
				if (entry->m_line[signal] != state)
				{
					if (LOG) logerror("Econet: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state);
					entry->m_line[signal] = state;
					changed = true;
				}
			}

			entry = entry->next();
		}
	}

	if (changed)
	{
		switch (signal)
		{
		case CLK:   m_out_clk_func(state);  break;
		case DATA:  m_out_data_func(state); break;
		}

		daisy_entry *entry = m_device_list.first();

		while (entry)
		{
			switch (signal)
			{
			case CLK:
				entry->m_interface->econet_clk(state);
				break;

			case DATA:
				entry->m_interface->econet_data(state);
				break;
			}

			entry = entry->next();
		}

		if (LOG) logerror("Econet: CLK %u DATA %u\n", get_signal(CLK), get_signal(DATA));
	}
}