Ejemplo n.º 1
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;
		m_write_tp(m_tp);
		break;

	case TIMER_DATA_OUT:
		m_data_out = !m_data_out;
		m_write_data(get_data_out());
		break;

	case TIMER_TEST_MODE:
		if (m_oe)
		{
			/* TODO: completely untested */
			/* time counter is advanced from "Second" counter input */
			int max_shift = is_serial_mode() ? 6 : 5;
			m_data_out = (m_time_counter[max_shift - 1] == 0);
			m_write_data(get_data_out());

			for (int i = 0; i < max_shift; i++)
			{
				m_time_counter[i]++;
				if (m_time_counter[i] != 0)
					return;
			}
		}
		else
		{
			/* each counter is advanced in parallel, overflow carry does not affect next counter */
			m_data_out = 0;

			int max_shift = is_serial_mode() ? 6 : 5;
			for (int i = 0; i < max_shift; i++)
			{
				m_time_counter[i]++;
				m_data_out |= (m_time_counter[i] == 0);
			}
			m_write_data(get_data_out());
		}

		break;
	}
}
Ejemplo n.º 2
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.º 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
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_write_clk(state);  break;
		case DATA:  m_write_data(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));
	}
}
Ejemplo n.º 5
0
void cbm_iec_device::set_signal(device_t *device, int signal, int state)
{
    bool changed = false;

    if (device == this)
    {
        if (m_line[signal] != state)
        {
            if (LOG) logerror("CBM IEC: '%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("CBM IEC: '%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 SRQ:
            m_write_srq(state);
            break;
        case ATN:
            m_write_atn(state);
            break;
        case CLK:
            m_write_clk(state);
            break;
        case DATA:
            m_write_data(state);
            break;
        case RESET:
            m_write_reset(state);
            break;
        }

        daisy_entry *entry = m_device_list.first();

        while (entry)
        {
            switch (signal)
            {
            case SRQ:
                entry->m_interface->cbm_iec_srq(state);
                break;

            case ATN:
                entry->m_interface->cbm_iec_atn(state);
                break;

            case CLK:
                entry->m_interface->cbm_iec_clk(state);
                break;

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

            case RESET:
                entry->m_interface->cbm_iec_reset(state);
                break;
            }

            entry = entry->next();
        }

        if (LOG) logerror("CBM IEC: SRQ %u ATN %u CLK %u DATA %u RESET %u\n",
                              get_signal(SRQ), get_signal(ATN), get_signal(CLK), get_signal(DATA), get_signal(RESET));
    }
}