Example #1
0
static WRITE8_DEVICE_HANDLER( starshp1_analog_out_w )
{
	starshp1_state *state = device->machine().driver_data<starshp1_state>();
	switch (offset & 7)
	{
	case 1:
		state->m_ship_size = data;
		break;
	case 2:
		discrete_sound_w(device, STARSHP1_NOISE_AMPLITUDE, data);
		break;
	case 3:
		discrete_sound_w(device, STARSHP1_TONE_PITCH, data);
		break;
	case 4:
		discrete_sound_w(device, STARSHP1_MOTOR_SPEED, data);
		break;
	case 5:
		state->m_circle_hpos = data;
		break;
	case 6:
		state->m_circle_vpos = data;
		break;
	case 7:
		state->m_circle_size = data;
		break;
	}
}
Example #2
0
static WRITE8_HANDLER( firetrk_output_w )
{
	firetrk_state *state = space->machine().driver_data<firetrk_state>();
	device_t *discrete = space->machine().device("discrete");

	/* BIT0 => START1 LAMP */
	set_led_status(space->machine(), 0, !(data & 0x01));

	/* BIT1 => START2 LAMP */
	set_led_status(space->machine(), 1, !(data & 0x02));

	/* BIT2 => FLASH       */
	state->m_flash = data & 0x04;

	/* BIT3 => TRACK LAMP  */
	set_led_status(space->machine(), 3, !(data & 0x08));

	/* BIT4 => ATTRACT     */
	discrete_sound_w(discrete, FIRETRUCK_ATTRACT_EN, data & 0x10);
	coin_lockout_w(space->machine(), 0, !(data & 0x10));
	coin_lockout_w(space->machine(), 1, !(data & 0x10));

	/* BIT5 => START3 LAMP */
	set_led_status(space->machine(), 2, !(data & 0x20));

	/* BIT6 => UNUSED      */

	/* BIT7 => BELL OUT    */
	discrete_sound_w(discrete, FIRETRUCK_BELL_EN, data & 0x80);
}
Example #3
0
static WRITE8_HANDLER( namco_54xx_O_w )
{
	UINT8 out = (data & 0x0f);
	if (data & 0x10)
		discrete_sound_w(machine, NAMCO_54XX_1_DATA, out);
	else
		discrete_sound_w(machine, NAMCO_54XX_0_DATA, out);
}
Example #4
0
static WRITE8_HANDLER( namco_54xx_O_w )
{
	namco_54xx_state *state = get_safe_token(space->cpu->owner());
	UINT8 out = (data & 0x0f);
	if (data & 0x10)
		discrete_sound_w(state->discrete, NAMCO_54XX_1_DATA(state->basenode), out);
	else
		discrete_sound_w(state->discrete, NAMCO_54XX_0_DATA(state->basenode), out);
}
Example #5
0
static void triplhnt_update_misc(address_space &space, int offset)
{
	triplhnt_state *state = space.machine().driver_data<triplhnt_state>();
	samples_device *samples = space.machine().device<samples_device>("samples");
	device_t *discrete = space.machine().device("discrete");
	UINT8 is_witch_hunt;
	UINT8 bit = offset >> 1;

	/* BIT0 => UNUSED      */
	/* BIT1 => LAMP        */
	/* BIT2 => SCREECH     */
	/* BIT3 => LOCKOUT     */
	/* BIT4 => SPRITE ZOOM */
	/* BIT5 => CMOS WRITE  */
	/* BIT6 => TAPE CTRL   */
	/* BIT7 => SPRITE BANK */

	if (offset & 1)
	{
		state->m_misc_flags |= 1 << bit;

		if (bit == 5)
		{
			state->m_cmos[state->m_cmos_latch] = state->m_da_latch;
		}
	}
	else
	{
		state->m_misc_flags &= ~(1 << bit);
	}

	state->m_sprite_zoom = (state->m_misc_flags >> 4) & 1;
	state->m_sprite_bank = (state->m_misc_flags >> 7) & 1;

	set_led_status(space.machine(), 0, state->m_misc_flags & 0x02);

	coin_lockout_w(space.machine(), 0, !(state->m_misc_flags & 0x08));
	coin_lockout_w(space.machine(), 1, !(state->m_misc_flags & 0x08));

	discrete_sound_w(discrete, space, TRIPLHNT_SCREECH_EN, state->m_misc_flags & 0x04);	// screech
	discrete_sound_w(discrete, space, TRIPLHNT_LAMP_EN, state->m_misc_flags & 0x02);	// Lamp is used to reset noise
	discrete_sound_w(discrete, space, TRIPLHNT_BEAR_EN, state->m_misc_flags & 0x80);	// bear

	is_witch_hunt = space.machine().root_device().ioport("0C09")->read() == 0x40;
	bit = ~state->m_misc_flags & 0x40;

	/* if we're not playing the sample yet, start it */
	if (!samples->playing(0))
		samples->start(0, 0, true);
	if (!samples->playing(1))
		samples->start(1, 1, true);

	/* bit 6 turns cassette on/off */
	samples->pause(0,  is_witch_hunt || bit);
	samples->pause(1, !is_witch_hunt || bit);
}
Example #6
0
static WRITE8_HANDLER( montecar_output_2_w )
{
	firetrk_state *state = space->machine().driver_data<firetrk_state>();
	device_t *discrete = space->machine().device("discrete");

	state->m_flash = data & 0x80;

	discrete_sound_w(discrete, MONTECAR_BEEPER_EN, data & 0x10);
	discrete_sound_w(discrete, MONTECAR_DRONE_LOUD_DATA, data & 0x0f);
}
Example #7
0
static INTERRUPT_GEN( skydiver_interrupt )
{
	/* Convert range data to divide value and write to sound */
	discrete_sound_w(SKYDIVER_RANGE_DATA, (0x01 << (~skydiver_videoram[0x394] & 0x07)) & 0xff);	// Range 0-2

	discrete_sound_w(SKYDIVER_RANGE3_EN,  skydiver_videoram[0x394] & 0x08);		// Range 3 - note disable
	discrete_sound_w(SKYDIVER_NOTE_DATA, ~skydiver_videoram[0x395] & 0xff);		// Note - freq
	discrete_sound_w(SKYDIVER_NOISE_DATA,  skydiver_videoram[0x396] & 0x0f);	// NAM - Noise Amplitude

	if (skydiver_nmion)
		cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE);
}
Example #8
0
UINT32 triplhnt_state::screen_update_triplhnt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
    m_bg_tilemap->mark_all_dirty();

    m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);

    draw_sprites(bitmap, cliprect);

    address_space &space = machine().driver_data()->generic_space();
    discrete_sound_w(m_discrete, space, TRIPLHNT_BEAR_ROAR_DATA, m_playfield_ram[0xfa] & 15);
    discrete_sound_w(m_discrete, space, TRIPLHNT_SHOT_DATA, m_playfield_ram[0xfc] & 15);
    return 0;
}
Example #9
0
static WRITE_HANDLER(play1s_data_w) {
  static UINT8 oldData;
  static int timer_on;
  if (data & 0x0f) {
    if (oldData != data) sndlocals.volume = 100;
    oldData = data;
    discrete_sound_w(8, data & 0x01);
    discrete_sound_w(4, data & 0x02);
    discrete_sound_w(2, data & 0x04);
    discrete_sound_w(1, data & 0x08);
    if (~data & 0x10) { // start fading
      timer_adjust(sndlocals.timer, 0.02, 0, 0.02);
      timer_on = 1;
    } else { // no fading used
      timer_adjust(sndlocals.timer, TIME_NEVER, 0, 0);
      timer_on = 0;
      mixer_set_volume(0, sndlocals.volume);
    }
  } else if (!timer_on) { // no fading going on, so stop sound
    discrete_sound_w(8, 0);
    discrete_sound_w(4, 0);
    discrete_sound_w(2, 0);
    discrete_sound_w(1, 0);
  }
}
Example #10
0
static WRITE_HANDLER( firetruck_out_w )
{
	firetruck_invert_display = data&0x04;
	/*		x-------	0x80 BELLOUT */
	/*		-x------	0x40 unused? */
	/*		--x-----	0x20 LED for START button */
	/*		---X----	0x10 ATTRACT (disables horn circuit) */
	/*		----x---	0x08 (LED for track select button?) */
	/*		-----x--	0x04 FLASH - inverts screen */
	/*		------x-	0x02 unused? */
	/*		-------x	0x01 LED for START button */
	discrete_sound_w(0x06,!(data&0x10));	/* Attract */
	discrete_sound_w(0x05,(data&0x80)?0x00:0x01);	/* Bell */
}
Example #11
0
DISCRETE_SOUND_END


