Exemple #1
0
static WRITE8_HANDLER( goonies_rom_banking )
{
    int reg = ( offset >> 12 ) & 0x07;
    int bankoffset = ( data & 7 ) * 0x2000 + 0x10000;

    switch( reg )
    {
    case 0: /* code bank 0 */
        memcpy( &memory_region( REGION_CPU1 )[0x08000], &memory_region( REGION_CPU1 )[bankoffset], 0x2000 );
        break;

    case 2: /* code bank 1 */
        memcpy( &memory_region( REGION_CPU1 )[0x0a000], &memory_region( REGION_CPU1 )[bankoffset], 0x2000 );
        break;

    case 4: /* code bank 2 */
        memcpy( &memory_region( REGION_CPU1 )[0x0c000], &memory_region( REGION_CPU1 )[bankoffset], 0x2000 );
        break;

    case 6: /* vrom bank 0 */
        ppu2c03b_set_videorom_bank( 0, 0, 4, data, 256 );
        break;

    case 7: /* vrom bank 1 */
        ppu2c03b_set_videorom_bank( 0, 4, 4, data, 256 );
        break;
    }
}
Exemple #2
0
static WRITE8_HANDLER( vsnormal_vrom_banking )
{
    /* switch vrom */
    ppu2c03b_set_videorom_bank( 0, 0, 8, ( data & 4 ) ? 1 : 0, 512 );

    /* bit 1 ( data & 2 ) enables writes to extra ram, we ignore it */

    /* move along */
    vsnes_in0_w( offset, data );
}
static WRITE_HANDLER( gun_in0_w )
{
	static int zapstore;

	if (vsnes_do_vrom_bank)
	{
		/* switch vrom */
		ppu2c03b_set_videorom_bank( 0, 0, 8, ( data & 4 ) ? 1 : 0, 512 );
	}

	/* here we do things a little different */
	if ( data & 1 )
	{

		/* load up the latches */
		input_latch[0] = readinputport( 0 );

		/* do the gun thing */
		if ( vsnes_gun_controller )
		{
			int x = readinputport( 4 );
			int y = readinputport( 5 );
			UINT32 pix, color_base;
			pen_t *pens = Machine->pens;

			/* get the pixel at the gun position */
			pix = ppu2c03b_get_pixel( 0, x, y );

			/* get the color base from the ppu */
			color_base = ppu2c03b_get_colorbase( 0 );

			/* look at the screen and see if the cursor is over a bright pixel */
			if ( ( pix == pens[color_base+0x20] ) || ( pix == pens[color_base+0x30] ) ||
				 ( pix == pens[color_base+0x33] ) || ( pix == pens[color_base+0x34] ) )
			{
				input_latch[0] |= 0x40;
			}
		}

		input_latch[1] = readinputport( 1 );
	}

    if ( ( zapstore & 1 ) && ( !( data & 1 ) ) )
	/* reset sound_fix to keep sound from hanging */
    {
		sound_fix = 0;
	}

    zapstore = data;

}