Ejemplo n.º 1
0
void cdp1852_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	if (!m_read_mode())
	{
		// input data into register
		m_data = m_read_data(0);

		// signal processor
		set_sr_line(0);
	}
	else
	{
		if (m_new_data)
		{
			m_new_data = 0;

			// latch data into register
			m_data = m_next_data;

			// output data
			m_write_data((offs_t)0, m_data);

			// signal peripheral device
			set_sr_line(1);

			m_next_sr = 0;
		}
		else
		{
			set_sr_line(m_next_sr);
		}
	}
}
Ejemplo n.º 2
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;
	}
}
Ejemplo n.º 3
0
void cdp1852_device::device_reset()
{
	// reset data register
	m_data = 0;

	if (!m_read_mode())
	{
		// reset service request flip-flop
		set_sr_line(1);
	}
	else
	{
		// output data
		m_write_data((offs_t)0, m_data);

		// reset service request flip-flop
		set_sr_line(0);
	}
}
Ejemplo n.º 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);
	}
}
Ejemplo n.º 5
0
static DEVICE_RESET( cdp1852 )
{
	cdp1852_t *cdp1852 = get_safe_token(device);

	/* reset data register */
	cdp1852->data = 0;

	if (cdp1852->mode == CDP1852_MODE_INPUT)
	{
		/* reset service request flip-flop */
		set_sr_line(cdp1852, 1);
	}
	else
	{
		/* output data */
		devcb_call_write8(&cdp1852->out_data_func, 0, cdp1852->data);

		/* reset service request flip-flop */
		set_sr_line(cdp1852, 0);
	}
}
Ejemplo n.º 6
0
static TIMER_CALLBACK( cdp1852_scan_tick )
{
	const device_config *device = (const device_config *)ptr;
	cdp1852_t *cdp1852 = get_safe_token(device);

	switch (cdp1852->mode)
	{
	case CDP1852_MODE_INPUT:
		/* input data into register */
		cdp1852->data = devcb_call_read8(&cdp1852->in_data_func, 0);

		/* signal processor */
		set_sr_line(cdp1852, 0);
		break;

	case CDP1852_MODE_OUTPUT:
		if (cdp1852->new_data)
		{
			cdp1852->new_data = 0;

			/* latch data into register */
			cdp1852->data = cdp1852->next_data;

			/* output data */
			devcb_call_write8(&cdp1852->out_data_func, 0, cdp1852->data);

			/* signal peripheral device */
			set_sr_line(cdp1852, 1);

			cdp1852->next_sr = 0;
		}
		else
		{
			set_sr_line(cdp1852, cdp1852->next_sr);
		}
		break;
	}
}