/* the ports are guessed from operation */
/* the schematics do not show the actual hookup */

WRITE8_DEVICE_HANDLER( m79amb_8000_w )
{
	/* these values are not latched */
	/* they are pulsed when the port is addressed */
	/* the discrete system will just trigger from them */
	discrete_sound_w(device, M79AMB_SHOT_EN, data & 0x01);
	discrete_sound_w(device, M79AMB_BOOM_EN, data & 0x02);
	discrete_sound_w(device, M79AMB_THUD_EN, data & 0x04);
};
Example #12
0
static INTERRUPT_GEN( skydiver_interrupt )
{
	skydiver_state *state = device->machine().driver_data<skydiver_state>();
	device_t *discrete = device->machine().device("discrete");

	/* Convert range data to divide value and write to sound */
	discrete_sound_w(discrete, SKYDIVER_RANGE_DATA, (0x01 << (~state->m_videoram[0x394] & 0x07)) & 0xff);	// Range 0-2

	discrete_sound_w(discrete, SKYDIVER_RANGE3_EN,  state->m_videoram[0x394] & 0x08);		// Range 3 - note disable
	discrete_sound_w(discrete, SKYDIVER_NOTE_DATA, ~state->m_videoram[0x395] & 0xff);		// Note - freq
	discrete_sound_w(discrete, SKYDIVER_NOISE_DATA,  state->m_videoram[0x396] & 0x0f);	// NAM - Noise Amplitude

	if (state->m_nmion)
		device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
}
Example #13
0
static INTERRUPT_GEN( sprint2 )
{
	static UINT8 dial[2];

	/* handle steering wheels */

	if (GAME_IS_SPRINT1 || GAME_IS_SPRINT2)
	{
		int i;

		for (i = 0; i < 2; i++)
		{
			signed char delta = readinputport(6 + i) - dial[i];

			if (delta < 0)
			{
				steering[i] = 0x00;
			}
			if (delta > 0)
			{
				steering[i] = 0x40;
			}

			dial[i] += delta;

			switch (readinputport(4 + i) & 15)
			{
			case 1: gear[i] = 1; break;
			case 2: gear[i] = 2; break;
			case 4: gear[i] = 3; break;
			case 8: gear[i] = 4; break;
			}
		}
	}

	discrete_sound_w(SPRINT2_MOTORSND1_DATA, sprint2_video_ram[0x394] & 15);	// also DOMINOS_FREQ_DATA
	discrete_sound_w(SPRINT2_MOTORSND2_DATA, sprint2_video_ram[0x395] & 15);
	discrete_sound_w(SPRINT2_CRASHSND_DATA, sprint2_video_ram[0x396] & 15);	// also DOMINOS_AMP_DATA

	/* interrupts and watchdog are disabled during service mode */

	watchdog_enable(!service_mode());

	if (!service_mode())
	{
		cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE);
	}
}
Example #14
0
DISCRETE_SOUND_END


