예제 #1
0
파일: taito_h.c 프로젝트: Sunoo/nonamemame
static READ16_HANDLER( syvalion_input_bypass_r )
{
	/* Bypass TC0220IOC controller for analog input */

	data8_t	port = TC0220IOC_port_r(0);	/* read port number */

	switch( port )
	{
		case 0x08:				/* trackball y coords bottom 8 bits for 2nd player */
			return input_port_7_r(0);

		case 0x09:				/* trackball y coords top 8 bits for 2nd player */
			if (input_port_7_r(0) & 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_6_r(0);

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

		case 0x0c:				/* trackball y coords bottom 8 bits for 2nd player */
			return input_port_5_r(0);

		case 0x0d:				/* trackball y coords top 8 bits for 1st player */
			if (input_port_5_r(0) & 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_4_r(0);

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

		default:
			return TC0220IOC_portreg_r( offset );
	}
}
예제 #2
0
static READ16_HANDLER( topspeed_input_bypass_r )
{
	UINT8 port = TC0220IOC_port_r(0);	/* read port number */
	int steer = 0;
	int analogue_steer = input_port_5_word_r(0,0);
	int fake = input_port_6_word_r(0,0);

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

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

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

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

		/* To allow hiscore input we must let you return to
           continuous input type while you press up */

		if (fake & 0x4)	/* pressing up */
			steer = analogue_steer;
	}

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

		case 0x0d:
			return steer >> 8;

		default:
			return TC0220IOC_portreg_r(offset);
	}
}