Exemple #1
0
static MACHINE_START( actfancr )
{
	actfancr_state *state = (actfancr_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");
}
Exemple #2
0
static WRITE8_HANDLER( speech_control_w )
{
	UINT8 previous = speech_control;
	speech_control = data;

	/* bit 0 enables/disables the NMI line */
	nmi_state_update(space->machine);

	/* bit 1 controls a LED on the sound board */

	/* bit 2 goes to 8913 BDIR pin */
	if ((previous & 0x04) != 0 && (data & 0x04) == 0)
	{
		/* bit 3 selects which of the two 8913 to enable */
		/* bit 4 goes to the 8913 BC1 pin */
		const device_config *ay = devtag_get_device(space->machine, (data & 0x08) ? "ay1" : "ay2");
		ay8910_data_address_w(ay, data >> 4, *psg_latch);
	}

	/* bit 5 goes to the speech chip DIRECT DATA TEST pin */

	/* bit 6 = speech chip DATA PRESENT pin; high then low to make the chip read data */
	if ((previous & 0x40) == 0 && (data & 0x40) != 0)
	{
		const device_config *sp = devtag_get_device(space->machine, "sp");
		sp0250_w(sp, 0, *sp0250_latch);
	}

	/* bit 7 goes to the speech chip RESET pin */
	if ((previous ^ data) & 0x80)
	{
		const device_config *sp = devtag_get_device(space->machine, "sp");
		device_reset(sp);
	}
}
Exemple #3
0
static MACHINE_START( firetrap )
{
	firetrap_state *state = (firetrap_state *)machine->driver_data;
	UINT8 *MAIN = memory_region(machine, "maincpu");
	UINT8 *SOUND = memory_region(machine, "audiocpu");

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");
	state->msm = devtag_get_device(machine, "msm");

	memory_configure_bank(machine, "bank1", 0, 4, &MAIN[0x10000], 0x4000);
	memory_configure_bank(machine, "bank2", 0, 2, &SOUND[0x10000], 0x4000);

	state_save_register_global(machine, state->i8751_current_command);
	state_save_register_global(machine, state->irq_enable);
	state_save_register_global(machine, state->nmi_enable);
	state_save_register_global(machine, state->i8751_return);
	state_save_register_global(machine, state->i8751_init_ptr);
	state_save_register_global(machine, state->msm5205next);
	state_save_register_global(machine, state->adpcm_toggle);
	state_save_register_global(machine, state->int_latch);
	state_save_register_global(machine, state->coin_command_pending);
	state_save_register_global_array(machine, state->scroll1_x);
	state_save_register_global_array(machine, state->scroll1_y);
	state_save_register_global_array(machine, state->scroll2_x);
	state_save_register_global_array(machine, state->scroll2_y);
}
Exemple #4
0
static MACHINE_START(quakeat)
{
	cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback);

	quakeat_devices.pic8259_1 = devtag_get_device( machine, "pic8259_1" );
	quakeat_devices.pic8259_2 = devtag_get_device( machine, "pic8259_2" );
}
Exemple #5
0
static WRITE8_HANDLER( tp84_filter_w )
{
	int C;

	/* 76489 #0 */
	C = 0;
	if (offset & 0x008) C +=  47000;	/*  47000pF = 0.047uF */
	if (offset & 0x010) C += 470000;	/* 470000pF = 0.47uF */
	filter_rc_set_RC(devtag_get_device(space->machine, "filter1"),FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));

	/* 76489 #1 (optional) */
	C = 0;
	if (offset & 0x020) C +=  47000;	/*  47000pF = 0.047uF */
	if (offset & 0x040) C += 470000;	/* 470000pF = 0.47uF */