WRITE8_MEMBER(sprint8_state::sprint8_crash_w)
{
	discrete_sound_w(m_discrete, space, SPRINT8_CRASH_EN, data & 0x01);
}
Example #15
0
static WRITE8_HANDLER( output_port_0_w )
{
	/*
        Note: We compute the timeout time on a write here. Unfortunately, the situation is
        kind of weird, because the discrete sound system is also affected by this timeout.
        In fact, it is very important that our timing calculation timeout AFTER the sound
        system's equivalent computation, or else we will hang notes.
    */
	UINT8 raw_game_speed = readinputport(6);
	double resistance = raw_game_speed * 25000 / 100;
	mame_time duration = make_mame_time(0, MAX_SUBSECONDS * 0.45 * 6.8e-6 * resistance * (data+1));
	timeout_time = add_mame_times(mame_timer_get_time(), duration);

	discrete_sound_w(HITME_DOWNCOUNT_VAL, data);
	discrete_sound_w(HITME_OUT0, 1);
}
Example #16
0
DISCRETE_SOUND_END


WRITE8_DEVICE_HANDLER( sprint8_crash_w )
{
	discrete_sound_w(device, SPRINT8_CRASH_EN, data & 0x01);
}
Example #17
0
DISCRETE_SOUND_END

WRITE8_HANDLER( blockade_sound_freq_w )
{
	discrete_sound_w(BLOCKADE_NOTE_DATA, data);
    return;
}
Example #18
0
void vip_state::machine_start()
{
	UINT8 *ram = m_ram->pointer();

	// randomize RAM contents
	for (UINT16 addr = 0; addr < m_ram->size(); addr++)
	{
		ram[addr] = machine().rand() & 0xff;
	}

	// turn on power LED
	set_led_status(machine(), LED_POWER, 1);

	// reset sound
	discrete_sound_w(m_beeper, machine().driver_data()->generic_space(), NODE_01, 0);

	// state saving
	save_item(NAME(m_8000));
	save_item(NAME(m_vdc_int));
	save_item(NAME(m_vdc_dma_out));
	save_item(NAME(m_vdc_ef1));
	save_item(NAME(m_exp_int));
	save_item(NAME(m_exp_dma_out));
	save_item(NAME(m_exp_dma_in));
	save_item(NAME(m_byteio_ef3));
	save_item(NAME(m_byteio_ef4));
	save_item(NAME(m_exp_ef1));
	save_item(NAME(m_exp_ef3));
	save_item(NAME(m_exp_ef4));
	save_item(NAME(m_keylatch));
	save_item(NAME(m_byteio_data));
}
Example #19
0
static WRITE8_HANDLER( montecar_output_1_w )
{
	device_t *discrete = space->machine().device("discrete");

	/* BIT0 => START LAMP    */
	set_led_status(space->machine(), 0, !(data & 0x01));

	/* BIT1 => TRACK LAMP    */
	set_led_status(space->machine(), 1, !(data & 0x02));

	/* BIT2 => ATTRACT       */
	discrete_sound_w(discrete, MONTECAR_ATTRACT_INV, data & 0x04);

	/* BIT3 => UNUSED        */
	/* BIT4 => UNUSED        */

	/* BIT5 => COIN3 COUNTER */
	coin_counter_w(space->machine(), 0, data & 0x80);

	/* BIT6 => COIN2 COUNTER */
	coin_counter_w(space->machine(), 1, data & 0x40);

	/* BIT7 => COIN1 COUNTER */
	coin_counter_w(space->machine(), 2, data & 0x20);
}
Example #20
0
static WRITE8_DEVICE_HANDLER( sprint2_attract_w )
{
	attract = offset & 1;

	// also DOMINOS_ATTRACT_EN
	discrete_sound_w(device, SPRINT2_ATTRACT_EN, attract);
}
Example #21
0
DISCRETE_SOUND_END

