Example #1
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];
}
Example #2
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);
//  }
}
Example #3
0
static void play_oki_sound(const device_config *device, int game_sound, int data)
{
	int status = okim6295_r(device,0);

	logerror("Playing sample %02x from command %02x\n",game_sound,data);

	if (game_sound != 0)
	{
		if ((status & 0x01) == 0) {
			okim6295_w(device,0,(0x80 | game_sound));
			okim6295_w(device,0,0x11);
		}
		else if ((status & 0x02) == 0) {
			okim6295_w(device,0,(0x80 | game_sound));
			okim6295_w(device,0,0x21);
		}
		else if ((status & 0x04) == 0) {
			okim6295_w(device,0,(0x80 | game_sound));
			okim6295_w(device,0,0x41);
		}
		else if ((status & 0x08) == 0) {
			okim6295_w(device,0,(0x80 | game_sound));
			okim6295_w(device,0,0x81);
		}
	}
}
Example #4
0
static void sslam_play(const device_config *device, int track, int data)
{
	int status = okim6295_r(device,0);

	if (data < 0x80) {
		if (track) {
			if (sslam_track != data) {
				sslam_track  = data;
				sslam_bar = 1;
				if (status & 0x08)
					okim6295_w(device,0,0x40);
				okim6295_w(device,0,(0x80 | data));
				okim6295_w(device,0,0x81);
				timer_adjust_periodic(music_timer, ATTOTIME_IN_MSEC(4), 0, ATTOTIME_IN_HZ(250));	/* 250Hz for smooth sequencing */
			}
		}
		else {
			if ((status & 0x01) == 0) {
				okim6295_w(device,0,(0x80 | data));
				okim6295_w(device,0,0x11);
			}
			else if ((status & 0x02) == 0) {
				okim6295_w(device,0,(0x80 | data));
				okim6295_w(device,0,0x21);
			}
			else if ((status & 0x04) == 0) {
				okim6295_w(device,0,(0x80 | data));
				okim6295_w(device,0,0x41);
			}
		}
	}
	else {		/* use above 0x80 to turn off channels */
		if (track) {
			timer_enable(music_timer,0);
			sslam_track = 0;
			sslam_melody = 0;
			sslam_bar = 0;
		}
		data &= 0x7f;
		okim6295_w(device,0,data);
	}
}
Example #5
0
	AM_RANGE(0xff0000, 0xffffff) AM_RAM	  /* Main RAM */
ADDRESS_MAP_END


/*
    Sound MCU mapping
*/

static READ8_HANDLER( playmark_snd_command_r )
{
	UINT8 data = 0;

	if ((playmark_oki_control & 0x38) == 0x30) {
		data = soundlatch_r(space,0);
	}
	else if ((playmark_oki_control & 0x38) == 0x28) {
		data = (okim6295_r(devtag_get_device(space->machine, "oki"),0) & 0x0f);
	}

	return data;
}
Example #6
0
static READ8_DEVICE_HANDLER( aquarium_oki_r )
{
	return (aquarium_snd_bitswap(okim6295_r(device,0)) );
}