예제 #1
0
파일: alg.c 프로젝트: broftkd/mess-cvs
static int get_lightgun_pos(int player, int *x, int *y)
{
	int xpos = readinputportbytag_safe((player == 0) ? "GUN1X" : "GUN2X", -1);
	int ypos = readinputportbytag_safe((player == 0) ? "GUN1Y" : "GUN2Y", -1);

	if (xpos == -1 || ypos == -1)
		return FALSE;

	*x = Machine->screen[0].visarea.min_x + xpos * (Machine->screen[0].visarea.max_x - Machine->screen[0].visarea.min_x + 1) / 255;
	*y = Machine->screen[0].visarea.min_y + ypos * (Machine->screen[0].visarea.max_y - Machine->screen[0].visarea.min_y + 1) / 255;
	return TRUE;
}
예제 #2
0
static READ16_HANDLER( topspeed_input_bypass_r )
{
	UINT8 port = TC0220IOC_port_r(0);	/* read port number */
	int steer = 0;
	int analogue_steer = readinputportbytag_safe(STEER_PORT_TAG,0x00);
	int fake = readinputportbytag_safe(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(offset);
	}
}
예제 #3
0
static UINT16 amiga_read_joy1dat(void)
{
	if ( readinputportbytag("config") & 0x10 ) {
		/* Joystick */
		return readinputportbytag_safe("JOY1DAT", 0xffff);
	} else {
		/* Mouse */
		int input;
		input  = ( readinputportbytag("P1MOUSEX") & 0xff );
		input |= ( readinputportbytag("P1MOUSEY") & 0xff ) << 8;
		return input;
	}
}
예제 #4
0
static rtc_type_t real_time_clock(void)
{
	return (rtc_type_t) (int) readinputportbytag_safe("real_time_clock", 0x00);
}
예제 #5
0
	return video_start_generic_bitmapped(machine);
}



/*************************************
 *
 *  Beam position
 *
 *************************************/

UINT32 amiga_gethvpos(void)
{
	UINT32 hvpos = (last_scanline << 8) | (cpu_gethorzbeampos() >> 2);
	UINT32 latchedpos = readinputportbytag_safe("HVPOS", 0);

	/* if there's no latched position, or if we are in the active display area */
	/* but before the latching point, return the live HV position */
	if ((CUSTOM_REG(REG_BPLCON0) & 0x0008) == 0 || latchedpos == 0 || (last_scanline >= 20 && hvpos < latchedpos))
		return hvpos;

	/* otherwise, return the latched position */
	return latchedpos;
}



/*************************************
 *
 *  Genlock interaction