WRITE8_MEMBER(asteroid_state::llander_snd_reset_w)
{
	/* Resets the LFSR that is used for the white noise generator       */
	discrete_sound_w(m_discrete, space, LLANDER_NOISE_RESET, 0);				/* Reset */
}
Example #22
0
static WRITE_HANDLER( firetruck_motorsnd_w )
{
	/*		xxxx----	0xf0 Siren Frequency */
	/*		----xxxx	0x0f Motor Frequency */
	discrete_sound_w(0x00,data&0x0f);
	discrete_sound_w(0x02,(data&0xf0)>>4);
}
Example #23
0
DISCRETE_SOUND_END

WRITE8_HANDLER( llander_snd_reset_w )
{
	/* Resets the LFSR that is used for the white noise generator       */
	discrete_sound_w(LLANDER_NOISE_RESET, 0);				/* Reset */
}
Example #24
0
static WRITE8_HANDLER( namco_54xx_R1_w )
{
	namco_54xx_state *state = get_safe_token(space->device().owner());
	UINT8 out = (data & 0x0f);

	discrete_sound_w(state->m_discrete, NAMCO_54XX_2_DATA(state->m_basenode), out);
}
Example #25
0
static INTERRUPT_GEN( sprint2 )
{
	const device_config *discrete = devtag_get_device(device->machine, "discrete");
	static UINT8 dial[2];

	/* handle steering wheels */

	if (GAME_IS_SPRINT1 || GAME_IS_SPRINT2)
	{
		int i;

		for (i = 0; i < 2; i++)
		{
			signed char delta = input_port_read(device->machine, i ? "DIAL_P2" : "DIAL_P1") - dial[i];

			if (delta < 0)
			{
				steering[i] = 0x00;
			}
			if (delta > 0)
			{
				steering[i] = 0x40;
			}

			dial[i] += delta;

			switch (input_port_read(device->machine, i ? "GEAR_P2" : "GEAR_P1") & 15)
			{
			case 1: gear[i] = 1; break;
			case 2: gear[i] = 2; break;
			case 4: gear[i] = 3; break;
			case 8: gear[i] = 4; break;
			}
		}
	}

	discrete_sound_w(discrete, SPRINT2_MOTORSND1_DATA, sprint2_video_ram[0x394] & 15);	// also DOMINOS_FREQ_DATA
	discrete_sound_w(discrete, SPRINT2_MOTORSND2_DATA, sprint2_video_ram[0x395] & 15);
	discrete_sound_w(discrete, SPRINT2_CRASHSND_DATA, sprint2_video_ram[0x396] & 15);	// also DOMINOS_AMP_DATA

	/* interrupts and watchdog are disabled during service mode */

	watchdog_enable(device->machine, !service_mode(device->machine));

	if (!service_mode(device->machine))
		cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
}
Example #26
0
static INTERRUPT_GEN( sprint2 )
{
	sprint2_state *state = device->machine().driver_data<sprint2_state>();
	device_t *discrete = device->machine().device("discrete");

	/* handle steering wheels */

	if (GAME_IS_SPRINT1 || GAME_IS_SPRINT2)
	{
		int i;

		for (i = 0; i < 2; i++)
		{
			signed char delta = state->ioport(i ? "DIAL_P2" : "DIAL_P1")->read() - state->m_dial[i];

			if (delta < 0)
			{
				state->m_steering[i] = 0x00;
			}
			if (delta > 0)
			{
				state->m_steering[i] = 0x40;
			}

			state->m_dial[i] += delta;

			switch (device->machine().root_device().ioport(i ? "GEAR_P2" : "GEAR_P1")->read() & 15)
			{
			case 1: state->m_gear[i] = 1; break;
			case 2: state->m_gear[i] = 2; break;
			case 4: state->m_gear[i] = 3; break;
			case 8: state->m_gear[i] = 4; break;
			}
		}
	}

	discrete_sound_w(discrete, SPRINT2_MOTORSND1_DATA, state->m_video_ram[0x394] & 15);	// also DOMINOS_FREQ_DATA
	discrete_sound_w(discrete, SPRINT2_MOTORSND2_DATA, state->m_video_ram[0x395] & 15);
	discrete_sound_w(discrete, SPRINT2_CRASHSND_DATA, state->m_video_ram[0x396] & 15);	// also DOMINOS_AMP_DATA

	/* interrupts and watchdog are disabled during service mode */

	device->machine().watchdog_enable(!service_mode(device->machine()));

	if (!service_mode(device->machine()))
		device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
}
Example #27
0
static WRITE8_DEVICE_HANDLER( output_port_0_w )
{
	/*
        Note: We compute the timeout time on a write here. Unfortunately, the situation is
        kind of weird, because the discrete sound system is also affected by this timeout.
        In fact, it is very important that our timing calculation timeout AFTER the sound
        system's equivalent computation, or else we will hang notes.
    */
	hitme_state *state = device->machine->driver_data<hitme_state>();
	UINT8 raw_game_speed = input_port_read(device->machine, "R3");
	double resistance = raw_game_speed * 25000 / 100;
	attotime duration = attotime(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data + 1));
	state->timeout_time = device->machine->time() + duration;

	discrete_sound_w(device, HITME_DOWNCOUNT_VAL, data);
	discrete_sound_w(device, HITME_OUT0, 1);
}
Example #28
0
static WRITE8_DEVICE_HANDLER( sprint2_attract_w )
{
	sprint2_state *state = device->machine().driver_data<sprint2_state>();
	state->m_attract = offset & 1;

	// also DOMINOS_ATTRACT_EN
	discrete_sound_w(device, SPRINT2_ATTRACT_EN, state->m_attract);
}
Example #29
0
static WRITE8_DEVICE_HANDLER( cliff_sound_overlay_w )
{
	/* audio */
	discrete_sound_w(device, CLIFF_ENABLE_SND_1, data & 1);
	discrete_sound_w(device, CLIFF_ENABLE_SND_2, (data >> 1) & 1);

	// bit 4 (data & 0x10) is overlay related?
}
Example #30
0
static WRITE8_DEVICE_HANDLER( starshp1_audio_w )
{
	starshp1_state *state = device->machine().driver_data<starshp1_state>();
	data &= 1;

	switch (offset & 7)
	{
	case 0:
		state->m_attract = data;
		discrete_sound_w(device, STARSHP1_ATTRACT, data);
		break;
	case 1:
		state->m_phasor = data;
		discrete_sound_w(device, STARSHP1_PHASOR_ON, data);
		break;
	case 2:
		discrete_sound_w(device, STARSHP1_KICKER, data);
		break;
	case 3:
		discrete_sound_w(device, STARSHP1_SL1, data);
		break;
	case 4:
		discrete_sound_w(device, STARSHP1_SL2, data);
		break;
	case 5:
		discrete_sound_w(device, STARSHP1_MOLVL, data);
		break;
	case 6:
		discrete_sound_w(device, STARSHP1_NOISE_FREQ, data);
		break;
	}

	coin_lockout_w(device->machine(), 0, !state->m_attract);
	coin_lockout_w(device->machine(), 1, !state->m_attract);
}