mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
Modernized Namco I/O devices (56xx, 58xx, 59xx) [Osso, Fabio Priuli]
in order to avoid as much as possible duplicated code, I've split machine configs for each device pairing (56+56, 56+58, 58+58, etc.) in mappy.c I've also considered splitting the driver class in multiple subclasses but then I saw no way to avoid the need of other 6 address maps in the driver...
This commit is contained in:
parent
0e79cea0cd
commit
4866a53fed
@ -151,7 +151,6 @@ TODO:
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "machine/namcoio.h"
|
||||
#include "machine/namco62.h"
|
||||
#include "sound/namco.h"
|
||||
#include "sound/samples.h"
|
||||
@ -202,14 +201,12 @@ WRITE8_MEMBER(gaplus_state::gaplus_sreset_w)
|
||||
|
||||
WRITE8_MEMBER(gaplus_state::gaplus_freset_w)
|
||||
{
|
||||
device_t *io58xx = machine().device("58xx");
|
||||
device_t *io56xx = machine().device("56xx");
|
||||
int bit = !BIT(offset, 11);
|
||||
|
||||
logerror("%04x: freset %d\n",space.device().safe_pc(), bit);
|
||||
|
||||
namcoio_set_reset_line(io58xx, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
namcoio_set_reset_line(io56xx, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco58xx->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco56xx->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
static const namco_62xx_interface namco_62xx_intf =
|
||||
@ -248,35 +245,41 @@ void gaplus_state::device_timer(emu_timer &timer, device_timer_id id, int param,
|
||||
|
||||
TIMER_CALLBACK_MEMBER(gaplus_state::namcoio_run)
|
||||
{
|
||||
device_t *io58xx = machine().device("58xx");
|
||||
device_t *io56xx = machine().device("56xx");
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
namco_customio_58xx_run(io58xx);
|
||||
m_namco58xx->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
namco_customio_56xx_run(io56xx);
|
||||
m_namco56xx->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_main_irq)
|
||||
{
|
||||
device_t *io58xx = machine().device("58xx");
|
||||
device_t *io56xx = machine().device("56xx");
|
||||
|
||||
if(m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!namcoio_read_reset_line(io58xx)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN);
|
||||
if (!m_namco58xx->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 0);
|
||||
|
||||
if (!namcoio_read_reset_line(io56xx)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 1);
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(gaplus_state::gapluso_vblank_main_irq)
|
||||
{
|
||||
if(m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!m_namco58xx->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 1);
|
||||
|
||||
if (!m_namco56xx->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 0);
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_sub_irq)
|
||||
{
|
||||
if(m_sub_irq_mask)
|
||||
@ -294,23 +297,8 @@ static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, gaplus_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_READWRITE(gaplus_videoram_r, gaplus_videoram_w) AM_SHARE("videoram") /* tilemap RAM (shared with CPU #2) */
|
||||
AM_RANGE(0x0800, 0x1fff) AM_READWRITE(gaplus_spriteram_r, gaplus_spriteram_w) AM_SHARE("spriteram") /* shared RAM with CPU #2 (includes sprite RAM) */
|
||||
AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with CPU #3 */
|
||||
AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE_LEGACY("56xx", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE_LEGACY("58xx", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x6820, 0x682f) AM_READWRITE(gaplus_customio_3_r, gaplus_customio_3_w) AM_SHARE("customio_3") /* custom I/O chip #3 interface */
|
||||
AM_RANGE(0x7000, 0x7fff) AM_WRITE(gaplus_irq_1_ctrl_w) /* main CPU irq control */
|
||||
AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) /* watchdog */
|
||||
AM_RANGE(0x8000, 0x8fff) AM_WRITE(gaplus_sreset_w) /* reset CPU #2 & #3, enable sound */
|
||||
AM_RANGE(0x9000, 0x9fff) AM_WRITE(gaplus_freset_w) /* reset I/O chips */
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_WRITE(gaplus_starfield_control_w) /* starfield control */
|
||||
AM_RANGE(0xa000, 0xffff) AM_ROM /* ROM */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( gaplusa_cpu1_map, AS_PROGRAM, 8, gaplus_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_READWRITE(gaplus_videoram_r, gaplus_videoram_w) AM_SHARE("videoram") /* tilemap RAM (shared with CPU #2) */
|
||||
AM_RANGE(0x0800, 0x1fff) AM_READWRITE(gaplus_spriteram_r, gaplus_spriteram_w) AM_SHARE("spriteram") /* shared RAM with CPU #2 (includes sprite RAM) */
|
||||
AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with CPU #3 */
|
||||
AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE_LEGACY("58xx", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE_LEGACY("56xx", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x6820, 0x682f) AM_READWRITE(gaplus_customio_3_r, gaplus_customio_3_w) AM_SHARE("customio_3") /* custom I/O chip #3 interface */
|
||||
AM_RANGE(0x7000, 0x7fff) AM_WRITE(gaplus_irq_1_ctrl_w) /* main CPU irq control */
|
||||
AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) /* watchdog */
|
||||
@ -540,14 +528,12 @@ static const namcoio_interface intf0 =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("COINS"), DEVCB_INPUT_PORT("P1"), DEVCB_INPUT_PORT("P2"), DEVCB_INPUT_PORT("BUTTONS") }, /* port read handlers */
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
|
||||
static const namcoio_interface intf0_lamps =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("COINS"), DEVCB_INPUT_PORT("P1"), DEVCB_INPUT_PORT("P2"), DEVCB_INPUT_PORT("BUTTONS") }, /* port read handlers */
|
||||
{ DEVCB_DRIVER_MEMBER(gaplus_state,out_lamps0), DEVCB_DRIVER_MEMBER(gaplus_state,out_lamps1) }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
|
||||
/* chip #1: dip switches */
|
||||
@ -555,12 +541,29 @@ static const namcoio_interface intf1 =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("DSWA_HIGH"), DEVCB_INPUT_PORT("DSWB_LOW"), DEVCB_INPUT_PORT("DSWB_HIGH"), DEVCB_INPUT_PORT("DSWA_LOW") }, /* port read handlers */
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
|
||||
/* TODO: chip #2: test/cocktail, optional buttons */
|
||||
|
||||
|
||||
|
||||
MACHINE_START_MEMBER(gaplus_state,gaplus)
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case GAME_GALAGA3:
|
||||
case GAME_GAPLUS:
|
||||
m_namco56xx = machine().device<namco56xx_device>("namcoio_1");
|
||||
m_namco58xx = machine().device<namco58xx_device>("namcoio_2");
|
||||
break;
|
||||
case GAME_GAPLUSD:
|
||||
m_namco58xx = machine().device<namco58xx_device>("namcoio_1");
|
||||
m_namco56xx = machine().device<namco56xx_device>("namcoio_2");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( gaplus, gaplus_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -576,10 +579,11 @@ static MACHINE_CONFIG_START( gaplus, gaplus_state )
|
||||
MCFG_CPU_PROGRAM_MAP(cpu3_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, gaplus_vblank_sub2_irq)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(gaplus_state, gaplus)
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* a high value to ensure proper synchronization of the CPUs */
|
||||
|
||||
MCFG_NAMCO56XX_ADD("56xx", intf0_lamps)
|
||||
MCFG_NAMCO58XX_ADD("58xx", intf1)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_1", intf0_lamps)
|
||||
MCFG_NAMCO58XX_ADD("namcoio_2", intf1)
|
||||
|
||||
MCFG_NAMCO_62XX_ADD("62xx", 24576000/6/2, namco_62xx_intf) /* totally made up - TODO: fix */
|
||||
|
||||
@ -595,7 +599,6 @@ static MACHINE_CONFIG_START( gaplus, gaplus_state )
|
||||
MCFG_GFXDECODE(gaplus)
|
||||
MCFG_PALETTE_LENGTH(64*4+64*8)
|
||||
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
@ -607,26 +610,24 @@ static MACHINE_CONFIG_START( gaplus, gaplus_state )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( gaplusa, gaplus )
|
||||
static MACHINE_CONFIG_DERIVED( gaplusd, gaplus )
|
||||
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO58XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( gapluso, gaplusd )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_PROGRAM_MAP(gaplusa_cpu1_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, gapluso_vblank_main_irq)
|
||||
|
||||
MCFG_DEVICE_REMOVE("56xx")
|
||||
MCFG_DEVICE_REMOVE("58xx")
|
||||
MCFG_NAMCO56XX_ADD("56xx", intf1)
|
||||
MCFG_NAMCO58XX_ADD("58xx", intf0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( gapluso, gaplus )
|
||||
|
||||
/* basic machine hardware */
|
||||
|
||||
MCFG_DEVICE_REMOVE("56xx")
|
||||
MCFG_DEVICE_REMOVE("58xx")
|
||||
MCFG_NAMCO58XX_ADD("56xx", intf0)
|
||||
MCFG_NAMCO56XX_ADD("58xx", intf1)
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO56XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO58XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -959,26 +960,41 @@ ROM_END
|
||||
DRIVER_INIT_MEMBER(gaplus_state,gaplus)
|
||||
{
|
||||
UINT8 *rom;
|
||||
int i;
|
||||
|
||||
|
||||
rom = memregion("gfx1")->base();
|
||||
for (i = 0;i < 0x2000;i++)
|
||||
for (int i = 0;i < 0x2000;i++)
|
||||
rom[i + 0x2000] = rom[i] >> 4;
|
||||
|
||||
|
||||
rom = memregion("gfx2")->base() + 0x6000;
|
||||
for (i = 0;i < 0x2000;i++)
|
||||
for (int i = 0;i < 0x2000;i++)
|
||||
rom[i + 0x2000] = rom[i] << 4;
|
||||
|
||||
m_type = GAME_GAPLUS;
|
||||
}
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(gaplus_state,gaplusd)
|
||||
{
|
||||
DRIVER_INIT_CALL(gaplus);
|
||||
m_type = GAME_GAPLUSD;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(gaplus_state,galaga3)
|
||||
{
|
||||
DRIVER_INIT_CALL(gaplus);
|
||||
m_type = GAME_GALAGA3;
|
||||
}
|
||||
|
||||
|
||||
/* These sets are on revision 2 or 3 PCBs AKA "Namco" PCBs */
|
||||
GAME( 1984, gaplus, 0, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2 rev. B)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, gaplusa, gaplus, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, gaplusd, gaplus, gaplusa, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2 rev D, alternate hardware)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3, gaplus, gaplus, gaplus, gaplus_state, gaplus, ROT90, "Namco", "Galaga 3 (GP3 rev. D)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3a, gaplus, gaplus, gaplus, gaplus_state, gaplus, ROT90, "Namco", "Galaga 3 (GP3 rev. C)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3b, gaplus, gaplus, gaplus, gaplus_state, gaplus, ROT90, "Namco", "Galaga 3 (GP3)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, gaplus, 0, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2 rev. B)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, gaplusa, gaplus, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, gaplusd, gaplus, gaplusd, gapluso, gaplus_state, gaplusd, ROT90, "Namco", "Gaplus (GP2 rev D, alternate hardware)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3 rev. D)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3a, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3 rev. C)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3b, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
|
||||
|
||||
/* These sets are on older revision (AKA Midway) 1 PCBs */
|
||||
GAME( 1984, galaga3c, gaplus, gaplus, galaga3a, gaplus_state, gaplus, ROT90, "Namco", "Galaga 3 (set 4)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3m, gaplus, gaplus, galaga3m, gaplus_state, gaplus, ROT90, "Namco", "Galaga 3 (set 5)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3c, gaplus, gaplus, galaga3a, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (set 4)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1984, galaga3m, gaplus, gaplus, galaga3m, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (set 5)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
|
@ -550,7 +550,6 @@ TODO:
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "sound/dac.h"
|
||||
#include "sound/namco.h"
|
||||
#include "machine/namcoio.h"
|
||||
#include "includes/mappy.h"
|
||||
|
||||
/*************************************
|
||||
@ -576,13 +575,10 @@ TODO:
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
WRITE8_MEMBER(mappy_state::superpac_latch_w)
|
||||
void mappy_state::common_latch_w(UINT32 offset)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
int bit = offset & 1;
|
||||
|
||||
|
||||
switch (offset & 0x0e)
|
||||
{
|
||||
case 0x00: /* INT ON 2 */
|
||||
@ -590,308 +586,359 @@ WRITE8_MEMBER(mappy_state::superpac_latch_w)
|
||||
if (!bit)
|
||||
m_subcpu->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
|
||||
case 0x02: /* INT ON */
|
||||
m_main_irq_mask = bit;
|
||||
if (!bit)
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
|
||||
case 0x04: /* n.c. */
|
||||
break;
|
||||
|
||||
|
||||
case 0x06: /* SOUND ON */
|
||||
mappy_sound_enable(machine().device("namco"), bit);
|
||||
break;
|
||||
|
||||
case 0x08: /* 4 RESET */
|
||||
namcoio_set_reset_line(namcoio_1, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
namcoio_set_reset_line(namcoio_2, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
|
||||
case 0x0a: /* SUB RESET */
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
|
||||
case 0x0c: /* n.c. */
|
||||
break;
|
||||
|
||||
|
||||
case 0x0e: /* n.c. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(mappy_state::phozon_latch_w)
|
||||
WRITE8_MEMBER(mappy_state::superpac_latch_w)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
int bit = offset & 1;
|
||||
|
||||
switch (offset & 0x0e)
|
||||
{
|
||||
case 0x00:
|
||||
m_sub_irq_mask = bit;
|
||||
if (!bit)
|
||||
m_subcpu->set_input_line(0, CLEAR_LINE);
|
||||
case 0x08: /* 4 RESET */
|
||||
switch (m_type)
|
||||
{
|
||||
case GAME_SUPERPAC:
|
||||
m_namco56xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco56xx_2->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
case GAME_PACNPAL:
|
||||
m_namco56xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco59xx->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
case GAME_GROBDA:
|
||||
m_namco58xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco56xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
m_main_irq_mask = bit;
|
||||
if (!bit)
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
default:
|
||||
common_latch_w(offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(mappy_state::phozon_latch_w)
|
||||
{
|
||||
int bit = offset & 1;
|
||||
|
||||
switch (offset & 0x0e)
|
||||
{
|
||||
case 0x04:
|
||||
m_sub2_irq_mask = bit;
|
||||
if (!bit)
|
||||
m_subcpu2->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
mappy_sound_enable(machine().device("namco"), bit);
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
namcoio_set_reset_line(namcoio_1, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
namcoio_set_reset_line(namcoio_2, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case 0x0a:
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco58xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco56xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case 0x0c:
|
||||
m_subcpu2->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case 0x0e:
|
||||
break;
|
||||
|
||||
default:
|
||||
common_latch_w(offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(mappy_state::mappy_latch_w)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
int bit = offset & 1;
|
||||
|
||||
switch (offset & 0x0e)
|
||||
{
|
||||
case 0x00: /* INT ON 2 */
|
||||
m_sub_irq_mask = bit;
|
||||
if (!bit)
|
||||
m_subcpu->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 0x02: /* INT ON */
|
||||
m_main_irq_mask = bit;
|
||||
if (!bit)
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 0x04: /* FLIP */
|
||||
flip_screen_set(bit);
|
||||
break;
|
||||
|
||||
case 0x06: /* SOUND ON */
|
||||
mappy_sound_enable(machine().device("namco"), bit);
|
||||
break;
|
||||
|
||||
case 0x08: /* 4 RESET */
|
||||
namcoio_set_reset_line(namcoio_1, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
namcoio_set_reset_line(namcoio_2, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case 0x0a: /* SUB RESET */
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case 0x0c: /* n.c. */
|
||||
break;
|
||||
|
||||
case 0x0e: /* n.c. */
|
||||
switch (m_type)
|
||||
{
|
||||
case GAME_MAPPY:
|
||||
m_namco58xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco58xx_2->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
case GAME_DRUAGA:
|
||||
case GAME_DIGDUG2:
|
||||
m_namco58xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco56xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
case GAME_MOTOS:
|
||||
m_namco56xx_1->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_namco56xx_2->set_reset_line(bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
common_latch_w(offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MACHINE_RESET_MEMBER(mappy_state,superpac)
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
int i;
|
||||
|
||||
/* Reset all latches */
|
||||
for (i = 0; i < 0x10; i += 2)
|
||||
superpac_latch_w(space,i,0);
|
||||
for (int i = 0; i < 0x10; i += 2)
|
||||
superpac_latch_w(space, i, 0);
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(mappy_state,phozon)
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
int i;
|
||||
|
||||
/* Reset all latches */
|
||||
for (i = 0; i < 0x10; i += 2)
|
||||
for (int i = 0; i < 0x10; i += 2)
|
||||
phozon_latch_w(space, i, 0);
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(mappy_state,mappy)
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
int i;
|
||||
|
||||
/* Reset all latches */
|
||||
for (i = 0; i < 0x10; i += 2)
|
||||
for (int i = 0; i < 0x10; i += 2)
|
||||
mappy_latch_w(space, i, 0);
|
||||
}
|
||||
|
||||
|
||||
/* different games need different interrupt generators & timers because they use different Namco I/O devices */
|
||||
|
||||
void mappy_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_SUPERPAC_IO_RUN:
|
||||
superpac_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_PACNPAL_IO_RUN:
|
||||
pacnpal_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_PHOZON_IO_RUN:
|
||||
phozon_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_MAPPY_IO_RUN:
|
||||
mappy_io_run(ptr, param);
|
||||
break;
|
||||
default:
|
||||
assert_always(FALSE, "Unknown id in mappy_state::device_timer");
|
||||
case TIMER_SUPERPAC_IO_RUN:
|
||||
superpac_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_PACNPAL_IO_RUN:
|
||||
pacnpal_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_GROBDA_IO_RUN:
|
||||
grobda_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_PHOZON_IO_RUN:
|
||||
phozon_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_MAPPY_IO_RUN:
|
||||
mappy_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_DIGDUG2_IO_RUN:
|
||||
digdug2_io_run(ptr, param);
|
||||
break;
|
||||
case TIMER_MOTOS_IO_RUN:
|
||||
motos_io_run(ptr, param);
|
||||
break;
|
||||
default:
|
||||
assert_always(FALSE, "Unknown id in mappy_state::device_timer");
|
||||
}
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::superpac_io_run)
|
||||
{
|
||||
device_t *io56xx_1 = machine().device("namcoio_1");
|
||||
device_t *io56xx_2 = machine().device("namcoio_2");
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
namco_customio_56xx_run(io56xx_1);
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
namco_customio_56xx_run(io56xx_2);
|
||||
m_namco56xx_2->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::superpac_main_vblank_irq)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
|
||||
if (m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_1)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_SUPERPAC_IO_RUN);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_2)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx_2->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_SUPERPAC_IO_RUN, 1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::pacnpal_io_run)
|
||||
{
|
||||
device_t *io56xx = machine().device("namcoio_1");
|
||||
device_t *io59xx = machine().device("namcoio_2");
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
namco_customio_56xx_run(io56xx);
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
namco_customio_59xx_run(io59xx);
|
||||
m_namco59xx->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::pacnpal_main_vblank_irq)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
|
||||
if (m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_1)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_PACNPAL_IO_RUN);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_2)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco59xx->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_PACNPAL_IO_RUN, 1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::grobda_io_run)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
m_namco58xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::grobda_main_vblank_irq)
|
||||
{
|
||||
if (m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!m_namco58xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_GROBDA_IO_RUN);
|
||||
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_GROBDA_IO_RUN, 1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::phozon_io_run)
|
||||
{
|
||||
device_t *io58xx = machine().device("namcoio_1");
|
||||
device_t *io56xx = machine().device("namcoio_2");
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
namco_customio_58xx_run(io58xx);
|
||||
m_namco58xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
namco_customio_56xx_run(io56xx);
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::phozon_main_vblank_irq)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
|
||||
if (m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_1)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco58xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_PHOZON_IO_RUN);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_2)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_PHOZON_IO_RUN, 1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::mappy_io_run)
|
||||
{
|
||||
device_t *io58xx_1 = machine().device("namcoio_1");
|
||||
device_t *io58xx_2 = machine().device("namcoio_2");
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
namco_customio_58xx_run(io58xx_1);
|
||||
m_namco58xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
namco_customio_58xx_run(io58xx_2);
|
||||
m_namco58xx_2->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::mappy_main_vblank_irq)
|
||||
{
|
||||
device_t *namcoio_1 = machine().device("namcoio_1");
|
||||
device_t *namcoio_2 = machine().device("namcoio_2");
|
||||
|
||||
if(m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_1)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco58xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_MAPPY_IO_RUN);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_2)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco58xx_2->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_MAPPY_IO_RUN, 1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::digdug2_io_run)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
m_namco58xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::digdug2_main_vblank_irq)
|
||||
{
|
||||
if(m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!m_namco58xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_DIGDUG2_IO_RUN);
|
||||
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_DIGDUG2_IO_RUN, 1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mappy_state::motos_io_run)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
m_namco56xx_2->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::motos_main_vblank_irq)
|
||||
{
|
||||
if(m_main_irq_mask)
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_MOTOS_IO_RUN);
|
||||
|
||||
if (!m_namco56xx_2->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_MOTOS_IO_RUN, 1);
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(mappy_state::sub_vblank_irq)
|
||||
{
|
||||
if(m_sub_irq_mask)
|
||||
@ -909,8 +956,8 @@ static ADDRESS_MAP_START( superpac_cpu1_map, AS_PROGRAM, 8, mappy_state )
|
||||
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* work RAM with embedded sprite RAM */
|
||||
AM_RANGE(0x2000, 0x2000) AM_READWRITE(superpac_flipscreen_r, superpac_flipscreen_w)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the sound CPU */
|
||||
AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE_LEGACY("namcoio_1", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE_LEGACY("namcoio_2", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x5000, 0x500f) AM_WRITE(superpac_latch_w) /* various control bits */
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0xa000, 0xffff) AM_ROM
|
||||
@ -920,8 +967,8 @@ static ADDRESS_MAP_START( phozon_cpu1_map, AS_PROGRAM, 8, mappy_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE("videoram") /* video RAM */
|
||||
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* shared RAM with CPU #2/sprite RAM*/
|
||||
AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the sound CPU */
|
||||
AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE_LEGACY("namcoio_1", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE_LEGACY("namcoio_2", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x5000, 0x500f) AM_WRITE(phozon_latch_w) /* various control bits */
|
||||
AM_RANGE(0x7000, 0x7000) AM_WRITE(watchdog_reset_w) /* watchdog reset */
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */
|
||||
@ -932,14 +979,13 @@ static ADDRESS_MAP_START( mappy_cpu1_map, AS_PROGRAM, 8, mappy_state )
|
||||
AM_RANGE(0x1000, 0x27ff) AM_RAM AM_SHARE("spriteram") /* work RAM with embedded sprite RAM */
|
||||
AM_RANGE(0x3800, 0x3fff) AM_WRITE(mappy_scroll_w) /* scroll */
|
||||
AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the sound CPU */
|
||||
AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE_LEGACY("namcoio_1", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE_LEGACY("namcoio_2", namcoio_r, namcoio_w) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */
|
||||
AM_RANGE(0x5000, 0x500f) AM_WRITE(mappy_latch_w) /* various control bits */
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w) /* watchdog reset */
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM code (only a000-ffff in Mappy) */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( superpac_cpu2_map, AS_PROGRAM, 8, mappy_state )
|
||||
AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the main CPU (also sound registers) */
|
||||
AM_RANGE(0x2000, 0x200f) AM_WRITE(superpac_latch_w) /* various control bits */
|
||||
@ -1602,14 +1648,12 @@ static const namcoio_interface intf0 =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("COINS"), DEVCB_INPUT_PORT("P1"), DEVCB_INPUT_PORT("P2"), DEVCB_INPUT_PORT("BUTTONS") }, /* port read handlers */
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port write handlers */
|
||||
NULL
|
||||
};
|
||||
|
||||
static const namcoio_interface intf0_lamps =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("COINS"), DEVCB_INPUT_PORT("P1"), DEVCB_INPUT_PORT("P2"), DEVCB_INPUT_PORT("BUTTONS") }, /* port read handlers */
|
||||
{ DEVCB_DRIVER_MEMBER(mappy_state,out_lamps), DEVCB_NULL }, /* port write handlers */
|
||||
NULL
|
||||
};
|
||||
|
||||
/* chip #1: dip switches, test/cocktail, optional buttons */
|
||||
@ -1617,25 +1661,47 @@ static const namcoio_interface intf1 =
|
||||
{
|
||||
{ DEVCB_DRIVER_MEMBER(mappy_state,dipB_mux), DEVCB_DRIVER_MEMBER(mappy_state,dipA_l), DEVCB_DRIVER_MEMBER(mappy_state,dipA_h), DEVCB_INPUT_PORT("DSW0") }, /* port read handlers */
|
||||
{ DEVCB_DRIVER_MEMBER(mappy_state,out_mux), DEVCB_NULL }, /* port write handlers */
|
||||
NULL
|
||||
};
|
||||
|
||||
static const namcoio_interface intf1_interleave =
|
||||
{
|
||||
{ DEVCB_DRIVER_MEMBER(mappy_state,dipB_muxi), DEVCB_DRIVER_MEMBER(mappy_state,dipA_l), DEVCB_DRIVER_MEMBER(mappy_state,dipA_h), DEVCB_INPUT_PORT("DSW0") }, /* port read handlers */
|
||||
{ DEVCB_DRIVER_MEMBER(mappy_state,out_mux), DEVCB_NULL }, /* port write handlers */
|
||||
NULL
|
||||
};
|
||||
|
||||
MACHINE_START_MEMBER(mappy_state,mappy)
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case GAME_SUPERPAC:
|
||||
case GAME_MOTOS:
|
||||
m_namco56xx_1 = machine().device<namco56xx_device>("namcoio_1");
|
||||
m_namco56xx_2 = machine().device<namco56xx_device>("namcoio_2");
|
||||
break;
|
||||
case GAME_MAPPY:
|
||||
m_namco58xx_1 = machine().device<namco58xx_device>("namcoio_1");
|
||||
m_namco58xx_2 = machine().device<namco58xx_device>("namcoio_2");
|
||||
break;
|
||||
case GAME_GROBDA:
|
||||
case GAME_PHOZON:
|
||||
case GAME_DRUAGA:
|
||||
case GAME_DIGDUG2:
|
||||
m_namco58xx_1 = machine().device<namco58xx_device>("namcoio_1");
|
||||
m_namco56xx_1 = machine().device<namco56xx_device>("namcoio_2");
|
||||
break;
|
||||
case GAME_PACNPAL:
|
||||
m_namco56xx_1 = machine().device<namco56xx_device>("namcoio_1");
|
||||
m_namco59xx = machine().device<namco59xx_device>("namcoio_2");
|
||||
break;
|
||||
}
|
||||
|
||||
save_item(NAME(m_main_irq_mask));
|
||||
save_item(NAME(m_sub_irq_mask));
|
||||
save_item(NAME(m_sub2_irq_mask));
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( superpac, mappy_state )
|
||||
static MACHINE_CONFIG_FRAGMENT( superpac_common )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* 1.536 MHz */
|
||||
@ -1648,13 +1714,11 @@ static MACHINE_CONFIG_START( superpac, mappy_state )
|
||||
|
||||
MCFG_WATCHDOG_VBLANK_INIT(8)
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||
/* synchronization of the CPUs */
|
||||
/* synchronization of the CPUs */
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(mappy_state,mappy)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(mappy_state,superpac)
|
||||
|
||||
MCFG_NAMCO56XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE(superpac)
|
||||
MCFG_PALETTE_LENGTH(64*4+64*4)
|
||||
@ -1674,27 +1738,34 @@ static MACHINE_CONFIG_START( superpac, mappy_state )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( pacnpal, superpac )
|
||||
|
||||
/* basic machine hardware */
|
||||
static MACHINE_CONFIG_START( superpac, mappy_state )
|
||||
|
||||
MCFG_FRAGMENT_ADD(superpac_common)
|
||||
|
||||
MCFG_NAMCO56XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( pacnpal, mappy_state )
|
||||
|
||||
MCFG_FRAGMENT_ADD(superpac_common)
|
||||
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, pacnpal_main_vblank_irq) // also update the custom I/O chips
|
||||
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO56XX_ADD("namcoio_1", intf0_lamps)
|
||||
MCFG_NAMCO59XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( grobda, superpac )
|
||||
static MACHINE_CONFIG_START( grobda, mappy_state )
|
||||
|
||||
MCFG_FRAGMENT_ADD(superpac_common)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, phozon_main_vblank_irq) // also update the custom I/O chips
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, grobda_main_vblank_irq) // also update the custom I/O chips
|
||||
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO58XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
|
||||
@ -1721,7 +1792,7 @@ static MACHINE_CONFIG_START( phozon, mappy_state )
|
||||
|
||||
MCFG_WATCHDOG_VBLANK_INIT(8)
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||
/* synchronization of the CPUs */
|
||||
/* synchronization of the CPUs */
|
||||
MCFG_MACHINE_START_OVERRIDE(mappy_state,mappy)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(mappy_state,phozon)
|
||||
|
||||
@ -1748,7 +1819,7 @@ static MACHINE_CONFIG_START( phozon, mappy_state )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( mappy, mappy_state )
|
||||
static MACHINE_CONFIG_FRAGMENT( mappy_common )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* 1.536 MHz */
|
||||
@ -1761,13 +1832,10 @@ static MACHINE_CONFIG_START( mappy, mappy_state )
|
||||
|
||||
MCFG_WATCHDOG_VBLANK_INIT(8)
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||
/* synchronization of the CPUs */
|
||||
/* synchronization of the CPUs */
|
||||
MCFG_MACHINE_START_OVERRIDE(mappy_state,mappy)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(mappy_state,mappy)
|
||||
|
||||
MCFG_NAMCO58XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO58XX_ADD("namcoio_2", intf1)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE(mappy)
|
||||
MCFG_PALETTE_LENGTH(64*4+16*16)
|
||||
@ -1787,44 +1855,34 @@ static MACHINE_CONFIG_START( mappy, mappy_state )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( digdug2, mappy )
|
||||
static MACHINE_CONFIG_START( mappy, mappy_state )
|
||||
|
||||
MCFG_FRAGMENT_ADD(mappy_common)
|
||||
|
||||
MCFG_NAMCO58XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO58XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( digdug2, mappy_state )
|
||||
|
||||
MCFG_FRAGMENT_ADD(mappy_common)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, phozon_main_vblank_irq) // also update the custom I/O chips
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, digdug2_main_vblank_irq) // also update the custom I/O chips
|
||||
|
||||
MCFG_WATCHDOG_VBLANK_INIT(0)
|
||||
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO58XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( todruaga, mappy )
|
||||
static MACHINE_CONFIG_START( motos, mappy_state )
|
||||
|
||||
MCFG_FRAGMENT_ADD(mappy_common)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, phozon_main_vblank_irq) // also update the custom I/O chips
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, motos_main_vblank_irq) // also update the custom I/O chips
|
||||
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO58XX_ADD("namcoio_1", intf0)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE(todruaga)
|
||||
MCFG_PALETTE_LENGTH(64*4+64*16)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( motos, mappy )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mappy_state, superpac_main_vblank_irq) // also update the custom I/O chips
|
||||
|
||||
MCFG_DEVICE_REMOVE("namcoio_1")
|
||||
MCFG_DEVICE_REMOVE("namcoio_2")
|
||||
MCFG_NAMCO56XX_ADD("namcoio_1", intf0_lamps)
|
||||
MCFG_NAMCO56XX_ADD("namcoio_2", intf1)
|
||||
MACHINE_CONFIG_END
|
||||
@ -2262,8 +2320,20 @@ WRITE8_MEMBER(mappy_state::grobda_DAC_w)
|
||||
m_dac->write_unsigned8((data << 4) | data);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,superpac)
|
||||
{
|
||||
m_type = GAME_SUPERPAC;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,pacnpal)
|
||||
{
|
||||
m_type = GAME_PACNPAL;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,grobda)
|
||||
{
|
||||
m_type = GAME_GROBDA;
|
||||
|
||||
/* I think the speech in Grobda is not a standard Namco sound feature, but rather a hack.
|
||||
The hardware automatically cycles the bottom 6 address lines of sound RAM, so they
|
||||
probably added a latch loaded when the bottom 4 lines are 0010 (which corresponds
|
||||
@ -2275,32 +2345,55 @@ DRIVER_INIT_MEMBER(mappy_state,grobda)
|
||||
m_subcpu->space(AS_PROGRAM).install_write_handler(0x0002, 0x0002, write8_delegate(FUNC(mappy_state::grobda_DAC_w),this));
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,phozon)
|
||||
{
|
||||
m_type = GAME_PHOZON;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,mappy)
|
||||
{
|
||||
m_type = GAME_MAPPY;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,druaga)
|
||||
{
|
||||
m_type = GAME_DRUAGA;
|
||||
}
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,digdug2)
|
||||
{
|
||||
m_type = GAME_DIGDUG2;
|
||||
|
||||
/* appears to not use the watchdog */
|
||||
m_maincpu->space(AS_PROGRAM).nop_write(0x8000, 0x8000);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(mappy_state,motos)
|
||||
{
|
||||
m_type = GAME_MOTOS;
|
||||
}
|
||||
|
||||
|
||||
/* 2x6809, static tilemap, 2bpp sprites (Super Pacman type) */
|
||||
GAME( 1982, superpac, 0, superpac, superpac, driver_device, 0, ROT90, "Namco", "Super Pac-Man", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, superpacm,superpac, superpac, superpac, driver_device, 0, ROT90, "Namco (Bally Midway license)", "Super Pac-Man (Midway)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, pacnpal, 0, pacnpal, pacnpal, driver_device, 0, ROT90, "Namco", "Pac & Pal", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, pacnpal2, pacnpal, pacnpal, pacnpal, driver_device, 0, ROT90, "Namco", "Pac & Pal (older)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, pacnchmp, pacnpal, pacnpal, pacnpal, driver_device, 0, ROT90, "Namco", "Pac-Man & Chomp Chomp", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, superpac, 0, superpac, superpac, mappy_state, superpac, ROT90, "Namco", "Super Pac-Man", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, superpacm,superpac, superpac, superpac, mappy_state, superpac, ROT90, "Namco (Bally Midway license)", "Super Pac-Man (Midway)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, pacnpal, 0, pacnpal, pacnpal, mappy_state, pacnpal, ROT90, "Namco", "Pac & Pal", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, pacnpal2, pacnpal, pacnpal, pacnpal, mappy_state, pacnpal, ROT90, "Namco", "Pac & Pal (older)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, pacnchmp, pacnpal, pacnpal, pacnpal, mappy_state, pacnpal, ROT90, "Namco", "Pac-Man & Chomp Chomp", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, grobda, 0, grobda, grobda, mappy_state, grobda, ROT90, "Namco", "Grobda (New Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, grobda2, grobda, grobda, grobda, mappy_state, grobda, ROT90, "Namco", "Grobda (Old Ver. set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, grobda3, grobda, grobda, grobda, mappy_state, grobda, ROT90, "Namco", "Grobda (Old Ver. set 2)", GAME_SUPPORTS_SAVE )
|
||||
|
||||
/* 3x6809, static tilemap, 2bpp sprites (Gaplus type) */
|
||||
GAME( 1983, phozon, 0, phozon, phozon, driver_device, 0, ROT90, "Namco", "Phozon (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, phozon, 0, phozon, phozon, mappy_state, phozon, ROT90, "Namco", "Phozon (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
||||
/* 2x6809, scroling tilemap, 4bpp sprites (Super Pacman type) */
|
||||
GAME( 1983, mappy, 0, mappy, mappy, driver_device, 0, ROT90, "Namco", "Mappy (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, mappyj, mappy, mappy, mappy, driver_device, 0, ROT90, "Namco", "Mappy (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, todruaga, 0, todruaga, todruaga, driver_device, 0, ROT90, "Namco", "The Tower of Druaga (New Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, todruagao,todruaga, todruaga, todruaga, driver_device, 0, ROT90, "Namco", "The Tower of Druaga (Old Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, todruagas,todruaga, todruaga, todruaga, driver_device, 0, ROT90, "bootleg? (Sidam)", "The Tower of Druaga (Sidam)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, mappy, 0, mappy, mappy, mappy_state, mappy, ROT90, "Namco", "Mappy (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, mappyj, mappy, mappy, mappy, mappy_state, mappy, ROT90, "Namco", "Mappy (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, todruaga, 0, digdug2, todruaga, mappy_state, druaga, ROT90, "Namco", "The Tower of Druaga (New Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, todruagao,todruaga, digdug2, todruaga, mappy_state, druaga, ROT90, "Namco", "The Tower of Druaga (Old Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, todruagas,todruaga, digdug2, todruaga, mappy_state, druaga, ROT90, "bootleg? (Sidam)", "The Tower of Druaga (Sidam)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, digdug2, 0, digdug2, digdug2, mappy_state, digdug2, ROT90, "Namco", "Dig Dug II (New Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, digdug2o, digdug2, digdug2, digdug2, mappy_state, digdug2, ROT90, "Namco", "Dig Dug II (Old Ver.)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, motos, 0, motos, motos, driver_device, 0, ROT90, "Namco", "Motos", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, motos, 0, motos, motos, mappy_state, motos, ROT90, "Namco", "Motos", GAME_SUPPORTS_SAVE )
|
||||
|
@ -32,7 +32,6 @@ TODO:
|
||||
#include "emu.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "machine/namcoio.h"
|
||||
#include "sound/namco.h"
|
||||
#include "includes/toypop.h"
|
||||
|
||||
@ -92,40 +91,32 @@ void toypop_state::device_timer(emu_timer &timer, device_timer_id id, int param,
|
||||
|
||||
TIMER_CALLBACK_MEMBER(toypop_state::namcoio_run)
|
||||
{
|
||||
device_t *io58xx = machine().device("58xx");
|
||||
device_t *io56xx_1 = machine().device("56xx_1");
|
||||
device_t *io56xx_2 = machine().device("56xx_2");
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case 0:
|
||||
namco_customio_58xx_run(io58xx);
|
||||
m_namco58xx->customio_run();
|
||||
break;
|
||||
case 1:
|
||||
namco_customio_56xx_run(io56xx_1);
|
||||
m_namco56xx_1->customio_run();
|
||||
break;
|
||||
case 2:
|
||||
namco_customio_56xx_run(io56xx_2);
|
||||
m_namco56xx_2->customio_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(toypop_state::toypop_main_vblank_irq)
|
||||
{
|
||||
device_t *namcoio_0 = machine().device("58xx");
|
||||
device_t *namcoio_1 = machine().device("56xx_1");
|
||||
device_t *namcoio_2 = machine().device("56xx_2");
|
||||
|
||||
if(m_main_irq_mask)
|
||||
device.execute().set_input_line(0, HOLD_LINE);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_0)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco58xx->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_1)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx_1->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 1);
|
||||
|
||||
if (!namcoio_read_reset_line(namcoio_2)) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
if (!m_namco56xx_2->read_reset_line()) /* give the cpu a tiny bit of time to write the command before processing it */
|
||||
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 2);
|
||||
|
||||
}
|
||||
@ -196,9 +187,9 @@ static ADDRESS_MAP_START( liblrabl_map, AS_PROGRAM, 8, toypop_state )
|
||||
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* general RAM, area 1 */
|
||||
AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("m68k_shared") /* shared RAM with the 68000 CPU */
|
||||
AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with sound CPU */
|
||||
AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE_LEGACY("58xx", namcoio_r, namcoio_w) /* custom I/O */
|
||||
AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE_LEGACY("56xx_1", namcoio_r, namcoio_w) /* custom I/O */
|
||||
AM_RANGE(0x6820, 0x682f) AM_DEVREADWRITE_LEGACY("56xx_2", namcoio_r, namcoio_w) /* custom I/O */
|
||||
AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE("58xx", namco58xx_device, read, write) /* custom I/O */
|
||||
AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE("56xx_1", namco56xx_device, read, write) /* custom I/O */
|
||||
AM_RANGE(0x6820, 0x682f) AM_DEVREADWRITE("56xx_2", namco56xx_device, read, write) /* custom I/O */
|
||||
AM_RANGE(0x7000, 0x7000) AM_WRITE(toypop_main_interrupt_enable_w) /* enable interrupt */
|
||||
AM_RANGE(0x7800, 0x7800) AM_READ(watchdog_reset_r) AM_WRITE(toypop_main_interrupt_disable_w) /* disable interrupt */
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(toypop_m68000_clear_w) /* reset 68000 */
|
||||
@ -213,9 +204,9 @@ static ADDRESS_MAP_START( toypop_map, AS_PROGRAM, 8, toypop_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(toypop_videoram_w) AM_SHARE("videoram") /* video RAM */
|
||||
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* general RAM, area 1 */
|
||||
AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("m68k_shared") /* shared RAM with the 68000 CPU */
|
||||
AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE_LEGACY("58xx", namcoio_r, namcoio_w) /* custom I/O */
|
||||
AM_RANGE(0x6010, 0x601f) AM_DEVREADWRITE_LEGACY("56xx_1", namcoio_r, namcoio_w) /* custom I/O */
|
||||
AM_RANGE(0x6020, 0x602f) AM_DEVREADWRITE_LEGACY("56xx_2", namcoio_r, namcoio_w) /* custom I/O */
|
||||
AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE("58xx", namco58xx_device, read, write) /* custom I/O */
|
||||
AM_RANGE(0x6010, 0x601f) AM_DEVREADWRITE("56xx_1", namco56xx_device, read, write) /* custom I/O */
|
||||
AM_RANGE(0x6020, 0x602f) AM_DEVREADWRITE("56xx_2", namco56xx_device, read, write) /* custom I/O */
|
||||
AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with sound CPU */
|
||||
AM_RANGE(0x7000, 0x7000) AM_READWRITE(toypop_main_interrupt_enable_r, toypop_main_interrupt_disable_w) /* disable interrupt */
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(toypop_m68000_clear_w) /* reset 68000 */
|
||||
@ -524,13 +515,11 @@ static const namcoio_interface intf0_coin =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("COINS"), DEVCB_INPUT_PORT("P1_RIGHT"), DEVCB_INPUT_PORT("P2_RIGHT"), DEVCB_INPUT_PORT("BUTTONS") }, /* port read handlers */
|
||||
{ DEVCB_DRIVER_MEMBER(toypop_state,out_coin0), DEVCB_DRIVER_MEMBER(toypop_state,out_coin1) }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
static const namcoio_interface intf0 =
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("COINS"), DEVCB_INPUT_PORT("P1_RIGHT"), DEVCB_INPUT_PORT("P2_RIGHT"), DEVCB_INPUT_PORT("BUTTONS") }, /* port read handlers */
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
|
||||
/* chip #1: dip switches */
|
||||
@ -538,7 +527,6 @@ static const namcoio_interface intf1 =
|
||||
{
|
||||
{ DEVCB_DRIVER_MEMBER(toypop_state,dipA_h), DEVCB_DRIVER_MEMBER(toypop_state,dipB_l), DEVCB_DRIVER_MEMBER(toypop_state,dipB_h), DEVCB_DRIVER_MEMBER(toypop_state,dipA_l) }, /* port read handlers */
|
||||
{ DEVCB_DRIVER_MEMBER(toypop_state,flip), DEVCB_NULL }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
|
||||
/* chip #2: test/cocktail, optional buttons */
|
||||
@ -546,7 +534,6 @@ static const namcoio_interface intf2 =
|
||||
{
|
||||
{ DEVCB_NULL, DEVCB_INPUT_PORT("P1_LEFT"), DEVCB_INPUT_PORT("P2_LEFT"), DEVCB_INPUT_PORT("SERVICE") }, /* port read handlers */
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port write handlers */
|
||||
NULL /* device */
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "sound/samples.h"
|
||||
#include "machine/namcoio.h"
|
||||
|
||||
#define MAX_STARS 250
|
||||
|
||||
struct star {
|
||||
@ -14,20 +16,36 @@ public:
|
||||
{
|
||||
TIMER_NAMCOIO_RUN
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GAME_GAPLUS = 0,
|
||||
GAME_GAPLUSD,
|
||||
GAME_GALAGA3
|
||||
};
|
||||
|
||||
gaplus_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_customio_3(*this,"customio_3"),
|
||||
m_videoram(*this,"videoram"),
|
||||
m_spriteram(*this,"spriteram") ,
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_subcpu2(*this, "sub2"),
|
||||
m_samples(*this, "samples") { }
|
||||
|
||||
m_samples(*this, "samples") ,
|
||||
m_customio_3(*this,"customio_3"),
|
||||
m_videoram(*this,"videoram"),
|
||||
m_spriteram(*this,"spriteram") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<cpu_device> m_subcpu2;
|
||||
required_device<samples_device> m_samples;
|
||||
required_shared_ptr<UINT8> m_customio_3;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
namco58xx_device *m_namco58xx;
|
||||
namco56xx_device *m_namco56xx;
|
||||
|
||||
int m_type;
|
||||
|
||||
tilemap_t *m_bg_tilemap;
|
||||
UINT8 m_starfield_control[4];
|
||||
int m_total_stars;
|
||||
@ -49,7 +67,10 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(gaplus_starfield_control_w);
|
||||
DECLARE_WRITE8_MEMBER(out_lamps0);
|
||||
DECLARE_WRITE8_MEMBER(out_lamps1);
|
||||
DECLARE_MACHINE_START(gaplus);
|
||||
DECLARE_DRIVER_INIT(gaplus);
|
||||
DECLARE_DRIVER_INIT(gaplusd);
|
||||
DECLARE_DRIVER_INIT(galaga3);
|
||||
TILEMAP_MAPPER_MEMBER(tilemap_scan);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
virtual void machine_reset();
|
||||
@ -58,17 +79,14 @@ public:
|
||||
UINT32 screen_update_gaplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void screen_eof_gaplus(screen_device &screen, bool state);
|
||||
INTERRUPT_GEN_MEMBER(gaplus_vblank_main_irq);
|
||||
INTERRUPT_GEN_MEMBER(gapluso_vblank_main_irq);
|
||||
INTERRUPT_GEN_MEMBER(gaplus_vblank_sub_irq);
|
||||
INTERRUPT_GEN_MEMBER(gaplus_vblank_sub2_irq);
|
||||
TIMER_CALLBACK_MEMBER(namcoio_run);
|
||||
void starfield_init();
|
||||
void starfield_render(bitmap_ind16 &bitmap);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<cpu_device> m_subcpu2;
|
||||
required_device<samples_device> m_samples;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "machine/namcoio.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
class mappy_state : public driver_device
|
||||
@ -7,10 +8,25 @@ public:
|
||||
{
|
||||
TIMER_SUPERPAC_IO_RUN,
|
||||
TIMER_PACNPAL_IO_RUN,
|
||||
TIMER_GROBDA_IO_RUN,
|
||||
TIMER_PHOZON_IO_RUN,
|
||||
TIMER_MAPPY_IO_RUN
|
||||
TIMER_MAPPY_IO_RUN,
|
||||
TIMER_DIGDUG2_IO_RUN,
|
||||
TIMER_MOTOS_IO_RUN
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GAME_SUPERPAC = 0,
|
||||
GAME_PACNPAL,
|
||||
GAME_GROBDA,
|
||||
GAME_PHOZON,
|
||||
GAME_MAPPY,
|
||||
GAME_DRUAGA,
|
||||
GAME_DIGDUG2,
|
||||
GAME_MOTOS
|
||||
};
|
||||
|
||||
mappy_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
@ -22,6 +38,21 @@ public:
|
||||
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
optional_device<cpu_device> m_subcpu2;
|
||||
optional_device<dac_device> m_dac;
|
||||
|
||||
namco56xx_device *m_namco56xx_1;
|
||||
namco56xx_device *m_namco56xx_2;
|
||||
namco58xx_device *m_namco58xx_1;
|
||||
namco58xx_device *m_namco58xx_2;
|
||||
namco59xx_device *m_namco59xx;
|
||||
|
||||
// per-game variable to distinguish between the various IO chip config
|
||||
int m_type;
|
||||
|
||||
tilemap_t *m_bg_tilemap;
|
||||
bitmap_ind16 m_sprite_bitmap;
|
||||
|
||||
@ -31,6 +62,8 @@ public:
|
||||
UINT8 m_main_irq_mask;
|
||||
UINT8 m_sub_irq_mask;
|
||||
UINT8 m_sub2_irq_mask;
|
||||
|
||||
void common_latch_w(UINT32 offset);
|
||||
DECLARE_WRITE8_MEMBER(superpac_latch_w);
|
||||
DECLARE_WRITE8_MEMBER(phozon_latch_w);
|
||||
DECLARE_WRITE8_MEMBER(mappy_latch_w);
|
||||
@ -46,8 +79,6 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(out_mux);
|
||||
DECLARE_WRITE8_MEMBER(out_lamps);
|
||||
DECLARE_WRITE8_MEMBER(grobda_DAC_w);
|
||||
DECLARE_DRIVER_INIT(digdug2);
|
||||
DECLARE_DRIVER_INIT(grobda);
|
||||
TILEMAP_MAPPER_MEMBER(superpac_tilemap_scan);
|
||||
TILEMAP_MAPPER_MEMBER(mappy_tilemap_scan);
|
||||
TILE_GET_INFO_MEMBER(superpac_get_tile_info);
|
||||
@ -68,20 +99,32 @@ public:
|
||||
UINT32 screen_update_mappy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(superpac_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(pacnpal_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(grobda_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(phozon_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(mappy_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(digdug2_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(todruaga_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(motos_main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(sub_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(sub2_vblank_irq);
|
||||
TIMER_CALLBACK_MEMBER(superpac_io_run);
|
||||
TIMER_CALLBACK_MEMBER(pacnpal_io_run);
|
||||
TIMER_CALLBACK_MEMBER(grobda_io_run);
|
||||
TIMER_CALLBACK_MEMBER(phozon_io_run);
|
||||
TIMER_CALLBACK_MEMBER(mappy_io_run);
|
||||
TIMER_CALLBACK_MEMBER(digdug2_io_run);
|
||||
TIMER_CALLBACK_MEMBER(todruaga_io_run);
|
||||
TIMER_CALLBACK_MEMBER(motos_io_run);
|
||||
DECLARE_DRIVER_INIT(superpac);
|
||||
DECLARE_DRIVER_INIT(pacnpal);
|
||||
DECLARE_DRIVER_INIT(grobda);
|
||||
DECLARE_DRIVER_INIT(phozon);
|
||||
DECLARE_DRIVER_INIT(mappy);
|
||||
DECLARE_DRIVER_INIT(druaga);
|
||||
DECLARE_DRIVER_INIT(digdug2);
|
||||
DECLARE_DRIVER_INIT(motos);
|
||||
void mappy_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base);
|
||||
void phozon_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
optional_device<cpu_device> m_subcpu2;
|
||||
optional_device<dac_device> m_dac;
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "machine/namcoio.h"
|
||||
|
||||
class toypop_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -14,12 +16,23 @@ public:
|
||||
m_bg_image(*this, "bg_image"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_subcpu(*this, "sub") { }
|
||||
m_subcpu(*this, "sub"),
|
||||
m_namco58xx(*this, "58xx"),
|
||||
m_namco56xx_1(*this, "56xx_1"),
|
||||
m_namco56xx_2(*this, "56xx_2") { }
|
||||
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_m68000_sharedram;
|
||||
required_shared_ptr<UINT16> m_bg_image;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<namco58xx_device> m_namco58xx;
|
||||
required_device<namco56xx_device> m_namco56xx_1;
|
||||
required_device<namco56xx_device> m_namco56xx_2;
|
||||
|
||||
tilemap_t *m_bg_tilemap;
|
||||
|
||||
int m_bitmapflip;
|
||||
@ -64,9 +77,6 @@ public:
|
||||
TIMER_CALLBACK_MEMBER(namcoio_run);
|
||||
void draw_background(bitmap_ind16 &bitmap);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
@ -116,57 +116,106 @@ TODO:
|
||||
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
|
||||
|
||||
|
||||
struct namcoio_state
|
||||
const device_type NAMCO56XX = &device_creator<namco56xx_device>;
|
||||
const device_type NAMCO58XX = &device_creator<namco58xx_device>;
|
||||
const device_type NAMCO59XX = &device_creator<namco59xx_device>;
|
||||
|
||||
namcoio_device::namcoio_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock, const char *shortname)
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__)
|
||||
{
|
||||
UINT8 ram[16];
|
||||
|
||||
devcb_resolved_read8 in[4];
|
||||
devcb_resolved_write8 out[2];
|
||||
|
||||
int reset;
|
||||
INT32 lastcoins, lastbuttons;
|
||||
INT32 credits;
|
||||
INT32 coins[2];
|
||||
INT32 coins_per_cred[2];
|
||||
INT32 creds_per_coin[2];
|
||||
INT32 in_count;
|
||||
|
||||
device_t *device;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
*****************************************************************************/
|
||||
|
||||
INLINE namcoio_state *get_safe_token( device_t *device )
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->type() == NAMCO56XX || device->type() == NAMCO58XX || device->type() == NAMCO59XX);
|
||||
|
||||
return (namcoio_state *)downcast<namcoio_device *>(device)->token();
|
||||
}
|
||||
|
||||
INLINE const namcoio_interface *get_interface( device_t *device )
|
||||
namco56xx_device::namco56xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: namcoio_device(mconfig, NAMCO56XX, "Namco 56xx", tag, owner, clock, "56xx")
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->type() == NAMCO56XX || device->type() == NAMCO58XX || device->type() == NAMCO59XX);
|
||||
return (const namcoio_interface *) device->static_config();
|
||||
m_device_type = TYPE_NAMCO56XX;
|
||||
}
|
||||
|
||||
namco58xx_device::namco58xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: namcoio_device(mconfig, NAMCO58XX, "Namco 58xx", tag, owner, clock, "58xx")
|
||||
{
|
||||
m_device_type = TYPE_NAMCO58XX;
|
||||
}
|
||||
|
||||
namco59xx_device::namco59xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: namcoio_device(mconfig, NAMCO59XX, "Namco 59xx", tag, owner, clock, "59xx")
|
||||
{
|
||||
m_device_type = TYPE_NAMCO59XX;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void namcoio_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const namcoio_interface *intf = reinterpret_cast<const namcoio_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<namcoio_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_in[0], 0, sizeof(m_in[0]));
|
||||
memset(&m_in[1], 0, sizeof(m_in[1]));
|
||||
memset(&m_in[2], 0, sizeof(m_in[2]));
|
||||
memset(&m_in[3], 0, sizeof(m_in[3]));
|
||||
memset(&m_out[0], 0, sizeof(m_out[0]));
|
||||
memset(&m_out[1], 0, sizeof(m_out[1]));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void namcoio_device::device_start()
|
||||
{
|
||||
m_in_func[0].resolve(m_in[0], *this);
|
||||
m_in_func[1].resolve(m_in[1], *this);
|
||||
m_in_func[2].resolve(m_in[2], *this);
|
||||
m_in_func[3].resolve(m_in[3], *this);
|
||||
m_out_func[0].resolve(m_out[0], *this);
|
||||
m_out_func[1].resolve(m_out[1], *this);
|
||||
|
||||
save_item(NAME(m_ram));
|
||||
save_item(NAME(m_reset));
|
||||
save_item(NAME(m_lastcoins));
|
||||
save_item(NAME(m_lastbuttons));
|
||||
save_item(NAME(m_credits));
|
||||
save_item(NAME(m_coins));
|
||||
save_item(NAME(m_coins_per_cred));
|
||||
save_item(NAME(m_creds_per_coin));
|
||||
save_item(NAME(m_in_count));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void namcoio_device::device_reset()
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
m_ram[i] = 0;
|
||||
|
||||
set_reset_line(PULSE_LINE);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
DEVICE HANDLERS
|
||||
*****************************************************************************/
|
||||
|
||||
#define READ_PORT(n) (namcoio->in[n](0) & 0x0f)
|
||||
#define WRITE_PORT(n,d) (namcoio->out[n](0, (d) & 0x0f))
|
||||
#define READ_PORT(n) (m_in_func[n](0) & 0x0f)
|
||||
#define WRITE_PORT(n,d) (m_out_func[n](0, (d) & 0x0f))
|
||||
|
||||
#define IORAM_READ(offset) (namcoio->ram[offset] & 0x0f)
|
||||
#define IORAM_WRITE(offset,data) {namcoio->ram[offset] = (data) & 0x0f;}
|
||||
#define IORAM_READ(offset) (m_ram[offset] & 0x0f)
|
||||
#define IORAM_WRITE(offset,data) {m_ram[offset] = (data) & 0x0f;}
|
||||
|
||||
static void handle_coins( device_t *device, int swap )
|
||||
void namcoio_device::handle_coins( int swap )
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
int val, toggled;
|
||||
int credit_add = 0;
|
||||
int credit_sub = 0;
|
||||
@ -175,30 +224,30 @@ static void handle_coins( device_t *device, int swap )
|
||||
//popmessage("%x %x %x %x %x %x %x %x",IORAM_READ(8),IORAM_READ(9),IORAM_READ(10),IORAM_READ(11),IORAM_READ(12),IORAM_READ(13),IORAM_READ(14),IORAM_READ(15));
|
||||
|
||||
val = ~READ_PORT(0); // pins 38-41
|
||||
toggled = val ^ namcoio->lastcoins;
|
||||
namcoio->lastcoins = val;
|
||||
toggled = val ^ m_lastcoins;
|
||||
m_lastcoins = val;
|
||||
|
||||
/* check coin insertion */
|
||||
if (val & toggled & 0x01)
|
||||
{
|
||||
namcoio->coins[0]++;
|
||||
if (namcoio->coins[0] >= (namcoio->coins_per_cred[0] & 7))
|
||||
m_coins[0]++;
|
||||
if (m_coins[0] >= (m_coins_per_cred[0] & 7))
|
||||
{
|
||||
credit_add = namcoio->creds_per_coin[0] - (namcoio->coins_per_cred[0] >> 3);
|
||||
namcoio->coins[0] -= namcoio->coins_per_cred[0] & 7;
|
||||
credit_add = m_creds_per_coin[0] - (m_coins_per_cred[0] >> 3);
|
||||
m_coins[0] -= m_coins_per_cred[0] & 7;
|
||||
}
|
||||
else if (namcoio->coins_per_cred[0] & 8)
|
||||
else if (m_coins_per_cred[0] & 8)
|
||||
credit_add = 1;
|
||||
}
|
||||
if (val & toggled & 0x02)
|
||||
{
|
||||
namcoio->coins[1]++;
|
||||
if (namcoio->coins[1] >= (namcoio->coins_per_cred[1] & 7))
|
||||
m_coins[1]++;
|
||||
if (m_coins[1] >= (m_coins_per_cred[1] & 7))
|
||||
{
|
||||
credit_add = namcoio->creds_per_coin[1] - (namcoio->coins_per_cred[1] >> 3);
|
||||
namcoio->coins[1] -= namcoio->coins_per_cred[1] & 7;
|
||||
credit_add = m_creds_per_coin[1] - (m_coins_per_cred[1] >> 3);
|
||||
m_coins[1] -= m_coins_per_cred[1] & 7;
|
||||
}
|
||||
else if (namcoio->coins_per_cred[1] & 8)
|
||||
else if (m_coins_per_cred[1] & 8)
|
||||
credit_add = 1;
|
||||
}
|
||||
if (val & toggled & 0x08)
|
||||
@ -207,8 +256,8 @@ static void handle_coins( device_t *device, int swap )
|
||||
}
|
||||
|
||||
val = ~READ_PORT(3); // pins 30-33
|
||||
toggled = val ^ namcoio->lastbuttons;
|
||||
namcoio->lastbuttons = val;
|
||||
toggled = val ^ m_lastbuttons;
|
||||
m_lastbuttons = val;
|
||||
|
||||
/* check start buttons, only if the game allows */
|
||||
if (IORAM_READ(9) == 0)
|
||||
@ -216,18 +265,18 @@ static void handle_coins( device_t *device, int swap )
|
||||
{
|
||||
if (val & toggled & 0x04)
|
||||
{
|
||||
if (namcoio->credits >= 1) credit_sub = 1;
|
||||
if (m_credits >= 1) credit_sub = 1;
|
||||
}
|
||||
else if (val & toggled & 0x08)
|
||||
{
|
||||
if (namcoio->credits >= 2) credit_sub = 2;
|
||||
if (m_credits >= 2) credit_sub = 2;
|
||||
}
|
||||
}
|
||||
|
||||
namcoio->credits += credit_add - credit_sub;
|
||||
m_credits += credit_add - credit_sub;
|
||||
|
||||
IORAM_WRITE(0 ^ swap, namcoio->credits / 10); // BCD credits
|
||||
IORAM_WRITE(1 ^ swap, namcoio->credits % 10); // BCD credits
|
||||
IORAM_WRITE(0 ^ swap, m_credits / 10); // BCD credits
|
||||
IORAM_WRITE(1 ^ swap, m_credits % 10); // BCD credits
|
||||
IORAM_WRITE(2 ^ swap, credit_add); // credit increment (coin inputs)
|
||||
IORAM_WRITE(3 ^ swap, credit_sub); // credit decrement (start buttons)
|
||||
IORAM_WRITE(4, ~READ_PORT(1)); // pins 22-25
|
||||
@ -239,10 +288,8 @@ static void handle_coins( device_t *device, int swap )
|
||||
}
|
||||
|
||||
|
||||
void namco_customio_56xx_run( device_t *device )
|
||||
void namco56xx_device::customio_run()
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
|
||||
LOG(("execute 56XX mode %d\n", IORAM_READ(8)));
|
||||
|
||||
switch (IORAM_READ(8))
|
||||
@ -263,10 +310,10 @@ void namco_customio_56xx_run( device_t *device )
|
||||
break;
|
||||
|
||||
case 2: // initialize coinage settings
|
||||
namcoio->coins_per_cred[0] = IORAM_READ(9);
|
||||
namcoio->creds_per_coin[0] = IORAM_READ(10);
|
||||
namcoio->coins_per_cred[1] = IORAM_READ(11);
|
||||
namcoio->creds_per_coin[1] = IORAM_READ(12);
|
||||
m_coins_per_cred[0] = IORAM_READ(9);
|
||||
m_creds_per_coin[0] = IORAM_READ(10);
|
||||
m_coins_per_cred[1] = IORAM_READ(11);
|
||||
m_creds_per_coin[1] = IORAM_READ(12);
|
||||
// IORAM_READ(13) = 1; meaning unknown - possibly a 3rd coin input? (there's a IPT_UNUSED bit in port A)
|
||||
// IORAM_READ(14) = 1; meaning unknown - possibly a 3rd coin input? (there's a IPT_UNUSED bit in port A)
|
||||
// IORAM_READ(15) = 0; meaning unknown
|
||||
@ -274,7 +321,7 @@ void namco_customio_56xx_run( device_t *device )
|
||||
|
||||
case 4: // druaga, digdug chip #1: read dip switches and inputs
|
||||
// superpac chip #0: process coin and start inputs, read switch inputs
|
||||
handle_coins(device, 0);
|
||||
handle_coins(0);
|
||||
break;
|
||||
|
||||
case 7: // bootup check (liblrabl only)
|
||||
@ -321,10 +368,8 @@ void namco_customio_56xx_run( device_t *device )
|
||||
|
||||
|
||||
|
||||
void namco_customio_59xx_run( device_t *device )
|
||||
void namco59xx_device::customio_run()
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
|
||||
LOG(("execute 59XX mode %d\n", IORAM_READ(8)));
|
||||
|
||||
switch (IORAM_READ(8))
|
||||
@ -346,10 +391,8 @@ void namco_customio_59xx_run( device_t *device )
|
||||
|
||||
|
||||
|
||||
void namco_customio_58xx_run( device_t *device )
|
||||
void namco58xx_device::customio_run()
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
|
||||
LOG(("execute 58XX mode %d\n", IORAM_READ(8)));
|
||||
|
||||
switch (IORAM_READ(8))
|
||||
@ -370,17 +413,17 @@ void namco_customio_58xx_run( device_t *device )
|
||||
break;
|
||||
|
||||
case 2: // initialize coinage settings
|
||||
namcoio->coins_per_cred[0] = IORAM_READ(9);
|
||||
namcoio->creds_per_coin[0] = IORAM_READ(10);
|
||||
namcoio->coins_per_cred[1] = IORAM_READ(11);
|
||||
namcoio->creds_per_coin[1] = IORAM_READ(12);
|
||||
m_coins_per_cred[0] = IORAM_READ(9);
|
||||
m_creds_per_coin[0] = IORAM_READ(10);
|
||||
m_coins_per_cred[1] = IORAM_READ(11);
|
||||
m_creds_per_coin[1] = IORAM_READ(12);
|
||||
// IORAM_READ(13) = 1; meaning unknown - possibly a 3rd coin input? (there's a IPT_UNUSED bit in port A)
|
||||
// IORAM_READ(14) = 0; meaning unknown - possibly a 3rd coin input? (there's a IPT_UNUSED bit in port A)
|
||||
// IORAM_READ(15) = 0; meaning unknown
|
||||
break;
|
||||
|
||||
case 3: // process coin and start inputs, read switch inputs
|
||||
handle_coins(device, 2);
|
||||
handle_coins(2);
|
||||
break;
|
||||
|
||||
case 4: // read dip switches and inputs
|
||||
@ -455,126 +498,44 @@ void namco_customio_58xx_run( device_t *device )
|
||||
|
||||
|
||||
|
||||
READ8_DEVICE_HANDLER( namcoio_r )
|
||||
READ8_MEMBER( namcoio_device::read )
|
||||
{
|
||||
// RAM is 4-bit wide; Pac & Pal requires the | 0xf0 otherwise Easter egg doesn't work
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
offset &= 0x3f;
|
||||
|
||||
// LOG(("%04x: I/O read: mode %d, offset %d = %02x\n", space.device().safe_pc(), offset / 16, namcoio_ram[(offset & 0x30) + 8], offset & 0x0f, namcoio_ram[offset]&0x0f));
|
||||
|
||||
return 0xf0 | namcoio->ram[offset];
|
||||
return 0xf0 | m_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( namcoio_w )
|
||||
WRITE8_MEMBER( namcoio_device::write )
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
offset &= 0x3f;
|
||||
data &= 0x0f; // RAM is 4-bit wide
|
||||
|
||||
// LOG(("%04x: I/O write %d: offset %d = %02x\n", space.device().safe_pc(), offset / 16, offset & 0x0f, data));
|
||||
|
||||
namcoio->ram[offset] = data;
|
||||
m_ram[offset] = data;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( namcoio_set_reset_line )
|
||||
WRITE_LINE_MEMBER( namcoio_device::set_reset_line )
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
namcoio->reset = (state == ASSERT_LINE) ? 1 : 0;
|
||||
m_reset = (state == ASSERT_LINE) ? 1 : 0;
|
||||
if (state != CLEAR_LINE)
|
||||
{
|
||||
/* reset internal registers */
|
||||
namcoio->credits = 0;
|
||||
namcoio->coins[0] = 0;
|
||||
namcoio->coins_per_cred[0] = 1;
|
||||
namcoio->creds_per_coin[0] = 1;
|
||||
namcoio->coins[1] = 0;
|
||||
namcoio->coins_per_cred[1] = 1;
|
||||
namcoio->creds_per_coin[1] = 1;
|
||||
namcoio->in_count = 0;
|
||||
m_credits = 0;
|
||||
m_coins[0] = 0;
|
||||
m_coins_per_cred[0] = 1;
|
||||
m_creds_per_coin[0] = 1;
|
||||
m_coins[1] = 0;
|
||||
m_coins_per_cred[1] = 1;
|
||||
m_creds_per_coin[1] = 1;
|
||||
m_in_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
READ_LINE_DEVICE_HANDLER( namcoio_read_reset_line )
|
||||
READ_LINE_MEMBER( namcoio_device::read_reset_line )
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
return namcoio->reset;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
DEVICE INTERFACE
|
||||
*****************************************************************************/
|
||||
|
||||
static DEVICE_START( namcoio )
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
const namcoio_interface *intf = get_interface(device);
|
||||
|
||||
namcoio->device = intf->device;
|
||||
|
||||
namcoio->in[0].resolve(intf->in[0], *device);
|
||||
namcoio->in[1].resolve(intf->in[1], *device);
|
||||
namcoio->in[2].resolve(intf->in[2], *device);
|
||||
namcoio->in[3].resolve(intf->in[3], *device);
|
||||
namcoio->out[0].resolve(intf->out[0], *device);
|
||||
namcoio->out[1].resolve(intf->out[1], *device);
|
||||
|
||||
device->save_item(NAME(namcoio->ram));
|
||||
device->save_item(NAME(namcoio->reset));
|
||||
device->save_item(NAME(namcoio->lastcoins));
|
||||
device->save_item(NAME(namcoio->lastbuttons));
|
||||
device->save_item(NAME(namcoio->credits));
|
||||
device->save_item(NAME(namcoio->coins));
|
||||
device->save_item(NAME(namcoio->coins_per_cred));
|
||||
device->save_item(NAME(namcoio->creds_per_coin));
|
||||
device->save_item(NAME(namcoio->in_count));
|
||||
|
||||
}
|
||||
|
||||
static DEVICE_RESET( namcoio )
|
||||
{
|
||||
namcoio_state *namcoio = get_safe_token(device);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
namcoio->ram[i] = 0;
|
||||
|
||||
namcoio_set_reset_line(device, PULSE_LINE);
|
||||
}
|
||||
|
||||
const device_type NAMCO56XX = &device_creator<namcoio_device>;
|
||||
|
||||
namcoio_device::namcoio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, NAMCO56XX, "Namco 56xx, 58xx & 59xx", tag, owner, clock)
|
||||
{
|
||||
m_token = global_alloc_clear(namcoio_state);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void namcoio_device::device_config_complete()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void namcoio_device::device_start()
|
||||
{
|
||||
DEVICE_START_NAME( namcoio )(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void namcoio_device::device_reset()
|
||||
{
|
||||
DEVICE_RESET_NAME( namcoio )(this);
|
||||
return m_reset;
|
||||
}
|
||||
|
@ -1,42 +1,92 @@
|
||||
#ifndef __NAMCOIO_H__
|
||||
#define __NAMCOIO_H__
|
||||
|
||||
#include "devlegcy.h"
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
struct namcoio_interface
|
||||
{
|
||||
devcb_read8 in[4];
|
||||
devcb_write8 out[2];
|
||||
|
||||
device_t *device;
|
||||
devcb_read8 m_in[4];
|
||||
devcb_write8 m_out[2];
|
||||
};
|
||||
|
||||
class namcoio_device : public device_t
|
||||
class namcoio_device : public device_t,
|
||||
public namcoio_interface
|
||||
{
|
||||
public:
|
||||
namcoio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~namcoio_device() { global_free(m_token); }
|
||||
namcoio_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock, const char *shortname);
|
||||
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
WRITE_LINE_MEMBER( set_reset_line );
|
||||
READ_LINE_MEMBER( read_reset_line );
|
||||
|
||||
// access to legacy token
|
||||
void *token() const { assert(m_token != NULL); return m_token; }
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
private:
|
||||
|
||||
int m_device_type;
|
||||
|
||||
enum {
|
||||
TYPE_NAMCO56XX,
|
||||
TYPE_NAMCO58XX,
|
||||
TYPE_NAMCO59XX,
|
||||
};
|
||||
|
||||
// internal state
|
||||
void *m_token;
|
||||
UINT8 m_ram[16];
|
||||
|
||||
devcb_resolved_read8 m_in_func[4];
|
||||
devcb_resolved_write8 m_out_func[2];
|
||||
|
||||
int m_reset;
|
||||
INT32 m_lastcoins, m_lastbuttons;
|
||||
INT32 m_credits;
|
||||
INT32 m_coins[2];
|
||||
INT32 m_coins_per_cred[2];
|
||||
INT32 m_creds_per_coin[2];
|
||||
INT32 m_in_count;
|
||||
|
||||
void handle_coins( int swap );
|
||||
|
||||
virtual void customio_run() {}
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
class namco56xx_device : public namcoio_device
|
||||
{
|
||||
public:
|
||||
namco56xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
virtual void customio_run();
|
||||
};
|
||||
|
||||
class namco58xx_device : public namcoio_device
|
||||
{
|
||||
public:
|
||||
namco58xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
virtual void customio_run();
|
||||
};
|
||||
|
||||
class namco59xx_device : public namcoio_device
|
||||
{
|
||||
public:
|
||||
namco59xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
virtual void customio_run();
|
||||
};
|
||||
|
||||
extern const device_type NAMCO56XX;
|
||||
|
||||
#define NAMCO58XX NAMCO56XX
|
||||
#define NAMCO59XX NAMCO56XX
|
||||
extern const device_type NAMCO58XX;
|
||||
extern const device_type NAMCO59XX;
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION MACROS
|
||||
@ -54,22 +104,4 @@ extern const device_type NAMCO56XX;
|
||||
MCFG_DEVICE_ADD(_tag, NAMCO59XX, 0) \
|
||||
MCFG_DEVICE_CONFIG(_interface)
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE I/O FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
DECLARE_READ8_DEVICE_HANDLER( namcoio_r );
|
||||
DECLARE_WRITE8_DEVICE_HANDLER( namcoio_w );
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( namcoio_set_reset_line );
|
||||
READ_LINE_DEVICE_HANDLER( namcoio_read_reset_line );
|
||||
|
||||
|
||||
/* these must be used in the single drivers, inside a timer */
|
||||
void namco_customio_56xx_run(device_t *device);
|
||||
void namco_customio_58xx_run(device_t *device);
|
||||
void namco_customio_59xx_run(device_t *device);
|
||||
|
||||
|
||||
#endif /* __NAMCOIO_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user