示例#1
0
文件: z80dma.c 项目: johkelly/MAME_hi
void z80dma_device::device_start()
{
	// resolve callbacks
	devcb_resolve_write_line(&m_out_busreq_func, &m_config.m_out_busreq_func, this);
	devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
	devcb_resolve_write_line(&m_out_bao_func, &m_config.m_out_bao_func, this);
	devcb_resolve_read8(&m_in_mreq_func, &m_config.m_in_mreq_func, this);
	devcb_resolve_write8(&m_out_mreq_func, &m_config.m_out_mreq_func, this);
	devcb_resolve_read8(&m_in_iorq_func, &m_config.m_in_iorq_func, this);
	devcb_resolve_write8(&m_out_iorq_func, &m_config.m_out_iorq_func, this);

	// allocate timer
	m_timer = timer_alloc(&m_machine, static_timerproc, (void *)this);

	// register for state saving
	state_save_register_device_item_array(this, 0, m_regs);
	state_save_register_device_item_array(this, 0, m_regs_follow);
	state_save_register_device_item(this, 0, m_num_follow);
	state_save_register_device_item(this, 0, m_cur_follow);
	state_save_register_device_item(this, 0, m_status);
	state_save_register_device_item(this, 0, m_dma_enabled);
	state_save_register_device_item(this, 0, m_vector);
	state_save_register_device_item(this, 0, m_ip);
	state_save_register_device_item(this, 0, m_ius);
	state_save_register_device_item(this, 0, m_addressA);
	state_save_register_device_item(this, 0, m_addressB);
	state_save_register_device_item(this, 0, m_count);
	state_save_register_device_item(this, 0, m_rdy);
	state_save_register_device_item(this, 0, m_force_ready);
	state_save_register_device_item(this, 0, m_is_read);
	state_save_register_device_item(this, 0, m_cur_cycle);
	state_save_register_device_item(this, 0, m_latch);
}
示例#2
0
文件: z80pio.c 项目: nitrologic/emu
static DEVICE_START( z80pio )
{
	const z80pio_interface *intf = (const z80pio_interface *)device->static_config;
	z80pio_t *z80pio = get_safe_token( device );

	devcb_resolve_write_line(&z80pio->intr, &intf->intr, device);
	devcb_resolve_read8(&z80pio->port_read[0], &intf->portAread, device);
	devcb_resolve_read8(&z80pio->port_read[1], &intf->portBread, device);
	devcb_resolve_write8(&z80pio->port_write[0], &intf->portAwrite, device);
	devcb_resolve_write8(&z80pio->port_write[1], &intf->portBwrite, device);
	devcb_resolve_write_line(&z80pio->rdyr[0], &intf->rdyA, device);
	devcb_resolve_write_line(&z80pio->rdyr[1], &intf->rdyB, device);

	/* register for save states */
	state_save_register_device_item_array(device, 0, z80pio->vector);
	state_save_register_device_item_array(device, 0, z80pio->mode);
	state_save_register_device_item_array(device, 0, z80pio->enable);
	state_save_register_device_item_array(device, 0, z80pio->mask);
	state_save_register_device_item_array(device, 0, z80pio->dir);
	state_save_register_device_item_array(device, 0, z80pio->rdy);
	state_save_register_device_item_array(device, 0, z80pio->in);
	state_save_register_device_item_array(device, 0, z80pio->out);
	state_save_register_device_item_array(device, 0, z80pio->strobe);
	state_save_register_device_item_array(device, 0, z80pio->int_state);
}
示例#3
0
static DEVICE_START( ppi8255 ) {
	ppi8255_t	*ppi8255 = get_safe_token(device);

	ppi8255->intf = (const ppi8255_interface *)device->baseconfig().static_config;

	devcb_resolve_read8(&ppi8255->port_read[0], &ppi8255->intf->port_a_read, device);
	devcb_resolve_read8(&ppi8255->port_read[1], &ppi8255->intf->port_b_read, device);
	devcb_resolve_read8(&ppi8255->port_read[2], &ppi8255->intf->port_c_read, device);

	devcb_resolve_write8(&ppi8255->port_write[0], &ppi8255->intf->port_a_write, device);
	devcb_resolve_write8(&ppi8255->port_write[1], &ppi8255->intf->port_b_write, device);
	devcb_resolve_write8(&ppi8255->port_write[2], &ppi8255->intf->port_c_write, device);

	/* register for state saving */
	state_save_register_device_item(device, 0, ppi8255->group_a_mode);
	state_save_register_device_item(device, 0, ppi8255->group_b_mode);
	state_save_register_device_item(device, 0, ppi8255->port_a_dir);
	state_save_register_device_item(device, 0, ppi8255->port_b_dir);
	state_save_register_device_item(device, 0, ppi8255->port_ch_dir);
	state_save_register_device_item(device, 0, ppi8255->port_cl_dir);
	state_save_register_device_item(device, 0, ppi8255->obf_a);
	state_save_register_device_item(device, 0, ppi8255->obf_b);
	state_save_register_device_item(device, 0, ppi8255->ibf_a);
	state_save_register_device_item(device, 0, ppi8255->ibf_b);
	state_save_register_device_item(device, 0, ppi8255->inte_a);
	state_save_register_device_item(device, 0, ppi8255->inte_b);
	state_save_register_device_item(device, 0, ppi8255->inte_1);
	state_save_register_device_item(device, 0, ppi8255->inte_2);
	state_save_register_device_item_array(device, 0, ppi8255->in_mask);
	state_save_register_device_item_array(device, 0, ppi8255->out_mask);
	state_save_register_device_item_array(device, 0, ppi8255->read);
	state_save_register_device_item_array(device, 0, ppi8255->latch);
}
示例#4
0
文件: 8255ppi.c 项目: cdenix/psmame
void ppi8255_device::device_start()
{
	devcb_resolve_read8(&m_port_read[0], &m_config.m_port_a_read, this);
	devcb_resolve_read8(&m_port_read[1], &m_config.m_port_b_read, this);
	devcb_resolve_read8(&m_port_read[2], &m_config.m_port_c_read, this);

	devcb_resolve_write8(&m_port_write[0], &m_config.m_port_a_write, this);
	devcb_resolve_write8(&m_port_write[1], &m_config.m_port_b_write, this);
	devcb_resolve_write8(&m_port_write[2], &m_config.m_port_c_write, this);

	/* register for state saving */
	save_item(NAME(m_group_a_mode));
	save_item(NAME(m_group_b_mode));
	save_item(NAME(m_port_a_dir));
	save_item(NAME(m_port_b_dir));
	save_item(NAME(m_port_ch_dir));
	save_item(NAME(m_port_cl_dir));
	save_item(NAME(m_obf_a));
	save_item(NAME(m_obf_b));
	save_item(NAME(m_ibf_a));
	save_item(NAME(m_ibf_b));
	save_item(NAME(m_inte_a));
	save_item(NAME(m_inte_b));
	save_item(NAME(m_inte_1));
	save_item(NAME(m_inte_2));
	save_item(NAME(m_in_mask));
	save_item(NAME(m_out_mask));
	save_item(NAME(m_read));
	save_item(NAME(m_latch));
}
示例#5
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);
}
示例#6
0
文件: i8355.c 项目: cdenix/psmame
void i8355_device::device_start()
{
	// resolve callbacks
	devcb_resolve_read8(&m_in_port_func[0], &m_config.in_pa_func, this);
	devcb_resolve_read8(&m_in_port_func[1], &m_config.in_pb_func, this);
	devcb_resolve_write8(&m_out_port_func[0], &m_config.out_pa_func, this);
	devcb_resolve_write8(&m_out_port_func[1], &m_config.out_pb_func, this);

	// register for state saving
	save_item(NAME(m_output));
	save_item(NAME(m_ddr));
}
示例#7
0
文件: cdp1852.c 项目: nitrologic/emu
static DEVICE_START( cdp1852 )
{
	cdp1852_t *cdp1852 = get_safe_token(device);
	const cdp1852_interface *intf = get_interface(device);

	/* resolve callbacks */
	devcb_resolve_read8(&cdp1852->in_data_func, &intf->in_data_func, device);
	devcb_resolve_write8(&cdp1852->out_data_func, &intf->out_data_func, device);
	devcb_resolve_write_line(&cdp1852->out_sr_func, &intf->out_sr_func, device);

	/* set initial values */
	cdp1852->mode = (cdp1852_mode)intf->mode;

	if (device->clock > 0)
	{
		/* create the scan timer */
		cdp1852->scan_timer = timer_alloc(device->machine, cdp1852_scan_tick, (void *)device);
		timer_adjust_periodic(cdp1852->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock));
	}

	/* register for state saving */
	state_save_register_device_item(device, 0, cdp1852->new_data);
	state_save_register_device_item(device, 0, cdp1852->data);
	state_save_register_device_item(device, 0, cdp1852->next_data);
	state_save_register_device_item(device, 0, cdp1852->sr);
	state_save_register_device_item(device, 0, cdp1852->next_sr);
}
示例#8
0
文件: cdp1852.c 项目: cdenix/psmame
static DEVICE_START( cdp1852 )
{
	cdp1852_t *cdp1852 = get_safe_token(device);
	const cdp1852_interface *intf = get_interface(device);

	/* resolve callbacks */
	devcb_resolve_read8(&cdp1852->in_data_func, &intf->in_data_func, device);
	devcb_resolve_write8(&cdp1852->out_data_func, &intf->out_data_func, device);
	devcb_resolve_write_line(&cdp1852->out_sr_func, &intf->out_sr_func, device);

	/* set initial values */
	cdp1852->mode = (cdp1852_mode)intf->mode;

	if (device->clock() > 0)
	{
		/* create the scan timer */
		cdp1852->scan_timer = device->machine().scheduler().timer_alloc(FUNC(cdp1852_scan_tick), (void *)device);
		cdp1852->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock()));
	}

	/* register for state saving */
	device->save_item(NAME(cdp1852->new_data));
	device->save_item(NAME(cdp1852->data));
	device->save_item(NAME(cdp1852->next_data));
	device->save_item(NAME(cdp1852->sr));
	device->save_item(NAME(cdp1852->next_sr));
}
示例#9
0
ROM_END


