Example #1
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 #2
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 #3
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);
}