Ejemplo n.º 1
0
static WRITE8_HANDLER( vskonami_rom_banking )
{
	int reg = (offset >> 12) & 0x07;
	int bankoffset = (data & 7) * 0x2000 + 0x10000;

	switch (reg)
	{
		case 0: /* code bank 0 */
		case 2: /* code bank 1 */
		case 4: /* code bank 2 */
		{
			UINT8 *prg = space->machine->region("maincpu")->base();
			memcpy(&prg[0x08000 + reg * 0x1000], &prg[bankoffset], 0x2000);
		}
		break;

		case 6: /* vrom bank 0 */
			v_set_videorom_bank(space->machine, 0, 4, data * 4);
		break;

		case 7: /* vrom bank 1 */
			v_set_videorom_bank(space->machine, 4, 4, data * 4);
		break;
	}
}
Ejemplo n.º 2
0
static WRITE8_HANDLER( vsnormal_vrom_banking )
{
	/* switch vrom */
	v_set_videorom_bank(space->machine, 0, 8, (data & 4) ? 8 : 0);

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

	/* move along */
	vsnes_in0_w(space, offset, data);
}
Ejemplo n.º 3
0
static WRITE8_HANDLER( gun_in0_w )
{
	device_t *ppu1 = space->machine->device("ppu1");
	static int zapstore;

	if (vsnes_do_vrom_bank)
	{
		/* switch vrom */
		v_set_videorom_bank(space->machine, 0, 8, (data & 4) ? 8 : 0);
	}

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

		/* load up the latches */
		input_latch[0] = input_port_read(space->machine, "IN0");

		/* do the gun thing */
		int x = input_port_read(space->machine, "GUNX");
		int y = input_port_read(space->machine, "GUNY");
		UINT32 pix, color_base;

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

		/* get the color base from the ppu */
		color_base = ppu2c0x_get_colorbase(ppu1);

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

		input_latch[1] = input_port_read(space->machine, "IN1");
	}

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

    zapstore = data;
}
Ejemplo n.º 4
0
MACHINE_START_MEMBER(vsnes_state,vsnes)
{
	address_space &ppu1_space = machine().device("ppu1")->memory().space(AS_PROGRAM);
	int i;

	/* establish nametable ram */
	m_nt_ram[0] = std::make_unique<uint8_t[]>(0x1000);
	/* set mirroring */
	m_nt_page[0][0] = m_nt_ram[0].get();
	m_nt_page[0][1] = m_nt_ram[0].get() + 0x400;
	m_nt_page[0][2] = m_nt_ram[0].get() + 0x800;
	m_nt_page[0][3] = m_nt_ram[0].get() + 0xc00;

	ppu1_space.install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt0_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt0_w),this));

	if (m_gfx1_rom != nullptr)
	{
		m_vrom[0] = memregion("gfx1")->base();
		m_vrom_size[0] = memregion("gfx1")->bytes();
		m_vrom_banks = m_vrom_size[0] / 0x400;
	}
	else
	{
		m_vrom[0] = nullptr;
		m_vrom_size[0] = 0;
		m_vrom_banks = 0;
	}

	/* establish chr banks */
	/* bank 1 is used already! */
	/* DRIVER_INIT is called first - means we can handle this different for VRAM games! */
	if (m_vrom[0] != nullptr)
	{
		for (i = 0; i < 8; i++)
		{
			ppu1_space.install_read_bank(0x0400 * i, 0x0400 * i + 0x03ff, chr_banknames[i]);
			membank(chr_banknames[i])->configure_entries(0, m_vrom_banks, m_vrom[0], 0x400);
		}
		v_set_videorom_bank(0, 8, 0);
	}
	else
	{
		ppu1_space.install_ram(0x0000, 0x1fff, m_vram.get());
	}
}