/*-------------------------------------------------
    device start callback
-------------------------------------------------*/

static DEVICE_START( namco_53xx )
{
	const namco_53xx_interface *config = (const namco_53xx_interface *)device->baseconfig().static_config;
	namco_53xx_state *state = get_safe_token(device);
	astring tempstring;

	assert(config != NULL);

	/* find our CPU */
	state->cpu = device->subdevice("mcu");
	assert(state->cpu != NULL);

	/* resolve our read/write callbacks */
	devcb_resolve_read8(&state->k, &config->k, device);
	devcb_resolve_read8(&state->in[0], &config->in[0], device);
	devcb_resolve_read8(&state->in[1], &config->in[1], device);
	devcb_resolve_read8(&state->in[2], &config->in[2], device);
	devcb_resolve_read8(&state->in[3], &config->in[3], device);
	devcb_resolve_write8(&state->p, &config->p, device);

	state_save_register_device_item(device, 0, state->portO);
}
示例#10
0
文件: i8155.c 项目: cdenix/psmame
void i8155_device::device_start()
{
	// resolve callbacks
	devcb_resolve_read8(&m_in_port_func[0], &m_config.in_pa_func, this);
	devcb_resolve_read8(&m_in_port_func[1], &m_config.in_pb_func, this);
	devcb_resolve_read8(&m_in_port_func[2], &m_config.in_pc_func, this);
	devcb_resolve_write8(&m_out_port_func[0], &m_config.out_pa_func, this);
	devcb_resolve_write8(&m_out_port_func[1], &m_config.out_pb_func, this);
	devcb_resolve_write8(&m_out_port_func[2], &m_config.out_pc_func, this);
	devcb_resolve_write_line(&m_out_to_func, &m_config.out_to_func, this);

	// allocate timers
	m_timer = timer_alloc();

	// register for state saving
	save_item(NAME(m_io_m));
	save_item(NAME(m_ad));
	save_item(NAME(m_command));
	save_item(NAME(m_status));
	save_item(NAME(m_output));
	save_item(NAME(m_count_length));
	save_item(NAME(m_counter));
	save_item(NAME(m_to));
}
示例#11
0
static DEVICE_START( i8255a )
{
	i8255a_t *i8255a = get_safe_token(device);
	const i8255a_interface *intf = get_interface(device);

	/* resolve callbacks */
	devcb_resolve_read8(&i8255a->in_port_func[PORT_A], &intf->in_pa_func, device);
	devcb_resolve_read8(&i8255a->in_port_func[PORT_B], &intf->in_pb_func, device);
	devcb_resolve_read8(&i8255a->in_port_func[PORT_C], &intf->in_pc_func, device);
	devcb_resolve_write8(&i8255a->out_port_func[PORT_A], &intf->out_pa_func, device);
	devcb_resolve_write8(&i8255a->out_port_func[PORT_B], &intf->out_pb_func, device);
	devcb_resolve_write8(&i8255a->out_port_func[PORT_C], &intf->out_pc_func, device);

	/* register for state saving */
	state_save_register_device_item(device, 0, i8255a->control);
	state_save_register_device_item_array(device, 0, i8255a->output);
	state_save_register_device_item_array(device, 0, i8255a->input);
	state_save_register_device_item_array(device, 0, i8255a->ibf);
	state_save_register_device_item_array(device, 0, i8255a->obf);
	state_save_register_device_item_array(device, 0, i8255a->inte);
	state_save_register_device_item(device, 0, i8255a->inte1);
	state_save_register_device_item(device, 0, i8255a->inte2);
	state_save_register_device_item_array(device, 0, i8255a->intr);
}
示例#12
0
void ppi8255_set_port_c_write(running_device *device, const devcb_write8 *config)
{
	ppi8255_t	*ppi8255 = get_safe_token(device);
	devcb_resolve_write8(&ppi8255->port_write[2], config, device);
}
示例#13
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);
}