Example #1
0
static WRITE_HANDLER( thunderx_1f98_w )
{
//logerror("%04x: write %02x to 1f98\n",cpu_get_pc(),data);
	/* bit 0 = enable char ROM reading through the video RAM */
	K052109_set_RMRD_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);

	/* bit 1 unknown - used by Thunder Cross during test of RAM C8 (5800-5fff) */
	if ( data & 2 )
		calculate_collisions();
}
Example #2
0
static void thunderx_1f98_w(unsigned char data)
{
	K052109RMRDLine = data & 0x01;

	if ((data & 4) && !(thunderx_1f98_data & 4))
	{
		calculate_collisions();

		konamiRun(10);

		konamiSetIrqLine(KONAMI_FIRQ_LINE, KONAMI_HOLD_LINE); // must be delayed
	}

	thunderx_1f98_data = data;
}
Example #3
0
static WRITE_HANDLER( thunderx_1f98_w )
{
//logerror("%04x: write %02x to 1f98\n",cpu_get_pc(),data);
	/* bit 0 = enable char ROM reading through the video RAM */
	K052109_set_RMRD_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);

	/* bit 1 = reset for collision MCU??? */
	/* we don't need it, anyway */

	/* bit 2 = do collision detection when 0->1 */
	if ((data & 4) && !(unknown_enable & 4))
	{
		calculate_collisions();
	}

	unknown_enable = data;
}
Example #4
0
static WRITE_HANDLER( thunderx_1f98_w )
{
// logerror("%04x: 1f98_w %02x\n",activecpu_get_pc(),data);

	/* bit 0 = enable char ROM reading through the video RAM */
	K052109_set_RMRD_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);

	/* bit 1 = PMC-BK */
	pmcbank = (data & 0x02) >> 1;

	/* bit 2 = do collision detection when 0->1 */
	if ((data & 4) && !(unknown_enable & 4))
	{
		calculate_collisions();

		/* 100 cycle delay is arbitrary */
		timer_set(TIME_IN_CYCLES(100,0),0, thunderx_firq_callback);
	}

	unknown_enable = data;
}
Example #5
0
static WRITE8_HANDLER( thunderx_1f98_w )
{
// logerror("%04x: 1f98_w %02x\n",cpu_get_pc(space->cpu),data);

	/* bit 0 = enable char ROM reading through the video RAM */
	K052109_set_RMRD_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);

	/* bit 1 = PMC-BK */
	pmcbank = (data & 0x02) >> 1;

	/* bit 2 = do collision detection when 0->1 */
	if ((data & 4) && !(thunderx_1f98_data & 4))
	{
		calculate_collisions();

		/* 100 cycle delay is arbitrary */
		timer_set(space->machine, cpu_clocks_to_attotime(space->cpu,100), NULL, 0, thunderx_firq_callback);
	}

	thunderx_1f98_data = data;
}
Example #6
0
static WRITE8_HANDLER( thunderx_1f98_w )
{
	thunderx_state *state = (thunderx_state *)space->machine->driver_data;

	// logerror("%04x: 1f98_w %02x\n", cpu_get_pc(space->cpu),data);

	/* bit 0 = enable char ROM reading through the video RAM */
	k052109_set_rmrd_line(state->k052109, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);

	/* bit 1 = PMC-BK */
	state->pmcbank = (data & 0x02) >> 1;

	/* bit 2 = do collision detection when 0->1 */
	if ((data & 4) && !(state->_1f98_data & 4))
	{
		calculate_collisions(space->machine);

		/* 100 cycle delay is arbitrary */
		timer_set(space->machine, downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100), NULL, 0, thunderx_firq_callback);
	}

	state->_1f98_data = data;
}
Example #7
0
int main(int argc, char **argv)
{	
	unsigned int i;
	unsigned long int n;
	unsigned int *boys = NULL, *girls = NULL;

	if (argc == 2)
	{
		
		n = atoi(argv[1]);
		printf("number of boys/girls: %lu\n", n);

		srand(time(NULL));

		boys = (unsigned int *) malloc (sizeof(int)*n);
		girls = (unsigned int *) malloc (sizeof(int)*n);

		for (i = 0; i < n; i++)
		{
			boys[i] = i;
			girls[i] = i;
		}

		shuffle((int *)boys, n);
		shuffle((int *)girls, n);

		for (int i = 0; i < n; i++)
			printf("boy: %d | girl: %d\n", boys[i], girls[i]);

		printf("\ncollisions: %u\n", calculate_collisions(boys, girls, n));
		
		free(boys);
		free(girls);
	}
	else
		usage(argv[0]);
}