From c6533ad9194cad9a96a808f609815689cfe1a107 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 2 Apr 2013 08:51:12 +0000 Subject: [PATCH] device callback handler cleanup (nw) --- src/mame/drivers/appoooh.c | 26 ++++++++-------- src/mame/drivers/ashnojoe.c | 22 +++++++------- src/mame/drivers/asuka.c | 18 +++++------- src/mame/drivers/battlera.c | 16 +++++----- src/mame/drivers/chinagat.c | 16 +++++----- src/mame/drivers/chinsan.c | 31 ++++++++++---------- src/mame/drivers/crgolf.c | 22 +++++++------- src/mame/drivers/dacholer.c | 18 ++++++------ src/mame/drivers/darius.c | 10 +++---- src/mame/drivers/ddragon.c | 49 +++++++++++++++++++------------ src/mame/drivers/de_2.c | 20 ++++++------- src/mame/drivers/dec0.c | 25 ++++++++-------- src/mame/drivers/dec8.c | 15 +++++----- src/mame/drivers/discoboy.c | 13 ++++---- src/mame/drivers/docastle.c | 22 +++++++------- src/mame/drivers/drmicro.c | 21 +++++++------ src/mame/drivers/dynax.c | 54 ++++++++++++++++------------------ src/mame/drivers/fantland.c | 16 +++++----- src/mame/drivers/fcrash.c | 28 ++++++++---------- src/mame/drivers/firetrap.c | 16 +++++----- src/mame/drivers/fromance.c | 20 ++++++------- src/mame/drivers/gcpinbal.c | 30 +++++++++---------- src/mame/drivers/gladiatr.c | 6 ++-- src/mame/drivers/goal92.c | 15 +++++----- src/mame/drivers/jangou.c | 17 +++++------ src/mame/drivers/jantotsu.c | 31 ++++++++++---------- src/mame/drivers/kchamp.c | 20 ++++++------- src/mame/drivers/kungfur.c | 32 ++++++++++---------- src/mame/drivers/kurukuru.c | 10 +++---- src/mame/drivers/lucky74.c | 41 +++++++++++++------------- src/mame/drivers/mastboy.c | 16 +++++----- src/mame/drivers/mermaid.c | 32 ++++++++++---------- src/mame/drivers/mitchell.c | 15 +++++----- src/mame/drivers/mlanding.c | 41 +++++++++++++------------- src/mame/drivers/ojankohs.c | 20 ++++++------- src/mame/drivers/opwolf.c | 43 +++++++++++++++++---------- src/mame/drivers/pachifev.c | 30 +++++++++---------- src/mame/drivers/pcktgal.c | 16 +++++----- src/mame/drivers/rastan.c | 17 +++++------ src/mame/drivers/sothello.c | 10 +++---- src/mame/drivers/spdodgeb.c | 42 ++++++++++++++++---------- src/mame/drivers/splash.c | 57 ++++++++++++++++-------------------- src/mame/drivers/srmp2.c | 31 ++++++++++---------- src/mame/drivers/stfight.c | 2 +- src/mame/drivers/suprgolf.c | 27 ++++++++--------- src/mame/drivers/system16.c | 30 +++++++++---------- src/mame/drivers/taito_l.c | 18 +++++------- src/mame/drivers/tbowl.c | 44 ++++++++++++++++++---------- src/mame/drivers/tecmo.c | 23 +++++++-------- src/mame/drivers/tehkanwc.c | 20 ++++++------- src/mame/drivers/toki.c | 16 +++++----- src/mame/drivers/topspeed.c | 27 ++++++++--------- src/mame/drivers/tubep.c | 15 +++++----- src/mame/drivers/wc90b.c | 16 +++++----- src/mame/drivers/yunsung8.c | 16 +++++----- src/mame/includes/appoooh.h | 1 + src/mame/includes/ashnojoe.h | 2 ++ src/mame/includes/asuka.h | 1 + src/mame/includes/battlera.h | 1 + src/mame/includes/cps1.h | 3 +- src/mame/includes/crgolf.h | 1 + src/mame/includes/darius.h | 1 + src/mame/includes/ddragon.h | 3 ++ src/mame/includes/dec0.h | 3 ++ src/mame/includes/dec8.h | 1 + src/mame/includes/docastle.h | 1 + src/mame/includes/drmicro.h | 1 + src/mame/includes/dynax.h | 4 +++ src/mame/includes/fantland.h | 4 +++ src/mame/includes/firetrap.h | 1 + src/mame/includes/fromance.h | 1 + src/mame/includes/gcpinbal.h | 1 + src/mame/includes/gladiatr.h | 1 + src/mame/includes/goal92.h | 1 + src/mame/includes/kchamp.h | 1 + src/mame/includes/lucky74.h | 1 + src/mame/includes/mermaid.h | 1 + src/mame/includes/mitchell.h | 1 + src/mame/includes/ojankohs.h | 4 +-- src/mame/includes/opwolf.h | 6 ++-- src/mame/includes/pcktgal.h | 1 + src/mame/includes/rastan.h | 1 + src/mame/includes/spdodgeb.h | 3 ++ src/mame/includes/splash.h | 4 +++ src/mame/includes/srmp2.h | 1 + src/mame/includes/stfight.h | 3 +- src/mame/includes/system16.h | 2 ++ src/mame/includes/taito_l.h | 1 + src/mame/includes/tbowl.h | 3 ++ src/mame/includes/tecmo.h | 1 + src/mame/includes/tehkanwc.h | 1 + src/mame/includes/toki.h | 1 + src/mame/includes/topspeed.h | 3 ++ src/mame/includes/tubep.h | 1 + src/mame/includes/wc90b.h | 1 + src/mame/includes/yunsung8.h | 1 + src/mame/machine/stfight.c | 21 +++++++------ 97 files changed, 713 insertions(+), 686 deletions(-) diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c index cfdf2318328..86333969b48 100644 --- a/src/mame/drivers/appoooh.c +++ b/src/mame/drivers/appoooh.c @@ -169,29 +169,27 @@ Language #include "sound/sn76496.h" -static void appoooh_adpcm_int(device_t *device, int st) +WRITE_LINE_MEMBER(appoooh_state::appoooh_adpcm_int) { - appoooh_state *state = device->machine().driver_data(); - - if (state->m_adpcm_address != 0xffffffff) + if (m_adpcm_address != 0xffffffff) { - if (state->m_adpcm_data == 0xffffffff) + if (m_adpcm_data == 0xffffffff) { - UINT8 *RAM = state->memregion("adpcm")->base(); + UINT8 *RAM = memregion("adpcm")->base(); - state->m_adpcm_data = RAM[state->m_adpcm_address++]; - msm5205_data_w(device, state->m_adpcm_data >> 4); + m_adpcm_data = RAM[m_adpcm_address++]; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); - if (state->m_adpcm_data == 0x70) + if (m_adpcm_data == 0x70) { - state->m_adpcm_address = 0xffffffff; - msm5205_reset_w(device, 1); + m_adpcm_address = 0xffffffff; + msm5205_reset_w(machine().device("msm"), 1); } } else { - msm5205_data_w(device, state->m_adpcm_data & 0x0f ); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0x0f ); + m_adpcm_data = -1; } } } @@ -387,7 +385,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(appoooh_adpcm_int),/* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(appoooh_state,appoooh_adpcm_int),/* interrupt function */ MSM5205_S64_4B /* 6KHz */ }; diff --git a/src/mame/drivers/ashnojoe.c b/src/mame/drivers/ashnojoe.c index 57f641b9844..b7f01e63a42 100644 --- a/src/mame/drivers/ashnojoe.c +++ b/src/mame/drivers/ashnojoe.c @@ -270,10 +270,9 @@ static GFXDECODE_START( ashnojoe ) GFXDECODE_END -static void ym2203_irq_handler( device_t *device, int irq ) +WRITE_LINE_MEMBER(ashnojoe_state::ym2203_irq_handler) { - ashnojoe_state *state = device->machine().driver_data(); - state->m_audiocpu->set_input_line(0, irq ? ASSERT_LINE : CLEAR_LINE); + m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); } WRITE8_MEMBER(ashnojoe_state::ym2203_write_a) @@ -301,28 +300,27 @@ static const ym2203_interface ym2203_config = DEVCB_DRIVER_MEMBER(ashnojoe_state,ym2203_write_a), DEVCB_DRIVER_MEMBER(ashnojoe_state,ym2203_write_b), }, - DEVCB_LINE(ym2203_irq_handler) + DEVCB_DRIVER_LINE_MEMBER(ashnojoe_state,ym2203_irq_handler) }; -static void ashnojoe_vclk_cb( device_t *device, int st ) +WRITE_LINE_MEMBER(ashnojoe_state::ashnojoe_vclk_cb) { - ashnojoe_state *state = device->machine().driver_data(); - if (state->m_msm5205_vclk_toggle == 0) + if (m_msm5205_vclk_toggle == 0) { - msm5205_data_w(device, state->m_adpcm_byte >> 4); + msm5205_data_w(machine().device("msm"), m_adpcm_byte >> 4); } else { - msm5205_data_w(device, state->m_adpcm_byte & 0xf); - state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + msm5205_data_w(machine().device("msm"), m_adpcm_byte & 0xf); + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } - state->m_msm5205_vclk_toggle ^= 1; + m_msm5205_vclk_toggle ^= 1; } static const msm5205_interface msm5205_config = { - DEVCB_LINE(ashnojoe_vclk_cb), + DEVCB_DRIVER_LINE_MEMBER(ashnojoe_state,ashnojoe_vclk_cb), MSM5205_S48_4B }; diff --git a/src/mame/drivers/asuka.c b/src/mame/drivers/asuka.c index 671617c0bf2..9546663aa8c 100644 --- a/src/mame/drivers/asuka.c +++ b/src/mame/drivers/asuka.c @@ -258,20 +258,18 @@ WRITE8_MEMBER(asuka_state::sound_bankswitch_2151_w) -static void asuka_msm5205_vck( device_t *device, int st ) +WRITE_LINE_MEMBER(asuka_state::asuka_msm5205_vck) { - asuka_state *state = device->machine().driver_data(); - - if (state->m_adpcm_data != -1) + if (m_adpcm_data != -1) { - msm5205_data_w(device, state->m_adpcm_data & 0x0f); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0x0f); + m_adpcm_data = -1; } else { - state->m_adpcm_data = device->machine().root_device().memregion("ymsnd")->base()[state->m_adpcm_pos]; - state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0xffff; - msm5205_data_w(device, state->m_adpcm_data >> 4); + m_adpcm_data = machine().root_device().memregion("ymsnd")->base()[m_adpcm_pos]; + m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); } } @@ -779,7 +777,7 @@ static const ym2610_interface ym2610_config = static const msm5205_interface msm5205_config = { - DEVCB_LINE(asuka_msm5205_vck), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(asuka_state,asuka_msm5205_vck), /* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; diff --git a/src/mame/drivers/battlera.c b/src/mame/drivers/battlera.c index 424e599f0c1..24d54ec248d 100644 --- a/src/mame/drivers/battlera.c +++ b/src/mame/drivers/battlera.c @@ -83,16 +83,14 @@ ADDRESS_MAP_END /******************************************************************************/ -static void battlera_adpcm_int(device_t *device, int st) +WRITE_LINE_MEMBER(battlera_state::battlera_adpcm_int) { - battlera_state *state = device->machine().driver_data(); + msm5205_data_w(machine().device("msm"),m_msm5205next >> 4); + m_msm5205next <<= 4; - msm5205_data_w(device,state->m_msm5205next >> 4); - state->m_msm5205next <<= 4; - - state->m_toggle = 1 - state->m_toggle; - if (state->m_toggle) - device->machine().device("audiocpu")->execute().set_input_line(1, HOLD_LINE); + m_toggle = 1 - m_toggle; + if (m_toggle) + machine().device("audiocpu")->execute().set_input_line(1, HOLD_LINE); } WRITE8_MEMBER(battlera_state::battlera_adpcm_data_w) @@ -217,7 +215,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(battlera_adpcm_int),/* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(battlera_state,battlera_adpcm_int),/* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/chinagat.c b/src/mame/drivers/chinagat.c index 02ac2eb1717..2720e1d869a 100644 --- a/src/mame/drivers/chinagat.c +++ b/src/mame/drivers/chinagat.c @@ -104,6 +104,8 @@ public: DECLARE_WRITE8_MEMBER( saiyugoub1_adpcm_control_w ); DECLARE_WRITE8_MEMBER( saiyugoub1_m5205_clk_w ); DECLARE_READ8_MEMBER( saiyugoub1_m5205_irq_r ); + DECLARE_WRITE_LINE_MEMBER(saiyugoub1_m5205_irq_w); + DECLARE_WRITE_LINE_MEMBER(chinagat_irq_handler); }; @@ -311,10 +313,9 @@ READ8_MEMBER(chinagat_state::saiyugoub1_m5205_irq_r ) return 0; } -static void saiyugoub1_m5205_irq_w( device_t *device, int st ) +WRITE_LINE_MEMBER(chinagat_state::saiyugoub1_m5205_irq_w) { - chinagat_state *state = device->machine().driver_data(); - state->m_adpcm_sound_irq = 1; + m_adpcm_sound_irq = 1; } static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, chinagat_state ) @@ -504,16 +505,15 @@ static GFXDECODE_START( chinagat ) GFXDECODE_END -static void chinagat_irq_handler(device_t *device, int irq ) +WRITE_LINE_MEMBER(chinagat_state::chinagat_irq_handler) { - chinagat_state *state = device->machine().driver_data(); - state->m_snd_cpu->execute().set_input_line(0, irq ? ASSERT_LINE : CLEAR_LINE ); + m_snd_cpu->execute().set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE ); } /* This on the bootleg board, instead of the m6295 */ static const msm5205_interface msm5205_config = { - DEVCB_LINE(saiyugoub1_m5205_irq_w), /* Interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(chinagat_state,saiyugoub1_m5205_irq_w), /* Interrupt function */ MSM5205_S64_4B /* vclk input mode (6030Hz, 4-bit) */ }; @@ -525,7 +525,7 @@ static const ym2203_interface ym2203_config = AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, - DEVCB_LINE(chinagat_irq_handler) + DEVCB_DRIVER_LINE_MEMBER(chinagat_state,chinagat_irq_handler) }; diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c index 229aeac2233..c098b741800 100644 --- a/src/mame/drivers/chinsan.c +++ b/src/mame/drivers/chinsan.c @@ -76,6 +76,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_chinsan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(chin_adpcm_int); }; @@ -535,35 +536,33 @@ GFXDECODE_END * *************************************/ -static void chin_adpcm_int( device_t *device, int st ) +WRITE_LINE_MEMBER(chinsan_state::chin_adpcm_int) { - chinsan_state *state = device->machine().driver_data(); - - if (state->m_adpcm_pos >= 0x10000 || state->m_adpcm_idle) + if (m_adpcm_pos >= 0x10000 || m_adpcm_idle) { - //state->m_adpcm_idle = 1; - msm5205_reset_w(device, 1); - state->m_trigger = 0; + //m_adpcm_idle = 1; + msm5205_reset_w(machine().device("msm"), 1); + m_trigger = 0; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); - state->m_adpcm_data = ((state->m_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0) >> 4)); - msm5205_data_w(device, state->m_adpcm_data & 0xf); - state->m_trigger ^= 1; - if(state->m_trigger == 0) + m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4)); + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0xf); + m_trigger ^= 1; + if(m_trigger == 0) { - state->m_adpcm_pos++; - if ((ROM[state->m_adpcm_pos] & 0xff) == 0x70) - state->m_adpcm_idle = 1; + m_adpcm_pos++; + if ((ROM[m_adpcm_pos] & 0xff) == 0x70) + m_adpcm_idle = 1; } } } static const msm5205_interface msm5205_config = { - DEVCB_LINE(chin_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(chinsan_state,chin_adpcm_int), /* interrupt function */ MSM5205_S64_4B /* 8kHz */ }; diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c index b223206715e..efe1595a510 100644 --- a/src/mame/drivers/crgolf.c +++ b/src/mame/drivers/crgolf.c @@ -198,27 +198,25 @@ READ8_MEMBER(crgolf_state::sound_to_main_r) * *************************************/ -static void vck_callback( device_t *device, int st ) +WRITE_LINE_MEMBER(crgolf_state::vck_callback) { - crgolf_state *state = device->machine().driver_data(); - /* only play back if we have data remaining */ - if (state->m_sample_count != 0xff) + if (m_sample_count != 0xff) { - UINT8 data = state->memregion("adpcm")->base()[state->m_sample_offset >> 1]; + UINT8 data = memregion("adpcm")->base()[m_sample_offset >> 1]; /* write the next nibble and advance */ - msm5205_data_w(device, (data >> (4 * (~state->m_sample_offset & 1))) & 0x0f); - state->m_sample_offset++; + msm5205_data_w(machine().device("msm"), (data >> (4 * (~m_sample_offset & 1))) & 0x0f); + m_sample_offset++; /* every 256 clocks, we decrement the length */ - if (!(state->m_sample_offset & 0xff)) + if (!(m_sample_offset & 0xff)) { - state->m_sample_count--; + m_sample_count--; /* if we hit 0xff, automatically turn off playback */ - if (state->m_sample_count == 0xff) - msm5205_reset_w(device, 1); + if (m_sample_count == 0xff) + msm5205_reset_w(machine().device("msm"), 1); } } } @@ -378,7 +376,7 @@ INPUT_PORTS_END static const msm5205_interface msm5205_intf = { - DEVCB_LINE(vck_callback), + DEVCB_DRIVER_LINE_MEMBER(crgolf_state,vck_callback), MSM5205_S64_4B }; diff --git a/src/mame/drivers/dacholer.c b/src/mame/drivers/dacholer.c index 2dc31dded95..1065ee25a65 100644 --- a/src/mame/drivers/dacholer.c +++ b/src/mame/drivers/dacholer.c @@ -92,6 +92,7 @@ public: UINT32 screen_update_dacholer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_irq); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); }; TILE_GET_INFO_MEMBER(dacholer_state::get_bg_tile_info) @@ -557,24 +558,23 @@ INTERRUPT_GEN_MEMBER(dacholer_state::sound_irq) } } -static void adpcm_int( device_t *device, int st ) +WRITE_LINE_MEMBER(dacholer_state::adpcm_int) { - dacholer_state *state = device->machine().driver_data(); - if (state->m_snd_interrupt_enable == 1 || (state->m_snd_interrupt_enable == 0 && state->m_msm_toggle == 1)) + if (m_snd_interrupt_enable == 1 || (m_snd_interrupt_enable == 0 && m_msm_toggle == 1)) { - msm5205_data_w(device, state->m_msm_data >> 4); - state->m_msm_data <<= 4; - state->m_msm_toggle ^= 1; - if (state->m_msm_toggle == 0) + msm5205_data_w(machine().device("msm"), m_msm_data >> 4); + m_msm_data <<= 4; + m_msm_toggle ^= 1; + if (m_msm_toggle == 0) { - state->m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0x38); + m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0x38); } } } static const msm5205_interface msm_interface = { - DEVCB_LINE(adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(dacholer_state,adpcm_int), /* interrupt function */ MSM5205_S96_4B /* 1 / 96 = 3906.25Hz playback - guess */ }; diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c index ec7bab5fa25..e01ca8382c8 100644 --- a/src/mame/drivers/darius.c +++ b/src/mame/drivers/darius.c @@ -484,17 +484,15 @@ static ADDRESS_MAP_START( darius_sound2_map, AS_PROGRAM, 8, darius_state ) ADDRESS_MAP_END -static void darius_adpcm_int( device_t *device, int st ) +WRITE_LINE_MEMBER(darius_state::darius_adpcm_int) { - darius_state *state = device->machine().driver_data(); - - if (state->m_nmi_enable) - state->m_adpcm->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_nmi_enable) + m_adpcm->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface msm5205_config = { - DEVCB_LINE(darius_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(darius_state,darius_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 5e68d7bf5de..5d1f289327a 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -438,31 +438,37 @@ WRITE8_MEMBER(ddragon_state::dd_adpcm_w) } } - -static void dd_adpcm_int( device_t *device, int st ) +void ddragon_state::dd_adpcm_int( device_t *device, int chip ) { - ddragon_state *state = device->machine().driver_data(); - int chip = (device == state->m_adpcm_1) ? 0 : 1; - - if (state->m_adpcm_pos[chip] >= state->m_adpcm_end[chip] || state->m_adpcm_pos[chip] >= 0x10000) + if (m_adpcm_pos[chip] >= m_adpcm_end[chip] || m_adpcm_pos[chip] >= 0x10000) { - state->m_adpcm_idle[chip] = 1; + m_adpcm_idle[chip] = 1; msm5205_reset_w(device, 1); } - else if (state->m_adpcm_data[chip] != -1) + else if (m_adpcm_data[chip] != -1) { - msm5205_data_w(device, state->m_adpcm_data[chip] & 0x0f); - state->m_adpcm_data[chip] = -1; + msm5205_data_w(device, m_adpcm_data[chip] & 0x0f); + m_adpcm_data[chip] = -1; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; + UINT8 *ROM = machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; - state->m_adpcm_data[chip] = ROM[state->m_adpcm_pos[chip]++]; - msm5205_data_w(device, state->m_adpcm_data[chip] >> 4); + m_adpcm_data[chip] = ROM[m_adpcm_pos[chip]++]; + msm5205_data_w(device, m_adpcm_data[chip] >> 4); } } +WRITE_LINE_MEMBER(ddragon_state::dd_adpcm_int_1) +{ + dd_adpcm_int(m_adpcm_1,0); +} + +WRITE_LINE_MEMBER(ddragon_state::dd_adpcm_int_2) +{ + dd_adpcm_int(m_adpcm_2,0); +} + READ8_MEMBER(ddragon_state::dd_adpcm_status_r) { @@ -935,12 +941,17 @@ GFXDECODE_END * *************************************/ -static const msm5205_interface msm5205_config = +static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(dd_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(ddragon_state,dd_adpcm_int_1), /* interrupt function */ MSM5205_S48_4B /* 8kHz */ }; +static const msm5205_interface msm5205_config_2 = +{ + DEVCB_DRIVER_LINE_MEMBER(ddragon_state,dd_adpcm_int_2), /* interrupt function */ + MSM5205_S48_4B /* 8kHz */ +}; /************************************* @@ -986,11 +997,11 @@ static MACHINE_CONFIG_START( ddragon, ddragon_state ) MCFG_SOUND_ROUTE(1, "mono", 0.60) MCFG_SOUND_ADD("adpcm1", MSM5205, MAIN_CLOCK/32) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_SOUND_ADD("adpcm2", MSM5205, MAIN_CLOCK/32) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -1049,11 +1060,11 @@ static MACHINE_CONFIG_START( ddragon6809, ddragon_state ) MCFG_SOUND_ROUTE(1, "mono", 0.60) MCFG_SOUND_ADD("adpcm1", MSM5205, MAIN_CLOCK/32) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_SOUND_ADD("adpcm2", MSM5205, MAIN_CLOCK/32) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/de_2.c b/src/mame/drivers/de_2.c index 196f4587451..360b553f420 100644 --- a/src/mame/drivers/de_2.c +++ b/src/mame/drivers/de_2.c @@ -262,21 +262,19 @@ WRITE_LINE_MEMBER(de_2_state::ym2151_irq_w) m_audiocpu->set_input_line(M6809_IRQ_LINE,state); } -//WRITE_LINE_MEMBER(de_2_state::msm5205_irq_w) -static void msm5205_irq_w(device_t* device,int st) +WRITE_LINE_MEMBER(de_2_state::msm5205_irq_w) { - de_2_state* state = device->machine().driver_data(); - msm5205_data_w(state->m_msm5205,state->m_sample_data >> 4); - if(state->m_more_data) + msm5205_data_w(m_msm5205,m_sample_data >> 4); + if(m_more_data) { - if(state->m_nmi_enable) - state->m_audiocpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // generate NMI when we need more data - state->m_more_data = false; + if(m_nmi_enable) + m_audiocpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // generate NMI when we need more data + m_more_data = false; } else { - state->m_more_data = true; - state->m_sample_data <<= 4; + m_more_data = true; + m_sample_data <<= 4; } } @@ -547,7 +545,7 @@ WRITE8_MEMBER( de_2_state::sample_bank_w ) static const msm5205_interface msm5205_intf = { - DEVCB_LINE(msm5205_irq_w), + DEVCB_DRIVER_LINE_MEMBER(de_2_state,msm5205_irq_w), MSM5205_S96_4B }; diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index ecb4fabc6e8..81c47762b3f 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -1294,24 +1294,24 @@ GFXDECODE_END /******************************************************************************/ -static void sound_irq(device_t *device, int linestate) +WRITE_LINE_MEMBER(dec0_state::sound_irq) { - device->machine().device("audiocpu")->execute().set_input_line(0, linestate); /* IRQ */ + machine().device("audiocpu")->execute().set_input_line(0, state); /* IRQ */ } -static void sound_irq2(device_t *device, int linestate) +WRITE_LINE_MEMBER(dec0_state::sound_irq2) { - device->machine().device("audiocpu")->execute().set_input_line(1, linestate); /* IRQ2 */ + machine().device("audiocpu")->execute().set_input_line(1, state); /* IRQ2 */ } static const ym3812_interface ym3812_config = { - DEVCB_LINE(sound_irq) + DEVCB_DRIVER_LINE_MEMBER(dec0_state,sound_irq) }; static const ym3812_interface ym3812b_interface = { - DEVCB_LINE(sound_irq2) + DEVCB_DRIVER_LINE_MEMBER(dec0_state,sound_irq2) }; /******************************************************************************/ @@ -1384,25 +1384,24 @@ MACHINE_CONFIG_END #define DEC0_VBSTART 256-8 -static void automat_vclk_cb(device_t *device,int st) +WRITE_LINE_MEMBER(dec0_automat_state::automat_vclk_cb) { - dec0_automat_state *state = device->machine().driver_data(); - if (state->m_automat_msm5205_vclk_toggle == 0) + if (m_automat_msm5205_vclk_toggle == 0) { - msm5205_data_w(device, state->m_automat_adpcm_byte & 0xf); + msm5205_data_w(machine().device("msm"), m_automat_adpcm_byte & 0xf); } else { - msm5205_data_w(device, state->m_automat_adpcm_byte >> 4); + msm5205_data_w(machine().device("msm"), m_automat_adpcm_byte >> 4); //device->machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); // gives some scratch samples but breaks other sounds too } - state->m_automat_msm5205_vclk_toggle ^= 1; + m_automat_msm5205_vclk_toggle ^= 1; } static const msm5205_interface msm5205_config = { - DEVCB_LINE(automat_vclk_cb), + DEVCB_DRIVER_LINE_MEMBER(dec0_automat_state,automat_vclk_cb), MSM5205_S48_4B }; diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c index 14f5a1f75f2..2758d107f4f 100644 --- a/src/mame/drivers/dec8.c +++ b/src/mame/drivers/dec8.c @@ -478,15 +478,14 @@ WRITE8_MEMBER(dec8_state::dec8_sound_w) m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } -static void csilver_adpcm_int( device_t *device ,int st) +WRITE_LINE_MEMBER(dec8_state::csilver_adpcm_int) { - dec8_state *state = device->machine().driver_data(); - state->m_toggle ^= 1; - if (state->m_toggle) - state->m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); + m_toggle ^= 1; + if (m_toggle) + m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); - msm5205_data_w(device, state->m_msm5205next >> 4); - state->m_msm5205next <<= 4; + msm5205_data_w(machine().device("msm"), m_msm5205next >> 4); + m_msm5205next <<= 4; } READ8_MEMBER(dec8_state::csilver_adpcm_reset_r) @@ -1922,7 +1921,7 @@ static const ym3812_interface ym3812_config = static const msm5205_interface msm5205_config = { - DEVCB_LINE(csilver_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(dec8_state,csilver_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/discoboy.c b/src/mame/drivers/discoboy.c index 6039cf1faed..c192e3fe20c 100644 --- a/src/mame/drivers/discoboy.c +++ b/src/mame/drivers/discoboy.c @@ -89,6 +89,7 @@ public: UINT32 screen_update_discoboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void discoboy_setrombank( UINT8 data ); + DECLARE_WRITE_LINE_MEMBER(yunsung8_adpcm_int); }; @@ -469,19 +470,17 @@ void discoboy_state::machine_reset() m_toggle = 0; } -static void yunsung8_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(discoboy_state::yunsung8_adpcm_int) { - discoboy_state *state = device->machine().driver_data(); + msm5205_data_w(machine().device("msm"), m_adpcm >> 4); + m_adpcm <<= 4; - msm5205_data_w(device, state->m_adpcm >> 4); - state->m_adpcm <<= 4; - - state->m_toggle ^= 1; + m_toggle ^= 1; } static const msm5205_interface yunsung8_msm5205_interface = { - DEVCB_LINE(yunsung8_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(discoboy_state,yunsung8_adpcm_int), /* interrupt function */ MSM5205_S96_4B /* 4KHz, 4 Bits */ }; diff --git a/src/mame/drivers/docastle.c b/src/mame/drivers/docastle.c index 0cf7267ef1e..fdea7f4b778 100644 --- a/src/mame/drivers/docastle.c +++ b/src/mame/drivers/docastle.c @@ -160,24 +160,22 @@ Dip locations verified with manual for docastle, dorunrun and dowild. /* Read/Write Handlers */ -static void idsoccer_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(docastle_state::idsoccer_adpcm_int) { - docastle_state *state = device->machine().driver_data(); - - if (state->m_adpcm_pos >= state->memregion("adpcm")->bytes()) + if (m_adpcm_pos >= memregion("adpcm")->bytes()) { - state->m_adpcm_idle = 1; - msm5205_reset_w(device, 1); + m_adpcm_idle = 1; + msm5205_reset_w(machine().device("msm"), 1); } - else if (state->m_adpcm_data != -1) + else if (m_adpcm_data != -1) { - msm5205_data_w(device, state->m_adpcm_data & 0x0f); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0x0f); + m_adpcm_data = -1; } else { - state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos++]; - msm5205_data_w(device, state->m_adpcm_data >> 4); + m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos++]; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); } } @@ -552,7 +550,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(idsoccer_adpcm_int), // interrupt function + DEVCB_DRIVER_LINE_MEMBER(docastle_state,idsoccer_adpcm_int), // interrupt function MSM5205_S64_4B // 6 kHz ??? }; diff --git a/src/mame/drivers/drmicro.c b/src/mame/drivers/drmicro.c index df45335d31a..4760eb8f82f 100644 --- a/src/mame/drivers/drmicro.c +++ b/src/mame/drivers/drmicro.c @@ -39,31 +39,30 @@ WRITE8_MEMBER(drmicro_state::nmi_enable_w) } -static void pcm_w(device_t *device,int st) +WRITE_LINE_MEMBER(drmicro_state::pcm_w) { - drmicro_state *state = device->machine().driver_data(); - UINT8 *PCM = state->memregion("adpcm")->base(); + UINT8 *PCM = memregion("adpcm")->base(); - int data = PCM[state->m_pcm_adr / 2]; + int data = PCM[m_pcm_adr / 2]; if (data != 0x70) // ?? { - if (~state->m_pcm_adr & 1) + if (~m_pcm_adr & 1) data >>= 4; - msm5205_data_w(device, data & 0x0f); - msm5205_reset_w(device, 0); + msm5205_data_w(m_msm, data & 0x0f); + msm5205_reset_w(m_msm, 0); - state->m_pcm_adr = (state->m_pcm_adr + 1) & 0x7fff; + m_pcm_adr = (m_pcm_adr + 1) & 0x7fff; } else - msm5205_reset_w(device, 1); + msm5205_reset_w(m_msm, 1); } WRITE8_MEMBER(drmicro_state::pcm_set_w) { m_pcm_adr = ((data & 0x3f) << 9); - pcm_w(m_msm,1); + pcm_w(1); } /************************************* @@ -214,7 +213,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(pcm_w), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(drmicro_state,pcm_w), /* IRQ handler */ MSM5205_S64_4B /* 6 KHz */ }; diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 4127fa63efd..244e5c9cf1f 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -124,11 +124,10 @@ INTERRUPT_GEN_MEMBER(dynax_state::sprtmtch_vblank_interrupt) sprtmtch_update_irq(machine()); } -static void sprtmtch_sound_callback( device_t *device, int state ) +WRITE_LINE_MEMBER(dynax_state::sprtmtch_sound_callback) { - dynax_state *driver_state = device->machine().driver_data(); - driver_state->m_sound_irq = state; - sprtmtch_update_irq(device->machine()); + m_sound_irq = state; + sprtmtch_update_irq(machine()); } @@ -192,11 +191,10 @@ WRITE8_MEMBER(dynax_state::jantouki_sound_vblank_ack_w) jantouki_sound_update_irq(machine()); } -static void jantouki_sound_callback(device_t *device, int state) +WRITE_LINE_MEMBER(dynax_state::jantouki_sound_callback) { - dynax_state *driver_state = device->machine().driver_data(); - driver_state->m_sound_irq = state; - jantouki_sound_update_irq(device->machine()); + m_sound_irq = state; + jantouki_sound_update_irq(machine()); } @@ -392,32 +390,30 @@ WRITE8_MEMBER(dynax_state::nanajign_palette_w) } -static void adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(dynax_state::adpcm_int) { - dynax_state *state = device->machine().driver_data(); - msm5205_data_w(device, state->m_msm5205next >> 4); - state->m_msm5205next <<= 4; + msm5205_data_w(machine().device("msm"), m_msm5205next >> 4); + m_msm5205next <<= 4; - state->m_toggle = 1 - state->m_toggle; + m_toggle = 1 - m_toggle; - if (state->m_toggle) + if (m_toggle) { - if (state->m_resetkludge) // don't know what's wrong, but NMIs when the 5205 is reset make the game crash - state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_resetkludge) // don't know what's wrong, but NMIs when the 5205 is reset make the game crash + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } -static void adpcm_int_cpu1( device_t *device,int st ) +WRITE_LINE_MEMBER(dynax_state::adpcm_int_cpu1) { - dynax_state *state = device->machine().driver_data(); - msm5205_data_w(device, state->m_msm5205next >> 4); - state->m_msm5205next <<= 4; + msm5205_data_w(machine().device("msm"), m_msm5205next >> 4); + m_msm5205next <<= 4; - state->m_toggle_cpu1 = 1 - state->m_toggle_cpu1; - if (state->m_toggle_cpu1) + m_toggle_cpu1 = 1 - m_toggle_cpu1; + if (m_toggle_cpu1) { - if (state->m_resetkludge) // don't know what's wrong, but NMIs when the 5205 is reset make the game crash - state->m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); // cpu1 + if (m_resetkludge) // don't know what's wrong, but NMIs when the 5205 is reset make the game crash + m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); // cpu1 } } @@ -4356,12 +4352,12 @@ static const ym2203_interface hanamai_ym2203_interface = DEVCB_NULL, /* Port A Write */ DEVCB_NULL, /* Port B Write */ }, - DEVCB_LINE(sprtmtch_sound_callback) /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(dynax_state,sprtmtch_sound_callback) /* IRQ handler */ }; static const msm5205_interface hanamai_msm5205_interface = { - DEVCB_LINE(adpcm_int), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(dynax_state,adpcm_int), /* IRQ handler */ MSM5205_S48_4B /* 8 KHz, 4 Bits */ }; @@ -4524,7 +4520,7 @@ static const ym2203_interface sprtmtch_ym2203_interface = DEVCB_NULL, /* Port A Write */ DEVCB_NULL, /* Port B Write */ }, - DEVCB_LINE(sprtmtch_sound_callback), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(dynax_state,sprtmtch_sound_callback), /* IRQ handler */ }; static MACHINE_CONFIG_START( sprtmtch, dynax_state ) @@ -4695,12 +4691,12 @@ static const ym2203_interface jantouki_ym2203_interface = AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, - DEVCB_LINE(jantouki_sound_callback) /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(dynax_state,jantouki_sound_callback) /* IRQ handler */ }; static const msm5205_interface jantouki_msm5205_interface = { - DEVCB_LINE(adpcm_int_cpu1), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(dynax_state,adpcm_int_cpu1), /* IRQ handler */ MSM5205_S48_4B /* 8 KHz, 4 Bits */ }; diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c index 8e068b98a53..1bb83fc994c 100644 --- a/src/mame/drivers/fantland.c +++ b/src/mame/drivers/fantland.c @@ -392,10 +392,10 @@ static void borntofi_adpcm_int( device_t *device, int voice ) } } -static void borntofi_adpcm_int_0(device_t *device,int state) { borntofi_adpcm_int(device, 0); } -static void borntofi_adpcm_int_1(device_t *device,int state) { borntofi_adpcm_int(device, 1); } -static void borntofi_adpcm_int_2(device_t *device,int state) { borntofi_adpcm_int(device, 2); } -static void borntofi_adpcm_int_3(device_t *device,int state) { borntofi_adpcm_int(device, 3); } +WRITE_LINE_MEMBER(fantland_state::borntofi_adpcm_int_0) { borntofi_adpcm_int(machine().device("msm1"), 0); } +WRITE_LINE_MEMBER(fantland_state::borntofi_adpcm_int_1) { borntofi_adpcm_int(machine().device("msm2"), 1); } +WRITE_LINE_MEMBER(fantland_state::borntofi_adpcm_int_2) { borntofi_adpcm_int(machine().device("msm3"), 2); } +WRITE_LINE_MEMBER(fantland_state::borntofi_adpcm_int_3) { borntofi_adpcm_int(machine().device("msm4"), 3); } static ADDRESS_MAP_START( borntofi_sound_map, AS_PROGRAM, 8, fantland_state ) @@ -925,22 +925,22 @@ MACHINE_CONFIG_END // OKI M5205 running at 384kHz [18.432/48]. Sample rate = 384000 / 48 static const msm5205_interface msm5205_config_0 = { - DEVCB_LINE(borntofi_adpcm_int_0), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(fantland_state,borntofi_adpcm_int_0), /* IRQ handler */ MSM5205_S48_4B /* 8 kHz, 4 Bits */ }; static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(borntofi_adpcm_int_1), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(fantland_state,borntofi_adpcm_int_1), /* IRQ handler */ MSM5205_S48_4B /* 8 kHz, 4 Bits */ }; static const msm5205_interface msm5205_config_2 = { - DEVCB_LINE(borntofi_adpcm_int_2), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(fantland_state,borntofi_adpcm_int_2), /* IRQ handler */ MSM5205_S48_4B /* 8 kHz, 4 Bits */ }; static const msm5205_interface msm5205_config_3 = { - DEVCB_LINE(borntofi_adpcm_int_3), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(fantland_state,borntofi_adpcm_int_3), /* IRQ handler */ MSM5205_S48_4B /* 8 kHz, 4 Bits */ }; diff --git a/src/mame/drivers/fcrash.c b/src/mame/drivers/fcrash.c index c66849b888d..07c2aa18b46 100644 --- a/src/mame/drivers/fcrash.c +++ b/src/mame/drivers/fcrash.c @@ -117,24 +117,20 @@ WRITE8_MEMBER( cps_state::knightsb_snd_bankswitch_w ) membank("bank1")->set_entry(data & 0x0f); } -static void m5205_int1( device_t *device,int st ) +WRITE_LINE_MEMBER(cps_state::m5205_int1) { - cps_state *state = device->machine().driver_data(); - - msm5205_data_w(device, state->m_sample_buffer1 & 0x0f); - state->m_sample_buffer1 >>= 4; - state->m_sample_select1 ^= 1; - if (state->m_sample_select1 == 0) - state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + msm5205_data_w(m_msm_1, m_sample_buffer1 & 0x0f); + m_sample_buffer1 >>= 4; + m_sample_select1 ^= 1; + if (m_sample_select1 == 0) + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } -static void m5205_int2( device_t *device,int st ) +WRITE_LINE_MEMBER(cps_state::m5205_int2) { - cps_state *state = device->machine().driver_data(); - - msm5205_data_w(device, state->m_sample_buffer2 & 0x0f); - state->m_sample_buffer2 >>= 4; - state->m_sample_select2 ^= 1; + msm5205_data_w(m_msm_2, m_sample_buffer2 & 0x0f); + m_sample_buffer2 >>= 4; + m_sample_select2 ^= 1; } @@ -1259,13 +1255,13 @@ INPUT_PORTS_END static const msm5205_interface msm5205_interface1 = { - DEVCB_LINE(m5205_int1), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(cps_state,m5205_int1), /* interrupt function */ MSM5205_S96_4B /* 4KHz 4-bit */ }; static const msm5205_interface msm5205_interface2 = { - DEVCB_LINE(m5205_int2), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(cps_state,m5205_int2), /* interrupt function */ MSM5205_S96_4B /* 4KHz 4-bit */ }; diff --git a/src/mame/drivers/firetrap.c b/src/mame/drivers/firetrap.c index 59d2fa8e189..4eaecbed65c 100644 --- a/src/mame/drivers/firetrap.c +++ b/src/mame/drivers/firetrap.c @@ -318,16 +318,14 @@ WRITE8_MEMBER(firetrap_state::firetrap_sound_bankselect_w) membank("bank2")->set_entry(data & 0x01); } -static void firetrap_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(firetrap_state::firetrap_adpcm_int) { - firetrap_state *state = device->machine().driver_data(); + msm5205_data_w(machine().device("msm"), m_msm5205next >> 4); + m_msm5205next <<= 4; - msm5205_data_w(device, state->m_msm5205next >> 4); - state->m_msm5205next <<= 4; - - state->m_adpcm_toggle ^= 1; - if (state->m_sound_irq_enable && state->m_adpcm_toggle) - state->m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); + m_adpcm_toggle ^= 1; + if (m_sound_irq_enable && m_adpcm_toggle) + m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); } WRITE8_MEMBER(firetrap_state::firetrap_adpcm_data_w) @@ -576,7 +574,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(firetrap_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(firetrap_state,firetrap_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 7.8125kHz */ }; diff --git a/src/mame/drivers/fromance.c b/src/mame/drivers/fromance.c index 9cfab25f2f6..54612234381 100644 --- a/src/mame/drivers/fromance.c +++ b/src/mame/drivers/fromance.c @@ -137,25 +137,23 @@ WRITE8_MEMBER(fromance_state::fromance_adpcm_w) } -static void fromance_adpcm_int( device_t *device, int st ) +WRITE_LINE_MEMBER(fromance_state::fromance_adpcm_int) { - fromance_state *state = device->machine().driver_data(); - /* skip if we're reset */ - if (!state->m_adpcm_reset) + if (!m_adpcm_reset) return; /* clock the data through */ - if (state->m_vclk_left) + if (m_vclk_left) { - msm5205_data_w(device, (state->m_adpcm_data >> 4)); - state->m_adpcm_data <<= 4; - state->m_vclk_left--; + msm5205_data_w(machine().device("msm"), (m_adpcm_data >> 4)); + m_adpcm_data <<= 4; + m_vclk_left--; } /* generate an NMI if we're out of data */ - if (!state->m_vclk_left) - state->m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (!m_vclk_left) + m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -937,7 +935,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(fromance_adpcm_int), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(fromance_state,fromance_adpcm_int), /* IRQ handler */ MSM5205_S48_4B /* 8 KHz */ }; diff --git a/src/mame/drivers/gcpinbal.c b/src/mame/drivers/gcpinbal.c index adc1abe3e0d..dd0a2eadf8b 100644 --- a/src/mame/drivers/gcpinbal.c +++ b/src/mame/drivers/gcpinbal.c @@ -202,27 +202,25 @@ WRITE16_MEMBER(gcpinbal_state::ioc_w) /* Controlled through ioc? */ -static void gcp_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(gcpinbal_state::gcp_adpcm_int) { - gcpinbal_state *state = device->machine().driver_data(); - - if (state->m_adpcm_idle) - msm5205_reset_w(device, 1); - if (state->m_adpcm_start >= 0x200000 || state->m_adpcm_start > state->m_adpcm_end) + if (m_adpcm_idle) + msm5205_reset_w(machine().device("msm"), 1); + if (m_adpcm_start >= 0x200000 || m_adpcm_start > m_adpcm_end) { - //msm5205_reset_w(device,1); - state->m_adpcm_start = state->m_msm_start + state->m_msm_bank; - state->m_adpcm_trigger = 0; + //msm5205_reset_w(machine().device("msm"),1); + m_adpcm_start = m_msm_start + m_msm_bank; + m_adpcm_trigger = 0; } else { - UINT8 *ROM = device->machine().root_device().memregion("msm")->base(); + UINT8 *ROM = machine().root_device().memregion("msm")->base(); - state->m_adpcm_data = ((state->m_adpcm_trigger ? (ROM[state->m_adpcm_start] & 0x0f) : (ROM[state->m_adpcm_start] & 0xf0) >> 4)); - msm5205_data_w(device, state->m_adpcm_data & 0xf); - state->m_adpcm_trigger ^= 1; - if (state->m_adpcm_trigger == 0) - state->m_adpcm_start++; + m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_start] & 0x0f) : (ROM[m_adpcm_start] & 0xf0) >> 4)); + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0xf); + m_adpcm_trigger ^= 1; + if (m_adpcm_trigger == 0) + m_adpcm_start++; } } @@ -384,7 +382,7 @@ GFXDECODE_END static const msm5205_interface msm6585_config = { - DEVCB_LINE(gcp_adpcm_int), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(gcpinbal_state,gcp_adpcm_int), /* VCK function */ MSM6585_S40 /* 16 kHz */ }; diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c index e77eccc9ac2..6c7c4610afb 100644 --- a/src/mame/drivers/gladiatr.c +++ b/src/mame/drivers/gladiatr.c @@ -270,10 +270,10 @@ WRITE8_MEMBER(gladiatr_state::gladiator_int_control_w) /* bit 0 : ?? */ } /* YM2203 IRQ */ -static void gladiator_ym_irq(device_t *device, int irq) +WRITE_LINE_MEMBER(gladiatr_state::gladiator_ym_irq) { /* NMI IRQ is not used by gladiator sound program */ - device->machine().device("sub")->execute().set_input_line(INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE); + machine().device("sub")->execute().set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); } /*Sound Functions*/ @@ -649,7 +649,7 @@ static const ym2203_interface gladiatr_ym2203_interface = DEVCB_DRIVER_MEMBER(gladiatr_state,gladiator_int_control_w), /* port A write */ DEVCB_NULL, }, - DEVCB_LINE(gladiator_ym_irq) /* NMI request for 2nd cpu */ + DEVCB_DRIVER_LINE_MEMBER(gladiatr_state,gladiator_ym_irq) /* NMI request for 2nd cpu */ }; static const msm5205_interface msm5205_config = diff --git a/src/mame/drivers/goal92.c b/src/mame/drivers/goal92.c index bbe9cbfa168..10355ca2a7d 100644 --- a/src/mame/drivers/goal92.c +++ b/src/mame/drivers/goal92.c @@ -225,20 +225,19 @@ static const ym2203_interface ym2203_config = DEVCB_DRIVER_LINE_MEMBER(goal92_state,irqhandler) }; -static void goal92_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(goal92_state::goal92_adpcm_int) { - goal92_state *state = device->machine().driver_data(); - msm5205_data_w(device, state->m_msm5205next); - state->m_msm5205next >>= 4; - state->m_adpcm_toggle^= 1; + msm5205_data_w(machine().device("msm"), m_msm5205next); + m_msm5205next >>= 4; + m_adpcm_toggle^= 1; - if (state->m_adpcm_toggle) - state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_adpcm_toggle) + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface msm5205_config = { - DEVCB_LINE(goal92_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(goal92_state,goal92_adpcm_int), /* interrupt function */ MSM5205_S96_4B /* 4KHz 4-bit */ }; diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c index 3dc0875ef3a..0ae4418aec0 100644 --- a/src/mame/drivers/jangou.c +++ b/src/mame/drivers/jangou.c @@ -93,6 +93,7 @@ public: TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); UINT8 jangou_gfx_nibble( UINT16 niboffset ); void plot_jangou_gfx_pixel( UINT8 pix, int x, int y ); + DECLARE_WRITE_LINE_MEMBER(jngolady_vclk_cb); }; @@ -346,19 +347,17 @@ WRITE8_MEMBER(jangou_state::adpcm_w) m_adpcm_byte = data; } -static void jngolady_vclk_cb( device_t *device,int st ) +WRITE_LINE_MEMBER(jangou_state::jngolady_vclk_cb) { - jangou_state *state = device->machine().driver_data(); - - if (state->m_msm5205_vclk_toggle == 0) - msm5205_data_w(device, state->m_adpcm_byte >> 4); + if (m_msm5205_vclk_toggle == 0) + msm5205_data_w(machine().device("msm"), m_adpcm_byte >> 4); else { - msm5205_data_w(device, state->m_adpcm_byte & 0xf); - state->m_cpu_1->execute().set_input_line(0, HOLD_LINE); + msm5205_data_w(machine().device("msm"), m_adpcm_byte & 0xf); + m_cpu_1->execute().set_input_line(0, HOLD_LINE); } - state->m_msm5205_vclk_toggle ^= 1; + m_msm5205_vclk_toggle ^= 1; } @@ -895,7 +894,7 @@ static const ay8910_interface ay8910_config = static const msm5205_interface msm5205_config = { - DEVCB_LINE(jngolady_vclk_cb), + DEVCB_DRIVER_LINE_MEMBER(jangou_state,jngolady_vclk_cb), MSM5205_S96_4B }; diff --git a/src/mame/drivers/jantotsu.c b/src/mame/drivers/jantotsu.c index 7e470128674..c2ee8815335 100644 --- a/src/mame/drivers/jantotsu.c +++ b/src/mame/drivers/jantotsu.c @@ -131,6 +131,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(jan_adpcm_int); }; @@ -290,28 +291,26 @@ WRITE8_MEMBER(jantotsu_state::jan_adpcm_w) } } -static void jan_adpcm_int( device_t *device ,int st) +WRITE_LINE_MEMBER(jantotsu_state::jan_adpcm_int) { - jantotsu_state *state = device->machine().driver_data(); - - if (state->m_adpcm_pos >= 0x10000 || state->m_adpcm_idle) + if (m_adpcm_pos >= 0x10000 || m_adpcm_idle) { - //state->m_adpcm_idle = 1; - msm5205_reset_w(device, 1); - state->m_adpcm_trigger = 0; + //m_adpcm_idle = 1; + msm5205_reset_w(machine().device("msm"), 1); + m_adpcm_trigger = 0; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); - state->m_adpcm_data = ((state->m_adpcm_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0) >> 4)); - msm5205_data_w(device, state->m_adpcm_data & 0xf); - state->m_adpcm_trigger ^= 1; - if (state->m_adpcm_trigger == 0) + m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4)); + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0xf); + m_adpcm_trigger ^= 1; + if (m_adpcm_trigger == 0) { - state->m_adpcm_pos++; - if ((ROM[state->m_adpcm_pos] & 0xff) == 0x70) - state->m_adpcm_idle = 1; + m_adpcm_pos++; + if ((ROM[m_adpcm_pos] & 0xff) == 0x70) + m_adpcm_idle = 1; } } } @@ -465,7 +464,7 @@ INPUT_PORTS_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(jan_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(jantotsu_state,jan_adpcm_int), /* interrupt function */ MSM5205_S64_4B /* 6 KHz */ }; diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c index d6f5b4cd687..5de2fa8cba4 100644 --- a/src/mame/drivers/kchamp.c +++ b/src/mame/drivers/kchamp.c @@ -345,27 +345,25 @@ INTERRUPT_GEN_MEMBER(kchamp_state::kc_interrupt) device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } -static void msmint( device_t *device,int st ) +WRITE_LINE_MEMBER(kchamp_state::msmint) { - kchamp_state *state = device->machine().driver_data(); - - if (state->m_msm_play_lo_nibble) - msm5205_data_w(device, state->m_msm_data & 0x0f); + if (m_msm_play_lo_nibble) + msm5205_data_w(machine().device("msm"), m_msm_data & 0x0f); else - msm5205_data_w(device, (state->m_msm_data >> 4) & 0x0f); + msm5205_data_w(machine().device("msm"), (m_msm_data >> 4) & 0x0f); - state->m_msm_play_lo_nibble ^= 1; + m_msm_play_lo_nibble ^= 1; - if (!(state->m_counter ^= 1)) + if (!(m_counter ^= 1)) { - if (state->m_sound_nmi_enable) - state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_sound_nmi_enable) + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } static const msm5205_interface msm_interface = { - DEVCB_LINE(msmint), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(kchamp_state,msmint), /* interrupt function */ MSM5205_S96_4B /* 1 / 96 = 3906.25Hz playback */ }; diff --git a/src/mame/drivers/kungfur.c b/src/mame/drivers/kungfur.c index 7a781d89288..6331e2852bc 100644 --- a/src/mame/drivers/kungfur.c +++ b/src/mame/drivers/kungfur.c @@ -84,6 +84,8 @@ public: virtual void machine_start(); virtual void machine_reset(); INTERRUPT_GEN_MEMBER(kungfur_irq); + DECLARE_WRITE_LINE_MEMBER(kfr_adpcm1_int); + DECLARE_WRITE_LINE_MEMBER(kfr_adpcm2_int); }; @@ -188,26 +190,24 @@ WRITE8_MEMBER(kungfur_state::kungfur_adpcm2_w) } // adpcm callbacks -static void kfr_adpcm1_int(device_t *device, int st) +WRITE_LINE_MEMBER(kungfur_state::kfr_adpcm1_int) { - kungfur_state *state = device->machine().driver_data(); - UINT8 *ROM = state->memregion("adpcm1")->base(); - UINT8 data = ROM[state->m_adpcm_pos[0] & 0x1ffff]; + UINT8 *ROM = memregion("adpcm1")->base(); + UINT8 data = ROM[m_adpcm_pos[0] & 0x1ffff]; - msm5205_data_w(device, state->m_adpcm_sel[0] ? data & 0xf : data >> 4 & 0xf); - state->m_adpcm_pos[0] += state->m_adpcm_sel[0]; - state->m_adpcm_sel[0] ^= 1; + msm5205_data_w(machine().device("adpcm1"), m_adpcm_sel[0] ? data & 0xf : data >> 4 & 0xf); + m_adpcm_pos[0] += m_adpcm_sel[0]; + m_adpcm_sel[0] ^= 1; } -static void kfr_adpcm2_int(device_t *device,int st) +WRITE_LINE_MEMBER(kungfur_state::kfr_adpcm2_int) { - kungfur_state *state = device->machine().driver_data(); - UINT8 *ROM = state->memregion("adpcm2")->base(); - UINT8 data = ROM[state->m_adpcm_pos[1] & 0x3ffff]; + UINT8 *ROM = memregion("adpcm2")->base(); + UINT8 data = ROM[m_adpcm_pos[1] & 0x3ffff]; - msm5205_data_w(device, state->m_adpcm_sel[1] ? data & 0xf : data >> 4 & 0xf); - state->m_adpcm_pos[1] += state->m_adpcm_sel[1]; - state->m_adpcm_sel[1] ^= 1; + msm5205_data_w(machine().device("adpcm2"), m_adpcm_sel[1] ? data & 0xf : data >> 4 & 0xf); + m_adpcm_pos[1] += m_adpcm_sel[1]; + m_adpcm_sel[1] ^= 1; } @@ -284,13 +284,13 @@ static I8255A_INTERFACE( ppi8255_1_intf ) static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(kfr_adpcm1_int), + DEVCB_DRIVER_LINE_MEMBER(kungfur_state,kfr_adpcm1_int), MSM5205_S48_4B }; static const msm5205_interface msm5205_config_2 = { - DEVCB_LINE(kfr_adpcm2_int), + DEVCB_DRIVER_LINE_MEMBER(kungfur_state,kfr_adpcm2_int), MSM5205_S48_4B }; diff --git a/src/mame/drivers/kurukuru.c b/src/mame/drivers/kurukuru.c index 9f83010401d..2fec98cd21b 100644 --- a/src/mame/drivers/kurukuru.c +++ b/src/mame/drivers/kurukuru.c @@ -228,6 +228,7 @@ public: virtual void machine_start(); virtual void machine_reset(); TIMER_DEVICE_CALLBACK_MEMBER(kurukuru_vdp_scanline); + DECLARE_WRITE_LINE_MEMBER(kurukuru_msm5205_vck); }; #define MAIN_CLOCK XTAL_21_4772MHz @@ -283,11 +284,10 @@ void kurukuru_state::update_sound_irq(UINT8 cause) } -static void kurukuru_msm5205_vck(device_t *device,int st) +WRITE_LINE_MEMBER(kurukuru_state::kurukuru_msm5205_vck) { - kurukuru_state *state = device->machine().driver_data(); - state->update_sound_irq(state->m_sound_irq_cause | 2); - msm5205_data_w(device, state->m_adpcm_data); + update_sound_irq(m_sound_irq_cause | 2); + msm5205_data_w(machine().device("msm"), m_adpcm_data); } @@ -548,7 +548,7 @@ static const ay8910_interface ym2149_intf = static const msm5205_interface msm5205_config = { - DEVCB_LINE(kurukuru_msm5205_vck), + DEVCB_DRIVER_LINE_MEMBER(kurukuru_state,kurukuru_msm5205_vck), MSM5205_S48_4B /* changed on the fly */ }; diff --git a/src/mame/drivers/lucky74.c b/src/mame/drivers/lucky74.c index c9bf8e69fcd..53517f2dc45 100644 --- a/src/mame/drivers/lucky74.c +++ b/src/mame/drivers/lucky74.c @@ -1402,46 +1402,45 @@ static SOUND_START( lucky74 ) state->m_adpcm_busy_line = 0x01; /* free and ready */ } -static void lucky74_adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(lucky74_state::lucky74_adpcm_int) { - lucky74_state *state = device->machine().driver_data(); - if (state->m_adpcm_reg[05] == 0x01) /* register 0x05 (bit 0 activated), trigger the sample */ + if (m_adpcm_reg[05] == 0x01) /* register 0x05 (bit 0 activated), trigger the sample */ { /* conditional zone for samples reproduction */ - if (state->m_adpcm_busy_line) /* still not started */ + if (m_adpcm_busy_line) /* still not started */ { /* init all 09R81P registers */ logerror("init ADPCM registers\n"); - state->m_adpcm_end = (state->m_adpcm_reg[04] << 8) + state->m_adpcm_reg[03]; - state->m_adpcm_pos = (state->m_adpcm_reg[01] << 8) + state->m_adpcm_reg[00]; - state->m_adpcm_busy_line = 0; - state->m_adpcm_data = -1; + m_adpcm_end = (m_adpcm_reg[04] << 8) + m_adpcm_reg[03]; + m_adpcm_pos = (m_adpcm_reg[01] << 8) + m_adpcm_reg[00]; + m_adpcm_busy_line = 0; + m_adpcm_data = -1; - logerror("sample pos:%4X\n", state->m_adpcm_pos); - logerror("sample end:%4X\n", state->m_adpcm_end); + logerror("sample pos:%4X\n", m_adpcm_pos); + logerror("sample end:%4X\n", m_adpcm_end); } - if (state->m_adpcm_data == -1) + if (m_adpcm_data == -1) { /* transferring 1st nibble */ - state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos]; - state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0xffff; - msm5205_data_w(device, state->m_adpcm_data >> 4); + m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos]; + m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); - if (state->m_adpcm_pos == state->m_adpcm_end) + if (m_adpcm_pos == m_adpcm_end) { - msm5205_reset_w(device, 0); /* reset the M5205 */ - state->m_adpcm_reg[05] = 0; /* clean trigger register */ - state->m_adpcm_busy_line = 0x01; /* deactivate busy flag */ + msm5205_reset_w(machine().device("msm"), 0); /* reset the M5205 */ + m_adpcm_reg[05] = 0; /* clean trigger register */ + m_adpcm_busy_line = 0x01; /* deactivate busy flag */ logerror("end of sample.\n"); } } else { /* transferring 2nd nibble */ - msm5205_data_w(device, state->m_adpcm_data & 0x0f); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0x0f); + m_adpcm_data = -1; } } @@ -1515,7 +1514,7 @@ static const ay8910_interface ay8910_config = static const msm5205_interface msm5205_config = { - DEVCB_LINE(lucky74_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(lucky74_state,lucky74_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/mastboy.c b/src/mame/drivers/mastboy.c index bbb8aa713ed..6e606b16ac8 100644 --- a/src/mame/drivers/mastboy.c +++ b/src/mame/drivers/mastboy.c @@ -480,6 +480,7 @@ public: virtual void video_start(); UINT32 screen_update_mastboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(mastboy_interrupt); + DECLARE_WRITE_LINE_MEMBER(mastboy_adpcm_int); }; @@ -667,21 +668,20 @@ WRITE8_MEMBER(mastboy_state::mastboy_msm5205_data_w) m_m5205_next = data; } -static void mastboy_adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(mastboy_state::mastboy_adpcm_int) { - mastboy_state *state = device->machine().driver_data(); - msm5205_data_w(device, state->m_m5205_next); - state->m_m5205_next >>= 4; + msm5205_data_w(machine().device("msm"), m_m5205_next); + m_m5205_next >>= 4; - state->m_m5205_part ^= 1; - if(!state->m_m5205_part) - device->machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_m5205_part ^= 1; + if(!m_m5205_part) + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface msm5205_config = { - DEVCB_LINE(mastboy_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(mastboy_state,mastboy_adpcm_int), /* interrupt function */ MSM5205_SEX_4B /* 4KHz 4-bit */ }; diff --git a/src/mame/drivers/mermaid.c b/src/mame/drivers/mermaid.c index bb047dfe928..70954932002 100644 --- a/src/mame/drivers/mermaid.c +++ b/src/mame/drivers/mermaid.c @@ -397,30 +397,28 @@ void mermaid_state::machine_reset() } /* Similar to Jantotsu, apparently the HW has three ports that controls what kind of sample should be played. Every sample size is 0x1000. */ -static void rougien_adpcm_int( device_t *device ,int st) +WRITE_LINE_MEMBER(mermaid_state::rougien_adpcm_int) { - mermaid_state *state = device->machine().driver_data(); +// popmessage("%08x",m_adpcm_pos); -// popmessage("%08x",state->m_adpcm_pos); - - if (state->m_adpcm_pos >= state->m_adpcm_end || state->m_adpcm_idle) + if (m_adpcm_pos >= m_adpcm_end || m_adpcm_idle) { - //state->m_adpcm_idle = 1; - msm5205_reset_w(device, 1); - state->m_adpcm_trigger = 0; + //m_adpcm_idle = 1; + msm5205_reset_w(machine().device("msm"), 1); + m_adpcm_trigger = 0; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); - state->m_adpcm_data = ((state->m_adpcm_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0) >> 4)); - msm5205_data_w(device, state->m_adpcm_data & 0xf); - state->m_adpcm_trigger ^= 1; - if (state->m_adpcm_trigger == 0) + m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4)); + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0xf); + m_adpcm_trigger ^= 1; + if (m_adpcm_trigger == 0) { - state->m_adpcm_pos++; - //if ((ROM[state->m_adpcm_pos] & 0xff) == 0x70) - // state->m_adpcm_idle = 1; + m_adpcm_pos++; + //if ((ROM[m_adpcm_pos] & 0xff) == 0x70) + // m_adpcm_idle = 1; } } } @@ -428,7 +426,7 @@ static void rougien_adpcm_int( device_t *device ,int st) static const msm5205_interface msm5205_config = { - DEVCB_LINE(rougien_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(mermaid_state,rougien_adpcm_int), /* interrupt function */ MSM5205_S96_4B }; diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c index 159c6fba516..fc0cb1e0702 100644 --- a/src/mame/drivers/mitchell.c +++ b/src/mame/drivers/mitchell.c @@ -1182,20 +1182,19 @@ GFXDECODE_END -static void spangbl_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(mitchell_state::spangbl_adpcm_int) { - mitchell_state *state = device->machine().driver_data(); - msm5205_data_w(device, state->m_sample_buffer & 0x0f); - state->m_sample_buffer >>= 4; - state->m_sample_select ^= 1; - if(state->m_sample_select == 0) - state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + msm5205_data_w(machine().device("msm"), m_sample_buffer & 0x0f); + m_sample_buffer >>= 4; + m_sample_select ^= 1; + if(m_sample_select == 0) + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface msm5205_config = { - DEVCB_LINE(spangbl_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(mitchell_state,spangbl_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 4KHz 4-bit */ }; diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c index 9307b8f5605..64f6153bdd5 100644 --- a/src/mame/drivers/mlanding.c +++ b/src/mame/drivers/mlanding.c @@ -80,6 +80,7 @@ public: UINT32 screen_update_mlanding(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(dma_complete); int start_dma(); + DECLARE_WRITE_LINE_MEMBER(ml_msm5205_vck); }; @@ -280,35 +281,33 @@ WRITE8_MEMBER(mlanding_state::sound_bankswitch_w) membank("bank1")->set_base(memregion("audiocpu")->base() + ((data) & 0x03) * 0x4000 + 0x10000 ); } -static void ml_msm5205_vck(device_t *device,int st) +WRITE_LINE_MEMBER(mlanding_state::ml_msm5205_vck) { - mlanding_state *state = device->machine().driver_data(); +// popmessage("%08x",m_adpcm_pos); -// popmessage("%08x",state->m_adpcm_pos); - - if (state->m_adpcm_pos >= 0x50000 || state->m_adpcm_idle) + if (m_adpcm_pos >= 0x50000 || m_adpcm_idle) { - //state->m_adpcm_idle = 1; - msm5205_reset_w(device,1); - state->m_trigger = 0; + //m_adpcm_idle = 1; + msm5205_reset_w(machine().device("msm"),1); + m_trigger = 0; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); - state->m_adpcm_data = ((state->m_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0)>>4) ); - msm5205_data_w(device,state->m_adpcm_data & 0xf); - state->m_trigger^=1; - if(state->m_trigger == 0) + m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0)>>4) ); + msm5205_data_w(machine().device("msm"),m_adpcm_data & 0xf); + m_trigger^=1; + if(m_trigger == 0) { - state->m_adpcm_pos++; - //device->machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_adpcm_pos++; + //machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); /*TODO: simplify this */ - if(ROM[state->m_adpcm_pos] == 0x00 && ROM[state->m_adpcm_pos+1] == 0x00 && ROM[state->m_adpcm_pos+2] == 0x00 && ROM[state->m_adpcm_pos+3] == 0x00 - && ROM[state->m_adpcm_pos+4] == 0x00 && ROM[state->m_adpcm_pos+5] == 0x00 && ROM[state->m_adpcm_pos+6] == 0x00 && ROM[state->m_adpcm_pos+7] == 0x00 - && ROM[state->m_adpcm_pos+8] == 0x00 && ROM[state->m_adpcm_pos+9] == 0x00 && ROM[state->m_adpcm_pos+10] == 0x00 && ROM[state->m_adpcm_pos+11] == 0x00 - && ROM[state->m_adpcm_pos+12] == 0x00 && ROM[state->m_adpcm_pos+13] == 0x00 && ROM[state->m_adpcm_pos+14] == 0x00 && ROM[state->m_adpcm_pos+15] == 0x00) - state->m_adpcm_idle = 1; + if(ROM[m_adpcm_pos] == 0x00 && ROM[m_adpcm_pos+1] == 0x00 && ROM[m_adpcm_pos+2] == 0x00 && ROM[m_adpcm_pos+3] == 0x00 + && ROM[m_adpcm_pos+4] == 0x00 && ROM[m_adpcm_pos+5] == 0x00 && ROM[m_adpcm_pos+6] == 0x00 && ROM[m_adpcm_pos+7] == 0x00 + && ROM[m_adpcm_pos+8] == 0x00 && ROM[m_adpcm_pos+9] == 0x00 && ROM[m_adpcm_pos+10] == 0x00 && ROM[m_adpcm_pos+11] == 0x00 + && ROM[m_adpcm_pos+12] == 0x00 && ROM[m_adpcm_pos+13] == 0x00 && ROM[m_adpcm_pos+14] == 0x00 && ROM[m_adpcm_pos+15] == 0x00) + m_adpcm_idle = 1; } } } @@ -732,7 +731,7 @@ INPUT_PORTS_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(ml_msm5205_vck), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(mlanding_state,ml_msm5205_vck), /* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c index 2c6e5879f1f..ec149c87316 100644 --- a/src/mame/drivers/ojankohs.c +++ b/src/mame/drivers/ojankohs.c @@ -70,25 +70,23 @@ WRITE8_MEMBER(ojankohs_state::ojankohs_msm5205_w) m_vclk_left = 2; } -static void ojankohs_adpcm_int( device_t *device ,int st) +WRITE_LINE_MEMBER(ojankohs_state::ojankohs_adpcm_int) { - ojankohs_state *state = device->machine().driver_data(); - /* skip if we're reset */ - if (!state->m_adpcm_reset) + if (!m_adpcm_reset) return; /* clock the data through */ - if (state->m_vclk_left) + if (m_vclk_left) { - msm5205_data_w(device, (state->m_adpcm_data >> 4)); - state->m_adpcm_data <<= 4; - state->m_vclk_left--; + msm5205_data_w(machine().device("msm"), (m_adpcm_data >> 4)); + m_adpcm_data <<= 4; + m_vclk_left--; } /* generate an NMI if we're out of data */ - if (!state->m_vclk_left) - state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (!m_vclk_left) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } WRITE8_MEMBER(ojankohs_state::ojankoc_ctrl_w) @@ -782,7 +780,7 @@ static const ay8910_interface ojankoc_ay8910_interface = static const msm5205_interface msm5205_config = { - DEVCB_LINE(ojankohs_adpcm_int), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(ojankohs_state,ojankohs_adpcm_int), /* IRQ handler */ MSM5205_S48_4B /* 8 KHz */ }; diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c index e979681db5c..ec92fccf135 100644 --- a/src/mame/drivers/opwolf.c +++ b/src/mame/drivers/opwolf.c @@ -459,24 +459,30 @@ MACHINE_RESET_MEMBER(opwolf_state,opwolf) msm5205_reset_w(machine().device("msm2"), 1); } -static void opwolf_msm5205_vck( device_t *device ,int st) +void opwolf_state::opwolf_msm5205_vck(device_t *device,int chip) { - opwolf_state *state = device->machine().driver_data(); - int chip = (strcmp(device->tag(), ":msm1") == 0) ? 0 : 1; - if (state->m_adpcm_data[chip] != -1) + if (m_adpcm_data[chip] != -1) { - msm5205_data_w(device, state->m_adpcm_data[chip] & 0x0f); - state->m_adpcm_data[chip] = -1; - if (state->m_adpcm_pos[chip] == state->m_adpcm_end[chip]) + msm5205_data_w(device, m_adpcm_data[chip] & 0x0f); + m_adpcm_data[chip] = -1; + if (m_adpcm_pos[chip] == m_adpcm_end[chip]) msm5205_reset_w(device, 1); } else { - state->m_adpcm_data[chip] = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos[chip]]; - state->m_adpcm_pos[chip] = (state->m_adpcm_pos[chip] + 1) & 0x7ffff; - msm5205_data_w(device, state->m_adpcm_data[chip] >> 4); + m_adpcm_data[chip] = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos[chip]]; + m_adpcm_pos[chip] = (m_adpcm_pos[chip] + 1) & 0x7ffff; + msm5205_data_w(device, m_adpcm_data[chip] >> 4); } } +WRITE_LINE_MEMBER(opwolf_state::opwolf_msm5205_vck_1) +{ + opwolf_msm5205_vck(machine().device("msm1"),0); +} +WRITE_LINE_MEMBER(opwolf_state::opwolf_msm5205_vck_2) +{ + opwolf_msm5205_vck(machine().device("msm2"),1); +} WRITE8_MEMBER(opwolf_state::opwolf_adpcm_b_w) { @@ -684,12 +690,17 @@ GFXDECODE_END YM2151 (SOUND) **************************************************************/ -static const msm5205_interface msm5205_config = +static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(opwolf_msm5205_vck), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(opwolf_state,opwolf_msm5205_vck_1), /* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; +static const msm5205_interface msm5205_config_2 = +{ + DEVCB_DRIVER_LINE_MEMBER(opwolf_state,opwolf_msm5205_vck_2), /* VCK function */ + MSM5205_S48_4B /* 8 kHz */ +}; /*********************************************************** @@ -750,12 +761,12 @@ static MACHINE_CONFIG_START( opwolf, opwolf_state ) MCFG_SOUND_ROUTE(1, "rspeaker", 0.75) MCFG_SOUND_ADD("msm1", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.60) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.60) MCFG_SOUND_ADD("msm2", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.60) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.60) @@ -804,12 +815,12 @@ static MACHINE_CONFIG_START( opwolfb, opwolf_state ) /* OSC clocks unknown for t MCFG_SOUND_ROUTE(1, "rspeaker", 0.75) MCFG_SOUND_ADD("msm1", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.60) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.60) MCFG_SOUND_ADD("msm2", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.60) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.60) diff --git a/src/mame/drivers/pachifev.c b/src/mame/drivers/pachifev.c index 397b5d0d43a..ee249e5d52e 100644 --- a/src/mame/drivers/pachifev.c +++ b/src/mame/drivers/pachifev.c @@ -267,35 +267,33 @@ static const sn76496_config psg_intf = #if USE_MSM -static void pf_adpcm_int(device_t *device,int state) +WRITE_LINE_MEMBER(pachifev_state::pf_adpcm_int) { - pachifev_state *state = device->machine().driver_data(); - - if (state->m_adpcm_pos >= 0x4000 || state->m_adpcm_idle) + if (m_adpcm_pos >= 0x4000 || m_adpcm_idle) { - state->m_adpcm_idle = 1; - msm5205_reset_w(device,1); - state->m_trigger = 0; + m_adpcm_idle = 1; + msm5205_reset_w(machine().device("msm"),1); + m_trigger = 0; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); - state->m_adpcm_data = ((state->m_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0)>>4) ); - msm5205_data_w(device,state->m_adpcm_data & 0xf); - state->m_trigger^=1; - if(state->m_trigger == 0) + m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0)>>4) ); + msm5205_data_w(machine().device("msm"),m_adpcm_data & 0xf); + m_trigger^=1; + if(m_trigger == 0) { - state->m_adpcm_pos++; - if((ROM[state->m_adpcm_pos] & 0xff) == 0xff) - state->m_adpcm_idle = 1; + m_adpcm_pos++; + if((ROM[m_adpcm_pos] & 0xff) == 0xff) + m_adpcm_idle = 1; } } } static const msm5205_interface msm5205_config = { - DEVCB_LINE(pf_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(pachifev_state,pf_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8kHz */ }; diff --git a/src/mame/drivers/pcktgal.c b/src/mame/drivers/pcktgal.c index b4e5ac85938..91810a8805e 100644 --- a/src/mame/drivers/pcktgal.c +++ b/src/mame/drivers/pcktgal.c @@ -46,16 +46,14 @@ WRITE8_MEMBER(pcktgal_state::pcktgal_sound_w) } -static void pcktgal_adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(pcktgal_state::pcktgal_adpcm_int) { - pcktgal_state *state = device->machine().driver_data(); + msm5205_data_w(machine().device("msm"),m_msm5205next >> 4); + m_msm5205next<<=4; - msm5205_data_w(device,state->m_msm5205next >> 4); - state->m_msm5205next<<=4; - - state->m_toggle = 1 - state->m_toggle; - if (state->m_toggle) - device->machine().device("audiocpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); + m_toggle = 1 - m_toggle; + if (m_toggle) + machine().device("audiocpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); } WRITE8_MEMBER(pcktgal_state::pcktgal_adpcm_data_w) @@ -212,7 +210,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(pcktgal_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(pcktgal_state,pcktgal_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/rastan.c b/src/mame/drivers/rastan.c index 4cafc186f0b..2e8dd8301ea 100644 --- a/src/mame/drivers/rastan.c +++ b/src/mame/drivers/rastan.c @@ -167,19 +167,18 @@ WRITE8_MEMBER(rastan_state::rastan_bankswitch_w) } -static void rastan_msm5205_vck( device_t *device ,int st) +WRITE_LINE_MEMBER(rastan_state::rastan_msm5205_vck) { - rastan_state *state = device->machine().driver_data(); - if (state->m_adpcm_data != -1) + if (m_adpcm_data != -1) { - msm5205_data_w(device, state->m_adpcm_data & 0x0f); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0x0f); + m_adpcm_data = -1; } else { - state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos]; - state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0xffff; - msm5205_data_w(device, state->m_adpcm_data >> 4); + m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos]; + m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); } } @@ -340,7 +339,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(rastan_msm5205_vck), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(rastan_state,rastan_msm5205_vck), /* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; diff --git a/src/mame/drivers/sothello.c b/src/mame/drivers/sothello.c index 5c964032e82..cc69ea90850 100644 --- a/src/mame/drivers/sothello.c +++ b/src/mame/drivers/sothello.c @@ -73,6 +73,7 @@ public: TIMER_CALLBACK_MEMBER(subcpu_resume); TIMER_DEVICE_CALLBACK_MEMBER(sothello_interrupt); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); }; @@ -324,18 +325,17 @@ TIMER_DEVICE_CALLBACK_MEMBER(sothello_state::sothello_interrupt) m_v9938->interrupt(); } -static void adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(sothello_state::adpcm_int) { - sothello_state *state = device->machine().driver_data(); /* only 4 bits are used */ - msm5205_data_w( device, state->m_msm_data & 0x0f ); - device->machine().device("soundcpu")->execute().set_input_line(0, ASSERT_LINE ); + msm5205_data_w(machine().device("msm"), m_msm_data & 0x0f ); + machine().device("soundcpu")->execute().set_input_line(0, ASSERT_LINE ); } static const msm5205_interface msm_interface = { - DEVCB_LINE(adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(sothello_state,adpcm_int), /* interrupt function */ MSM5205_S48_4B /* changed on the fly */ }; diff --git a/src/mame/drivers/spdodgeb.c b/src/mame/drivers/spdodgeb.c index 76f7b3ca974..fad2e8fb85e 100644 --- a/src/mame/drivers/spdodgeb.c +++ b/src/mame/drivers/spdodgeb.c @@ -62,29 +62,36 @@ WRITE8_MEMBER(spdodgeb_state::spd_adpcm_w) } } -static void spd_adpcm_int(device_t *device,int st) +void spdodgeb_state::spd_adpcm_int( device_t *device, int chip ) { - spdodgeb_state *state = device->machine().driver_data(); - int chip = (strcmp(device->tag(), ":msm1") == 0) ? 0 : 1; - if (state->m_adpcm_pos[chip] >= state->m_adpcm_end[chip] || state->m_adpcm_pos[chip] >= 0x10000) + if (m_adpcm_pos[chip] >= m_adpcm_end[chip] || m_adpcm_pos[chip] >= 0x10000) { - state->m_adpcm_idle[chip] = 1; + m_adpcm_idle[chip] = 1; msm5205_reset_w(device,1); } - else if (state->m_adpcm_data[chip] != -1) + else if (m_adpcm_data[chip] != -1) { - msm5205_data_w(device,state->m_adpcm_data[chip] & 0x0f); - state->m_adpcm_data[chip] = -1; + msm5205_data_w(device,m_adpcm_data[chip] & 0x0f); + m_adpcm_data[chip] = -1; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; + UINT8 *ROM = machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; - state->m_adpcm_data[chip] = ROM[state->m_adpcm_pos[chip]++]; - msm5205_data_w(device,state->m_adpcm_data[chip] >> 4); + m_adpcm_data[chip] = ROM[m_adpcm_pos[chip]++]; + msm5205_data_w(device,m_adpcm_data[chip] >> 4); } } +WRITE_LINE_MEMBER(spdodgeb_state::spd_adpcm_int_1) +{ + spd_adpcm_int(machine().device("msm1"), 0); +} + +WRITE_LINE_MEMBER(spdodgeb_state::spd_adpcm_int_2) +{ + spd_adpcm_int(machine().device("msm2"), 1); +} #if 0 // default - more sensitive (state change and timing measured on real board?) void spdodgeb_state::mcu63705_update_inputs() @@ -385,12 +392,17 @@ static const ym3812_interface ym3812_config = DEVCB_DRIVER_LINE_MEMBER(spdodgeb_state,irqhandler) }; -static const msm5205_interface msm5205_config = +static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(spd_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(spdodgeb_state,spd_adpcm_int_1), /* interrupt function */ MSM5205_S48_4B /* 8kHz? */ }; +static const msm5205_interface msm5205_config_2 = +{ + DEVCB_DRIVER_LINE_MEMBER(spdodgeb_state,spd_adpcm_int_2), /* interrupt function */ + MSM5205_S48_4B /* 8kHz? */ +}; void spdodgeb_state::machine_reset() { @@ -435,12 +447,12 @@ static MACHINE_CONFIG_START( spdodgeb, spdodgeb_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) MCFG_SOUND_ADD("msm1", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) MCFG_SOUND_ADD("msm2", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/splash.c b/src/mame/drivers/splash.c index 088f36f25b0..88d66d3d17a 100644 --- a/src/mame/drivers/splash.c +++ b/src/mame/drivers/splash.c @@ -110,12 +110,10 @@ WRITE8_MEMBER(splash_state::splash_adpcm_data_w) m_adpcm_data = data; } -static void splash_msm5205_int(device_t *device,int st) +WRITE_LINE_MEMBER(splash_state::splash_msm5205_int) { - splash_state *state = device->machine().driver_data(); - - msm5205_data_w(device, state->m_adpcm_data >> 4); - state->m_adpcm_data = (state->m_adpcm_data << 4) & 0xf0; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); + m_adpcm_data = (m_adpcm_data << 4) & 0xf0; } static ADDRESS_MAP_START( splash_sound_map, AS_PROGRAM, 8, splash_state ) @@ -155,11 +153,10 @@ WRITE8_MEMBER(splash_state::roldfrog_vblank_ack_w) } -static void ym_irq(device_t *device, int state) +WRITE_LINE_MEMBER(splash_state::ym_irq) { - splash_state * driver_state = device->machine().driver_data(); - driver_state->m_sound_irq = state; - driver_state->roldfrog_update_irq(); + m_sound_irq = state; + roldfrog_update_irq(); } static ADDRESS_MAP_START( roldfrog_map, AS_PROGRAM, 16, splash_state ) @@ -476,7 +473,7 @@ GFXDECODE_END static const msm5205_interface splash_msm5205_interface = { - DEVCB_LINE(splash_msm5205_int), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(splash_state,splash_msm5205_int), /* IRQ handler */ MSM5205_S48_4B /* 8KHz */ }; @@ -531,7 +528,7 @@ static const ym2203_interface ym2203_config = DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, - DEVCB_LINE(ym_irq) + DEVCB_DRIVER_LINE_MEMBER(splash_state,ym_irq) }; INTERRUPT_GEN_MEMBER(splash_state::roldfrog_interrupt) @@ -578,47 +575,45 @@ static MACHINE_CONFIG_START( roldfrog, splash_state ) MCFG_SOUND_ROUTE(3, "mono", 1.0) MACHINE_CONFIG_END -static void adpcm_int1( device_t *device,int st) +WRITE_LINE_MEMBER(splash_state::adpcm_int1) { - splash_state *state = device->machine().driver_data(); - if (state->m_snd_interrupt_enable1 || state->m_msm_toggle1 == 1) + if (m_snd_interrupt_enable1 || m_msm_toggle1 == 1) { - msm5205_data_w(device, state->m_msm_data1 >> 4); - state->m_msm_data1 <<= 4; - state->m_msm_toggle1 ^= 1; - if (state->m_msm_toggle1 == 0) + msm5205_data_w(machine().device("msm1"), m_msm_data1 >> 4); + m_msm_data1 <<= 4; + m_msm_toggle1 ^= 1; + if (m_msm_toggle1 == 0) { - state->m_msm_source|=1; - device->machine().device("audiocpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0x38); + m_msm_source|=1; + machine().device("audiocpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0x38); } } } -static void adpcm_int2( device_t *device,int st ) +WRITE_LINE_MEMBER(splash_state::adpcm_int2) { - splash_state *state = device->machine().driver_data(); - if (state->m_snd_interrupt_enable2 || state->m_msm_toggle2 == 1) + if (m_snd_interrupt_enable2 || m_msm_toggle2 == 1) { - msm5205_data_w(device, state->m_msm_data2 >> 4); - state->m_msm_data2 <<= 4; - state->m_msm_toggle2 ^= 1; - if (state->m_msm_toggle2 == 0) + msm5205_data_w(machine().device("msm2"), m_msm_data2 >> 4); + m_msm_data2 <<= 4; + m_msm_toggle2 ^= 1; + if (m_msm_toggle2 == 0) { - state->m_msm_source|=2; - device->machine().device("audiocpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0x38); + m_msm_source|=2; + machine().device("audiocpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0x38); } } } static const msm5205_interface msm_interface1 = { - DEVCB_LINE(adpcm_int1), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(splash_state,adpcm_int1), /* interrupt function */ MSM5205_S64_4B /* 1 / 96 = 3906.25Hz playback - guess */ }; static const msm5205_interface msm_interface2 = { - DEVCB_LINE(adpcm_int2), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(splash_state,adpcm_int2), /* interrupt function */ MSM5205_S96_4B /* 1 / 96 = 3906.25Hz playback - guess */ }; diff --git a/src/mame/drivers/srmp2.c b/src/mame/drivers/srmp2.c index dac492568ed..bf505672ded 100644 --- a/src/mame/drivers/srmp2.c +++ b/src/mame/drivers/srmp2.c @@ -206,38 +206,37 @@ WRITE8_MEMBER(srmp2_state::srmp3_adpcm_code_w) } -static void srmp2_adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(srmp2_state::srmp2_adpcm_int) { - srmp2_state *state = device->machine().driver_data(); - UINT8 *ROM = state->memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); - if (state->m_adpcm_sptr) + if (m_adpcm_sptr) { - if (state->m_adpcm_data == -1) + if (m_adpcm_data == -1) { - state->m_adpcm_data = ROM[state->m_adpcm_sptr]; + m_adpcm_data = ROM[m_adpcm_sptr]; - if (state->m_adpcm_sptr >= state->m_adpcm_eptr) + if (m_adpcm_sptr >= m_adpcm_eptr) { - msm5205_reset_w(device, 1); - state->m_adpcm_data = 0; - state->m_adpcm_sptr = 0; + msm5205_reset_w(machine().device("msm"), 1); + m_adpcm_data = 0; + m_adpcm_sptr = 0; } else { - msm5205_data_w(device, ((state->m_adpcm_data >> 4) & 0x0f)); + msm5205_data_w(machine().device("msm"), ((m_adpcm_data >> 4) & 0x0f)); } } else { - msm5205_data_w(device, ((state->m_adpcm_data >> 0) & 0x0f)); - state->m_adpcm_sptr++; - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), ((m_adpcm_data >> 0) & 0x0f)); + m_adpcm_sptr++; + m_adpcm_data = -1; } } else { - msm5205_reset_w(device, 1); + msm5205_reset_w(machine().device("msm"), 1); } } @@ -1129,7 +1128,7 @@ static const ay8910_interface srmp2_ay8910_interface = static const msm5205_interface msm5205_config = { - DEVCB_LINE(srmp2_adpcm_int), /* IRQ handler */ + DEVCB_DRIVER_LINE_MEMBER(srmp2_state,srmp2_adpcm_int), /* IRQ handler */ MSM5205_S48_4B /* 8 KHz, 4 Bits */ }; diff --git a/src/mame/drivers/stfight.c b/src/mame/drivers/stfight.c index aeb0e1963f4..fd0b303fc4f 100644 --- a/src/mame/drivers/stfight.c +++ b/src/mame/drivers/stfight.c @@ -427,7 +427,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(stfight_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(stfight_state,stfight_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/suprgolf.c b/src/mame/drivers/suprgolf.c index e0dc565388b..a9100bb41df 100644 --- a/src/mame/drivers/suprgolf.c +++ b/src/mame/drivers/suprgolf.c @@ -70,6 +70,7 @@ public: virtual void video_start(); UINT32 screen_update_suprgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); }; TILE_GET_INFO_MEMBER(suprgolf_state::get_tile_info) @@ -432,28 +433,24 @@ static const ym2203_interface ym2203_config = DEVCB_DRIVER_LINE_MEMBER(suprgolf_state,irqhandler) }; -static void adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(suprgolf_state::adpcm_int) { - suprgolf_state *state = device->machine().driver_data(); - + msm5205_reset_w(machine().device("msm"),0); + m_toggle ^= 1; + if(m_toggle) { - msm5205_reset_w(device,0); - state->m_toggle ^= 1; - if(state->m_toggle) - { - msm5205_data_w(device, (state->m_msm5205next & 0xf0) >> 4); - if(state->m_msm_nmi_mask) { device->machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } - } - else - { - msm5205_data_w(device, (state->m_msm5205next & 0x0f) >> 0); - } + msm5205_data_w(machine().device("msm"), (m_msm5205next & 0xf0) >> 4); + if(m_msm_nmi_mask) { machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } + } + else + { + msm5205_data_w(machine().device("msm"), (m_msm5205next & 0x0f) >> 0); } } static const msm5205_interface msm5205_config = { - DEVCB_LINE(adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(suprgolf_state,adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 4KHz 4-bit */ }; diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c index 66a9d865395..c0d2233f9f9 100644 --- a/src/mame/drivers/system16.c +++ b/src/mame/drivers/system16.c @@ -357,20 +357,19 @@ WRITE8_MEMBER(segas1x_bootleg_state::tturfbl_msm5205_data_w) m_sample_buffer = data; } -static void tturfbl_msm5205_callback( device_t *device,int st ) +WRITE_LINE_MEMBER(segas1x_bootleg_state::tturfbl_msm5205_callback) { - segas1x_bootleg_state *state = device->machine().driver_data(); - msm5205_data_w(device, (state->m_sample_buffer >> 4) & 0x0f); + msm5205_data_w(machine().device("msm"), (m_sample_buffer >> 4) & 0x0f); - state->m_sample_buffer <<= 4; - state->m_sample_select ^= 1; - if(state->m_sample_select == 0) - state->m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_sample_buffer <<= 4; + m_sample_select ^= 1; + if(m_sample_select == 0) + m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface tturfbl_msm5205_interface = { - DEVCB_LINE(tturfbl_msm5205_callback), + DEVCB_DRIVER_LINE_MEMBER(segas1x_bootleg_state,tturfbl_msm5205_callback), MSM5205_S48_4B }; @@ -1158,20 +1157,19 @@ WRITE8_MEMBER(segas1x_bootleg_state::shdancbl_msm5205_data_w) m_sample_buffer = data; } -static void shdancbl_msm5205_callback(device_t *device, int st) +WRITE_LINE_MEMBER(segas1x_bootleg_state::shdancbl_msm5205_callback) { - segas1x_bootleg_state *state = device->machine().driver_data(); - msm5205_data_w(device, state->m_sample_buffer & 0x0f); + msm5205_data_w(machine().device("msm"), m_sample_buffer & 0x0f); - state->m_sample_buffer >>= 4; - state->m_sample_select ^= 1; - if (state->m_sample_select == 0) - state->m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_sample_buffer >>= 4; + m_sample_select ^= 1; + if (m_sample_select == 0) + m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface shdancbl_msm5205_interface = { - DEVCB_LINE(shdancbl_msm5205_callback), + DEVCB_DRIVER_LINE_MEMBER(segas1x_bootleg_state,shdancbl_msm5205_callback), MSM5205_S48_4B }; diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c index e966fadf642..7f1e82a6d6d 100644 --- a/src/mame/drivers/taito_l.c +++ b/src/mame/drivers/taito_l.c @@ -557,20 +557,18 @@ WRITE8_MEMBER(taitol_state::mux_ctrl_w) } -static void champwr_msm5205_vck( device_t *device,int st ) +WRITE_LINE_MEMBER(taitol_state::champwr_msm5205_vck) { - taitol_state *state = device->machine().driver_data(); - - if (state->m_adpcm_data != -1) + if (m_adpcm_data != -1) { - msm5205_data_w(device, state->m_adpcm_data & 0x0f); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"), m_adpcm_data & 0x0f); + m_adpcm_data = -1; } else { - state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos]; - state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0x1ffff; - msm5205_data_w(device, state->m_adpcm_data >> 4); + m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos]; + m_adpcm_pos = (m_adpcm_pos + 1) & 0x1ffff; + msm5205_data_w(machine().device("msm"), m_adpcm_data >> 4); } } @@ -1791,7 +1789,7 @@ static const ym2203_interface ym2203_interface_champwr = static const msm5205_interface msm5205_config = { - DEVCB_LINE(champwr_msm5205_vck),/* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(taitol_state,champwr_msm5205_vck),/* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; diff --git a/src/mame/drivers/tbowl.c b/src/mame/drivers/tbowl.c index fbbe5d55d68..19bd4c2357f 100644 --- a/src/mame/drivers/tbowl.c +++ b/src/mame/drivers/tbowl.c @@ -161,27 +161,35 @@ WRITE8_MEMBER(tbowl_state::tbowl_adpcm_vol_w) msm5205_set_volume(adpcm, (data & 0x7f) * 100 / 0x7f); } -static void tbowl_adpcm_int(device_t *device,int st) +void tbowl_state::tbowl_adpcm_int( device_t *device, int num ) { - tbowl_state *state = device->machine().driver_data(); - int num = (strcmp(device->tag(), ":msm1") == 0) ? 0 : 1; - if (state->m_adpcm_pos[num] >= state->m_adpcm_end[num] || - state->m_adpcm_pos[num] >= state->memregion("adpcm")->bytes()/2) + if (m_adpcm_pos[num] >= m_adpcm_end[num] || + m_adpcm_pos[num] >= memregion("adpcm")->bytes()/2) msm5205_reset_w(device,1); - else if (state->m_adpcm_data[num] != -1) + else if (m_adpcm_data[num] != -1) { - msm5205_data_w(device,state->m_adpcm_data[num] & 0x0f); - state->m_adpcm_data[num] = -1; + msm5205_data_w(device,m_adpcm_data[num] & 0x0f); + m_adpcm_data[num] = -1; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * num; + UINT8 *ROM = machine().root_device().memregion("adpcm")->base() + 0x10000 * num; - state->m_adpcm_data[num] = ROM[state->m_adpcm_pos[num]++]; - msm5205_data_w(device,state->m_adpcm_data[num] >> 4); + m_adpcm_data[num] = ROM[m_adpcm_pos[num]++]; + msm5205_data_w(device,m_adpcm_data[num] >> 4); } } +WRITE_LINE_MEMBER(tbowl_state::tbowl_adpcm_int_1) +{ + tbowl_adpcm_int(machine().device("msm1"), 0); +} + +WRITE_LINE_MEMBER(tbowl_state::tbowl_adpcm_int_2) +{ + tbowl_adpcm_int(machine().device("msm2"), 1); +} + static ADDRESS_MAP_START( 6206A_map, AS_PROGRAM, 8, tbowl_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc000, 0xc7ff) AM_RAM @@ -429,9 +437,15 @@ static const ym3812_interface ym3812_config = DEVCB_DRIVER_LINE_MEMBER(tbowl_state,irqhandler) }; -static const msm5205_interface msm5205_config = +static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(tbowl_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(tbowl_state,tbowl_adpcm_int_1), /* interrupt function */ + MSM5205_S48_4B /* 8KHz */ +}; + +static const msm5205_interface msm5205_config_2 = +{ + DEVCB_DRIVER_LINE_MEMBER(tbowl_state,tbowl_adpcm_int_2), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; @@ -505,11 +519,11 @@ static MACHINE_CONFIG_START( tbowl, tbowl_state ) /* something for the samples? */ MCFG_SOUND_ADD("msm1", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_SOUND_ADD("msm2", MSM5205, 384000) - MCFG_SOUND_CONFIG(msm5205_config) + MCFG_SOUND_CONFIG(msm5205_config_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/tecmo.c b/src/mame/drivers/tecmo.c index 4fd231d54bb..036864223d0 100644 --- a/src/mame/drivers/tecmo.c +++ b/src/mame/drivers/tecmo.c @@ -94,23 +94,22 @@ WRITE8_MEMBER(tecmo_state::tecmo_adpcm_vol_w) msm5205_set_volume(device,(data & 0x0f) * 100 / 15); } -static void tecmo_adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(tecmo_state::tecmo_adpcm_int) { - tecmo_state *state = device->machine().driver_data(); - if (state->m_adpcm_pos >= state->m_adpcm_end || - state->m_adpcm_pos >= state->memregion("adpcm")->bytes()) - msm5205_reset_w(device,1); - else if (state->m_adpcm_data != -1) + if (m_adpcm_pos >= m_adpcm_end || + m_adpcm_pos >= memregion("adpcm")->bytes()) + msm5205_reset_w(machine().device("msm"),1); + else if (m_adpcm_data != -1) { - msm5205_data_w(device,state->m_adpcm_data & 0x0f); - state->m_adpcm_data = -1; + msm5205_data_w(machine().device("msm"),m_adpcm_data & 0x0f); + m_adpcm_data = -1; } else { - UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); - state->m_adpcm_data = ROM[state->m_adpcm_pos++]; - msm5205_data_w(device,state->m_adpcm_data >> 4); + m_adpcm_data = ROM[m_adpcm_pos++]; + msm5205_data_w(machine().device("msm"),m_adpcm_data >> 4); } } @@ -616,7 +615,7 @@ static const ym3812_interface ym3812_config = static const msm5205_interface msm5205_config = { - DEVCB_LINE(tecmo_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(tecmo_state,tecmo_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/tehkanwc.c b/src/mame/drivers/tehkanwc.c index 71b9d473a2e..51296cab847 100644 --- a/src/mame/drivers/tehkanwc.c +++ b/src/mame/drivers/tehkanwc.c @@ -188,22 +188,20 @@ WRITE8_MEMBER(tehkanwc_state::msm_reset_w) msm5205_reset_w(device,data ? 0 : 1); } -static void tehkanwc_adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(tehkanwc_state::tehkanwc_adpcm_int) { - tehkanwc_state *state = device->machine().driver_data(); + UINT8 *SAMPLES = memregion("adpcm")->base(); + int msm_data = SAMPLES[m_msm_data_offs & 0x7fff]; - UINT8 *SAMPLES = state->memregion("adpcm")->base(); - int msm_data = SAMPLES[state->m_msm_data_offs & 0x7fff]; - - if (state->m_toggle == 0) - msm5205_data_w(device,(msm_data >> 4) & 0x0f); + if (m_toggle == 0) + msm5205_data_w(machine().device("msm"),(msm_data >> 4) & 0x0f); else { - msm5205_data_w(device,msm_data & 0x0f); - state->m_msm_data_offs++; + msm5205_data_w(machine().device("msm"),msm_data & 0x0f); + m_msm_data_offs++; } - state->m_toggle ^= 1; + m_toggle ^= 1; } /* End of MSM with counters emulation */ @@ -633,7 +631,7 @@ static const ay8910_interface ay8910_interface_2 = static const msm5205_interface msm5205_config = { - DEVCB_LINE(tehkanwc_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(tehkanwc_state,tehkanwc_adpcm_int), /* interrupt function */ MSM5205_S48_4B /* 8KHz */ }; diff --git a/src/mame/drivers/toki.c b/src/mame/drivers/toki.c index 24f3de5c05a..dc57d6a1c57 100644 --- a/src/mame/drivers/toki.c +++ b/src/mame/drivers/toki.c @@ -56,16 +56,14 @@ READ16_MEMBER(toki_state::pip16_r) -static void toki_adpcm_int (device_t *device,int st) +WRITE_LINE_MEMBER(toki_state::toki_adpcm_int) { - toki_state *state = device->machine().driver_data(); + msm5205_data_w (machine().device("msm"), m_msm5205next); + m_msm5205next >>= 4; - msm5205_data_w (device, state->m_msm5205next); - state->m_msm5205next >>= 4; - - state->m_toggle ^= 1; - if (state->m_toggle) - device->machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_toggle ^= 1; + if (m_toggle) + machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } WRITE8_MEMBER(toki_state::toki_adpcm_control_w) @@ -408,7 +406,7 @@ GFXDECODE_END static const msm5205_interface msm5205_config = { - DEVCB_LINE(toki_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(toki_state,toki_adpcm_int), /* interrupt function */ MSM5205_S96_4B /* 4KHz */ }; diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c index c2f3397bba8..1335bce9ff1 100644 --- a/src/mame/drivers/topspeed.c +++ b/src/mame/drivers/topspeed.c @@ -424,27 +424,26 @@ WRITE8_MEMBER(topspeed_state::topspeed_tc0140syt_comm_w) device->tc0140syt_comm_w(space, 0, data); } -static void topspeed_msm5205_clock( device_t *device, int chip ) +void topspeed_state::topspeed_msm5205_clock( device_t *device, int chip ) { - topspeed_state *state = device->machine().driver_data(); - UINT8 data = state->m_msm_rom[chip][state->m_msm_pos[chip]]; + UINT8 data = m_msm_rom[chip][m_msm_pos[chip]]; - msm5205_data_w(device, state->m_msm_sel[chip] ? data & 0xf : data >> 4 & 0xf); - state->m_msm_pos[chip] += state->m_msm_sel[chip]; - state->m_msm_sel[chip] ^= 1; + msm5205_data_w(device, m_msm_sel[chip] ? data & 0xf : data >> 4 & 0xf); + m_msm_pos[chip] += m_msm_sel[chip]; + m_msm_sel[chip] ^= 1; - if ((state->m_msm_pos[chip]) == state->m_msm_loop[chip]) - state->m_msm_pos[chip] = state->m_msm_start[chip]; + if ((m_msm_pos[chip]) == m_msm_loop[chip]) + m_msm_pos[chip] = m_msm_start[chip]; } -static void topspeed_msm5205_vck_1( device_t *device ,int state) +WRITE_LINE_MEMBER(topspeed_state::topspeed_msm5205_vck_1) { - topspeed_msm5205_clock(device, 0); + topspeed_msm5205_clock(m_msm_chip[0], 0); } -static void topspeed_msm5205_vck_2( device_t *device ,int state) +WRITE_LINE_MEMBER(topspeed_state::topspeed_msm5205_vck_2) { - topspeed_msm5205_clock(device, 1); + topspeed_msm5205_clock(m_msm_chip[1], 1); } @@ -655,13 +654,13 @@ GFXDECODE_END static const msm5205_interface msm5205_config_1 = { - DEVCB_LINE(topspeed_msm5205_vck_1), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(topspeed_state,topspeed_msm5205_vck_1), /* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; static const msm5205_interface msm5205_config_2 = { - DEVCB_LINE(topspeed_msm5205_vck_2), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(topspeed_state,topspeed_msm5205_vck_2), /* VCK function */ MSM5205_S48_4B /* 8 kHz */ }; diff --git a/src/mame/drivers/tubep.c b/src/mame/drivers/tubep.c index 5c833ded43d..f5d912e3adb 100644 --- a/src/mame/drivers/tubep.c +++ b/src/mame/drivers/tubep.c @@ -549,19 +549,18 @@ WRITE8_MEMBER(tubep_state::rjammer_voice_frequency_select_w) } -static void rjammer_adpcm_vck (device_t *device,int st) +WRITE_LINE_MEMBER(tubep_state::rjammer_adpcm_vck) { - tubep_state *state = device->machine().driver_data(); - state->m_ls74 = (state->m_ls74 + 1) & 1; + m_ls74 = (m_ls74 + 1) & 1; - if (state->m_ls74 == 1) + if (m_ls74 == 1) { - msm5205_data_w(device, (state->m_ls377 >> 0) & 15 ); - device->machine().device("soundcpu")->execute().set_input_line(0, ASSERT_LINE ); + msm5205_data_w(machine().device("msm"), (m_ls377 >> 0) & 15 ); + machine().device("soundcpu")->execute().set_input_line(0, ASSERT_LINE ); } else { - msm5205_data_w(device, (state->m_ls377 >> 4) & 15 ); + msm5205_data_w(machine().device("msm"), (m_ls377 >> 4) & 15 ); } } @@ -870,7 +869,7 @@ static const ay8910_interface ay8910_interface_3 = static const msm5205_interface msm5205_config = { - DEVCB_LINE(rjammer_adpcm_vck), /* VCK function */ + DEVCB_DRIVER_LINE_MEMBER(tubep_state,rjammer_adpcm_vck), /* VCK function */ MSM5205_S48_4B /* 8 KHz (changes at run time) */ }; diff --git a/src/mame/drivers/wc90b.c b/src/mame/drivers/wc90b.c index 575caf2b9d5..9e4145ba827 100644 --- a/src/mame/drivers/wc90b.c +++ b/src/mame/drivers/wc90b.c @@ -340,23 +340,21 @@ static const ym2203_interface ym2203_config = DEVCB_DRIVER_LINE_MEMBER(wc90b_state,irqhandler) }; -static void adpcm_int(device_t *device,int st) +WRITE_LINE_MEMBER(wc90b_state::adpcm_int) { - wc90b_state *state = device->machine().driver_data(); - - state->m_toggle ^= 1; - if(state->m_toggle) + m_toggle ^= 1; + if(m_toggle) { - msm5205_data_w(device, (state->m_msm5205next & 0xf0) >> 4); - device->machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + msm5205_data_w(machine().device("msm"), (m_msm5205next & 0xf0) >> 4); + machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } else - msm5205_data_w(device, (state->m_msm5205next & 0x0f) >> 0); + msm5205_data_w(machine().device("msm"), (m_msm5205next & 0x0f) >> 0); } static const msm5205_interface msm5205_config = { - DEVCB_LINE(adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(wc90b_state,adpcm_int), /* interrupt function */ MSM5205_S96_4B /* 4KHz 4-bit */ }; diff --git a/src/mame/drivers/yunsung8.c b/src/mame/drivers/yunsung8.c index c0845ccc9a9..6216e14b7ab 100644 --- a/src/mame/drivers/yunsung8.c +++ b/src/mame/drivers/yunsung8.c @@ -443,21 +443,19 @@ GFXDECODE_END ***************************************************************************/ -static void yunsung8_adpcm_int( device_t *device,int st ) +WRITE_LINE_MEMBER(yunsung8_state::yunsung8_adpcm_int) { - yunsung8_state *state = device->machine().driver_data(); + msm5205_data_w(machine().device("msm"), m_adpcm >> 4); + m_adpcm <<= 4; - msm5205_data_w(device, state->m_adpcm >> 4); - state->m_adpcm <<= 4; - - state->m_toggle ^= 1; - if (state->m_toggle) - state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_toggle ^= 1; + if (m_toggle) + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface yunsung8_msm5205_interface = { - DEVCB_LINE(yunsung8_adpcm_int), /* interrupt function */ + DEVCB_DRIVER_LINE_MEMBER(yunsung8_state,yunsung8_adpcm_int), /* interrupt function */ MSM5205_S96_4B /* 4KHz, 4 Bits */ }; diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h index ac2fca5e442..69476ed838d 100644 --- a/src/mame/includes/appoooh.h +++ b/src/mame/includes/appoooh.h @@ -55,6 +55,7 @@ public: INTERRUPT_GEN_MEMBER(vblank_irq); void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ); void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ); + DECLARE_WRITE_LINE_MEMBER(appoooh_adpcm_int); }; #define CHR1_OFST 0x00 /* palette page of char set #1 */ diff --git a/src/mame/includes/ashnojoe.h b/src/mame/includes/ashnojoe.h index 544a20385a7..65b6d0491d6 100644 --- a/src/mame/includes/ashnojoe.h +++ b/src/mame/includes/ashnojoe.h @@ -74,4 +74,6 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_ashnojoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(ym2203_irq_handler); + DECLARE_WRITE_LINE_MEMBER(ashnojoe_vclk_cb); }; diff --git a/src/mame/includes/asuka.h b/src/mame/includes/asuka.h index e93c0223009..49d76be0d4f 100644 --- a/src/mame/includes/asuka.h +++ b/src/mame/includes/asuka.h @@ -63,4 +63,5 @@ public: DECLARE_WRITE16_MEMBER( bonzeadv_cchip_bank_w ); DECLARE_WRITE16_MEMBER( bonzeadv_cchip_ram_w ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(asuka_msm5205_vck); }; diff --git a/src/mame/includes/battlera.h b/src/mame/includes/battlera.h index 4742b85ced0..c228ed54dbc 100644 --- a/src/mame/includes/battlera.h +++ b/src/mame/includes/battlera.h @@ -43,4 +43,5 @@ public: UINT32 screen_update_battlera(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(battlera_irq); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &clip,int pri); + DECLARE_WRITE_LINE_MEMBER(battlera_adpcm_int); }; diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index eb608d8a504..43431cc506b 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -319,7 +319,8 @@ public: DECLARE_READ16_MEMBER(cps2_qsound_volume_r); DECLARE_READ16_MEMBER(kludge_r); DECLARE_READ16_MEMBER(joy_or_paddle_r); - + DECLARE_WRITE_LINE_MEMBER(m5205_int1); + DECLARE_WRITE_LINE_MEMBER(m5205_int2); }; /*----------- defined in drivers/cps1.c -----------*/ diff --git a/src/mame/includes/crgolf.h b/src/mame/includes/crgolf.h index b2b3ab895bf..4c55cb3e92f 100644 --- a/src/mame/includes/crgolf.h +++ b/src/mame/includes/crgolf.h @@ -57,6 +57,7 @@ public: TIMER_CALLBACK_MEMBER(main_to_sound_callback); TIMER_CALLBACK_MEMBER(sound_to_main_callback); void get_pens( pen_t *pens ); + DECLARE_WRITE_LINE_MEMBER(vck_callback); }; /*----------- defined in video/crgolf.c -----------*/ diff --git a/src/mame/includes/darius.h b/src/mame/includes/darius.h index 97c3df820f4..0b2673b5f77 100644 --- a/src/mame/includes/darius.h +++ b/src/mame/includes/darius.h @@ -108,4 +108,5 @@ public: void update_psg1( int port ); void update_da( ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(darius_adpcm_int); }; diff --git a/src/mame/includes/ddragon.h b/src/mame/includes/ddragon.h index 27d632fcce5..9f5856fc8ba 100644 --- a/src/mame/includes/ddragon.h +++ b/src/mame/includes/ddragon.h @@ -100,4 +100,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(ddragon_scanline); void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ); int scanline_to_vcount( int scanline ); + void dd_adpcm_int(device_t *device, int chip); + DECLARE_WRITE_LINE_MEMBER(dd_adpcm_int_1); + DECLARE_WRITE_LINE_MEMBER(dd_adpcm_int_2); }; diff --git a/src/mame/includes/dec0.h b/src/mame/includes/dec0.h index 0e2c130a831..28db77b5c49 100644 --- a/src/mame/includes/dec0.h +++ b/src/mame/includes/dec0.h @@ -89,6 +89,8 @@ public: void dec0_i8751_reset(); void h6280_decrypt(const char *cputag); void slyspy_set_protection_map( int type); + DECLARE_WRITE_LINE_MEMBER(sound_irq); + DECLARE_WRITE_LINE_MEMBER(sound_irq2); }; @@ -114,4 +116,5 @@ public: DECLARE_VIDEO_START(automat); UINT32 screen_update_automat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_secretab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(automat_vclk_cb); }; diff --git a/src/mame/includes/dec8.h b/src/mame/includes/dec8.h index 9f1928f84d5..5eeb3245db1 100644 --- a/src/mame/includes/dec8.h +++ b/src/mame/includes/dec8.h @@ -135,4 +135,5 @@ public: TIMER_CALLBACK_MEMBER(dec8_i8751_timer_callback); void srdarwin_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(csilver_adpcm_int); }; diff --git a/src/mame/includes/docastle.h b/src/mame/includes/docastle.h index f968736f321..aee524d24a2 100644 --- a/src/mame/includes/docastle.h +++ b/src/mame/includes/docastle.h @@ -50,4 +50,5 @@ public: UINT32 screen_update_docastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void video_start_common( UINT32 tile_transmask ); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + DECLARE_WRITE_LINE_MEMBER(idsoccer_adpcm_int); }; diff --git a/src/mame/includes/drmicro.h b/src/mame/includes/drmicro.h index 088273f28b2..b7ba3c441b6 100644 --- a/src/mame/includes/drmicro.h +++ b/src/mame/includes/drmicro.h @@ -36,4 +36,5 @@ public: virtual void palette_init(); UINT32 screen_update_drmicro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(drmicro_interrupt); + DECLARE_WRITE_LINE_MEMBER(pcm_w); }; diff --git a/src/mame/includes/dynax.h b/src/mame/includes/dynax.h index 7aa9bea3bc3..9ea0a2bead5 100644 --- a/src/mame/includes/dynax.h +++ b/src/mame/includes/dynax.h @@ -492,6 +492,10 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(mjmyster_irq); void tenkai_update_rombank(); void gekisha_bank_postload(); + DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback); + DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); + DECLARE_WRITE_LINE_MEMBER(adpcm_int_cpu1); }; //----------- defined in drivers/dynax.c ----------- diff --git a/src/mame/includes/fantland.h b/src/mame/includes/fantland.h index 5823e26e6ab..5281429007d 100644 --- a/src/mame/includes/fantland.h +++ b/src/mame/includes/fantland.h @@ -52,4 +52,8 @@ public: INTERRUPT_GEN_MEMBER(fantland_irq); INTERRUPT_GEN_MEMBER(fantland_sound_irq); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(borntofi_adpcm_int_0); + DECLARE_WRITE_LINE_MEMBER(borntofi_adpcm_int_1); + DECLARE_WRITE_LINE_MEMBER(borntofi_adpcm_int_2); + DECLARE_WRITE_LINE_MEMBER(borntofi_adpcm_int_3); }; diff --git a/src/mame/includes/firetrap.h b/src/mame/includes/firetrap.h index 7ac457690fc..9004e9e2fc4 100644 --- a/src/mame/includes/firetrap.h +++ b/src/mame/includes/firetrap.h @@ -74,4 +74,5 @@ public: INTERRUPT_GEN_MEMBER(firetrap_irq); inline void get_bg_tile_info(tile_data &tileinfo, int tile_index, UINT8 *bgvideoram, int gfx_region); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + DECLARE_WRITE_LINE_MEMBER(firetrap_adpcm_int); }; diff --git a/src/mame/includes/fromance.h b/src/mame/includes/fromance.h index 8fe900e401a..f887184fdc3 100644 --- a/src/mame/includes/fromance.h +++ b/src/mame/includes/fromance.h @@ -93,4 +93,5 @@ public: inline void get_fromance_tile_info( tile_data &tileinfo, int tile_index, int layer ); inline void get_nekkyoku_tile_info( tile_data &tileinfo, int tile_index, int layer ); void init_common( ); + DECLARE_WRITE_LINE_MEMBER(fromance_adpcm_int); }; diff --git a/src/mame/includes/gcpinbal.h b/src/mame/includes/gcpinbal.h index e15cc1f9720..701dbfb114c 100644 --- a/src/mame/includes/gcpinbal.h +++ b/src/mame/includes/gcpinbal.h @@ -64,4 +64,5 @@ public: TIMER_CALLBACK_MEMBER(gcpinbal_interrupt3); void gcpinbal_core_vh_start( ); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ); + DECLARE_WRITE_LINE_MEMBER(gcp_adpcm_int); }; diff --git a/src/mame/includes/gladiatr.h b/src/mame/includes/gladiatr.h index e342856a2d8..49610a2f382 100644 --- a/src/mame/includes/gladiatr.h +++ b/src/mame/includes/gladiatr.h @@ -68,4 +68,5 @@ public: UINT32 screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void swap_block(UINT8 *src1,UINT8 *src2,int len); + DECLARE_WRITE_LINE_MEMBER(gladiator_ym_irq); }; diff --git a/src/mame/includes/goal92.h b/src/mame/includes/goal92.h index a22afae506b..0c8554d5761 100644 --- a/src/mame/includes/goal92.h +++ b/src/mame/includes/goal92.h @@ -55,4 +55,5 @@ public: void screen_eof_goal92(screen_device &screen, bool state); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(goal92_adpcm_int); }; diff --git a/src/mame/includes/kchamp.h b/src/mame/includes/kchamp.h index c813ae4feee..c7e24a02557 100644 --- a/src/mame/includes/kchamp.h +++ b/src/mame/includes/kchamp.h @@ -55,4 +55,5 @@ public: void kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); UINT8 *decrypt_code(); + DECLARE_WRITE_LINE_MEMBER(msmint); }; diff --git a/src/mame/includes/lucky74.h b/src/mame/includes/lucky74.h index 87c5b1b7e52..ebe767fc56c 100644 --- a/src/mame/includes/lucky74.h +++ b/src/mame/includes/lucky74.h @@ -41,4 +41,5 @@ public: virtual void palette_init(); UINT32 screen_update_lucky74(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(nmi_interrupt); + DECLARE_WRITE_LINE_MEMBER(lucky74_adpcm_int); }; diff --git a/src/mame/includes/mermaid.h b/src/mame/includes/mermaid.h index 449e9d85b7e..ee05e3558ad 100644 --- a/src/mame/includes/mermaid.h +++ b/src/mame/includes/mermaid.h @@ -82,4 +82,5 @@ public: INTERRUPT_GEN_MEMBER(vblank_irq); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); UINT8 collision_check( rectangle& rect ); + DECLARE_WRITE_LINE_MEMBER(rougien_adpcm_int); }; diff --git a/src/mame/includes/mitchell.h b/src/mame/includes/mitchell.h index c5cef3d8f06..3974ed3f9a1 100644 --- a/src/mame/includes/mitchell.h +++ b/src/mame/includes/mitchell.h @@ -107,4 +107,5 @@ public: void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void bootleg_decode( ); void configure_banks( ); + DECLARE_WRITE_LINE_MEMBER(spangbl_adpcm_int); }; diff --git a/src/mame/includes/ojankohs.h b/src/mame/includes/ojankohs.h index 97fda9d17bb..86cc2bef862 100644 --- a/src/mame/includes/ojankohs.h +++ b/src/mame/includes/ojankohs.h @@ -73,7 +73,5 @@ public: UINT32 screen_update_ojankohs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ojankoc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void ojankoc_flipscreen( address_space &space, int data ); + DECLARE_WRITE_LINE_MEMBER(ojankohs_adpcm_int); }; - -/*----------- defined in video/ojankohs.c -----------*/ -void ojankoc_flipscreen(address_space &space, int data); diff --git a/src/mame/includes/opwolf.h b/src/mame/includes/opwolf.h index bde9c97fde4..e69dd22fc2a 100644 --- a/src/mame/includes/opwolf.h +++ b/src/mame/includes/opwolf.h @@ -77,7 +77,7 @@ public: TIMER_CALLBACK_MEMBER(cchip_timer); void updateDifficulty( int mode ); void opwolf_cchip_init( ); + void opwolf_msm5205_vck(device_t *device, int chip); + DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_1); + DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_2); }; - -/*----------- defined in machine/opwolf.c -----------*/ -void opwolf_cchip_init(running_machine &machine); diff --git a/src/mame/includes/pcktgal.h b/src/mame/includes/pcktgal.h index fba07856af9..af5cfd5e552 100644 --- a/src/mame/includes/pcktgal.h +++ b/src/mame/includes/pcktgal.h @@ -19,4 +19,5 @@ public: UINT32 screen_update_pcktgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_pcktgalb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(pcktgal_adpcm_int); }; diff --git a/src/mame/includes/rastan.h b/src/mame/includes/rastan.h index a136ca4be70..bf545e80336 100644 --- a/src/mame/includes/rastan.h +++ b/src/mame/includes/rastan.h @@ -34,4 +34,5 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_rastan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(rastan_msm5205_vck); }; diff --git a/src/mame/includes/spdodgeb.h b/src/mame/includes/spdodgeb.h index 50422b9bf58..39f47b28021 100644 --- a/src/mame/includes/spdodgeb.h +++ b/src/mame/includes/spdodgeb.h @@ -51,4 +51,7 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); void mcu63705_update_inputs(); DECLARE_WRITE_LINE_MEMBER(irqhandler); + void spd_adpcm_int(device_t *device, int chip); + DECLARE_WRITE_LINE_MEMBER(spd_adpcm_int_1); + DECLARE_WRITE_LINE_MEMBER(spd_adpcm_int_2); }; diff --git a/src/mame/includes/splash.h b/src/mame/includes/splash.h index bbabf3b3cc1..909bca81afb 100644 --- a/src/mame/includes/splash.h +++ b/src/mame/includes/splash.h @@ -69,4 +69,8 @@ public: void splash_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void roldfrog_update_irq( ); + DECLARE_WRITE_LINE_MEMBER(splash_msm5205_int); + DECLARE_WRITE_LINE_MEMBER(ym_irq); + DECLARE_WRITE_LINE_MEMBER(adpcm_int1); + DECLARE_WRITE_LINE_MEMBER(adpcm_int2); }; diff --git a/src/mame/includes/srmp2.h b/src/mame/includes/srmp2.h index 9263df23a97..90597158030 100644 --- a/src/mame/includes/srmp2.h +++ b/src/mame/includes/srmp2.h @@ -50,4 +50,5 @@ public: UINT32 screen_update_srmp3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mjyuugi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT8 iox_key_matrix_calc(UINT8 p_side); + DECLARE_WRITE_LINE_MEMBER(srmp2_adpcm_int); }; diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index 1d8fce3b33a..0c9a6c3e7ae 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -51,7 +51,6 @@ public: DECLARE_WRITE8_MEMBER(stfight_adpcm_control_w); void set_pens(); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(stfight_adpcm_int); }; -/*----------- defined in machine/stfight.c -----------*/ -void stfight_adpcm_int(device_t *device, int st); diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index b1912762a02..483a32a5d9d 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -200,4 +200,6 @@ public: void set_fg_page( int data ); void set_bg_page( int data ); void datsu_set_pages( ); + DECLARE_WRITE_LINE_MEMBER(tturfbl_msm5205_callback); + DECLARE_WRITE_LINE_MEMBER(shdancbl_msm5205_callback); }; diff --git a/src/mame/includes/taito_l.h b/src/mame/includes/taito_l.h index 9b9e0ce5476..774f4eea35f 100644 --- a/src/mame/includes/taito_l.h +++ b/src/mame/includes/taito_l.h @@ -141,4 +141,5 @@ public: void taito_machine_reset(); void bank_w(address_space &space, offs_t offset, UINT8 data, int banknum ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(champwr_msm5205_vck); }; diff --git a/src/mame/includes/tbowl.h b/src/mame/includes/tbowl.h index 165a20823cb..cc5d0940982 100644 --- a/src/mame/includes/tbowl.h +++ b/src/mame/includes/tbowl.h @@ -55,4 +55,7 @@ public: UINT32 screen_update_tbowl_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void tbowl_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int xscroll, UINT8* spriteram); DECLARE_WRITE_LINE_MEMBER(irqhandler); + void tbowl_adpcm_int(device_t *device, int chip); + DECLARE_WRITE_LINE_MEMBER(tbowl_adpcm_int_1); + DECLARE_WRITE_LINE_MEMBER(tbowl_adpcm_int_2); }; diff --git a/src/mame/includes/tecmo.h b/src/mame/includes/tecmo.h index 82d4931b52c..478d8cb1029 100644 --- a/src/mame/includes/tecmo.h +++ b/src/mame/includes/tecmo.h @@ -51,4 +51,5 @@ public: UINT32 screen_update_tecmo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(tecmo_adpcm_int); }; diff --git a/src/mame/includes/tehkanwc.h b/src/mame/includes/tehkanwc.h index fd72f39fd6f..9beb2e784c3 100644 --- a/src/mame/includes/tehkanwc.h +++ b/src/mame/includes/tehkanwc.h @@ -50,4 +50,5 @@ public: TIMER_CALLBACK_MEMBER(reset_callback); void gridiron_draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 led,int player); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(tehkanwc_adpcm_int); }; diff --git a/src/mame/includes/toki.h b/src/mame/includes/toki.h index b12ded4068e..a4df2d029d6 100644 --- a/src/mame/includes/toki.h +++ b/src/mame/includes/toki.h @@ -42,4 +42,5 @@ public: UINT32 screen_update_tokib(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void toki_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void tokib_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(toki_adpcm_int); }; diff --git a/src/mame/includes/topspeed.h b/src/mame/includes/topspeed.h index 54924eae71e..ee45c3c5969 100644 --- a/src/mame/includes/topspeed.h +++ b/src/mame/includes/topspeed.h @@ -64,4 +64,7 @@ public: void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void parse_control( ) /* assumes Z80 sandwiched between 68Ks */; void reset_sound_region( ); + void topspeed_msm5205_clock(device_t *device, int chip); + DECLARE_WRITE_LINE_MEMBER(topspeed_msm5205_vck_1); + DECLARE_WRITE_LINE_MEMBER(topspeed_msm5205_vck_2); }; diff --git a/src/mame/includes/tubep.h b/src/mame/includes/tubep.h index c472090bf1a..227154ddc40 100644 --- a/src/mame/includes/tubep.h +++ b/src/mame/includes/tubep.h @@ -84,6 +84,7 @@ public: void draw_sprite(); void tubep_vblank_end(); void tubep_setup_save_state(); + DECLARE_WRITE_LINE_MEMBER(rjammer_adpcm_vck); }; diff --git a/src/mame/includes/wc90b.h b/src/mame/includes/wc90b.h index 116ecc5fde0..5cb29ca1792 100644 --- a/src/mame/includes/wc90b.h +++ b/src/mame/includes/wc90b.h @@ -42,4 +42,5 @@ public: UINT32 screen_update_wc90b(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); }; diff --git a/src/mame/includes/yunsung8.h b/src/mame/includes/yunsung8.h index a8b8d1a8b8e..92f39057e2b 100644 --- a/src/mame/includes/yunsung8.h +++ b/src/mame/includes/yunsung8.h @@ -40,4 +40,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_yunsung8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(yunsung8_adpcm_int); }; diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c index 26bbb2008d6..3574ef81a84 100644 --- a/src/mame/machine/stfight.c +++ b/src/mame/machine/stfight.c @@ -186,28 +186,27 @@ static const int sampleLimits[] = 0x7200 // (end of samples) }; -void stfight_adpcm_int(device_t *device, int st) +WRITE_LINE_MEMBER(stfight_state::stfight_adpcm_int) { - stfight_state *state = device->machine().driver_data(); - UINT8 *SAMPLES = state->memregion("adpcm")->base(); - int adpcm_data = SAMPLES[state->m_adpcm_data_offs & 0x7fff]; + UINT8 *SAMPLES = memregion("adpcm")->base(); + int adpcm_data = SAMPLES[m_adpcm_data_offs & 0x7fff]; // finished playing sample? - if( state->m_adpcm_data_offs == state->m_adpcm_data_end ) + if( m_adpcm_data_offs == m_adpcm_data_end ) { - msm5205_reset_w( device, 1 ); + msm5205_reset_w(machine().device("msm"), 1 ); return; } - if( state->m_toggle == 0 ) - msm5205_data_w( device, ( adpcm_data >> 4 ) & 0x0f ); + if( m_toggle == 0 ) + msm5205_data_w(machine().device("msm"), ( adpcm_data >> 4 ) & 0x0f ); else { - msm5205_data_w( device, adpcm_data & 0x0f ); - state->m_adpcm_data_offs++; + msm5205_data_w(machine().device("msm"), adpcm_data & 0x0f ); + m_adpcm_data_offs++; } - state->m_toggle ^= 1; + m_toggle ^= 1; } WRITE8_MEMBER(stfight_state::stfight_adpcm_control_w)