示例#1
0
static DEVICE_START( pia6821 )
{
	pia6821_state *p = get_token(device);
	const pia6821_interface *intf = get_interface(device);

	/* clear structure */
	memset(p, 0, sizeof(*p));

	/* resolve callbacks */
	devcb_resolve_read8(&p->in_a_func, &intf->in_a_func, device);
	devcb_resolve_read8(&p->in_b_func, &intf->in_b_func, device);
	devcb_resolve_read_line(&p->in_ca1_func, &intf->in_ca1_func, device);
	devcb_resolve_read_line(&p->in_cb1_func, &intf->in_cb1_func, device);
	devcb_resolve_read_line(&p->in_ca2_func, &intf->in_ca2_func, device);
	devcb_resolve_read_line(&p->in_cb2_func, &intf->in_cb2_func, device);
	devcb_resolve_write8(&p->out_a_func, &intf->out_a_func, device);
	devcb_resolve_write8(&p->out_b_func, &intf->out_b_func, device);
	devcb_resolve_write_line(&p->out_ca2_func, &intf->out_ca2_func, device);
	devcb_resolve_write_line(&p->out_cb2_func, &intf->out_cb2_func, device);
	devcb_resolve_write_line(&p->irq_a_func, &intf->irq_a_func, device);
	devcb_resolve_write_line(&p->irq_b_func, &intf->irq_b_func, device);

	state_save_register_device_item(device, 0, p->in_a);
	state_save_register_device_item(device, 0, p->in_ca1);
	state_save_register_device_item(device, 0, p->in_ca2);
	state_save_register_device_item(device, 0, p->out_a);
	state_save_register_device_item(device, 0, p->out_ca2);
	state_save_register_device_item(device, 0, p->port_a_z_mask);
	state_save_register_device_item(device, 0, p->ddr_a);
	state_save_register_device_item(device, 0, p->ctl_a);
	state_save_register_device_item(device, 0, p->irq_a1);
	state_save_register_device_item(device, 0, p->irq_a2);
	state_save_register_device_item(device, 0, p->irq_a_state);
	state_save_register_device_item(device, 0, p->in_b);
	state_save_register_device_item(device, 0, p->in_cb1);
	state_save_register_device_item(device, 0, p->in_cb2);
	state_save_register_device_item(device, 0, p->out_b);
	state_save_register_device_item(device, 0, p->out_cb2);
	state_save_register_device_item(device, 0, p->last_out_cb2_z);
	state_save_register_device_item(device, 0, p->ddr_b);
	state_save_register_device_item(device, 0, p->ctl_b);
	state_save_register_device_item(device, 0, p->irq_b1);
	state_save_register_device_item(device, 0, p->irq_b2);
	state_save_register_device_item(device, 0, p->irq_b_state);
	state_save_register_device_item(device, 0, p->in_a_pushed);
	state_save_register_device_item(device, 0, p->out_a_needs_pulled);
	state_save_register_device_item(device, 0, p->in_ca1_pushed);
	state_save_register_device_item(device, 0, p->in_ca2_pushed);
	state_save_register_device_item(device, 0, p->out_ca2_needs_pulled);
	state_save_register_device_item(device, 0, p->in_b_pushed);
	state_save_register_device_item(device, 0, p->out_b_needs_pulled);
	state_save_register_device_item(device, 0, p->in_cb1_pushed);
	state_save_register_device_item(device, 0, p->in_cb2_pushed);
	state_save_register_device_item(device, 0, p->out_cb2_needs_pulled);
}
示例#2
0
文件: 6850acia.c 项目: cdenix/psmame
void acia6850_device::device_start()
{
	/* resolve callbacks */
	devcb_resolve_read_line(&m_in_rx_func, &m_config.m_in_rx_func, this);
	devcb_resolve_write_line(&m_out_tx_func, &m_config.m_out_tx_func, this);
	devcb_resolve_read_line(&m_in_cts_func, &m_config.m_in_cts_func, this);
	devcb_resolve_write_line(&m_out_rts_func, &m_config.m_out_rts_func, this);
	devcb_resolve_read_line(&m_in_dcd_func, &m_config.m_in_dcd_func, this);
	devcb_resolve_write_line(&m_out_irq_func, &m_config.m_out_irq_func, this);

	m_rx_clock = m_config.m_rx_clock;
	m_tx_clock = m_config.m_tx_clock;
	m_tx_counter = 0;
	m_rx_counter = 0;
	m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(receive_event_callback), (void *)this);
	m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(transmit_event_callback), (void *)this);
	m_first_reset = 1;
	m_status_read = 0;
	m_brk = 0;

	m_rx_timer->reset();
	m_tx_timer->reset();

	save_item(NAME(m_ctrl));
	save_item(NAME(m_status));
	save_item(NAME(m_rx_clock));
	save_item(NAME(m_tx_clock));
	save_item(NAME(m_rx_counter));
	save_item(NAME(m_tx_counter));
	save_item(NAME(m_rx_shift));
	save_item(NAME(m_tx_shift));
	save_item(NAME(m_rdr));
	save_item(NAME(m_tdr));
	save_item(NAME(m_rx_bits));
	save_item(NAME(m_tx_bits));
	save_item(NAME(m_rx_parity));
	save_item(NAME(m_tx_parity));
	save_item(NAME(m_tx_int));

	save_item(NAME(m_divide));
	save_item(NAME(m_overrun));
	save_item(NAME(m_reset));
	save_item(NAME(m_first_reset));
	save_item(NAME(m_rts));
	save_item(NAME(m_brk));
	save_item(NAME(m_status_read));
}
示例#3
0
void z80dart_device::dart_channel::start(z80dart_device *device, int index, const devcb_read_line &in_rxd, const devcb_write_line &out_txd, const devcb_write_line &out_dtr, const devcb_write_line &out_rts, const devcb_write_line &out_wrdy)
{
	m_index = index;
	m_device = device;

	devcb_resolve_read_line(&m_in_rxd_func, &in_rxd, m_device);
	devcb_resolve_write_line(&m_out_txd_func, &out_txd, m_device);
	devcb_resolve_write_line(&m_out_dtr_func, &out_dtr, m_device);
	devcb_resolve_write_line(&m_out_rts_func, &out_rts, m_device);
	devcb_resolve_write_line(&m_out_wrdy_func, &out_wrdy, m_device);

	state_save_register_device_item_array(m_device, m_index, m_rr);
	state_save_register_device_item_array(m_device, m_index, m_wr);
	state_save_register_device_item_array(m_device, m_index, m_rx_data_fifo);
	state_save_register_device_item_array(m_device, m_index, m_rx_error_fifo);
	state_save_register_device_item(m_device, m_index, m_rx_shift);
	state_save_register_device_item(m_device, m_index, m_rx_error);
	state_save_register_device_item(m_device, m_index, m_rx_fifo);
	state_save_register_device_item(m_device, m_index, m_rx_clock);
	state_save_register_device_item(m_device, m_index, m_rx_state);
	state_save_register_device_item(m_device, m_index, m_rx_bits);
	state_save_register_device_item(m_device, m_index, m_rx_first);
	state_save_register_device_item(m_device, m_index, m_rx_parity);
	state_save_register_device_item(m_device, m_index, m_rx_break);
	state_save_register_device_item(m_device, m_index, m_rx_rr0_latch);
	state_save_register_device_item(m_device, m_index, m_ri);
	state_save_register_device_item(m_device, m_index, m_cts);
	state_save_register_device_item(m_device, m_index, m_dcd);
	state_save_register_device_item(m_device, m_index, m_tx_data);
	state_save_register_device_item(m_device, m_index, m_tx_shift);
	state_save_register_device_item(m_device, m_index, m_tx_clock);
	state_save_register_device_item(m_device, m_index, m_tx_state);
	state_save_register_device_item(m_device, m_index, m_tx_bits);
	state_save_register_device_item(m_device, m_index, m_tx_parity);
	state_save_register_device_item(m_device, m_index, m_dtr);
	state_save_register_device_item(m_device, m_index, m_rts);
}
示例#4
0
void via6522_device::device_start()
{
    devcb_resolve_read8(&m_in_a_func, &m_config.m_in_a_func, this);
    devcb_resolve_read8(&m_in_b_func, &m_config.m_in_b_func, this);
    devcb_resolve_read_line(&m_in_ca1_func, &m_config.m_in_ca1_func, this);
    devcb_resolve_read_line(&m_in_cb1_func, &m_config.m_in_cb1_func, this);
    devcb_resolve_read_line(&m_in_ca2_func, &m_config.m_in_ca2_func, this);
    devcb_resolve_read_line(&m_in_cb2_func, &m_config.m_in_cb2_func, this);
    devcb_resolve_write8(&m_out_a_func, &m_config.m_out_a_func, this);
    devcb_resolve_write8(&m_out_b_func, &m_config.m_out_b_func, this);
    devcb_resolve_write_line(&m_out_ca1_func, &m_config.m_out_ca1_func, this);
    devcb_resolve_write_line(&m_out_cb1_func, &m_config.m_out_cb1_func, this);
    devcb_resolve_write_line(&m_out_ca2_func, &m_config.m_out_ca2_func, this);
    devcb_resolve_write_line(&m_out_cb2_func, &m_config.m_out_cb2_func, this);
    devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);

    m_t1ll = 0xf3; /* via at 0x9110 in vic20 show these values */
    m_t1lh = 0xb5; /* ports are not written by kernel! */
    m_t2ll = 0xff; /* taken from vice */
    m_t2lh = 0xff;
    m_time2 = m_time1 = timer_get_time(&m_machine);
    m_t1 = device_timer_alloc(*this, TIMER_T1);
    m_t2 = device_timer_alloc(*this, TIMER_T2);
    m_shift_timer = device_timer_alloc(*this, TIMER_SHIFT);

	/* Default clock is from CPU1 */
	if (clock() == 0)
    {
		set_unscaled_clock(m_machine.firstcpu->clock());
    }

	/* save state register */
    state_save_register_device_item(this, 0, m_in_a);
    state_save_register_device_item(this, 0, m_in_ca1);
    state_save_register_device_item(this, 0, m_in_ca2);
    state_save_register_device_item(this, 0, m_out_a);
    state_save_register_device_item(this, 0, m_out_ca2);
    state_save_register_device_item(this, 0, m_ddr_a);
    state_save_register_device_item(this, 0, m_in_b);
    state_save_register_device_item(this, 0, m_in_cb1);
    state_save_register_device_item(this, 0, m_in_cb2);
    state_save_register_device_item(this, 0, m_out_b);
    state_save_register_device_item(this, 0, m_out_cb2);
    state_save_register_device_item(this, 0, m_ddr_b);
    state_save_register_device_item(this, 0, m_t1cl);
    state_save_register_device_item(this, 0, m_t1ch);
    state_save_register_device_item(this, 0, m_t1ll);
    state_save_register_device_item(this, 0, m_t1lh);
    state_save_register_device_item(this, 0, m_t2cl);
    state_save_register_device_item(this, 0, m_t2ch);
    state_save_register_device_item(this, 0, m_t2ll);
    state_save_register_device_item(this, 0, m_t2lh);
    state_save_register_device_item(this, 0, m_sr);
    state_save_register_device_item(this, 0, m_pcr);
    state_save_register_device_item(this, 0, m_acr);
    state_save_register_device_item(this, 0, m_ier);
    state_save_register_device_item(this, 0, m_ifr);
    state_save_register_device_item(this, 0, m_t1_active);
    state_save_register_device_item(this, 0, m_t2_active);
    state_save_register_device_item(this, 0, m_shift_counter);
}