Exemple #1
0
void base_c2040_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	int ready = 1;

	// shift in data from the read head
	m_sr <<= 1;
	m_sr |= BIT(m_unit[m_drive].m_track_buffer[m_unit[m_drive].m_buffer_pos], m_unit[m_drive].m_bit_pos);

	// update GCR data
	update_gcr_data();

	// update bit counters
	m_unit[m_drive].m_bit_pos--;
	m_bit_count++;

	if (m_unit[m_drive].m_bit_pos < 0)
	{
		m_unit[m_drive].m_bit_pos = 7;
		m_unit[m_drive].m_buffer_pos++;

		if (m_unit[m_drive].m_buffer_pos >= m_unit[m_drive].m_track_len)
		{
			// loop to the start of the track
			m_unit[m_drive].m_buffer_pos = 0;
		}
	}

	if (!SYNC)
	{
		// SYNC detected
		m_bit_count = 0;
	}

	if (m_bit_count == 10)
	{
		// byte ready
		m_bit_count = 0;
		ready = 0;
	}

	if (m_ready != ready)
	{
		// set byte ready flag
		m_ready = ready;

		m_via->write_ca1(ready);
		m_via->write_cb1(ERROR);

		if ((m_variant == base_c2040_device::TYPE_8050) ||
			(m_variant == base_c2040_device::TYPE_8250) ||
			(m_variant == base_c2040_device::TYPE_SFD1001))
		{
			m_fdccpu->set_input_line(M6502_SET_OVERFLOW, ready ? CLEAR_LINE : ASSERT_LINE);
		}
	}
}
Exemple #2
0
void c2040_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	int ready = 1;

	// shift in data from the read head
	m_sr <<= 1;
	m_sr |= BIT(m_unit[m_drive].m_track_buffer[m_unit[m_drive].m_buffer_pos], m_unit[m_drive].m_bit_pos);

	// update GCR data
	update_gcr_data();

	// update bit counters
	m_unit[m_drive].m_bit_pos--;
	m_bit_count++;

	if (m_unit[m_drive].m_bit_pos < 0)
	{
		m_unit[m_drive].m_bit_pos = 7;
		m_unit[m_drive].m_buffer_pos++;

		if (m_unit[m_drive].m_buffer_pos >= m_unit[m_drive].m_track_len)
		{
			// loop to the start of the track
			m_unit[m_drive].m_buffer_pos = 0;
		}
	}

	if (!SYNC)
	{
		// SYNC detected
		m_bit_count = 0;
	}

	if (m_bit_count == 10)
	{
		// byte ready
		m_bit_count = 0;
		ready = 0;
	}

	if (m_ready != ready)
	{
		// set byte ready flag
		m_ready = ready;

		m_via->write_ca1(ready);
		m_via->write_cb1(ERROR);

		this->byte_ready(ready);
	}
}