summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/cabal.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-10-14 06:28:35 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-10-14 06:28:35 +0000
commitecfbeb7fd0e5d13dfb99b9abd3c4d17b539dc655 (patch)
treef34beae335fab79d570e7b4e8c1abb25334d644e /src/mame/drivers/cabal.c
parent85f1df0adcf8eb926e46fb7867651198f48fc968 (diff)
Created a base class delegate_common_base for all delegate
types. Created a binding_type_exception which is thrown when a bind attempt fails due to mismatched types. Added helper templates to driver_device to wrap legacy device read/write handlers into driver_device member functions. This should help move some things forward until more common code is converted into proper devices. Introduce new module devcb2 which contains modernized versions of devcb. Compared to previous implementation this one is simpler overall, trampolining calls through a single internal set of adapter functions. The new versions are also designed to be specified in the machine_config rather than in structures, so they are no longer simple POD types. Additional new/changed features: * reads and writes can map to delegates for line or 8/16/32/64-bit * reads and writes can map to an I/O port * reads can be mapped to a constant value, with or without logging * writes can be mapped to a device's input line * all reads/writes can have a shift, mask, and/or xor applied * devices can opt to make the functions safe-if-NULL when resolving * only member function types are supported Rewrote the YM2151 interface to be fully modernized, and removed the ym2151_interface struct in favor of inline configs using the new devcb2 mechanism. In many cases, removed no longer needed trampolines, instead taking advantage of direct support for input line writes.
Diffstat (limited to 'src/mame/drivers/cabal.c')
-rw-r--r--src/mame/drivers/cabal.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c
index 1b9c78670c4..7e19d368fd5 100644
--- a/src/mame/drivers/cabal.c
+++ b/src/mame/drivers/cabal.c
@@ -183,7 +183,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, cabal_state )
AM_RANGE(0x4002, 0x4002) AM_WRITE_LEGACY(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE_LEGACY(seibu_rst18_ack_w)
AM_RANGE(0x4005, 0x4006) AM_DEVWRITE_LEGACY("adpcm1", seibu_adpcm_adr_w)
- AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x4010, 0x4011) AM_READ_LEGACY(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ_LEGACY(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
@@ -205,7 +205,7 @@ static ADDRESS_MAP_START( cabalbl_sound_map, AS_PROGRAM, 8, cabal_state )
AM_RANGE(0x4008, 0x4008) AM_READ(cabalbl_snd2_r)
AM_RANGE(0x400a, 0x400a) AM_READ(cabalbl_snd1_r)
AM_RANGE(0x400c, 0x400c) AM_WRITE(soundlatch2_byte_w)
- AM_RANGE(0x400e, 0x400f) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
+ AM_RANGE(0x400e, 0x400f) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x6000, 0x6000) AM_WRITENOP /* ??? */
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -465,16 +465,6 @@ static GFXDECODE_START( cabal )
GFXDECODE_END
-static void irqhandler(device_t *device, int irq)
-{
- device->machine().device("audiocpu")->execute().set_input_line(0, irq ? ASSERT_LINE : CLEAR_LINE);
-}
-
-static const ym2151_interface cabalbl_ym2151_interface =
-{
- DEVCB_LINE(irqhandler)
-};
-
static const msm5205_interface msm5205_interface_1 =
{
0,
@@ -514,8 +504,8 @@ static MACHINE_CONFIG_START( cabal, cabal_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("ymsnd", YM2151, XTAL_3_579545MHz) /* verified on pcb */
- MCFG_SOUND_CONFIG(seibu_ym2151_interface)
+ MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* verified on pcb */
+ MCFG_YM2151_IRQ_HANDLER(WRITELINE(driver_device, member_wrapper_line<seibu_ym2151_irqhandler>))
MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80)
MCFG_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) /* it should use the msm5205 */
@@ -569,8 +559,8 @@ static MACHINE_CONFIG_START( cabalbl, cabal_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("ymsnd", YM2151, XTAL_3_579545MHz) /* verified on pcb */
- MCFG_SOUND_CONFIG(cabalbl_ym2151_interface)
+ MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* verified on pcb */
+ MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80)
MCFG_SOUND_ADD("msm1", MSM5205, XTAL_12MHz/32) /* verified on pcb (no resonator) */