//  filter_rc_set_RC(devtag_get_device(space->machine, "filter2"),1000,2200,1000,C);

	/* 76489 #2 */
	C = 0;
	if (offset & 0x080) C += 470000;	/* 470000pF = 0.47uF */
	filter_rc_set_RC(devtag_get_device(space->machine, "filter2"),FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));

	/* 76489 #3 */
	C = 0;
	if (offset & 0x100) C += 470000;	/* 470000pF = 0.47uF */
	filter_rc_set_RC(devtag_get_device(space->machine, "filter3"),FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
}
Exemple #6
0
static MACHINE_START( dietgo )
{
	dietgo_state *state = (dietgo_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");
	state->deco16ic = devtag_get_device(machine, "deco_custom");
}
Exemple #7
0
static READ8_HANDLER( spcforce_SN76496_select_r )
{
	if (~spcforce_SN76496_select & 0x40) return sn76496_ready_r(devtag_get_device(space->machine, "sn1"), 0 );
	if (~spcforce_SN76496_select & 0x20) return sn76496_ready_r(devtag_get_device(space->machine, "sn2"), 0 );
	if (~spcforce_SN76496_select & 0x10) return sn76496_ready_r(devtag_get_device(space->machine, "sn3"), 0 );

	return 0;
}
Exemple #8
0
static WRITE8_HANDLER( spcforce_SN76496_select_w )
{
    spcforce_SN76496_select = data;

	if (~data & 0x40)  sn76496_w(devtag_get_device(space->machine, "sn1"), 0, spcforce_SN76496_latch);
	if (~data & 0x20)  sn76496_w(devtag_get_device(space->machine, "sn2"), 0, spcforce_SN76496_latch);
	if (~data & 0x10)  sn76496_w(devtag_get_device(space->machine, "sn3"), 0, spcforce_SN76496_latch);
}
Exemple #9
0
static DEVICE_START( namco_06xx )
{
	const namco_06xx_config *config = (const namco_06xx_config *)device->baseconfig().inline_config;
	namco_06xx_state *state = get_safe_token(device);
	int devnum;

	assert(config != NULL);

	/* resolve our CPU */
	state->nmicpu = devtag_get_device(device->machine, config->nmicpu);
	assert(state->nmicpu != NULL);

	/* resolve our devices */
	state->device[0] = (config->chip0 != NULL) ? devtag_get_device(device->machine, config->chip0) : NULL;
	assert(state->device[0] != NULL || config->chip0 == NULL);
	state->device[1] = (config->chip1 != NULL) ? devtag_get_device(device->machine, config->chip1) : NULL;
	assert(state->device[1] != NULL || config->chip1 == NULL);
	state->device[2] = (config->chip2 != NULL) ? devtag_get_device(device->machine, config->chip2) : NULL;
	assert(state->device[2] != NULL || config->chip2 == NULL);
	state->device[3] = (config->chip3 != NULL) ? devtag_get_device(device->machine, config->chip3) : NULL;
	assert(state->device[3] != NULL || config->chip3 == NULL);

	/* loop over devices and set their read/write handlers */
	for (devnum = 0; devnum < 4; devnum++)
		if (state->device[devnum] != NULL)
		{
			device_type type = state->device[devnum]->type;

			if (type == NAMCO_50XX)
			{
				state->read[devnum] = namco_50xx_read;
				state->readreq[devnum] = namco_50xx_read_request;
				state->write[devnum] = namco_50xx_write;
			}
			else if (type == NAMCO_51XX)
			{
				state->read[devnum] = namco_51xx_read;
				state->write[devnum] = namco_51xx_write;
			}
			else if (type == NAMCO_52XX)
				state->write[devnum] = namco_52xx_write;
			else if (type == NAMCO_53XX)
			{
				state->read[devnum] = namco_53xx_read;
				state->readreq[devnum] = namco_53xx_read_request;
			}
			else if (type == NAMCO_54XX)
				state->write[devnum] = namco_54xx_write;
			else
				fatalerror("Unknown device type %s connected to Namco 06xx", state->device[devnum]->name());
		}

	/* allocate a timer */
	state->nmi_timer = timer_alloc(device->machine, nmi_generate, (void *)device);

	state_save_register_device_item(device, 0, state->control);
}
Exemple #10
0
static MACHINE_START( rainbow )
{
	rainbow_state *state = (rainbow_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");
	state->pc080sn = devtag_get_device(machine, "pc080sn");
	state->pc090oj = devtag_get_device(machine, "pc090oj");
}
Exemple #11
0
static WRITE8_HANDLER( cavelon_banksw_w )
{
	cavelon_banksw(space->machine);

	if      ((offset >= 0x0100) && (offset <= 0x0103))
		ppi8255_w(devtag_get_device(space->machine, "ppi8255_0"), offset - 0x0100, data);
	else if ((offset >= 0x0200) && (offset <= 0x0203))
		ppi8255_w(devtag_get_device(space->machine, "ppi8255_1"), offset - 0x0200, data);
}
Exemple #12
0
static MACHINE_RESET( skeetsht )
{
    skeetsht_state *state = (skeetsht_state *)machine->driver_data;

    state->ay = devtag_get_device(machine, "aysnd");
    state->tms = devtag_get_device(machine, "tms");

    /* Setup the Bt476 VGA RAMDAC palette chip */
    tlc34076_reset(6);
}
Exemple #13
0
static MACHINE_START( boogwing )
{
	boogwing_state *state = (boogwing_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");
	state->deco16ic = devtag_get_device(machine, "deco_custom");
	state->oki1 = devtag_get_device(machine, "oki1");
	state->oki2 = devtag_get_device(machine, "oki2");
}
Exemple #14
0
static READ8_HANDLER( cavelon_banksw_r )
{
	cavelon_banksw(space->machine);

	if      ((offset >= 0x0100) && (offset <= 0x0103))
		return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), offset - 0x0100);
	else if ((offset >= 0x0200) && (offset <= 0x0203))
		return ppi8255_r(devtag_get_device(space->machine, "ppi8255_1"), offset - 0x0200);

	return 0xff;
}
Exemple #15
0
static WRITE8_HANDLER( dual_pokey_w )
{
	int pokey_num = (offset >> 3) & 0x01;
	int control = (offset & 0x10) >> 1;
	int pokey_reg = (offset % 8) | control;

	if (pokey_num == 0)
		pokey_w(devtag_get_device(space->machine, "pokey1"), pokey_reg, data);
	else
		pokey_w(devtag_get_device(space->machine, "pokey2"), pokey_reg, data);
}
Exemple #16
0
static MACHINE_START( brkthru )
{
	brkthru_state *state = (brkthru_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");

	state_save_register_global(machine, state->bgscroll);
	state_save_register_global(machine, state->bgbasecolor);
	state_save_register_global(machine, state->flipscreen);
}
Exemple #17
0
static READ8_HANDLER( dual_pokey_r )
{
	int pokey_num = (offset >> 3) & 0x01;
	int control = (offset & 0x10) >> 1;
	int pokey_reg = (offset % 8) | control;

	if (pokey_num == 0)
		return pokey_r(devtag_get_device(space->machine, "pokey1"), pokey_reg);
	else
		return pokey_r(devtag_get_device(space->machine, "pokey2"), pokey_reg);
}
Exemple #18
0
static MACHINE_RESET( opwolf )
{
	adpcm_b[0] = adpcm_b[1] = 0;
	adpcm_c[0] = adpcm_c[1] = 0;
	adpcm_pos[0] = adpcm_pos[1] = 0;
	adpcm_end[0] = adpcm_end[1] = 0;
	adpcm_data[0] = adpcm_data[1] = -1;

	msm5205_reset_w(devtag_get_device(machine, "msm1"), 1);
	msm5205_reset_w(devtag_get_device(machine, "msm2"), 1);
}
Exemple #19
0
static MACHINE_START( f1gp )
{
	f1gp_state *state = (f1gp_state *)machine->driver_data;
	UINT8 *ROM = memory_region(machine, "audiocpu");

	memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x8000);

	state->audiocpu = devtag_get_device(machine, "audiocpu");
	state->k053936 = devtag_get_device(machine, "k053936");

	MACHINE_START_CALL(f1gpb);
}
Exemple #20
0
GFXDECODE_END


static MACHINE_START( mouser )
{
    mouser_state *state = (mouser_state *)machine->driver_data;

    state->maincpu = devtag_get_device(machine, "maincpu");
    state->audiocpu = devtag_get_device(machine, "audiocpu");

    state_save_register_global(machine, state->sound_byte);
    state_save_register_global(machine, state->nmi_enable);
}
Exemple #21
0
static MACHINE_START( mrflea )
{
	mrflea_state *state = (mrflea_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->subcpu = devtag_get_device(machine, "sub");

	state_save_register_global(machine, state->gfx_bank);
	state_save_register_global(machine, state->io);
	state_save_register_global(machine, state->main);
	state_save_register_global(machine, state->status);
	state_save_register_global(machine, state->select1);
}
Exemple #22
0
static MACHINE_START( oneshot )
{
	oneshot_state *state = (oneshot_state *)machine->driver_data;

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");

	state_save_register_global(machine, state->gun_x_p1);
	state_save_register_global(machine, state->gun_y_p1);
	state_save_register_global(machine, state->gun_x_p2);
	state_save_register_global(machine, state->gun_y_p2);
	state_save_register_global(machine, state->gun_x_shift);
	state_save_register_global(machine, state->p1_wobble);
	state_save_register_global(machine, state->p2_wobble);
}
Exemple #23
0
static WRITE32_HANDLER( control_w )
{
	UINT32 old = control_data;

	// bit $80000000 = BSMT access/ROM read
	// bit $20000000 = toggled every 64 IRQ4's
	// bit $10000000 = ????
	// bit $00800000 = EEPROM data
	// bit $00400000 = EEPROM clock
	// bit $00200000 = EEPROM enable (on 1)

	COMBINE_DATA(&control_data);

	/* handle EEPROM I/O */
	if (ACCESSING_BITS_16_23)
	{
		eeprom_write_bit(data & 0x00800000);
		eeprom_set_cs_line((data & 0x00200000) ? CLEAR_LINE : ASSERT_LINE);
		eeprom_set_clock_line((data & 0x00400000) ? ASSERT_LINE : CLEAR_LINE);
	}

	/* toggling BSMT off then on causes a reset */
	if (!(old & 0x80000000) && (control_data & 0x80000000))
	{
		const device_config *device = devtag_get_device(space->machine, "bsmt");
		bsmt2000_data_w(device, bsmt_data_bank, 0, 0xffff);
		device_reset(device);
	}

	/* log any unknown bits */
	if (data & 0x4f1fffff)
		logerror("%08X: control_w = %08X & %08X\n", cpu_get_previouspc(space->cpu), data, mem_mask);
}
Exemple #24
0
ROM_END


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

static DEVICE_START( namco_52xx )
{
	namco_52xx_interface *intf = (namco_52xx_interface *)device->baseconfig().static_config;
	namco_52xx_state *state = get_safe_token(device);
	astring tempstring;

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

	/* find the attached discrete sound device */
	assert(intf->discrete != NULL);
	state->discrete = devtag_get_device(device->machine, intf->discrete);
	assert(state->discrete != NULL);
	state->basenode = intf->firstnode;

	/* resolve our read/write callbacks */
	devcb_resolve_read8(&state->romread, &intf->romread, device);
	devcb_resolve_read8(&state->si, &intf->si, device);

	/* start the external clock */
	if (intf->extclock != 0)
		timer_pulse(device->machine, attotime_make(0, intf->extclock), (void *)device, 0, external_clock_pulse);
}
Exemple #25
0
static MACHINE_START( tail2nos )
{
	tail2nos_state *state = (tail2nos_state *)machine->driver_data;
	UINT8 *ROM = memory_region(machine, "audiocpu");

	memory_configure_bank(machine, "bank3", 0, 2, &ROM[0x10000], 0x8000);
	memory_set_bank(machine, "bank3", 0);

	state->maincpu = devtag_get_device(machine, "maincpu");
	state->audiocpu = devtag_get_device(machine, "audiocpu");
	state->k051316 = devtag_get_device(machine, "k051316");

	state_save_register_global(machine, state->charbank);
	state_save_register_global(machine, state->charpalette);
	state_save_register_global(machine, state->video_enable);
}
Exemple #26
0
static READ8_HANDLER( spool99_io_r )
{
	UINT8 *ROM = memory_region(space->machine, "maincpu");

//  if(!(io_switch))
	{
		switch(offset+0xaf00)
		{
			case 0xafd8: return input_port_read(space->machine,"COIN1");
//          case 0xafd9: return 1;
			case 0xafda: return input_port_read(space->machine,"COIN2");
			case 0xafdb: return 1;
			case 0xafdc: return input_port_read(space->machine,"SERVICE1");//attract mode
			case 0xafdd: return input_port_read(space->machine,"HOLD3");
			case 0xafde: return input_port_read(space->machine,"HOLD4");
			case 0xafdf: return input_port_read(space->machine,"HOLD2");
			case 0xafe0: return input_port_read(space->machine,"HOLD1");
			case 0xafe1: return input_port_read(space->machine,"HOLD5");
			case 0xafe2: return input_port_read(space->machine,"START");
			case 0xafe3: return input_port_read(space->machine,"BET");//system 2
			case 0xafe4: return input_port_read(space->machine,"SERVICE2");//attract mode
//          case 0xafe5: return 1;
//          case 0xafe6: return 1;
			case 0xafe7: return eeprom_read_bit();
			case 0xaff8: return okim6295_r(devtag_get_device(space->machine, "oki"),0);
		}
	}
//  printf("%04x %d\n",offset+0xaf00,io_switch);

	return ROM[0xaf00+offset];
}
Exemple #27
0
static TIMER_CALLBACK( music_playback )
{
	int pattern = 0;
	const device_config *device = devtag_get_device(machine, "oki");

	if ((okim6295_r(device,0) & 0x08) == 0)
	{
		if (sslam_bar != 0) {
			sslam_bar += 1;
			if (sslam_bar >= (sslam_snd_loop[sslam_melody][0] + 1))
				sslam_bar = 1;
		}
		pattern = sslam_snd_loop[sslam_melody][sslam_bar];

		if (pattern == 0xff) {		/* Restart track from first bar */
			sslam_bar = 1;
			pattern = sslam_snd_loop[sslam_melody][sslam_bar];
		}
		if (pattern == 0x00) {		/* Non-looped track. Stop playing it */
			sslam_track = 0;
			sslam_melody = 0;
			sslam_bar = 0;
			timer_enable(music_timer,0);
		}
		if (pattern) {
			logerror("Changing bar in music track to pattern %02x\n",pattern);
			okim6295_w(device,0,(0x80 | pattern));
			okim6295_w(device,0,0x81);
		}
	}
//  {
//      pattern = sslam_snd_loop[sslam_melody][sslam_bar];
//      popmessage("Music track: %02x, Melody: %02x, Pattern: %02x, Bar:%02d",sslam_track,sslam_melody,pattern,sslam_bar);
//  }
}
Exemple #28
0
static READ8_HANDLER( wolfpack_misc_r )
{
	running_device *device = devtag_get_device(space->machine, "speech");
	UINT8 val = 0;

	/* BIT0 => SPEECH BUSY */
	/* BIT1 => COMP SIREN  */
	/* BIT2 => SPARE       */
	/* BIT3 => SPARE       */
	/* BIT4 => COL DETECT  */
	/* BIT5 => UNUSED      */
	/* BIT6 => UNUSED      */
	/* BIT7 => VBLANK      */

	if (!s14001a_bsy_r(device))
        val |= 0x01;

	if (!wolfpack_collision)
		val |= 0x10;

	if (video_screen_get_vpos(space->machine->primary_screen) >= 240)
		val |= 0x80;

	return val;
}
Exemple #29
0
static READ16_HANDLER( main_irqiack_r )
{
    //fprintf(stderr, "M0: irq iack\n");
    cpu_set_input_line(devtag_get_device(space->machine, "maincpu"), M68K_IRQ_1, CLEAR_LINE);
    //cpu_set_input_line(devtag_get_device(space->machine, "maincpu"), INPUT_LINE_RESET, CLEAR_LINE);
    return 0;
}
Exemple #30
0
static WRITE8_DEVICE_HANDLER(ic8j2_output_changed)
{
	/* written from /Q to A with slight delight */
	LOG(("ic8j2: %d\n", data));
	ttl74123_a_w(device, 0, data);
	ttl74123_a_w(devtag_get_device(device->machine, "ic8j1"), 0, data);
}