mirror of
https://github.com/holub/mame
synced 2025-05-24 14:56:21 +03:00
ppu2c0x: converted NES PPU to be a modern device. [Fabio Priuli]
This commit is contained in:
parent
202a695a94
commit
336cddc752
@ -128,7 +128,8 @@ static READ8_HANDLER( nt_r )
|
||||
static WRITE8_HANDLER( sprite_dma_w )
|
||||
{
|
||||
int source = (data & 7);
|
||||
ppu2c0x_spriteram_dma(space, space->machine().device("ppu"), source);
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
ppu->spriteram_dma(space, source);
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( psg_4015_r )
|
||||
@ -222,7 +223,7 @@ static WRITE8_HANDLER( cham24_mapper_w )
|
||||
|
||||
static ADDRESS_MAP_START( cham24_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
|
||||
@ -264,7 +265,8 @@ static MACHINE_RESET( cham24 )
|
||||
|
||||
static PALETTE_INIT( cham24 )
|
||||
{
|
||||
ppu2c0x_init_palette(machine, 0);
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
ppu->init_palette(machine, 0);
|
||||
}
|
||||
|
||||
static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
@ -275,6 +277,8 @@ static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
/* our ppu interface */
|
||||
static const ppu2c0x_interface ppu_interface =
|
||||
{
|
||||
"maincpu",
|
||||
"screen",
|
||||
0, /* gfxlayout num */
|
||||
0, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
@ -288,7 +292,8 @@ static VIDEO_START( cham24 )
|
||||
static SCREEN_UPDATE_IND16( cham24 )
|
||||
{
|
||||
/* render the ppu */
|
||||
ppu2c0x_render(screen.machine().device("ppu"), bitmap, 0, 0, 0, 0);
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu");
|
||||
ppu->render(bitmap, 0, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,9 @@ static READ8_HANDLER (famibox_nt_r)
|
||||
|
||||
static WRITE8_HANDLER( sprite_dma_w )
|
||||
{
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
int source = (data & 7);
|
||||
ppu2c0x_spriteram_dma(space, space->machine().device("ppu"), source);
|
||||
ppu->spriteram_dma(space, source);
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( psg_4015_r )
|
||||
@ -373,7 +374,7 @@ static WRITE8_HANDLER( famibox_system_w )
|
||||
|
||||
static ADDRESS_MAP_START( famibox_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_RAM
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
|
||||
@ -502,7 +503,8 @@ static const nes_interface famibox_interface_1 =
|
||||
|
||||
static PALETTE_INIT( famibox )
|
||||
{
|
||||
ppu2c0x_init_palette(machine, 0);
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
ppu->init_palette(machine, 0);
|
||||
}
|
||||
|
||||
static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
@ -513,6 +515,8 @@ static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
/* our ppu interface */
|
||||
static const ppu2c0x_interface ppu_interface =
|
||||
{
|
||||
"maincpu",
|
||||
"screen",
|
||||
0, /* gfxlayout num */
|
||||
0, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
@ -526,7 +530,8 @@ static VIDEO_START( famibox )
|
||||
static SCREEN_UPDATE_IND16( famibox )
|
||||
{
|
||||
/* render the ppu */
|
||||
ppu2c0x_render(screen.machine().device("ppu"), bitmap, 0, 0, 0, 0);
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu");
|
||||
ppu->render(bitmap, 0, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,8 @@ static void set_videoram_bank(running_machine& machine, int start, int count, in
|
||||
static WRITE8_HANDLER( sprite_dma_w )
|
||||
{
|
||||
int source = (data & 7);
|
||||
ppu2c0x_spriteram_dma(space, space->machine().device("ppu"), source);
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
ppu->spriteram_dma(space, source);
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( psg_4015_r )
|
||||
@ -328,7 +329,7 @@ static WRITE8_HANDLER(multigam_mapper2_w)
|
||||
static ADDRESS_MAP_START( multigam_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
|
||||
@ -348,7 +349,7 @@ static ADDRESS_MAP_START( multigmt_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
|
||||
AM_RANGE(0x3000, 0x3000) AM_WRITE(multigam_switch_prg_rom)
|
||||
AM_RANGE(0x3fff, 0x3fff) AM_WRITE(multigam_switch_gfx_rom)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
|
||||
@ -384,7 +385,7 @@ static void multigam3_mmc3_scanline_cb( device_t *device, int scanline, int vbla
|
||||
static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w )
|
||||
{
|
||||
multigam_state *state = space->machine().driver_data<multigam_state>();
|
||||
device_t *ppu = space->machine().device("ppu");
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
|
||||
/* basically, a MMC3 mapper from the nes */
|
||||
int bankmask = state->m_multigam3_mmc3_prg_size == 0x40000 ? 0x1f : 0x0f;
|
||||
@ -521,11 +522,11 @@ static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w )
|
||||
break;
|
||||
|
||||
case 0x6000: /* disable irqs */
|
||||
ppu2c0x_set_scanline_callback(ppu, 0);
|
||||
ppu->set_scanline_callback(0);
|
||||
break;
|
||||
|
||||
case 0x6001: /* enable irqs */
|
||||
ppu2c0x_set_scanline_callback(ppu, multigam3_mmc3_scanline_cb);
|
||||
ppu->set_scanline_callback(multigam3_mmc3_scanline_cb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -617,7 +618,7 @@ static WRITE8_HANDLER(multigm3_switch_prg_rom)
|
||||
static ADDRESS_MAP_START( multigm3_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
|
||||
@ -651,14 +652,14 @@ static WRITE8_HANDLER(multigam3_mapper02_rom_switch_w)
|
||||
static void multigam_init_mapper02(running_machine &machine, UINT8* prg_base, int prg_size)
|
||||
{
|
||||
multigam_state *state = machine.driver_data<multigam_state>();
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
UINT8* mem = machine.region("maincpu")->base();
|
||||
memcpy(mem + 0x8000, prg_base + prg_size - 0x8000, 0x8000);
|
||||
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0xffff, FUNC(multigam3_mapper02_rom_switch_w) );
|
||||
|
||||
state->m_mapper02_prg_base = prg_base;
|
||||
state->m_mapper02_prg_size = prg_size;
|
||||
|
||||
ppu2c0x_set_scanline_callback(machine.device("ppu"), 0);
|
||||
ppu->set_scanline_callback(0);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
@ -807,6 +808,7 @@ static void multigam_init_mmc1(running_machine &machine, UINT8 *prg_base, int pr
|
||||
{
|
||||
multigam_state *state = machine.driver_data<multigam_state>();
|
||||
UINT8* dst = machine.region("maincpu")->base();
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
|
||||
memcpy(&dst[0x8000], prg_base + (prg_size - 0x8000), 0x8000);
|
||||
|
||||
@ -818,8 +820,7 @@ static void multigam_init_mmc1(running_machine &machine, UINT8 *prg_base, int pr
|
||||
state->m_mmc1_prg_size = prg_size;
|
||||
state->m_mmc1_chr_bank_base = chr_bank_base;
|
||||
|
||||
ppu2c0x_set_scanline_callback(machine.device("ppu"), 0);
|
||||
|
||||
ppu->set_scanline_callback(0);
|
||||
};
|
||||
|
||||
|
||||
@ -848,7 +849,7 @@ static void multigam_init_mmc1(running_machine &machine, UINT8 *prg_base, int pr
|
||||
static void supergm3_set_bank(running_machine &machine)
|
||||
{
|
||||
multigam_state *state = machine.driver_data<multigam_state>();
|
||||
device_t *ppu = machine.device("ppu");
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
UINT8* mem = machine.region("maincpu")->base();
|
||||
|
||||
// video bank
|
||||
@ -884,7 +885,7 @@ static void supergm3_set_bank(running_machine &machine)
|
||||
// title screen
|
||||
memcpy(mem + 0x8000, mem + 0x18000, 0x8000);
|
||||
memory_set_bankptr(machine, "bank10", mem + 0x6000);
|
||||
ppu2c0x_set_scanline_callback(ppu, 0);
|
||||
ppu->set_scanline_callback(0);
|
||||
}
|
||||
else if ((state->m_supergm3_prg_bank & 0x40) == 0)
|
||||
{
|
||||
@ -933,7 +934,7 @@ static WRITE8_HANDLER(supergm3_chr_bank_w)
|
||||
static ADDRESS_MAP_START( supergm3_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
|
||||
@ -1069,7 +1070,8 @@ static const nes_interface multigam_interface_1 =
|
||||
|
||||
static PALETTE_INIT( multigam )
|
||||
{
|
||||
ppu2c0x_init_palette(machine, 0);
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
ppu->init_palette(machine, 0);
|
||||
}
|
||||
|
||||
static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
@ -1080,6 +1082,8 @@ static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
/* our ppu interface */
|
||||
static const ppu2c0x_interface ppu_interface =
|
||||
{
|
||||
"maincpu",
|
||||
"screen",
|
||||
0, /* gfxlayout num */
|
||||
0, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
@ -1093,7 +1097,8 @@ static VIDEO_START( multigam )
|
||||
static SCREEN_UPDATE_IND16( multigam )
|
||||
{
|
||||
/* render the ppu */
|
||||
ppu2c0x_render(screen.machine().device("ppu"), bitmap, 0, 0, 0, 0);
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu");
|
||||
ppu->render(bitmap, 0, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,8 @@ static WRITE8_HANDLER( ram_8w_w )
|
||||
static WRITE8_HANDLER( sprite_dma_w )
|
||||
{
|
||||
int source = ( data & 7 );
|
||||
ppu2c0x_spriteram_dma( space, space->machine().device("ppu"), source );
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
ppu->spriteram_dma(space, source);
|
||||
}
|
||||
|
||||
/* Only used in single monitor bios */
|
||||
@ -396,7 +397,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( cart_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) AM_BASE_MEMBER(playch10_state, m_work_ram)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac", dac_w)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w)
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
|
||||
@ -728,9 +729,6 @@ MACHINE_CONFIG_END
|
||||
static MACHINE_CONFIG_DERIVED( playch10_hboard, playch10 )
|
||||
MCFG_VIDEO_START(playch10_hboard)
|
||||
MCFG_MACHINE_START(playch10_hboard)
|
||||
|
||||
MCFG_DEVICE_REMOVE("ppu")
|
||||
MCFG_PPU2C03B_ADD("ppu", playch10_ppu_interface)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -152,13 +152,15 @@ Changes:
|
||||
static WRITE8_HANDLER( sprite_dma_0_w )
|
||||
{
|
||||
int source = ( data & 7 );
|
||||
ppu2c0x_spriteram_dma( space, space->machine().device("ppu1"), source );
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu1");
|
||||
ppu->spriteram_dma( space, source );
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sprite_dma_1_w )
|
||||
{
|
||||
int source = ( data & 7 );
|
||||
ppu2c0x_spriteram_dma( space, space->machine().device("ppu2"), source );
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu2");
|
||||
ppu->spriteram_dma( space, source );
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( vsnes_coin_counter_w )
|
||||
@ -210,7 +212,7 @@ static WRITE8_DEVICE_HANDLER( psg_4017_w )
|
||||
|
||||
static ADDRESS_MAP_START( vsnes_cpu1_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE_MEMBER(vsnes_state, m_work_ram)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu1", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu1", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac1", dac_w)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes1", nes_psg_r, nes_psg_w)
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_0_w)
|
||||
@ -224,7 +226,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( vsnes_cpu2_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE_MEMBER(vsnes_state, m_work_ram_1)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu2", ppu2c0x_r, ppu2c0x_w)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE_MODERN("ppu2", ppu2c0x_device, read, write)
|
||||
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac2", dac_w)
|
||||
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes2", nes_psg_r, nes_psg_w)
|
||||
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_1_w)
|
||||
@ -1650,7 +1652,7 @@ static MACHINE_CONFIG_START( vsnes, vsnes_state )
|
||||
MCFG_MACHINE_START(vsnes)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_ADD("screen1", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_SIZE(32*8, 262)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
|
||||
@ -1714,13 +1716,13 @@ static MACHINE_CONFIG_START( vsdual, vsnes_state )
|
||||
MCFG_PALETTE_LENGTH(2*8*4*16)
|
||||
MCFG_DEFAULT_LAYOUT(layout_dualhsxs)
|
||||
|
||||
MCFG_SCREEN_ADD("top", RASTER)
|
||||
MCFG_SCREEN_ADD("screen1", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_SIZE(32*8, 262)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
|
||||
MCFG_SCREEN_UPDATE_STATIC(vsnes)
|
||||
|
||||
MCFG_SCREEN_ADD("bottom", RASTER)
|
||||
MCFG_SCREEN_ADD("screen2", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_SIZE(32*8, 262)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
|
||||
|
@ -267,7 +267,7 @@ READ8_HANDLER( pc10_in1_r )
|
||||
/* do the gun thing */
|
||||
if (state->m_pc10_gun_controller)
|
||||
{
|
||||
device_t *ppu = space->machine().device("ppu");
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
int trigger = input_port_read(space->machine(), "P1");
|
||||
int x = input_port_read(space->machine(), "GUNX");
|
||||
int y = input_port_read(space->machine(), "GUNY");
|
||||
@ -277,10 +277,10 @@ READ8_HANDLER( pc10_in1_r )
|
||||
ret |= 0x08;
|
||||
|
||||
/* get the pixel at the gun position */
|
||||
pix = ppu2c0x_get_pixel(ppu, x, y);
|
||||
pix = ppu->get_pixel(x, y);
|
||||
|
||||
/* get the color base from the ppu */
|
||||
color_base = ppu2c0x_get_colorbase(ppu);
|
||||
color_base = ppu->get_colorbase();
|
||||
|
||||
/* look at the screen and see if the cursor is over a bright pixel */
|
||||
if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
|
||||
@ -799,6 +799,7 @@ static WRITE8_HANDLER( eboard_rom_switch_w )
|
||||
DRIVER_INIT( pceboard )
|
||||
{
|
||||
playch10_state *state = machine.driver_data<playch10_state>();
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
UINT8 *prg = machine.region("cart")->base();
|
||||
|
||||
/* we have no vram, make sure switching games doesn't point to an old allocation */
|
||||
@ -812,7 +813,7 @@ DRIVER_INIT( pceboard )
|
||||
machine.device("cart")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0xffff, FUNC(eboard_rom_switch_w) );
|
||||
|
||||
/* ppu_latch callback */
|
||||
ppu2c0x_set_latch(machine.device("ppu"), mapper9_latch);
|
||||
ppu->set_latch(mapper9_latch);
|
||||
|
||||
/* nvram at $6000-$6fff */
|
||||
machine.device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x6fff);
|
||||
@ -879,7 +880,7 @@ static void gboard_scanline_cb( device_t *device, int scanline, int vblank, int
|
||||
static WRITE8_HANDLER( gboard_rom_switch_w )
|
||||
{
|
||||
playch10_state *state = space->machine().driver_data<playch10_state>();
|
||||
device_t *ppu = space->machine().device("ppu");
|
||||
ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
|
||||
|
||||
/* basically, a MMC3 mapper from the nes */
|
||||
|
||||
@ -1003,11 +1004,11 @@ static WRITE8_HANDLER( gboard_rom_switch_w )
|
||||
break;
|
||||
|
||||
case 0x6000: /* disable irqs */
|
||||
ppu2c0x_set_scanline_callback(ppu, 0);
|
||||
ppu->set_scanline_callback(0);
|
||||
break;
|
||||
|
||||
case 0x6001: /* enable irqs */
|
||||
ppu2c0x_set_scanline_callback(ppu, gboard_scanline_cb);
|
||||
ppu->set_scanline_callback(gboard_scanline_cb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ DRIVER_INIT( vsnormal )
|
||||
static WRITE8_HANDLER( gun_in0_w )
|
||||
{
|
||||
vsnes_state *state = space->machine().driver_data<vsnes_state>();
|
||||
device_t *ppu1 = space->machine().device("ppu1");
|
||||
ppu2c0x_device *ppu1 = space->machine().device<ppu2c0x_device>("ppu1");
|
||||
|
||||
if (state->m_do_vrom_bank)
|
||||
{
|
||||
@ -384,10 +384,10 @@ static WRITE8_HANDLER( gun_in0_w )
|
||||
UINT32 pix, color_base;
|
||||
|
||||
/* get the pixel at the gun position */
|
||||
pix = ppu2c0x_get_pixel(ppu1, x, y);
|
||||
pix = ppu1->get_pixel(x, y);
|
||||
|
||||
/* get the color base from the ppu */
|
||||
color_base = ppu2c0x_get_colorbase(ppu1);
|
||||
color_base = ppu1->get_colorbase();
|
||||
|
||||
/* look at the screen and see if the cursor is over a bright pixel */
|
||||
if ((pix == color_base + 0x20 ) || (pix == color_base + 0x30) ||
|
||||
@ -700,7 +700,7 @@ static void mapper4_irq( device_t *device, int scanline, int vblank, int blanked
|
||||
static WRITE8_HANDLER( mapper4_w )
|
||||
{
|
||||
vsnes_state *state = space->machine().driver_data<vsnes_state>();
|
||||
device_t *ppu1 = space->machine().device("ppu1");
|
||||
ppu2c0x_device *ppu1 = space->machine().device<ppu2c0x_device>("ppu1");
|
||||
UINT8 MMC3_helper, cmd;
|
||||
|
||||
switch (offset & 0x6001)
|
||||
@ -765,13 +765,13 @@ static WRITE8_HANDLER( mapper4_w )
|
||||
state->m_IRQ_enable = 0;
|
||||
state->m_IRQ_count = state->m_IRQ_count_latch;
|
||||
|
||||
ppu2c0x_set_scanline_callback (ppu1, 0);
|
||||
ppu1->set_scanline_callback(0);
|
||||
|
||||
break;
|
||||
|
||||
case 0x6001: /* $e001 - Enable IRQs */
|
||||
state->m_IRQ_enable = 1;
|
||||
ppu2c0x_set_scanline_callback (ppu1, mapper4_irq);
|
||||
ppu1->set_scanline_callback(mapper4_irq);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -17,6 +17,7 @@ WRITE8_HANDLER( playch10_videoram_w )
|
||||
|
||||
PALETTE_INIT( playch10 )
|
||||
{
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
@ -54,7 +55,7 @@ PALETTE_INIT( playch10 )
|
||||
color_prom++;
|
||||
}
|
||||
|
||||
ppu2c0x_init_palette_rgb(machine, 256 );
|
||||
ppu->init_palette_rgb(machine, 256);
|
||||
}
|
||||
|
||||
static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
@ -70,14 +71,8 @@ static void ppu_irq( device_t *device, int *ppu_regs )
|
||||
|
||||
const ppu2c0x_interface playch10_ppu_interface =
|
||||
{
|
||||
1, /* gfxlayout num */
|
||||
256, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
ppu_irq /* irq */
|
||||
};
|
||||
|
||||
const ppu2c0x_interface playch10_ppu_interface_hboard =
|
||||
{
|
||||
"cart",
|
||||
"bottom",
|
||||
1, /* gfxlayout num */
|
||||
256, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
@ -124,7 +119,7 @@ VIDEO_START( playch10_hboard )
|
||||
SCREEN_UPDATE_IND16( playch10_single )
|
||||
{
|
||||
playch10_state *state = screen.machine().driver_data<playch10_state>();
|
||||
device_t *ppu = screen.machine().device("ppu");
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu");
|
||||
|
||||
rectangle top_monitor = screen.visible_area();
|
||||
|
||||
@ -140,7 +135,7 @@ SCREEN_UPDATE_IND16( playch10_single )
|
||||
|
||||
if ( state->m_pc10_game_mode )
|
||||
/* render the ppu */
|
||||
ppu2c0x_render( ppu, bitmap, 0, 0, 0, 0 );
|
||||
ppu->render(bitmap, 0, 0, 0, 0 );
|
||||
else
|
||||
{
|
||||
/* When the bios is accessing vram, the video circuitry can't access it */
|
||||
@ -153,15 +148,15 @@ SCREEN_UPDATE_IND16( playch10_single )
|
||||
SCREEN_UPDATE_IND16( playch10_top )
|
||||
{
|
||||
playch10_state *state = screen.machine().driver_data<playch10_state>();
|
||||
device_t *ppu = screen.machine().device("ppu");
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu");
|
||||
|
||||
/* Single Monitor version */
|
||||
if (state->m_pc10_bios != 1)
|
||||
return SCREEN_UPDATE16_CALL(playch10_single);
|
||||
|
||||
if ( !state->m_pc10_dispmask )
|
||||
if (!state->m_pc10_dispmask)
|
||||
/* render the ppu */
|
||||
ppu2c0x_render( ppu, bitmap, 0, 0, 0, 0 );
|
||||
ppu->render(bitmap, 0, 0, 0, 0);
|
||||
else
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,17 +7,19 @@
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PPU_2C03B_H__
|
||||
#define __PPU_2C03B_H__
|
||||
|
||||
#include "devlegcy.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
///*************************************************************************
|
||||
// MACROS / CONSTANTS
|
||||
///*************************************************************************
|
||||
|
||||
/* mirroring types */
|
||||
// mirroring types
|
||||
#define PPU_MIRROR_NONE 0
|
||||
#define PPU_MIRROR_VERT 1
|
||||
#define PPU_MIRROR_HORZ 2
|
||||
@ -25,7 +27,7 @@
|
||||
#define PPU_MIRROR_LOW 4
|
||||
#define PPU_MIRROR_4SCREEN 5 // Same effect as NONE, but signals that we should never mirror
|
||||
|
||||
/* registers definition */
|
||||
// registers definition
|
||||
enum
|
||||
{
|
||||
PPU_CONTROL0 = 0,
|
||||
@ -39,7 +41,7 @@ enum
|
||||
PPU_MAX_REG
|
||||
};
|
||||
|
||||
/* bit definitions for (some of) the registers */
|
||||
// bit definitions for (some of) the registers
|
||||
enum
|
||||
{
|
||||
PPU_CONTROL0_INC = 0x04,
|
||||
@ -74,15 +76,58 @@ enum
|
||||
// are non-rendering and non-vblank.
|
||||
};
|
||||
|
||||
/* callback datatypes */
|
||||
/*----------- defined in video/ppu2c0x.c -----------*/
|
||||
|
||||
///*************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
///*************************************************************************
|
||||
|
||||
#define MCFG_PPU2C0X_ADD(_tag, _type, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, _type, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C02_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C02, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C03B_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C03B, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C04_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C04, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C07_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C07, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C05_01_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C05_01, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C05_02_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C05_02, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C05_03_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C05_03, _intrf) \
|
||||
|
||||
#define MCFG_PPU2C05_04_ADD(_tag, _intrf) \
|
||||
MCFG_PPU2C0X_ADD(_tag, PPU_2C05_04, _intrf) \
|
||||
|
||||
|
||||
///*************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
///*************************************************************************
|
||||
|
||||
// callback datatypes
|
||||
typedef void (*ppu2c0x_scanline_cb)( device_t *device, int scanline, int vblank, int blanked );
|
||||
typedef void (*ppu2c0x_hblank_cb)( device_t *device, int scanline, int vblank, int blanked );
|
||||
typedef void (*ppu2c0x_nmi_cb)( device_t *device, int *ppu_regs );
|
||||
typedef int (*ppu2c0x_vidaccess_cb)( device_t *device, int address, int data );
|
||||
|
||||
typedef struct _ppu2c0x_interface ppu2c0x_interface;
|
||||
struct _ppu2c0x_interface
|
||||
|
||||
// ======================> ppu2c0x_interface
|
||||
|
||||
struct ppu2c0x_interface
|
||||
{
|
||||
const char *cpu_tag;
|
||||
const char *screen_tag;
|
||||
int gfx_layout_number; /* gfx layout number used by each chip */
|
||||
int color_base; /* color base to use per ppu */
|
||||
int mirroring; /* mirroring options (PPU_MIRROR_* flag) */
|
||||
@ -90,75 +135,154 @@ struct _ppu2c0x_interface
|
||||
};
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
PROTOTYPES
|
||||
***************************************************************************/
|
||||
// ======================> ppu2c0x_device
|
||||
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C02, ppu2c02); // NTSC NES
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C03B, ppu2c03b); // Playchoice 10
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C04, ppu2c04); // Vs. Unisystem
|
||||
// The PPU_2C05 variants have different protection value, set at DEVICE_START, but otherwise are all the same...
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C05_01, ppu2c05_01); // Vs. Unisystem (Ninja Jajamaru Kun)
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C05_02, ppu2c05_02); // Vs. Unisystem (Mighty Bomb Jack)
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C05_03, ppu2c05_03); // Vs. Unisystem (Gumshoe)
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C05_04, ppu2c05_04); // Vs. Unisystem (Top Gun)
|
||||
DECLARE_LEGACY_MEMORY_DEVICE(PPU_2C07, ppu2c07); // PAL NES
|
||||
class ppu2c0x_device : public device_t,
|
||||
public device_memory_interface,
|
||||
public ppu2c0x_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
ppu2c0x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
DECLARE_READ8_MEMBER( palette_read );
|
||||
DECLARE_WRITE8_MEMBER( palette_write );
|
||||
|
||||
/* routines */
|
||||
void ppu2c0x_init_palette(running_machine &machine, int first_entry );
|
||||
void ppu2c0x_init_palette_rgb(running_machine &machine, int first_entry );
|
||||
virtual void device_start();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
virtual void device_config_complete();
|
||||
// device_config_memory_interface overrides
|
||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
|
||||
// address space configurations
|
||||
const address_space_config m_space_config;
|
||||
|
||||
|
||||
/* routines */
|
||||
void init_palette( running_machine &machine, int first_entry );
|
||||
void init_palette_rgb( running_machine &machine, int first_entry );
|
||||
|
||||
void draw_background( UINT8 *line_priority );
|
||||
void draw_sprites( UINT8 *line_priority );
|
||||
void render_scanline();
|
||||
void update_scanline();
|
||||
|
||||
void ppu2c0x_spriteram_dma(address_space *space, device_t *device, const UINT8 page ) ATTR_NONNULL(1);
|
||||
void ppu2c0x_render( device_t *device, bitmap_ind16 &bitmap, int flipx, int flipy, int sx, int sy ) ATTR_NONNULL(1);
|
||||
int ppu2c0x_get_pixel( device_t *device, int x, int y ) ATTR_NONNULL(1);
|
||||
int ppu2c0x_get_colorbase( device_t *device ) ATTR_NONNULL(1);
|
||||
int ppu2c0x_get_current_scanline( device_t *device ) ATTR_NONNULL(1);
|
||||
int ppu2c0x_is_sprite_8x16( device_t *device ) ATTR_NONNULL(1);
|
||||
void ppu2c0x_set_scanline_callback( device_t *device, ppu2c0x_scanline_cb cb ) ATTR_NONNULL(1);
|
||||
void ppu2c0x_set_hblank_callback( device_t *device, ppu2c0x_scanline_cb cb ) ATTR_NONNULL(1);
|
||||
void ppu2c0x_set_vidaccess_callback( device_t *device, ppu2c0x_vidaccess_cb cb ) ATTR_NONNULL(1);
|
||||
void ppu2c0x_set_scanlines_per_frame( device_t *device, int scanlines ) ATTR_NONNULL(1);
|
||||
void spriteram_dma(address_space *space, const UINT8 page ) ATTR_NONNULL(1);
|
||||
void render( bitmap_ind16 &bitmap, int flipx, int flipy, int sx, int sy ) ATTR_NONNULL(1);
|
||||
int get_pixel( int x, int y ) ATTR_NONNULL(1);
|
||||
|
||||
//27/12/2002 (HACK!)
|
||||
void ppu2c0x_set_latch( device_t *device, void (*ppu_latch_t)( device_t *device, offs_t offset ));
|
||||
WRITE8_DEVICE_HANDLER( ppu2c0x_w );
|
||||
READ8_DEVICE_HANDLER( ppu2c0x_r );
|
||||
int get_colorbase() { return m_color_base; };
|
||||
int get_current_scanline() { return m_scanline; };
|
||||
int is_sprite_8x16() { return BIT(m_regs[0], 5); }; // MMC5 has to be able to check this
|
||||
void set_scanline_callback( ppu2c0x_scanline_cb cb ) { if (cb != NULL) m_scanline_callback_proc = cb; };
|
||||
void set_hblank_callback( ppu2c0x_scanline_cb cb ) { if (cb != NULL) m_hblank_callback_proc = cb; };
|
||||
void set_vidaccess_callback( ppu2c0x_vidaccess_cb cb ) { if (cb != NULL) m_vidaccess_callback_proc = cb; };
|
||||
void set_scanlines_per_frame( int scanlines ) { m_scanlines_per_frame = scanlines; };
|
||||
|
||||
//27/12/2002 (HACK!)
|
||||
void set_latch( void (*ppu_latch_t)( device_t *device, offs_t offset ) );
|
||||
|
||||
// void update_screen(bitmap_t &bitmap, const rectangle &cliprect);
|
||||
|
||||
cpu_device *m_cpu;
|
||||
screen_device *m_screen;
|
||||
bitmap_ind16 *m_bitmap; /* target bitmap */
|
||||
UINT8 *m_spriteram; /* sprite ram */
|
||||
pen_t *m_colortable; /* color table modified at run time */
|
||||
pen_t *m_colortable_mono; /* monochromatic color table modified at run time */
|
||||
int m_scanline; /* scanline count */
|
||||
ppu2c0x_scanline_cb m_scanline_callback_proc; /* optional scanline callback */
|
||||
ppu2c0x_hblank_cb m_hblank_callback_proc; /* optional hblank callback */
|
||||
ppu2c0x_vidaccess_cb m_vidaccess_callback_proc; /* optional video access callback */
|
||||
ppu2c0x_nmi_cb m_nmi_callback_proc; /* nmi access callback from interface */
|
||||
int m_regs[PPU_MAX_REG]; /* registers */
|
||||
int m_refresh_data; /* refresh-related */
|
||||
int m_refresh_latch; /* refresh-related */
|
||||
int m_x_fine; /* refresh-related */
|
||||
int m_toggle; /* used to latch hi-lo scroll */
|
||||
int m_add; /* vram increment amount */
|
||||
int m_videomem_addr; /* videomem address pointer */
|
||||
int m_data_latch; /* latched videomem data */
|
||||
int m_buffered_data;
|
||||
int m_tile_page; /* current tile page */
|
||||
int m_sprite_page; /* current sprite page */
|
||||
int m_back_color; /* background color */
|
||||
int m_color_base;
|
||||
UINT8 m_palette_ram[0x20]; /* shouldn't be in main memory! */
|
||||
int m_scan_scale; /* scan scale */
|
||||
int m_scanlines_per_frame; /* number of scanlines per frame */
|
||||
int m_security_value; /* 2C05 protection */
|
||||
void (*m_latch)( device_t *device, offs_t offset );
|
||||
|
||||
// timers
|
||||
emu_timer *m_hblank_timer; /* hblank period at end of each scanline */
|
||||
emu_timer *m_nmi_timer; /* NMI timer */
|
||||
emu_timer *m_scanline_timer; /* scanline timer */
|
||||
|
||||
const char *m_cpu_tag;
|
||||
const char *m_screen_tag;
|
||||
|
||||
private:
|
||||
static const device_timer_id TIMER_HBLANK = 0;
|
||||
static const device_timer_id TIMER_NMI = 1;
|
||||
static const device_timer_id TIMER_SCANLINE = 2;
|
||||
|
||||
inline UINT8 readbyte(offs_t address);
|
||||
inline void writebyte(offs_t address, UINT8 data);
|
||||
};
|
||||
|
||||
class ppu2c02_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c02_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c03b_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c03b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c04_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c04_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c07_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c07_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c05_01_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c05_01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c05_02_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c05_02_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c05_03_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c05_03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class ppu2c05_04_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu2c05_04_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION MACROS
|
||||
***************************************************************************/
|
||||
// device type definition
|
||||
//extern const device_type PPU_2C0X;
|
||||
extern const device_type PPU_2C02; // NTSC NES
|
||||
extern const device_type PPU_2C03B; // Playchoice 10
|
||||
extern const device_type PPU_2C04; // Vs. Unisystem
|
||||
extern const device_type PPU_2C07; // PAL NES
|
||||
extern const device_type PPU_2C05_01; // Vs. Unisystem (Ninja Jajamaru Kun)
|
||||
extern const device_type PPU_2C05_02; // Vs. Unisystem (Mighty Bomb Jack)
|
||||
extern const device_type PPU_2C05_03; // Vs. Unisystem (Gumshoe)
|
||||
extern const device_type PPU_2C05_04; // Vs. Unisystem (Top Gun)
|
||||
|
||||
#define MCFG_PPU2C02_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C02, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C03B_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C03B, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C04_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C04, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C05_01_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C05_01, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C05_02_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C05_02, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C05_03_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C05_03, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C05_04_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C05_04, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#define MCFG_PPU2C07_ADD(_tag, _intrf) \
|
||||
MCFG_DEVICE_ADD(_tag, PPU_2C07, 0) \
|
||||
MCFG_DEVICE_CONFIG(_intrf)
|
||||
|
||||
#endif /* __PPU_2C0X_H__ */
|
||||
#endif
|
||||
|
@ -5,13 +5,16 @@
|
||||
|
||||
PALETTE_INIT( vsnes )
|
||||
{
|
||||
ppu2c0x_init_palette_rgb(machine, 0 );
|
||||
ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu1");
|
||||
ppu->init_palette_rgb(machine, 0 );
|
||||
}
|
||||
|
||||
PALETTE_INIT( vsdual )
|
||||
{
|
||||
ppu2c0x_init_palette_rgb(machine, 0 );
|
||||
ppu2c0x_init_palette_rgb(machine, 8*4*16 );
|
||||
ppu2c0x_device *ppu1 = machine.device<ppu2c0x_device>("ppu1");
|
||||
ppu2c0x_device *ppu2 = machine.device<ppu2c0x_device>("ppu2");
|
||||
ppu1->init_palette_rgb(machine, 0 );
|
||||
ppu2->init_palette_rgb(machine, 8*4*16 );
|
||||
}
|
||||
|
||||
static void ppu_irq_1( device_t *device, int *ppu_regs )
|
||||
@ -27,6 +30,8 @@ static void ppu_irq_2( device_t *device, int *ppu_regs )
|
||||
/* our ppu interface */
|
||||
const ppu2c0x_interface vsnes_ppu_interface_1 =
|
||||
{
|
||||
"maincpu",
|
||||
"screen1",
|
||||
0, /* gfxlayout num */
|
||||
0, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
@ -36,6 +41,8 @@ const ppu2c0x_interface vsnes_ppu_interface_1 =
|
||||
/* our ppu interface for dual games */
|
||||
const ppu2c0x_interface vsnes_ppu_interface_2 =
|
||||
{
|
||||
"sub",
|
||||
"screen2",
|
||||
1, /* gfxlayout num */
|
||||
512, /* color base */
|
||||
PPU_MIRROR_NONE, /* mirroring */
|
||||
@ -58,13 +65,15 @@ VIDEO_START( vsdual )
|
||||
SCREEN_UPDATE_IND16( vsnes )
|
||||
{
|
||||
/* render the ppu */
|
||||
ppu2c0x_render( screen.machine().device("ppu1"), bitmap, 0, 0, 0, 0 );
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu1");
|
||||
ppu->render(bitmap, 0, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
SCREEN_UPDATE_IND16( vsnes_bottom )
|
||||
{
|
||||
ppu2c0x_render(screen.machine().device("ppu2"), bitmap, 0, 0, 0, 0);
|
||||
ppu2c0x_device *ppu = screen.machine().device<ppu2c0x_device>("ppu2");
|
||||
ppu->render(bitmap, 0, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user