summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2014-05-15 05:28:02 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2014-05-15 05:28:02 +0000
commitcd941da1657929e60dce840c05d71a786b379b65 (patch)
treebc505f7aa4e6759db8d7216e4dac5ecfc6c619b8 /src
parent5b22660639682358a801ad2072845cdb518d7d62 (diff)
Gaelco CG-1V/GAE1: converted to use inline configs. nw.
Diffstat (limited to 'src')
-rw-r--r--src/emu/sound/gaelco.c22
-rw-r--r--src/emu/sound/gaelco.h41
-rw-r--r--src/mame/drivers/gaelco2.c68
3 files changed, 49 insertions, 82 deletions
diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c
index d2aa0f7ef66..6e073b91c9a 100644
--- a/src/emu/sound/gaelco.c
+++ b/src/emu/sound/gaelco.c
@@ -58,7 +58,8 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char
: device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock, "gaelco_gae1", __FILE__),
device_sound_interface(mconfig, *this),
m_stream(NULL),
- m_snd_data(NULL)
+ m_snd_data(NULL),
+ m_data_tag(NULL)
{
}
@@ -66,7 +67,8 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_typ
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_sound_interface(mconfig, *this),
m_stream(NULL),
- m_snd_data(NULL)
+ m_snd_data(NULL),
+ m_data_tag(NULL)
{
}
@@ -236,21 +238,15 @@ WRITE16_MEMBER( gaelco_gae1_device::gaelcosnd_w )
void gaelco_gae1_device::device_start()
{
- int j, vol;
- const gaelcosnd_interface *intf = (const gaelcosnd_interface *)static_config();
-
- /* copy rom banks */
- for (j = 0; j < 4; j++){
- m_banks[j] = intf->banks[j];
- }
m_stream = stream_alloc(0, 2, 8000);
- m_snd_data = (UINT8 *)machine().root_device().memregion(intf->gfxregion)->base();
+
+ m_snd_data = (UINT8 *)machine().root_device().memregion(m_data_tag)->base();
if (m_snd_data == NULL)
m_snd_data = *region();
/* init volume table */
- for (vol = 0; vol < GAELCO_VOLUME_LEVELS; vol++){
- for (j = -128; j <= 127; j++){
+ for (int vol = 0; vol < GAELCO_VOLUME_LEVELS; vol++){
+ for (int j = -128; j <= 127; j++){
m_volume_table[vol][(j ^ 0x80) & 0xff] = (vol*j*256)/(GAELCO_VOLUME_LEVELS - 1);
}
}
@@ -268,8 +264,6 @@ void gaelco_gae1_device::device_stop()
}
-
-
/*============================================================================
Gaelco CG-1V sound device
============================================================================*/
diff --git a/src/emu/sound/gaelco.h b/src/emu/sound/gaelco.h
index fdb3a984685..c1cf64ed6d7 100644
--- a/src/emu/sound/gaelco.h
+++ b/src/emu/sound/gaelco.h
@@ -1,7 +1,7 @@
#pragma once
-#ifndef __GALELCO_H__
-#define __GALELCO_H__
+#ifndef __GAELCO_SND_H__
+#define __GAELCO_SND_H__
#define GAELCO_NUM_CHANNELS 0x07
#define GAELCO_VOLUME_LEVELS 0x10
@@ -11,14 +11,12 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_GAELCO_GAE1_ADD(_tag, _clock) \
- MCFG_DEVICE_ADD(_tag, GAELCO_GAE1, _clock)
-#define MCFG_GAELCO_GAE1_REPLACE(_tag, _clock) \
- MCFG_DEVICE_REPLACE(_tag, GAELCO_GAE1, _clock)
-#define MCFG_GAELCO_CG1V_ADD(_tag, _clock) \
- MCFG_DEVICE_ADD(_tag, GAELCO_CG1V, _clock)
-#define MCFG_GAELCO_CG1V_REPLACE(_tag, _clock) \
- MCFG_DEVICE_REPLACE(_tag, GAELCO_CG1V, _clock)
+#define MCFG_GAELCO_SND_DATA(_tag) \
+ gaelco_gae1_device::set_snd_data_tag(*device, _tag);
+
+#define MCFG_GAELCO_BANKS(_offs1, _offs2, _offs3, _offs4) \
+ gaelco_gae1_device::set_bank_offsets(*device, _offs1, _offs2, _offs3, _offs4);
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -34,15 +32,6 @@ struct gaelco_sound_channel
};
-// ======================> External interface
-
-struct gaelcosnd_interface
-{
- const char *gfxregion; /* shared gfx region name */
- int banks[4]; /* start of each ROM bank */
-};
-
-
// ======================> gaelco_gae1_device
class gaelco_gae1_device : public device_t,
@@ -53,6 +42,16 @@ public:
gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
~gaelco_gae1_device() { }
+ static void set_snd_data_tag(device_t &device, const char *tag) { downcast<gaelco_gae1_device &>(device).m_data_tag = tag; }
+ static void set_bank_offsets(device_t &device, int offs1, int offs2, int offs3, int offs4)
+ {
+ gaelco_gae1_device &dev = downcast<gaelco_gae1_device &>(device);
+ dev.m_banks[0] = offs1;
+ dev.m_banks[1] = offs2;
+ dev.m_banks[2] = offs3;
+ dev.m_banks[3] = offs4;
+ }
+
protected:
// device-level overrides
virtual void device_start();
@@ -71,6 +70,8 @@ private:
int m_banks[4]; /* start of each ROM bank */
gaelco_sound_channel m_channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */
+ const char *m_data_tag;
+
UINT16 m_sndregs[0x38];
// Table for converting from 8 to 16 bits with volume control
@@ -92,4 +93,4 @@ public:
extern const device_type GAELCO_CG1V;
-#endif /* __GALELCO_H__ */
+#endif /* __GAELCO_SND_H__ */
diff --git a/src/mame/drivers/gaelco2.c b/src/mame/drivers/gaelco2.c
index d279d09dd1b..761e50e68ce 100644
--- a/src/mame/drivers/gaelco2.c
+++ b/src/mame/drivers/gaelco2.c
@@ -147,12 +147,6 @@ static INPUT_PORTS_START( maniacsq )
PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
-static const gaelcosnd_interface maniacsq_snd_interface =
-{
- "gfx1", /* memory region */
- { 0*0x0080000, 1*0x0080000, 0, 0 }, /* start of each ROM bank */
-};
-
static MACHINE_CONFIG_START( maniacsq, gaelco2_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 26000000/2) /* 13 MHz? */
@@ -179,8 +173,9 @@ static MACHINE_CONFIG_START( maniacsq, gaelco2_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GAELCO_GAE1_ADD("gaelco", 0)
- MCFG_SOUND_CONFIG(maniacsq_snd_interface)
+ MCFG_DEVICE_ADD("gaelco", GAELCO_GAE1, 0)
+ MCFG_GAELCO_SND_DATA("gfx1")
+ MCFG_GAELCO_BANKS(0 * 0x0080000, 1 * 0x0080000, 0, 0)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END
@@ -266,12 +261,6 @@ static INPUT_PORTS_START( bang )
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, -6.0 / 240, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2)
INPUT_PORTS_END
-static const gaelcosnd_interface bang_snd_interface =
-{
- "gfx1", /* memory region */
- { 0*0x0200000, 1*0x0200000, 2*0x0200000, 3*0x0200000 } /* start of each ROM bank */
-};
-
static MACHINE_CONFIG_START( bang, gaelco2_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 30000000/2) /* 15 MHz */
@@ -300,8 +289,9 @@ static MACHINE_CONFIG_START( bang, gaelco2_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GAELCO_CG1V_ADD("gaelco", 0)
- MCFG_SOUND_CONFIG(bang_snd_interface)
+ MCFG_DEVICE_ADD("gaelco", GAELCO_CG1V, 0)
+ MCFG_GAELCO_SND_DATA("gfx1")
+ MCFG_GAELCO_BANKS(0 * 0x0200000, 1 * 0x0200000, 2 * 0x0200000, 3 * 0x0200000)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END
@@ -510,12 +500,6 @@ static INPUT_PORTS_START( alighunt )
PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
-static const gaelcosnd_interface alighunt_snd_interface =
-{
- "gfx1", /* memory region */
- { 0*0x0400000, 1*0x0400000, 2*0x0400000, 3*0x0400000 } /* start of each ROM bank */
-};
-
static MACHINE_CONFIG_START( alighunt, gaelco2_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 24000000/2) /* 12 MHz */
@@ -542,8 +526,9 @@ static MACHINE_CONFIG_START( alighunt, gaelco2_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GAELCO_GAE1_ADD("gaelco", 0)
- MCFG_SOUND_CONFIG(alighunt_snd_interface)
+ MCFG_DEVICE_ADD("gaelco", GAELCO_GAE1, 0)
+ MCFG_GAELCO_SND_DATA("gfx1")
+ MCFG_GAELCO_BANKS(0 * 0x0400000, 1 * 0x0400000, 2 * 0x0400000, 3 * 0x0400000)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END
@@ -753,12 +738,6 @@ static INPUT_PORTS_START( touchgo )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_TOGGLE
INPUT_PORTS_END
-static const gaelcosnd_interface touchgo_snd_interface =
-{
- "gfx1", /* memory region */
- { 0*0x0400000, 1*0x0400000, 0, 0 } /* start of each ROM bank */
-};
-
static MACHINE_CONFIG_START( touchgo, gaelco2_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 32000000/2) /* 16 MHz */
@@ -794,8 +773,10 @@ static MACHINE_CONFIG_START( touchgo, gaelco2_state )
/* the chip is stereo, but the game sound is mono because the right channel
output is for cabinet 1 and the left channel output is for cabinet 2 */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GAELCO_GAE1_ADD("gaelco", 0)
- MCFG_SOUND_CONFIG(touchgo_snd_interface)
+
+ MCFG_DEVICE_ADD("gaelco", GAELCO_GAE1, 0)
+ MCFG_GAELCO_SND_DATA("gfx1")
+ MCFG_GAELCO_BANKS(0 * 0x0400000, 1 * 0x0400000, 0, 0)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END
@@ -947,12 +928,6 @@ static INPUT_PORTS_START( snowboar )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )
INPUT_PORTS_END
-static const gaelcosnd_interface snowboar_snd_interface =
-{
- "gfx1", /* memory region */
- { 0*0x0400000, 1*0x0400000, 0, 0 } /* start of each ROM bank */
-};
-
static MACHINE_CONFIG_START( snowboar, gaelco2_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 30000000/2) /* 15 MHz */
@@ -981,8 +956,9 @@ static MACHINE_CONFIG_START( snowboar, gaelco2_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GAELCO_CG1V_ADD("gaelco", 0)
- MCFG_SOUND_CONFIG(snowboar_snd_interface)
+ MCFG_DEVICE_ADD("gaelco", GAELCO_CG1V, 0)
+ MCFG_GAELCO_SND_DATA("gfx1")
+ MCFG_GAELCO_BANKS(0 * 0x0400000, 1 * 0x0400000, 0, 0)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END
@@ -1189,12 +1165,6 @@ static INPUT_PORTS_START( wrally2 )
PORT_BIT( 0xff, 0x8A, IPT_PADDLE_V ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_REVERSE PORT_NAME("P2 Wheel")
INPUT_PORTS_END
-static const gaelcosnd_interface wrally2_snd_interface =
-{
- "gfx1", /* memory region */
- { 0*0x0200000, 1*0x0200000, 0, 0 } /* start of each ROM bank */
-};
-
static MACHINE_CONFIG_START( wrally2, gaelco2_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 26000000/2) /* 13 MHz */
@@ -1233,8 +1203,10 @@ static MACHINE_CONFIG_START( wrally2, gaelco2_state )
/* the chip is stereo, but the game sound is mono because the right channel
output is for cabinet 1 and the left channel output is for cabinet 2 */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GAELCO_GAE1_ADD("gaelco", 0)
- MCFG_SOUND_CONFIG(wrally2_snd_interface)
+
+ MCFG_DEVICE_ADD("gaelco", GAELCO_GAE1, 0)
+ MCFG_GAELCO_SND_DATA("gfx1")
+ MCFG_GAELCO_BANKS(0 * 0x0200000, 1 * 0x0200000, 0, 0)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END