Ejemplo n.º 1
0
static READ8_HANDLER( syvalion_input_bypass_r )
{
	/* Bypass TC0220IOC controller for analog input */

	taitoh_state *state = space->machine().driver_data<taitoh_state>();
	UINT8	port = tc0220ioc_port_r(state->m_tc0220ioc, 0);	/* read port number */

	switch( port )
	{
		case 0x08:				/* trackball y coords bottom 8 bits for 2nd player */
			return input_port_read(space->machine(), P2TRACKY_PORT_TAG);

		case 0x09:				/* trackball y coords top 8 bits for 2nd player */
			if (input_port_read(space->machine(), P2TRACKY_PORT_TAG) & 0x80)	/* y- direction (negative value) */
				return 0xff;
			else												/* y+ direction (positive value) */
				return 0x00;

		case 0x0a:				/* trackball x coords bottom 8 bits for 2nd player */
			return input_port_read(space->machine(), P2TRACKX_PORT_TAG);

		case 0x0b:				/* trackball x coords top 8 bits for 2nd player */
			if (input_port_read(space->machine(), P2TRACKX_PORT_TAG) & 0x80)	/* x- direction (negative value) */
				return 0xff;
			else												/* x+ direction (positive value) */
				return 0x00;

		case 0x0c:				/* trackball y coords bottom 8 bits for 1st player */
			return input_port_read(space->machine(), P1TRACKY_PORT_TAG);

		case 0x0d:				/* trackball y coords top 8 bits for 1st player */
			if (input_port_read(space->machine(), P1TRACKY_PORT_TAG) & 0x80)	/* y- direction (negative value) */
				return 0xff;
			else												/* y+ direction (positive value) */
				return 0x00;

		case 0x0e:				/* trackball x coords bottom 8 bits for 1st player */
			return input_port_read(space->machine(), P1TRACKX_PORT_TAG);

		case 0x0f:				/* trackball x coords top 8 bits for 1st player */
			if (input_port_read(space->machine(), P1TRACKX_PORT_TAG) & 0x80)	/* x- direction (negative value) */
				return 0xff;
			else												/* x+ direction (positive value) */
				return 0x00;

		default:
			return tc0220ioc_portreg_r(state->m_tc0220ioc, offset);
	}
}
Ejemplo n.º 2
0
static READ8_HANDLER( topspeed_input_bypass_r )
{
	topspeed_state *state = space->machine->driver_data<topspeed_state>();
	UINT8 port = tc0220ioc_port_r(state->tc0220ioc, 0);	/* read port number */
	int steer = 0;
	int analogue_steer = input_port_read_safe(space->machine, STEER_PORT_TAG, 0x00);
	int fake = input_port_read_safe(space->machine, FAKE_PORT_TAG, 0x00);

	if (!(fake & 0x10))	/* Analogue steer (the real control method) */
	{
		steer = analogue_steer;

	}
	else	/* Digital steer */
	{
		if (fake & 0x08)	/* pressing down */
			steer = 0xff40;

		if (fake & 0x02)	/* pressing right */
			steer = 0x007f;

		if (fake & 0x01)	/* pressing left */
			steer = 0xff80;

		/* To allow hiscore input we must let you return to continuous input type while you press up */
		if (fake & 0x04)	/* pressing up */
			steer = analogue_steer;
	}

	switch (port)
	{
		case 0x0c:
			return steer & 0xff;

		case 0x0d:
			return steer >> 8;

		default:
			return tc0220ioc_portreg_r(state->tc0220ioc, offset);
	}
}