Beispiel #1
0
void pia6821_device::set_out_cb2(int data)
{
	int z = cb2_output_z();

	if ((data != m_out_cb2) || (z != m_last_out_cb2_z))
	{
		m_out_cb2 = data;
		m_last_out_cb2_z = z;

		// send to output function
		if (!m_cb2_handler.isnull())
		{
			m_cb2_handler(m_out_cb2);
		}
		else
		{
			if (m_out_cb2_needs_pulled)
			{
				logerror("PIA #%s: Warning! No port CB2 write handler. Previous value has been lost!\n", tag());
			}

			m_out_cb2_needs_pulled = true;
		}
	}
}
Beispiel #2
0
void via6522_device::device_reset()
{
	m_out_a = 0;
	m_out_ca2 = 1;
	m_ddr_a = 0;
	m_latch_a = 0;

	m_out_b = 0;
	m_out_cb1 = 1;
	m_out_cb2 = 1;
	m_ddr_b = 0;
	m_latch_b = 0;

	m_t1cl = 0;
	m_t1ch = 0;
	m_t2cl = 0;
	m_t2ch = 0;

	m_pcr = 0;
	m_acr = 0;
	m_ier = 0;
	m_ifr = 0;
	m_t1_active = 0;
	m_t1_pb7 = 1;
	m_t2_active = 0;
	m_shift_counter = 0;

	output_pa();
	output_pb();
	m_ca2_handler(m_out_ca2);
	m_cb1_handler(m_out_cb1);
	m_cb2_handler(m_out_cb2);
}
Beispiel #3
0
void via6522_device::shift()
{
	if (SO_O2_CONTROL(m_acr) || SO_T2_CONTROL(m_acr))
	{
		m_out_cb2 = (m_sr >> 7) & 1;
		m_sr =  (m_sr << 1) | m_out_cb2;

		m_cb2_handler(m_out_cb2);

		/* this should be one cycle wide */
		m_cb1_handler(0);
		m_cb1_handler(1);

		m_shift_counter = (m_shift_counter + 1) % 8;

		if (m_shift_counter)
		{
			if (SO_O2_CONTROL(m_acr)) {
				m_shift_timer->adjust(clocks_to_attotime(2));
			} else {
				m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2));
			}
		}
		else
		{
			if (!(m_ifr & INT_SR))
			{
				set_int(INT_SR);
			}
		}
	}