From 15fdafadd2721d16d28bfb7573a3a37ee5beeb00 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 9 Jun 2016 17:18:09 +0200 Subject: [PATCH] second-to-last gen_latch.cpp update (nw) --- src/mame/drivers/bbusters.cpp | 8 ++++-- src/mame/drivers/cabal.cpp | 17 +++++++----- src/mame/drivers/dmndrby.cpp | 11 +++++--- src/mame/drivers/go2000.cpp | 24 ++++++++++------- src/mame/drivers/goal92.cpp | 7 ++--- src/mame/drivers/goindol.cpp | 7 +++-- src/mame/drivers/kangaroo.cpp | 10 ++++--- src/mame/drivers/kncljoe.cpp | 15 +++++------ src/mame/drivers/lasso.cpp | 12 +++++---- src/mame/drivers/legionna.cpp | 4 ++- src/mame/drivers/mainsnk.cpp | 8 +++--- src/mame/drivers/munchmo.cpp | 8 +++--- src/mame/drivers/nyny.cpp | 27 +++++++++++++------ src/mame/drivers/prehisle.cpp | 6 +++-- src/mame/drivers/r2dtank.cpp | 18 +++++++++---- src/mame/drivers/segag80r.cpp | 8 +++--- src/mame/drivers/segahang.cpp | 7 ++--- src/mame/drivers/segajw.cpp | 15 ++++++++--- src/mame/drivers/segaorun.cpp | 7 ++--- src/mame/drivers/segas16a.cpp | 6 +++-- src/mame/drivers/segas16b.cpp | 19 ++++++++----- src/mame/drivers/segas18.cpp | 7 ++--- src/mame/drivers/segaxbd.cpp | 12 ++++----- src/mame/drivers/segaybd.cpp | 9 +++---- src/mame/drivers/seta.cpp | 50 ++++++++++++++++++++++++----------- src/mame/drivers/shangha3.cpp | 9 ++++--- src/mame/drivers/sigmab52.cpp | 8 ++++-- src/mame/drivers/snk.cpp | 38 +++++++++++++++++--------- src/mame/drivers/snk68.cpp | 15 ++++++----- src/mame/drivers/stv.cpp | 10 ++++--- src/mame/drivers/sub.cpp | 12 ++++++--- src/mame/drivers/suna16.cpp | 37 +++++++++++++++++--------- src/mame/drivers/suna8.cpp | 46 +++++++++++++++++++++----------- src/mame/drivers/suprloco.cpp | 6 +++-- src/mame/drivers/system1.cpp | 10 +++---- src/mame/drivers/system16.cpp | 34 +++++++++++++----------- src/mame/drivers/toki.cpp | 7 ++--- src/mame/drivers/wiz.cpp | 9 ++++--- src/mame/drivers/zaxxon.cpp | 7 +++-- src/mame/drivers/zn.cpp | 23 +++++++++++----- src/mame/includes/bbusters.h | 4 +++ src/mame/includes/goal92.h | 18 ++++++++----- src/mame/includes/kncljoe.h | 20 +++++++++----- src/mame/includes/lasso.h | 5 +++- src/mame/includes/legionna.h | 4 +++ src/mame/includes/mainsnk.h | 5 ++++ src/mame/includes/munchmo.h | 6 ++++- src/mame/includes/prehisle.h | 6 ++++- src/mame/includes/segag80r.h | 3 +++ src/mame/includes/segahang.h | 3 +++ src/mame/includes/segaorun.h | 3 +++ src/mame/includes/segas16a.h | 3 +++ src/mame/includes/segas16b.h | 3 +++ src/mame/includes/segas18.h | 3 +++ src/mame/includes/segaxbd.h | 17 ++---------- src/mame/includes/segaybd.h | 3 +++ src/mame/includes/seta.h | 6 +++++ src/mame/includes/shangha3.h | 4 +++ src/mame/includes/snk.h | 5 ++++ src/mame/includes/snk68.h | 12 ++++++--- src/mame/includes/stv.h | 5 +++- src/mame/includes/suna16.h | 4 +++ src/mame/includes/suna8.h | 6 +++++ src/mame/includes/suprloco.h | 5 ++++ src/mame/includes/system1.h | 4 +++ src/mame/includes/system16.h | 3 +++ src/mame/includes/toki.h | 6 ++++- src/mame/machine/seicop.cpp | 2 +- 68 files changed, 512 insertions(+), 249 deletions(-) diff --git a/src/mame/drivers/bbusters.cpp b/src/mame/drivers/bbusters.cpp index 2a04e850028..a856853fc5f 100644 --- a/src/mame/drivers/bbusters.cpp +++ b/src/mame/drivers/bbusters.cpp @@ -254,7 +254,7 @@ WRITE16_MEMBER(bbusters_state::sound_cpu_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data&0xff); + m_soundlatch->write(space, 0, data&0xff); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } @@ -375,7 +375,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, bbusters_state ) AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_WRITE(sound_status_w) + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(sound_status_w) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, bbusters_state ) @@ -684,6 +684,8 @@ static MACHINE_CONFIG_START( bbusters, bbusters_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM2610, 8000000) MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) @@ -723,6 +725,8 @@ static MACHINE_CONFIG_START( mechatt, bbusters_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM2608, 8000000) MCFG_YM2608_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) diff --git a/src/mame/drivers/cabal.cpp b/src/mame/drivers/cabal.cpp index b14eeb7e6f8..6a7629a5a6c 100644 --- a/src/mame/drivers/cabal.cpp +++ b/src/mame/drivers/cabal.cpp @@ -46,6 +46,7 @@ Dip locations verified with Fabtek manual for the trackball version #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/2151intf.h" #include "sound/msm5205.h" #include "includes/cabal.h" @@ -156,7 +157,7 @@ static ADDRESS_MAP_START( cabalbl_main_map, AS_PROGRAM, 16, cabal_state ) AM_RANGE(0xc0080, 0xc0081) AM_WRITE(flipscreen_w) AM_RANGE(0xe0000, 0xe07ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xe8000, 0xe8003) AM_WRITE(cabalbl_sndcmd_w) - AM_RANGE(0xe8004, 0xe8005) AM_READ(soundlatch2_word_r) + AM_RANGE(0xe8004, 0xe8005) AM_DEVREAD8("soundlatch", generic_latch_8_device, read, 0x00ff) AM_RANGE(0xe8008, 0xe8009) AM_WRITE(cabalbl_sound_irq_trigger_word_w) ADDRESS_MAP_END @@ -203,13 +204,13 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cabalbl_sound_map, AS_PROGRAM, 8, cabal_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x2fff) AM_RAM - AM_RANGE(0x4000, 0x4000) AM_WRITE(soundlatch3_byte_w) - AM_RANGE(0x4002, 0x4002) AM_WRITE(soundlatch4_byte_w) + AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) + AM_RANGE(0x4002, 0x4002) AM_DEVWRITE("soundlatch3", generic_latch_8_device, write) AM_RANGE(0x4004, 0x4004) AM_WRITE(cabalbl_coin_w) AM_RANGE(0x4006, 0x4006) AM_READ_PORT("COIN") AM_RANGE(0x4008, 0x4008) AM_READ(cabalbl_snd2_r) AM_RANGE(0x400a, 0x400a) AM_READ(cabalbl_snd1_r) - AM_RANGE(0x400c, 0x400c) AM_WRITE(soundlatch2_byte_w) + AM_RANGE(0x400c, 0x400c) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x400e, 0x400f) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) AM_RANGE(0x6000, 0x6000) AM_WRITENOP /* ??? */ AM_RANGE(0x8000, 0xffff) AM_ROM @@ -239,7 +240,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cabalbl_talk1_portmap, AS_IO, 8, cabal_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_byte_r) + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_RANGE(0x01, 0x01) AM_WRITE(cabalbl_1_adpcm_w) ADDRESS_MAP_END @@ -249,7 +250,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cabalbl_talk2_portmap, AS_IO, 8, cabal_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch4_byte_r) + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch3", generic_latch_8_device, read) AM_RANGE(0x01, 0x01) AM_WRITE(cabalbl_2_adpcm_w) ADDRESS_MAP_END @@ -561,6 +562,10 @@ static MACHINE_CONFIG_START( cabalbl, cabal_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_GENERIC_LATCH_8_ADD("soundlatch3") + MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* verified on pcb */ MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80) diff --git a/src/mame/drivers/dmndrby.cpp b/src/mame/drivers/dmndrby.cpp index 209ac140802..c95e8c04c87 100644 --- a/src/mame/drivers/dmndrby.cpp +++ b/src/mame/drivers/dmndrby.cpp @@ -54,6 +54,7 @@ DD10 DD14 DD18 H5 DD21 #include "emu.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "video/resnet.h" @@ -70,7 +71,8 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } required_shared_ptr m_scroll_ram; required_shared_ptr m_sprite_ram; @@ -93,12 +95,13 @@ public: required_device m_audiocpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; }; WRITE8_MEMBER(dmndrby_state::dderby_sound_w) { - soundlatch_byte_w(space,0,data); + m_soundlatch->write(space,0,data); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -158,7 +161,7 @@ static ADDRESS_MAP_START( dderby_sound_map, AS_PROGRAM, 8, dmndrby_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x1000, 0x1000) AM_RAM //??? AM_RANGE(0x4000, 0x4001) AM_DEVWRITE("ay1", ay8910_device, address_data_w) - AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r) + AM_RANGE(0x4000, 0x4000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x4001, 0x4001) AM_DEVREAD("ay1", ay8910_device, data_r) AM_RANGE(0x6000, 0x67ff) AM_RAM ADDRESS_MAP_END @@ -545,6 +548,8 @@ static MACHINE_CONFIG_START( dderby, dmndrby_state ) MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, 1789750) // frequency guessed MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) MACHINE_CONFIG_END diff --git a/src/mame/drivers/go2000.cpp b/src/mame/drivers/go2000.cpp index 5bb7a58f0a3..90391a01e20 100644 --- a/src/mame/drivers/go2000.cpp +++ b/src/mame/drivers/go2000.cpp @@ -4,7 +4,7 @@ Go 2000 - Korean Card game -Newer PCB, very sparce with newer surface mounted CPUs +Newer PCB, very sparse with newer surface mounted CPUs MC68EC000FU10 Z84C0006FEC @@ -34,6 +34,7 @@ Notes: #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/dac.h" class go2000_state : public driver_device @@ -43,33 +44,36 @@ public: : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_videoram2(*this, "videoram2"), - m_soundcpu(*this, "soundcpu"), m_maincpu(*this, "maincpu"), + m_soundcpu(*this, "soundcpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_videoram; required_shared_ptr m_videoram2; /* devices */ + required_device m_maincpu; required_device m_soundcpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_soundlatch; + DECLARE_WRITE16_MEMBER(sound_cmd_w); DECLARE_WRITE8_MEMBER(go2000_pcm_1_bankswitch_w); virtual void machine_start() override; virtual void video_start() override; UINT32 screen_update_go2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; }; WRITE16_MEMBER(go2000_state::sound_cmd_w) { - soundlatch_byte_w(space, offset, data & 0xff); + m_soundlatch->write(space, offset, data & 0xff); m_soundcpu->set_input_line(0, HOLD_LINE); } @@ -99,7 +103,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( go2000_sound_io, AS_IO, 8, go2000_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x00, 0x00) AM_DEVWRITE("dac1", dac_device, write_unsigned8) AM_RANGE(0x03, 0x03) AM_WRITE(go2000_pcm_1_bankswitch_w) ADDRESS_MAP_END @@ -352,6 +356,8 @@ static MACHINE_CONFIG_START( go2000, go2000_state ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_DAC_ADD("dac1") MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) diff --git a/src/mame/drivers/goal92.cpp b/src/mame/drivers/goal92.cpp index 1bb26dad975..26fc4e032ae 100644 --- a/src/mame/drivers/goal92.cpp +++ b/src/mame/drivers/goal92.cpp @@ -14,14 +14,13 @@ #include "cpu/m68000/m68000.h" #include "sound/2203intf.h" #include "sound/okim6295.h" -#include "sound/msm5205.h" #include "includes/goal92.h" WRITE16_MEMBER(goal92_state::goal92_sound_command_w) { if (ACCESSING_BITS_8_15) { - soundlatch_byte_w(space, 0, (data >> 8) & 0xff); + m_soundlatch->write(space, 0, (data >> 8) & 0xff); m_audiocpu->set_input_line(0, HOLD_LINE); } } @@ -89,7 +88,7 @@ static ADDRESS_MAP_START( sound_cpu, AS_PROGRAM, 8, goal92_state ) AM_RANGE(0xe800, 0xe801) AM_DEVREADWRITE("ym1", ym2203_device, read, write) AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE("ym2", ym2203_device, read, write) AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END static INPUT_PORTS_START( goal92 ) @@ -320,6 +319,8 @@ static MACHINE_CONFIG_START( goal92, goal92_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, 2500000/2) MCFG_YM2203_IRQ_HANDLER(WRITELINE(goal92_state, irqhandler)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/drivers/goindol.cpp b/src/mame/drivers/goindol.cpp index a47f1892c3c..6c1a76541ed 100644 --- a/src/mame/drivers/goindol.cpp +++ b/src/mame/drivers/goindol.cpp @@ -21,6 +21,7 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/2203intf.h" #include "includes/goindol.h" @@ -81,7 +82,7 @@ static ADDRESS_MAP_START( goindol_map, AS_PROGRAM, 8, goindol_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("ram") - AM_RANGE(0xc800, 0xc800) AM_READNOP AM_WRITE(soundlatch_byte_w) // watchdog? + AM_RANGE(0xc800, 0xc800) AM_READNOP AM_DEVWRITE("soundlatch", generic_latch_8_device, write) // watchdog? AM_RANGE(0xc810, 0xc810) AM_WRITE(goindol_bankswitch_w) AM_RANGE(0xc820, 0xc820) AM_READ_PORT("DIAL") AM_RANGE(0xc820, 0xd820) AM_WRITEONLY AM_SHARE("fg_scrolly") @@ -107,7 +108,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, goindol_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xa000, 0xa001) AM_DEVWRITE("ymsnd", ym2203_device, write) AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xd800, 0xd800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -256,6 +257,8 @@ static MACHINE_CONFIG_START( goindol, goindol_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/8) /* Confirmed pitch from recording */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END diff --git a/src/mame/drivers/kangaroo.cpp b/src/mame/drivers/kangaroo.cpp index 54ef454f871..c213279a5f8 100644 --- a/src/mame/drivers/kangaroo.cpp +++ b/src/mame/drivers/kangaroo.cpp @@ -158,6 +158,7 @@ #include "emu.h" #include "cpu/mb88xx/mb88xx.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/ay8910.h" #include "includes/kangaroo.h" @@ -256,7 +257,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, kangaroo_state ) AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_RANGE(0xe400, 0xe400) AM_MIRROR(0x03ff) AM_READ_PORT("DSW0") AM_RANGE(0xe800, 0xe80a) AM_MIRROR(0x03f0) AM_WRITE(kangaroo_video_control_w) AM_SHARE("video_control") - AM_RANGE(0xec00, 0xec00) AM_MIRROR(0x00ff) AM_READ_PORT("IN0") AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xec00, 0xec00) AM_MIRROR(0x00ff) AM_READ_PORT("IN0") AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xed00, 0xed00) AM_MIRROR(0x00ff) AM_READ_PORT("IN1") AM_WRITE(kangaroo_coin_counter_w) AM_RANGE(0xee00, 0xee00) AM_MIRROR(0x00ff) AM_READ_PORT("IN2") ADDRESS_MAP_END @@ -272,7 +273,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, kangaroo_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM - AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_byte_r) + AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE("aysnd", ay8910_device, data_w) AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE("aysnd", ay8910_device, address_w) ADDRESS_MAP_END @@ -282,7 +283,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, kangaroo_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM - AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_byte_r) + AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE("aysnd", ay8910_device, data_w) AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE("aysnd", ay8910_device, address_w) ADDRESS_MAP_END @@ -447,6 +448,9 @@ static MACHINE_CONFIG_START( nomcu, kangaroo_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, MASTER_CLOCK/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/kncljoe.cpp b/src/mame/drivers/kncljoe.cpp index 4b52111a3b9..2343e57c5c6 100644 --- a/src/mame/drivers/kncljoe.cpp +++ b/src/mame/drivers/kncljoe.cpp @@ -30,7 +30,6 @@ Updates: #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m6800/m6800.h" -#include "sound/ay8910.h" #include "sound/sn76496.h" #include "includes/kncljoe.h" @@ -38,7 +37,7 @@ Updates: WRITE8_MEMBER(kncljoe_state::sound_cmd_w) { if ((data & 0x80) == 0) - soundlatch_byte_w(space, 0, data & 0x7f); + m_soundlatch->write(space, 0, data & 0x7f); else m_soundcpu->set_input_line(0, ASSERT_LINE); } @@ -70,24 +69,20 @@ WRITE8_MEMBER(kncljoe_state::m6803_port1_w) WRITE8_MEMBER(kncljoe_state::m6803_port2_w) { - ay8910_device *ay8910 = machine().device("aysnd"); - /* write latch */ if ((m_port2 & 0x01) && !(data & 0x01)) { /* control or data port? */ if (m_port2 & 0x08) - ay8910->data_address_w(space, m_port2 >> 2, m_port1); + m_ay8910->data_address_w(space, m_port2 >> 2, m_port1); } m_port2 = data; } READ8_MEMBER(kncljoe_state::m6803_port1_r) { - ay8910_device *ay8910 = machine().device("aysnd"); - if (m_port2 & 0x08) - return ay8910->data_r(space, 0); + return m_ay8910->data_r(space, 0); return 0xff; } @@ -286,8 +281,10 @@ static MACHINE_CONFIG_START( kncljoe, kncljoe_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(kncljoe_state, unused_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) diff --git a/src/mame/drivers/lasso.cpp b/src/mame/drivers/lasso.cpp index f8048f908de..77b0c1d8ac8 100644 --- a/src/mame/drivers/lasso.cpp +++ b/src/mame/drivers/lasso.cpp @@ -48,7 +48,7 @@ INPUT_CHANGED_MEMBER(lasso_state::coin_inserted) /* Write to the sound latch and generate an IRQ on the sound CPU */ WRITE8_MEMBER(lasso_state::sound_command_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -93,7 +93,7 @@ static ADDRESS_MAP_START( lasso_audio_map, AS_PROGRAM, 8, lasso_state ) AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_SHARE("chip_data") AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w) AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r) - AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_byte_r) + AM_RANGE(0xb005, 0xb005) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("audiocpu", 0x7000) ADDRESS_MAP_END @@ -131,7 +131,7 @@ static ADDRESS_MAP_START( chameleo_audio_map, AS_PROGRAM, 8, lasso_state ) AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_SHARE("chip_data") AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w) AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r) - AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_byte_r) + AM_RANGE(0xb005, 0xb005) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("audiocpu", 0x7000) ADDRESS_MAP_END @@ -162,7 +162,7 @@ static ADDRESS_MAP_START( wwjgtin_audio_map, AS_PROGRAM, 8, lasso_state ) AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w) AM_RANGE(0xb003, 0xb003) AM_DEVWRITE("dac", dac_device, write_unsigned8) AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r) - AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_byte_r) + AM_RANGE(0xb005, 0xb005) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -196,7 +196,7 @@ static ADDRESS_MAP_START( pinbo_audio_io_map, AS_IO, 8, lasso_state ) AM_RANGE(0x02, 0x02) AM_DEVREAD("ay1", ay8910_device, data_r) AM_RANGE(0x04, 0x05) AM_DEVWRITE("ay2", ay8910_device, address_data_w) AM_RANGE(0x06, 0x06) AM_DEVREAD("ay2", ay8910_device, data_r) - AM_RANGE(0x08, 0x08) AM_READ(soundlatch_byte_r) AM_WRITENOP /* ??? */ + AM_RANGE(0x08, 0x08) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITENOP /* ??? */ AM_RANGE(0x14, 0x14) AM_WRITENOP /* ??? */ ADDRESS_MAP_END @@ -503,6 +503,8 @@ static MACHINE_CONFIG_START( base, lasso_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("sn76489.1", SN76489, 2000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/legionna.cpp b/src/mame/drivers/legionna.cpp index b8fcdc151c4..e83b0aebfc1 100644 --- a/src/mame/drivers/legionna.cpp +++ b/src/mame/drivers/legionna.cpp @@ -398,7 +398,7 @@ static ADDRESS_MAP_START( cupsocbl_sound_mem, AS_PROGRAM, 8, legionna_state ) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x9000, 0x9000) AM_WRITE(okim_rombank_w) AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END /*****************************************************************************/ @@ -1500,6 +1500,8 @@ static MACHINE_CONFIG_START( cupsocbl, legionna_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", 1000000, OKIM6295_PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/mainsnk.cpp b/src/mame/drivers/mainsnk.cpp index 29ba1642308..c75e8ebda0f 100644 --- a/src/mame/drivers/mainsnk.cpp +++ b/src/mame/drivers/mainsnk.cpp @@ -74,7 +74,7 @@ Canvas Croquis, SNK 1984 Note: The bproms(MB7054) was read as 74s572. -I have not tested this PCB yet so i have no idea if it's workin. +I have not tested this PCB yet so I have no idea if it's working. All Bproms and P1-P8 is on top pcb, P9-P14 on bottom board, see pictures. Documentation: @@ -123,7 +123,7 @@ void mainsnk_state::machine_start() WRITE8_MEMBER(mainsnk_state::sound_command_w) { m_sound_cpu_busy = 1; - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -159,7 +159,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, mainsnk_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xc000, 0xc000) AM_READ(sound_ack_r) AM_RANGE(0xe000, 0xe001) AM_DEVWRITE("ay1", ay8910_device, address_data_w) AM_RANGE(0xe002, 0xe003) AM_WRITENOP // ? always FFFF, snkwave leftover? @@ -412,6 +412,8 @@ static MACHINE_CONFIG_START( mainsnk, mainsnk_state ) MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, 2000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) diff --git a/src/mame/drivers/munchmo.cpp b/src/mame/drivers/munchmo.cpp index 86d5c2e0669..24a4d96cd49 100644 --- a/src/mame/drivers/munchmo.cpp +++ b/src/mame/drivers/munchmo.cpp @@ -58,7 +58,7 @@ INTERRUPT_GEN_MEMBER(munchmo_state::mnchmobl_sound_irq) WRITE8_MEMBER(munchmo_state::mnchmobl_soundlatch_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(0, HOLD_LINE ); } @@ -114,7 +114,7 @@ ADDRESS_MAP_END /* memory map provided thru schematics */ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, munchmo_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x3fff) AM_READ(soundlatch_byte_r) + AM_RANGE(0x2000, 0x3fff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x4000, 0x4fff) AM_DEVWRITE("ay1", ay8910_device, data_w) AM_RANGE(0x5000, 0x5fff) AM_DEVWRITE("ay1", ay8910_device, address_w) AM_RANGE(0x6000, 0x6fff) AM_DEVWRITE("ay2", ay8910_device, data_w) @@ -345,7 +345,9 @@ static MACHINE_CONFIG_START( mnchmobl, munchmo_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - /* AY clock speeds confirmed to match known recording */ + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + + /* AY clock speeds confirmed to match known recording */ MCFG_SOUND_ADD("ay1", AY8910, XTAL_15MHz/4/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) diff --git a/src/mame/drivers/nyny.cpp b/src/mame/drivers/nyny.cpp index 3bd05899748..85e18877188 100644 --- a/src/mame/drivers/nyny.cpp +++ b/src/mame/drivers/nyny.cpp @@ -28,7 +28,7 @@ * The Crosshatch switch only works on the title screen * The Service Mode switch, which displays the total number of credits stored in the NVRAM, only works on the "Start Game" - screen after a coin has been insered. Hold down the key to + screen after a coin has been inserted. Hold down the key to display the coin count * The schematics mixed up port A and B on both AY-8910 @@ -72,6 +72,7 @@ #include "cpu/m6809/m6809.h" #include "sound/ay8910.h" #include "sound/dac.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" @@ -100,7 +101,10 @@ public: m_mc6845(*this, "crtc"), m_palette(*this, "palette"), m_pia1(*this, "pia1"), - m_pia2(*this, "pia2") { } + m_pia2(*this, "pia2"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2"), + m_soundlatch3(*this, "soundlatch3") { } /* memory pointers */ required_shared_ptr m_videoram1; @@ -123,6 +127,9 @@ public: required_device m_palette; required_device m_pia1; required_device m_pia2; + required_device m_soundlatch; + required_device m_soundlatch2; + required_device m_soundlatch3; DECLARE_WRITE8_MEMBER(audio_1_command_w); DECLARE_WRITE8_MEMBER(audio_1_answer_w); @@ -355,14 +362,14 @@ WRITE_LINE_MEMBER(nyny_state::display_enable_changed) WRITE8_MEMBER(nyny_state::audio_1_command_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(M6800_IRQ_LINE, HOLD_LINE); } WRITE8_MEMBER(nyny_state::audio_1_answer_w) { - soundlatch3_byte_w(space, 0, data); + m_soundlatch3->write(space, 0, data); m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); } @@ -382,7 +389,7 @@ WRITE8_MEMBER(nyny_state::nyny_ay8910_37_port_a_w) WRITE8_MEMBER(nyny_state::audio_2_command_w) { - soundlatch2_byte_w(space, 0, (data & 0x60) >> 5); + m_soundlatch2->write(space, 0, (data & 0x60) >> 5); m_audiocpu2->set_input_line(M6800_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); } @@ -424,7 +431,7 @@ static ADDRESS_MAP_START( nyny_main_map, AS_PROGRAM, 8, nyny_state ) AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x00fe) AM_DEVWRITE("crtc", mc6845_device, address_w) AM_RANGE(0xa101, 0xa101) AM_MIRROR(0x00fe) AM_DEVWRITE("crtc", mc6845_device, register_w) AM_RANGE(0xa200, 0xa20f) AM_MIRROR(0x00f0) AM_READWRITE(nyny_pia_1_2_r, nyny_pia_1_2_w) - AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x00ff) AM_READ(soundlatch3_byte_r) AM_WRITE(audio_1_command_w) + AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x00ff) AM_DEVREAD("soundlatch3", generic_latch_8_device, read) AM_WRITE(audio_1_command_w) AM_RANGE(0xa400, 0xa7ff) AM_NOP AM_RANGE(0xa800, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM @@ -436,7 +443,7 @@ static ADDRESS_MAP_START( nyny_audio_1_map, AS_PROGRAM, 8, nyny_state ) ADDRESS_MAP_GLOBAL_MASK(0x7fff) AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ AM_RANGE(0x0080, 0x0fff) AM_NOP - AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch_byte_r) AM_WRITE(audio_1_answer_w) + AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(audio_1_answer_w) AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0fff) AM_READ_PORT("SW3") AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffc) AM_DEVREAD("ay1", ay8910_device, data_r) AM_RANGE(0x3000, 0x3001) AM_MIRROR(0x0ffc) AM_DEVWRITE("ay1", ay8910_device, data_address_w) @@ -453,7 +460,7 @@ static ADDRESS_MAP_START( nyny_audio_2_map, AS_PROGRAM, 8, nyny_state ) ADDRESS_MAP_GLOBAL_MASK(0x7fff) AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ AM_RANGE(0x0080, 0x0fff) AM_NOP - AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch2_byte_r) + AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD("ay3", ay8910_device, data_r) AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x0ffe) AM_DEVWRITE("ay3", ay8910_device, data_address_w) AM_RANGE(0x3000, 0x6fff) AM_NOP @@ -632,6 +639,10 @@ static MACHINE_CONFIG_START( nyny, nyny_state ) /* audio hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_GENERIC_LATCH_8_ADD("soundlatch3") + MCFG_SOUND_ADD("ay1", AY8910, AUDIO_CPU_1_CLOCK) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(nyny_state, nyny_ay8910_37_port_a_w)) MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("dac", dac_device, write_unsigned8)) diff --git a/src/mame/drivers/prehisle.cpp b/src/mame/drivers/prehisle.cpp index 7a384a033cb..1bca554476d 100644 --- a/src/mame/drivers/prehisle.cpp +++ b/src/mame/drivers/prehisle.cpp @@ -20,7 +20,7 @@ WRITE16_MEMBER(prehisle_state::soundcmd_w) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -55,7 +55,7 @@ WRITE8_MEMBER(prehisle_state::D7759_upd_reset_w) static ADDRESS_MAP_START( prehisle_sound_map, AS_PROGRAM, 8, prehisle_state ) AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf800, 0xf800) AM_WRITENOP // ??? ADDRESS_MAP_END @@ -220,6 +220,8 @@ static MACHINE_CONFIG_START( prehisle, prehisle_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* verified on pcb */ MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/r2dtank.cpp b/src/mame/drivers/r2dtank.cpp index 135fe3e83a8..771bf1a6500 100644 --- a/src/mame/drivers/r2dtank.cpp +++ b/src/mame/drivers/r2dtank.cpp @@ -40,6 +40,7 @@ RAM = 4116 (x11) #include "cpu/m6800/m6800.h" #include "cpu/m6809/m6809.h" #include "sound/ay8910.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" @@ -58,7 +59,9 @@ public: m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_palette(*this, "palette"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2") { } required_shared_ptr m_videoram; required_shared_ptr m_colorram; @@ -86,6 +89,8 @@ public: required_device m_maincpu; required_device m_palette; required_device m_audiocpu; + required_device m_soundlatch; + required_device m_soundlatch2; }; @@ -126,7 +131,7 @@ WRITE_LINE_MEMBER(r2dtank_state::main_cpu_irq) READ8_MEMBER(r2dtank_state::audio_command_r) { - UINT8 ret = soundlatch_byte_r(space, 0); + UINT8 ret = m_soundlatch->read(space, 0); if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Command Read: %x\n", space.device().safe_pc(), ret); @@ -136,7 +141,7 @@ if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Command Read: %x\n", space.devi WRITE8_MEMBER(r2dtank_state::audio_command_w) { - soundlatch_byte_w(space, 0, ~data); + m_soundlatch->write(space, 0, ~data); m_audiocpu->set_input_line(M6800_IRQ_LINE, HOLD_LINE); if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Command Write: %x\n", space.device().safe_pc(), data^0xff); @@ -145,7 +150,7 @@ if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Command Write: %x\n", space.de READ8_MEMBER(r2dtank_state::audio_answer_r) { - UINT8 ret = soundlatch2_byte_r(space, 0); + UINT8 ret = m_soundlatch2->read(space, 0); if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Answer Read: %x\n", space.device().safe_pc(), ret); return ret; @@ -158,7 +163,7 @@ WRITE8_MEMBER(r2dtank_state::audio_answer_w) if (space.device().safe_pc() == 0xfb12) data = 0x00; - soundlatch2_byte_w(space, 0, data); + m_soundlatch2->write(space, 0, data); m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Answer Write: %x\n", space.device().safe_pc(), data); @@ -484,6 +489,9 @@ static MACHINE_CONFIG_START( r2dtank, r2dtank_state ) /* audio hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ay1", AY8910, (4000000 / 4)) MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWB")) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/drivers/segag80r.cpp b/src/mame/drivers/segag80r.cpp index bc79d600800..ce6bfb195c5 100644 --- a/src/mame/drivers/segag80r.cpp +++ b/src/mame/drivers/segag80r.cpp @@ -77,7 +77,7 @@ **************************************************************************** - See also sega.c for the Sega G-80 Vector games. + See also segag80v.cpp for the Sega G-80 Vector games. Many thanks go to Dave Fish for the fine detective work he did into the G-80 security chips (315-0064, 315-0070, 315-0076, 315-0082) which provided @@ -283,7 +283,7 @@ WRITE8_MEMBER(segag80r_state::coin_count_w) WRITE8_MEMBER(segag80r_state::sindbadm_soundport_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); } @@ -371,7 +371,7 @@ static ADDRESS_MAP_START( sindbadm_sound_map, AS_PROGRAM, 8, segag80r_state ) AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x1800) AM_RAM AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1ffc) AM_WRITE(sindbadm_sn1_SN76496_w) AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ffc) AM_WRITE(sindbadm_sn2_SN76496_w) - AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -933,6 +933,8 @@ static MACHINE_CONFIG_DERIVED( sindbadm, g80r_base ) MCFG_CPU_PROGRAM_MAP(sindbadm_sound_map) MCFG_CPU_PERIODIC_INT_DRIVER(segag80r_state, irq0_line_hold, 4*60) + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_SOUND_ADD("sn1", SN76496, SINDBADM_SOUND_CLOCK/4) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp index f75a5af5631..2fa93f1db11 100644 --- a/src/mame/drivers/segahang.cpp +++ b/src/mame/drivers/segahang.cpp @@ -17,7 +17,6 @@ #include "emu.h" #include "includes/segahang.h" -#include "machine/segaic16.h" #include "machine/fd1089.h" #include "machine/fd1094.h" #include "sound/2203intf.h" @@ -306,7 +305,7 @@ READ8_MEMBER( segahang_state::sound_data_r ) { // assert ACK m_i8255_1->pc6_w(CLEAR_LINE); - return soundlatch_read(); + return m_soundlatch->read(space, 0); } @@ -775,7 +774,7 @@ static MACHINE_CONFIG_START( shared_base, segahang_state ) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) MCFG_DEVICE_ADD("i8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(driver_device, soundlatch_byte_w)) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("soundlatch", generic_latch_8_device, write)) MCFG_I8255_OUT_PORTB_CB(WRITE8(segahang_state, video_lamps_w)) MCFG_I8255_OUT_PORTC_CB(WRITE8(segahang_state, tilemap_sound_w)) @@ -795,6 +794,8 @@ static MACHINE_CONFIG_START( shared_base, segahang_state ) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224) MCFG_SCREEN_UPDATE_DRIVER(segahang_state, screen_update) MCFG_SCREEN_PALETTE("palette") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") MACHINE_CONFIG_END diff --git a/src/mame/drivers/segajw.cpp b/src/mame/drivers/segajw.cpp index a58adaa4e5a..fa372b4ea55 100644 --- a/src/mame/drivers/segajw.cpp +++ b/src/mame/drivers/segajw.cpp @@ -30,6 +30,7 @@ Also seem to be running on the same/similar hardware: #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "sound/2612intf.h" #include "video/hd63484.h" @@ -43,7 +44,8 @@ public: segajw_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") + m_audiocpu(*this, "audiocpu"), + m_soundlatch(*this, "soundlatch") { } DECLARE_READ16_MEMBER(coin_counter_r); @@ -64,6 +66,7 @@ protected: // devices required_device m_maincpu; required_device m_audiocpu; + required_device m_soundlatch; // driver_device overrides virtual void machine_start() override; @@ -131,7 +134,7 @@ WRITE16_MEMBER(segajw_state::coinlockout_w) WRITE8_MEMBER(segajw_state::audiocpu_cmd_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -190,7 +193,7 @@ static ADDRESS_MAP_START( segajw_map, AS_PROGRAM, 16, segajw_state ) AM_RANGE(0x080002, 0x080003) AM_DEVREADWRITE("hd63484", hd63484_device, data_r, data_w) AM_RANGE(0x180000, 0x180001) AM_READ_PORT("DSW0") - AM_RANGE(0x180004, 0x180005) AM_READWRITE8(soundlatch2_byte_r, audiocpu_cmd_w, 0x00ff) + AM_RANGE(0x180004, 0x180005) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) AM_WRITE8(audiocpu_cmd_w, 0x00ff) AM_RANGE(0x180008, 0x180009) AM_READ_PORT("DSW1") AM_RANGE(0x18000a, 0x18000b) AM_READ_PORT("DSW3") AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("DSW2") @@ -223,7 +226,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( segajw_audiocpu_io_map, AS_IO, 8, segajw_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ymsnd", ym3438_device, read, write) - AM_RANGE(0xc0, 0xc0) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( segajw_hd63484_map, AS_0, 16, segajw_state ) @@ -416,6 +419,10 @@ static MACHINE_CONFIG_START( segajw, segajw_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM3438, 8000000) // unknown clock MCFG_YM2612_IRQ_HANDLER(INPUTLINE("maincpu", 5)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) diff --git a/src/mame/drivers/segaorun.cpp b/src/mame/drivers/segaorun.cpp index a07de247de8..a3e33761331 100644 --- a/src/mame/drivers/segaorun.cpp +++ b/src/mame/drivers/segaorun.cpp @@ -274,7 +274,6 @@ Notes: #include "emu.h" #include "includes/segaorun.h" #include "machine/fd1089.h" -#include "machine/segaic16.h" #include "sound/2151intf.h" #include "sound/segapcm.h" #include "includes/segaipt.h" @@ -550,7 +549,7 @@ WRITE16_MEMBER( segaorun_state::nop_w ) READ8_MEMBER( segaorun_state::sound_data_r ) { m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return soundlatch_read(); + return m_soundlatch->read(space, 0); } @@ -587,7 +586,7 @@ void segaorun_state::device_timer(emu_timer &timer, device_timer_id id, int para switch (id) { case TID_SOUND_WRITE: - soundlatch_write(param); + m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, param); m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); break; @@ -1197,6 +1196,8 @@ static MACHINE_CONFIG_START( outrun_base, segaorun_state ) // sound hardware MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", SOUND_CLOCK/4) MCFG_SOUND_ROUTE(0, "lspeaker", 0.43) MCFG_SOUND_ROUTE(1, "rspeaker", 0.43) diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp index caed5dd589b..daece602870 100644 --- a/src/mame/drivers/segas16a.cpp +++ b/src/mame/drivers/segas16a.cpp @@ -315,7 +315,7 @@ READ8_MEMBER( segas16a_state::sound_data_r ) { // assert ACK m_i8255->pc6_w(CLEAR_LINE); - return soundlatch_read(); + return m_soundlatch->read(space, 0); } @@ -1911,7 +1911,7 @@ static MACHINE_CONFIG_START( system16a, segas16a_state ) MCFG_WATCHDOG_ADD("watchdog") MCFG_DEVICE_ADD("i8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(driver_device, soundlatch_byte_w)) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("soundlatch", generic_latch_8_device, write)) MCFG_I8255_OUT_PORTB_CB(WRITE8(segas16a_state, misc_control_w)) MCFG_I8255_OUT_PORTC_CB(WRITE8(segas16a_state, tilemap_sound_w)) @@ -1933,6 +1933,8 @@ static MACHINE_CONFIG_START( system16a, segas16a_state ) // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", 4000000) MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(segas16a_state, n7751_control_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.43) diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index 171530fa06e..1e71a6afb92 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -870,7 +870,6 @@ S11 S13 S15 S17 |EPR12194 - - - EPR12195 - - #include "emu.h" #include "includes/segas16b.h" -#include "machine/segaic16.h" #include "machine/mc8123.h" #include "includes/segaipt.h" #include "sound/okim6295.h" @@ -983,7 +982,8 @@ UINT8 segas16b_state::mapper_sound_r() void segas16b_state::mapper_sound_w(UINT8 data) { - soundlatch_write(data & 0xff); + if (m_soundlatch != nullptr) + m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, data & 0xff); if (m_soundcpu != nullptr) m_soundcpu->set_input_line(0, HOLD_LINE); } @@ -1775,7 +1775,7 @@ static ADDRESS_MAP_START( lockonph_map, AS_PROGRAM, 16, segas16b_state ) AM_RANGE(0xC42000, 0xC42001) AM_READ_PORT("DSW1") AM_RANGE(0xC42002, 0xC42003) AM_READ_PORT("DSW2") - AM_RANGE(0x777706, 0x777707) AM_WRITE(sound_w16) // AM_WRITE8(soundlatch_byte_w, 0xff00) + AM_RANGE(0x777706, 0x777707) AM_WRITE(sound_w16) // AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0xff00) AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("workram") ADDRESS_MAP_END @@ -1810,7 +1810,7 @@ ADDRESS_MAP_END */ static ADDRESS_MAP_START( fpointbl_sound_map, AS_PROGRAM, 8, segas16b_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -1834,7 +1834,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segas16b_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xdfff) AM_ROMBANK("soundbank") - AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe800, 0xe800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -1850,7 +1850,7 @@ static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segas16b_state ) AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE("ym2151", ym2151_device, read, write) AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_WRITE(upd7759_control_w) AM_RANGE(0x80, 0x80) AM_MIRROR(0x3f) AM_READ(upd7759_status_r) AM_DEVWRITE("upd", upd7759_device, port_w) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END // similar to whizz / other philko games in sidearms.cpp, but with the m6295 @@ -1865,7 +1865,7 @@ static ADDRESS_MAP_START( lockonph_sound_iomap, AS_IO, 8, segas16b_state ) AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) AM_RANGE(0x40, 0x40) AM_WRITENOP // ?? AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -3606,6 +3606,8 @@ static MACHINE_CONFIG_START( system16b, segas16b_state ) // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ym2151", MASTER_CLOCK_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.43) @@ -3755,6 +3757,8 @@ static MACHINE_CONFIG_START( lockonph, segas16b_state ) // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", XTAL_16MHz/4) // ?? // MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0)) // does set up the timer, but end up with no sound? MCFG_SOUND_ROUTE(0, "mono", 0.5) @@ -3779,6 +3783,7 @@ static MACHINE_CONFIG_DERIVED( atomicp, system16b ) // 10MHz CPU Clock verified MCFG_DEVICE_REMOVE("sprites") // sound hardware + MCFG_DEVICE_REMOVE("soundlatch") MCFG_DEVICE_REMOVE("ym2151") MCFG_SOUND_ADD("ym2413", YM2413, XTAL_20MHz/4) // 20MHz OSC divided by 4 (verified) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/segas18.cpp b/src/mame/drivers/segas18.cpp index 0dbb04eb3cf..67f94791302 100644 --- a/src/mame/drivers/segas18.cpp +++ b/src/mame/drivers/segas18.cpp @@ -30,7 +30,6 @@ ***************************************************************************/ #include "emu.h" -#include "machine/segaic16.h" #include "machine/nvram.h" #include "includes/segas18.h" #include "sound/2612intf.h" @@ -129,7 +128,7 @@ UINT8 segas18_state::mapper_sound_r() void segas18_state::mapper_sound_w(UINT8 data) { - soundlatch_write(data & 0xff); + m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, data & 0xff); m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -551,7 +550,7 @@ static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segas18_state ) AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE("ym1", ym3438_device, read, write) AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE("ym2", ym3438_device, read, write) AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(soundbank_w) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_READ(soundlatch_byte_r) AM_WRITE(mcu_data_w) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(mcu_data_w) ADDRESS_MAP_END @@ -1251,6 +1250,8 @@ static MACHINE_CONFIG_START( system18, segas18_state ) // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM3438, 8000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_YM2612_IRQ_HANDLER(WRITELINE(segas18_state, ym3438_irq_handler)) diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 87c7cf2983a..361193da404 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -261,10 +261,7 @@ ROMs: ***************************************************************************/ #include "emu.h" -#include "cpu/z80/z80.h" #include "includes/segaxbd.h" -#include "cpu/m68000/m68000.h" -#include "machine/segaic16.h" #include "machine/nvram.h" #include "sound/2151intf.h" #include "sound/segapcm.h" @@ -284,6 +281,7 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, dev m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), m_segaic16road(*this, "segaic16road"), + m_soundlatch(*this, "soundlatch"), m_subram0(*this, "subram0"), m_road_priority(1), m_scanline_timer(nullptr), @@ -300,8 +298,6 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, dev memset(m_adc_reverse, 0, sizeof(m_adc_reverse)); memset(m_iochip_regs, 0, sizeof(m_iochip_regs)); palette_init(); - memset(m_latched_value, 0, sizeof(m_latched_value)); - memset(m_latch_read, 0, sizeof(m_latch_read)); } @@ -773,7 +769,7 @@ WRITE16_MEMBER( segaxbd_state::smgp_excs_w ) READ8_MEMBER( segaxbd_state::sound_data_r ) { m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return soundlatch_read(); + return m_soundlatch->read(space, 0); } @@ -791,7 +787,7 @@ void segaxbd_state::device_timer(emu_timer &timer, device_timer_id id, int param switch (id) { case TID_SOUND_WRITE: - soundlatch_write(param); + m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, param); m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); // if an extra sound board is attached, do an nmi there as well @@ -1858,6 +1854,8 @@ static MACHINE_CONFIG_FRAGMENT( xboard ) // sound hardware MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", SOUND_CLOCK/4) MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.43) diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp index ad60759a7d4..54212cb0da8 100644 --- a/src/mame/drivers/segaybd.cpp +++ b/src/mame/drivers/segaybd.cpp @@ -57,11 +57,8 @@ MB89372 - Uses 3 serial data transfer protocols: ASYNC, COP & BOP. Has a built ***************************************************************************/ #include "emu.h" -#include "cpu/z80/z80.h" #include "includes/segaybd.h" -#include "cpu/m68000/m68000.h" #include "machine/mb8421.h" -#include "machine/segaic16.h" #include "machine/nvram.h" #include "sound/2151intf.h" #include "sound/segapcm.h" @@ -257,7 +254,7 @@ WRITE16_MEMBER( segaybd_state::sound_data_w ) READ8_MEMBER( segaybd_state::sound_data_r ) { m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return soundlatch_read(); + return m_soundlatch->read(space, 0); } @@ -373,7 +370,7 @@ void segaybd_state::device_timer(emu_timer &timer, device_timer_id id, int param break; case TID_SOUND_WRITE: - soundlatch_write(param); + m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, param); m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); break; @@ -1409,6 +1406,8 @@ static MACHINE_CONFIG_START( yboard, segaybd_state ) // sound hardware MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", SOUND_CLOCK/8) MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.43) diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index a40c080e356..d86d44cffa2 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -1559,11 +1559,11 @@ WRITE16_MEMBER(seta_state::sub_ctrl_w) break; case 4/2: // not sure - if (ACCESSING_BITS_0_7) soundlatch_byte_w(space, 0, data & 0xff); + if (ACCESSING_BITS_0_7) if(m_soundlatch != nullptr) m_soundlatch->write(space, 0, data & 0xff); break; case 6/2: // not sure - if (ACCESSING_BITS_0_7) soundlatch2_byte_w(space, 0, data & 0xff); + if (ACCESSING_BITS_0_7) if(m_soundlatch2 != nullptr) m_soundlatch2->write(space, 0, data & 0xff); break; } @@ -1708,7 +1708,7 @@ WRITE16_MEMBER(seta_state::calibr50_soundlatch_w) { if (ACCESSING_BITS_0_7) { - soundlatch_word_w(space, 0, data, mem_mask); + m_soundlatch->write(space, 0, data & 0xff); m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); space.device().execute().spin_until_time(attotime::from_usec(50)); // Allow the other cpu to reply } @@ -1733,7 +1733,7 @@ static ADDRESS_MAP_START( calibr50_map, AS_PROGRAM, 16, seta_state ) /**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r16, spriteylow_w16) // Sprites Y AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr - AM_RANGE(0xb00000, 0xb00001) AM_READ(soundlatch2_word_r) AM_WRITE(calibr50_soundlatch_w) // From Sub CPU + AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) AM_WRITE(calibr50_soundlatch_w) // From Sub CPU /**/AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? $4000 ADDRESS_MAP_END @@ -2890,7 +2890,7 @@ WRITE16_MEMBER(seta_state::utoukond_soundlatch_w) if (ACCESSING_BITS_0_7) { m_audiocpu->set_input_line(0, HOLD_LINE); - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); } } @@ -3145,8 +3145,8 @@ READ8_MEMBER(seta_state::ff_r){return 0xff;} static ADDRESS_MAP_START( tndrcade_sub_map, AS_PROGRAM, 8, seta_state ) AM_RANGE(0x0000, 0x01ff) AM_RAM // RAM AM_RANGE(0x0800, 0x0800) AM_READ(ff_r) // ? (bits 0/1/2/3: 1 -> do test 0-ff/100-1e0/5001-57ff/banked rom) - //AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r) // - //AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r) // + //AM_RANGE(0x0800, 0x0800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // + //AM_RANGE(0x0801, 0x0801) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1") // P1 AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w) // ROM Bank + Coin Lockout AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2") // P2 @@ -3166,8 +3166,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( twineagl_sub_map, AS_PROGRAM, 8, seta_state ) AM_RANGE(0x0000, 0x01ff) AM_RAM // RAM - AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r) // - AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r) // + AM_RANGE(0x0800, 0x0800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // + AM_RANGE(0x0801, 0x0801) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1") // P1 AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w) // ROM Bank + Coin Lockout AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2") // P2 @@ -3208,8 +3208,8 @@ READ8_MEMBER(seta_state::downtown_ip_r) static ADDRESS_MAP_START( downtown_sub_map, AS_PROGRAM, 8, seta_state ) AM_RANGE(0x0000, 0x01ff) AM_RAM // RAM - AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r) // - AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r) // + AM_RANGE(0x0800, 0x0800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // + AM_RANGE(0x0801, 0x0801) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // AM_RANGE(0x1000, 0x1007) AM_READ(downtown_ip_r) // Input Ports AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w) // ROM Bank + Coin Lockout AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("sharedram") // Shared RAM @@ -3231,13 +3231,13 @@ MACHINE_RESET_MEMBER(seta_state,calibr50) WRITE8_MEMBER(seta_state::calibr50_soundlatch2_w) { - soundlatch2_byte_w(space,0,data); + m_soundlatch2->write(space,0,data); space.device().execute().spin_until_time(attotime::from_usec(50)); // Allow the other cpu to reply } static ADDRESS_MAP_START( calibr50_sub_map, AS_PROGRAM, 8, seta_state ) AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("x1snd", x1_010_device, read ,write) // Sound - AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r) // From Main CPU + AM_RANGE(0x4000, 0x4000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU AM_RANGE(0x4000, 0x4000) AM_WRITE(sub_bankswitch_w) // Bankswitching AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM AM_RANGE(0xc000, 0xffff) AM_ROM // ROM @@ -3251,8 +3251,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( metafox_sub_map, AS_PROGRAM, 8, seta_state ) AM_RANGE(0x0000, 0x01ff) AM_RAM // RAM - AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r) // - AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r) // + AM_RANGE(0x0800, 0x0800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // + AM_RANGE(0x0801, 0x0801) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // AM_RANGE(0x1000, 0x1000) AM_READ_PORT("COINS") // Coins AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w) // ROM Bank + Coin Lockout AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P1") // P1 @@ -3279,7 +3279,7 @@ static ADDRESS_MAP_START( utoukond_sound_io_map, AS_IO, 8, seta_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ymsnd", ym3438_device, read, write) AM_RANGE(0x80, 0x80) AM_WRITENOP //? - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -7775,6 +7775,9 @@ static MACHINE_CONFIG_START( twineagl, seta_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -7817,6 +7820,10 @@ static MACHINE_CONFIG_START( downtown, seta_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -7882,6 +7889,8 @@ static MACHINE_CONFIG_START( usclssic, seta_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ MCFG_X1_010_ADDRESS(0x1000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -7932,6 +7941,10 @@ static MACHINE_CONFIG_START( calibr50, seta_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ MCFG_X1_010_ADDRESS(0x1000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -7976,6 +7989,9 @@ static MACHINE_CONFIG_START( metafox, seta_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -9292,6 +9308,8 @@ static MACHINE_CONFIG_START( utoukond, seta_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("x1snd", X1_010, 16000000) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) diff --git a/src/mame/drivers/shangha3.cpp b/src/mame/drivers/shangha3.cpp index f6e434c4cd8..ef29d1b67ec 100644 --- a/src/mame/drivers/shangha3.cpp +++ b/src/mame/drivers/shangha3.cpp @@ -37,7 +37,6 @@ Notes: #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" -#include "sound/okim6295.h" #include "sound/2612intf.h" #include "includes/shangha3.h" @@ -113,7 +112,7 @@ WRITE16_MEMBER(shangha3_state::heberpop_sound_command_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); /* RST 38h */ } } @@ -183,7 +182,7 @@ static ADDRESS_MAP_START( heberpop_sound_io_map, AS_IO, 8, shangha3_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ymsnd", ym3438_device, read, write) AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -519,6 +518,8 @@ static MACHINE_CONFIG_START( heberpop, shangha3_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3438, XTAL_48MHz/6) /* 8 MHz? */ MCFG_YM2612_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) MCFG_SOUND_ROUTE(0, "mono", 0.40) @@ -560,6 +561,8 @@ static MACHINE_CONFIG_START( blocken, shangha3_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3438, XTAL_48MHz/6) /* 8 MHz? */ MCFG_YM2612_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) MCFG_SOUND_ROUTE(0, "mono", 0.40) diff --git a/src/mame/drivers/sigmab52.cpp b/src/mame/drivers/sigmab52.cpp index ea3947f61db..586f52e533e 100644 --- a/src/mame/drivers/sigmab52.cpp +++ b/src/mame/drivers/sigmab52.cpp @@ -127,6 +127,7 @@ #include "cpu/m6809/m6809.h" #include "machine/6840ptm.h" #include "machine/6850acia.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "sound/3812intf.h" #include "video/hd63484.h" @@ -334,7 +335,7 @@ static ADDRESS_MAP_START( jwildb52_map, AS_PROGRAM, 8, sigmab52_state ) // AM_RANGE(0xf770, 0xf77f) Bill validator AM_RANGE(0xf780, 0xf780) AM_WRITE(audiocpu_cmd_irq_w) - AM_RANGE(0xf790, 0xf790) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xf790, 0xf790) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xf7b0, 0xf7b0) AM_WRITE(coin_enable_w) AM_RANGE(0xf7d5, 0xf7d5) AM_WRITE(hopper_w) @@ -360,7 +361,7 @@ static ADDRESS_MAP_START( sound_prog_map, AS_PROGRAM, 8, sigmab52_state ) AM_RANGE(0x0000, 0x1fff) AM_RAM AM_RANGE(0x6020, 0x6027) AM_DEVREADWRITE("6840ptm_2", ptm6840_device, read, write) AM_RANGE(0x6030, 0x6030) AM_WRITE(audiocpu_irq_ack_w) - AM_RANGE(0x6050, 0x6050) AM_READ(soundlatch_byte_r) + AM_RANGE(0x6050, 0x6050) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x6060, 0x6061) AM_DEVREADWRITE("ymsnd", ym3812_device, read, write) AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("audiocpu", 0) ADDRESS_MAP_END @@ -605,6 +606,9 @@ static MACHINE_CONFIG_START( jwildb52, sigmab52_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, AUX_CLOCK) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/snk.cpp b/src/mame/drivers/snk.cpp index e05bc0a34d9..a682a3bff67 100644 --- a/src/mame/drivers/snk.cpp +++ b/src/mame/drivers/snk.cpp @@ -328,14 +328,14 @@ enum WRITE8_MEMBER(snk_state::marvins_soundlatch_w) { m_marvins_sound_busy_flag = 1; - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(0, HOLD_LINE); } READ8_MEMBER(snk_state::marvins_soundlatch_r) { m_marvins_sound_busy_flag = 0; - return soundlatch_byte_r(space, 0); + return m_soundlatch->read(space, 0); } CUSTOM_INPUT_MEMBER(snk_state::marvins_sound_busy) @@ -374,14 +374,14 @@ TIMER_CALLBACK_MEMBER(snk_state::sgladiat_sndirq_update_callback) WRITE8_MEMBER(snk_state::sgladiat_soundlatch_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); machine().scheduler().synchronize(timer_expired_delegate(FUNC(snk_state::sgladiat_sndirq_update_callback),this), CMDIRQ_BUSY_ASSERT); } READ8_MEMBER(snk_state::sgladiat_soundlatch_r) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(snk_state::sgladiat_sndirq_update_callback),this), BUSY_CLEAR); - return soundlatch_byte_r(space,0); + return m_soundlatch->read(space,0); } READ8_MEMBER(snk_state::sgladiat_sound_nmi_ack_r) @@ -474,7 +474,7 @@ WRITE_LINE_MEMBER(snk_state::ymirq_callback_2) WRITE8_MEMBER(snk_state::snk_soundlatch_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); machine().scheduler().synchronize(timer_expired_delegate(FUNC(snk_state::sndirq_update_callback),this), CMDIRQ_BUSY_ASSERT); } @@ -522,7 +522,7 @@ READ8_MEMBER(snk_state::tnk3_ymirq_ack_r) READ8_MEMBER(snk_state::tnk3_busy_clear_r) { // it's uncertain whether the latch should be cleared here or when it's read - soundlatch_clear_byte_w(space, 0, 0); + m_soundlatch->clear_w(space, 0, 0); machine().scheduler().synchronize(timer_expired_delegate(FUNC(snk_state::sndirq_update_callback),this), BUSY_CLEAR); return 0xff; } @@ -1410,7 +1410,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tnk3_YM3526_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xc000, 0xc000) AM_READ(tnk3_busy_clear_r) AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE("ym1", ym3526_device, read, write) AM_RANGE(0xe004, 0xe004) AM_READ(tnk3_cmdirq_ack_r) @@ -1420,7 +1420,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( aso_YM3526_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xd000, 0xd000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xe000, 0xe000) AM_READ(tnk3_busy_clear_r) AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE("ym1", ym3526_device, read, write) // AM_RANGE(0xf002, 0xf002) AM_READNOP unknown @@ -1431,7 +1431,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( YM3526_YM3526_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3526_device, status_port_r, control_port_w) AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3526_device, write_port_w) AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", ym3526_device, status_port_r, control_port_w) @@ -1442,7 +1442,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( YM3812_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3812_device, status_port_r, control_port_w) AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3812_device, write_port_w) AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w) @@ -1451,7 +1451,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( YM3526_Y8950_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3526_device, status_port_r, control_port_w) AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3526_device, write_port_w) AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", y8950_device, status_port_r, control_port_w) @@ -1462,7 +1462,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( YM3812_Y8950_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3812_device, status_port_r, control_port_w) AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3812_device, write_port_w) AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", y8950_device, status_port_r, control_port_w) @@ -1473,7 +1473,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( Y8950_sound_map, AS_PROGRAM, 8, snk_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", y8950_device, status_port_r, control_port_w) AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("ym2", y8950_device, write_port_w) AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w) @@ -3643,6 +3643,8 @@ static MACHINE_CONFIG_START( marvins, snk_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, 2000000) /* verified on schematics */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) @@ -3713,6 +3715,8 @@ static MACHINE_CONFIG_START( jcross, snk_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, 2000000) /* NOT verified */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) @@ -3792,6 +3796,8 @@ static MACHINE_CONFIG_START( tnk3, snk_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM3526, XTAL_8MHz/2) /* verified on pcb */ MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) @@ -3881,6 +3887,8 @@ static MACHINE_CONFIG_START( ikari, snk_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM3526, XTAL_8MHz/2) /* verified on pcb */ MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) @@ -3936,6 +3944,8 @@ static MACHINE_CONFIG_START( bermudat, snk_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM3526, XTAL_8MHz/2) /* verified on pcb */ MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) @@ -4034,6 +4044,8 @@ static MACHINE_CONFIG_START( tdfever, snk_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM3526, 4000000) MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/snk68.cpp b/src/mame/drivers/snk68.cpp index d173946a5ab..84aeca47291 100644 --- a/src/mame/drivers/snk68.cpp +++ b/src/mame/drivers/snk68.cpp @@ -97,7 +97,7 @@ WRITE16_MEMBER(snk68_state::sound_w) { if (ACCESSING_BITS_8_15) { - soundlatch_byte_w(space, 0, data >> 8); + m_soundlatch->write(space, 0, data >> 8); m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } @@ -136,7 +136,7 @@ static ADDRESS_MAP_START( searchar_map, AS_PROGRAM, 16, snk68_state ) // AM_RANGE(0x0f0000, 0x0f0001) AM_WRITENOP /* ?? */ AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1") AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2") - AM_RANGE(0x0f8000, 0x0f8001) AM_READ8(soundlatch2_byte_r, 0xff00) + AM_RANGE(0x0f8000, 0x0f8001) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0xff00) AM_RANGE(0x100000, 0x107fff) AM_DEVREADWRITE("sprites", snk68_spr_device, spriteram_r, spriteram_w) AM_SHARE("spriteram") // only partially populated AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(searchar_fg_videoram_w) AM_MIRROR(0x1000) AM_SHARE("pow_fg_videoram") /* Mirror is used by Ikari 3 */ AM_RANGE(0x300000, 0x33ffff) AM_ROM AM_REGION("user1", 0) /* Extra code bank */ @@ -148,7 +148,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, snk68_state ) AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_WRITE(soundlatch2_byte_w) + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) ADDRESS_MAP_END WRITE8_MEMBER(snk68_state::D7759_write_port_0_w) @@ -612,13 +612,16 @@ static MACHINE_CONFIG_START( pow, snk68_state ) MCFG_PALETTE_ADD("palette", 0x800) MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit0) - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_DEVICE_ADD("sprites", SNK68_SPR, 0) MCFG_SNK68_SPR_GFXDECODE("gfxdecode") MCFG_SNK68_SPR_SET_TILE_INDIRECT( snk68_state, tile_callback_pow ) + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) /* verified on pcb */ MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 441307baa94..55aa6b9873b 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -2,14 +2,14 @@ // copyright-holders:David Haywood, Angelo Salese, Olivier Galibert, Mariusz Wojcieszek, R. Belmont /************************************************************************************************************************ - stv.c + stv.cpp ST-V hardware This file contains all game specific overrides TODO: - clean this up! - - Properly emulate the protection chips, used by several games (check stvprot.c for more info) + - Properly emulate the protection chips, used by several games (check stvprot.cpp for more info) (per-game issues) - stress: accesses the Sound Memory Expansion Area (0x05a80000-0x05afffff), unknown purpose; @@ -1054,7 +1054,7 @@ MACHINE_CONFIG_END WRITE32_MEMBER( stv_state::batmanfr_sound_comms_w ) { if(ACCESSING_BITS_16_31) - soundlatch_word_w(space, 0, data >> 16, 0x0000ffff); + m_soundlatch->write(space, 0, data >> 16, 0x0000ffff); if(ACCESSING_BITS_0_15) printf("Warning: write %04x & %08x to lo-word sound communication area\n",data,mem_mask); } @@ -1070,7 +1070,7 @@ READ16_MEMBER( stv_state::adsp_control_r ) break; /* TODO: is this location correct? */ case 0x5: - res = soundlatch_word_r(space,0); + res = m_soundlatch->read(space,0); break; default: osd_printf_debug("Unhandled register: %x\n", 0x3fe0 + offset); @@ -1203,6 +1203,8 @@ static MACHINE_CONFIG_DERIVED( batmanfr, stv ) MCFG_MACHINE_RESET_OVERRIDE(stv_state,batmanfr) + MCFG_GENERIC_LATCH_16_ADD("soundlatch") + MCFG_SOUND_ADD("dac1", DMADAC, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) diff --git a/src/mame/drivers/sub.cpp b/src/mame/drivers/sub.cpp index 9b2487ce495..39fe1b8d072 100644 --- a/src/mame/drivers/sub.cpp +++ b/src/mame/drivers/sub.cpp @@ -110,6 +110,7 @@ PCB2 (Top board, CPU board) #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/ay8910.h" #define MASTER_CLOCK XTAL_18_432MHz @@ -123,6 +124,7 @@ public: m_soundcpu(*this, "soundcpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_attr(*this, "attr"), m_vid(*this, "vid"), m_spriteram(*this, "spriteram"), @@ -133,6 +135,7 @@ public: required_device m_soundcpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; required_shared_ptr m_attr; required_shared_ptr m_vid; @@ -263,7 +266,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(sub_state::to_sound_w) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_soundcpu->set_input_line(0, HOLD_LINE); } @@ -274,7 +277,7 @@ WRITE8_MEMBER(sub_state::nmi_mask_w) static ADDRESS_MAP_START( subm_io, AS_IO, 8, sub_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r) AM_WRITE(to_sound_w) // to/from sound CPU + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_WRITE(to_sound_w) // to/from sound CPU ADDRESS_MAP_END static ADDRESS_MAP_START( subm_sound_map, AS_PROGRAM, 8, sub_state ) @@ -285,7 +288,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( subm_sound_io, AS_IO, 8, sub_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) // to/from main CPU + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // to/from main CPU AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("ay1", ay8910_device, data_r, address_data_w) AM_RANGE(0x80, 0x81) AM_DEVREADWRITE("ay2", ay8910_device, data_r, address_data_w) ADDRESS_MAP_END @@ -468,6 +471,9 @@ static MACHINE_CONFIG_START( sub, sub_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ay1", AY8910, MASTER_CLOCK/6/2) /* ? Mhz */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.23) diff --git a/src/mame/drivers/suna16.cpp b/src/mame/drivers/suna16.cpp index f33d0142f62..d7555c3118e 100644 --- a/src/mame/drivers/suna16.cpp +++ b/src/mame/drivers/suna16.cpp @@ -44,7 +44,7 @@ WRITE16_MEMBER(suna16_state::soundlatch_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data & 0xff ); + m_soundlatch->write(space, 0, data & 0xff ); } if (data & ~0xff) logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", space.device().safe_pc(), data); } @@ -240,9 +240,9 @@ static ADDRESS_MAP_START( bssoccer_sound_map, AS_PROGRAM, 8, suna16_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM // RAM AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) // YM2151 - AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_byte_r) // From Main CPU - AM_RANGE(0xfd00, 0xfd00) AM_WRITE(soundlatch2_byte_w) // To PCM Z80 #1 - AM_RANGE(0xfe00, 0xfe00) AM_WRITE(soundlatch3_byte_w) // To PCM Z80 #2 + AM_RANGE(0xfc00, 0xfc00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU + AM_RANGE(0xfd00, 0xfd00) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // To PCM Z80 #1 + AM_RANGE(0xfe00, 0xfe00) AM_DEVWRITE("soundlatch3", generic_latch_8_device, write) // To PCM Z80 #2 ADDRESS_MAP_END /*************************************************************************** @@ -253,7 +253,7 @@ static ADDRESS_MAP_START( uballoon_sound_map, AS_PROGRAM, 8, suna16_state ) AM_RANGE(0x0000, 0xefff) AM_ROM // ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM // RAM AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) // YM2151 - AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) // To PCM Z80 + AM_RANGE(0xfc00, 0xfc00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // To PCM Z80 ADDRESS_MAP_END /*************************************************************************** @@ -264,7 +264,7 @@ static ADDRESS_MAP_START( sunaq_sound_map, AS_PROGRAM, 8, suna16_state ) AM_RANGE(0x0000, 0xe82f) AM_ROM // ROM AM_RANGE(0xe830, 0xf7ff) AM_RAM // RAM (writes to efxx, could be a program bug tho) AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) // YM2151 - AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) // To PCM Z80 + AM_RANGE(0xfc00, 0xfc00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // To PCM Z80 ADDRESS_MAP_END /*************************************************************************** @@ -276,8 +276,8 @@ static ADDRESS_MAP_START( bestbest_sound_map, AS_PROGRAM, 8, suna16_state ) AM_RANGE( 0xc000, 0xc001 ) AM_DEVWRITE("ymsnd", ym3526_device, write) AM_RANGE( 0xc002, 0xc003 ) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) // AY8910 AM_RANGE( 0xe000, 0xe7ff ) AM_RAM // RAM - AM_RANGE( 0xf000, 0xf000 ) AM_WRITE(soundlatch2_byte_w ) // To PCM Z80 - AM_RANGE( 0xf800, 0xf800 ) AM_READ ( soundlatch_byte_r ) // From Main CPU + AM_RANGE( 0xf000, 0xf000 ) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // To PCM Z80 + AM_RANGE( 0xf800, 0xf800 ) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU ADDRESS_MAP_END /*************************************************************************** @@ -353,7 +353,7 @@ WRITE8_MEMBER(suna16_state::bssoccer_DAC4_w) static ADDRESS_MAP_START( bssoccer_pcm_1_io_map, AS_IO, 8, suna16_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r) // From The Sound Z80 + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // From The Sound Z80 AM_RANGE(0x00, 0x00) AM_WRITE(DAC1_w) // 2 x DAC AM_RANGE(0x01, 0x01) AM_WRITE(DAC2_w) // 2 x DAC AM_RANGE(0x03, 0x03) AM_WRITE(bssoccer_pcm_1_bankswitch_w) // Rom Bank @@ -361,7 +361,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bssoccer_pcm_2_io_map, AS_IO, 8, suna16_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_byte_r) // From The Sound Z80 + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch3", generic_latch_8_device, read) // From The Sound Z80 AM_RANGE(0x00, 0x00) AM_WRITE(bssoccer_DAC3_w) // 2 x DAC AM_RANGE(0x01, 0x01) AM_WRITE(bssoccer_DAC4_w) // 2 x DAC AM_RANGE(0x03, 0x03) AM_WRITE(bssoccer_pcm_2_bankswitch_w) // Rom Bank @@ -390,7 +390,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( uballoon_pcm_1_io_map, AS_IO, 8, suna16_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r) // From The Sound Z80 + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // From The Sound Z80 AM_RANGE(0x00, 0x00) AM_WRITE(DAC1_w) // 2 x DAC AM_RANGE(0x01, 0x01) AM_WRITE(DAC2_w) // 2 x DAC AM_RANGE(0x03, 0x03) AM_WRITE(uballoon_pcm_1_bankswitch_w) // Rom Bank @@ -420,7 +420,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bestbest_pcm_1_iomap, AS_IO, 8, suna16_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ (soundlatch2_byte_r ) // From The Sound Z80 + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // From The Sound Z80 AM_RANGE(0x00, 0x00) AM_MIRROR(0x02) AM_WRITE(DAC1_w) // 2 x DAC AM_RANGE(0x01, 0x01) AM_MIRROR(0x02) AM_WRITE(DAC2_w) // 2 x DAC ADDRESS_MAP_END @@ -846,6 +846,10 @@ static MACHINE_CONFIG_START( bssoccer, suna16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_GENERIC_LATCH_8_ADD("soundlatch3") + MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ MCFG_SOUND_ROUTE(0, "lspeaker", 0.20) MCFG_SOUND_ROUTE(1, "rspeaker", 0.20) @@ -906,6 +910,9 @@ static MACHINE_CONFIG_START( uballoon, suna16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) @@ -959,6 +966,9 @@ static MACHINE_CONFIG_START( sunaq, suna16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) @@ -1015,6 +1025,9 @@ static MACHINE_CONFIG_START( bestbest, suna16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("aysnd", AY8910, XTAL_24MHz/16) /* 1.5MHz */ MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna16_state, bestbest_ay8910_port_a_w)) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) diff --git a/src/mame/drivers/suna8.cpp b/src/mame/drivers/suna8.cpp index 02db5b88c25..2537ba034a7 100644 --- a/src/mame/drivers/suna8.cpp +++ b/src/mame/drivers/suna8.cpp @@ -42,7 +42,6 @@ Notes: #include "sound/2203intf.h" #include "sound/3812intf.h" #include "sound/dac.h" -#include "sound/samples.h" #include "includes/suna8.h" #define SUNA8_MASTER_CLOCK XTAL_24MHz @@ -561,8 +560,8 @@ static ADDRESS_MAP_START( hardhead_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xc000, 0xd7ff) AM_RAM // RAM AM_RANGE(0xd800, 0xd9ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // Palette AM_RANGE(0xda00, 0xda00) AM_RAM_READ(hardhead_ip_r) AM_SHARE("hardhead_ip") // Input Port Select - AM_RANGE(0xda80, 0xda80) AM_READ(soundlatch2_byte_r) AM_WRITE(hardhead_bankswitch_w ) // ROM Banking - AM_RANGE(0xdb00, 0xdb00) AM_WRITE(soundlatch_byte_w ) // To Sound CPU + AM_RANGE(0xda80, 0xda80) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_WRITE(hardhead_bankswitch_w ) // ROM Banking + AM_RANGE(0xdb00, 0xdb00) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) // To Sound CPU AM_RANGE(0xdb80, 0xdb80) AM_WRITE(hardhead_flipscreen_w ) // Flip Screen + Coin Lockout AM_RANGE(0xdc00, 0xdc00) AM_NOP // <- R (after bank select) AM_RANGE(0xdc80, 0xdc80) AM_NOP // <- R (after bank select) @@ -611,7 +610,7 @@ WRITE8_MEMBER(suna8_state::rranger_bankswitch_w) */ READ8_MEMBER(suna8_state::rranger_soundstatus_r) { - soundlatch2_byte_r(space, offset); + m_soundlatch2->read(space, offset); return 0x02; } @@ -625,7 +624,7 @@ WRITE8_MEMBER(suna8_state::sranger_prot_w) static ADDRESS_MAP_START( rranger_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM - AM_RANGE(0xc000, 0xc000) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_WRITE(soundlatch_byte_w) // To Sound CPU + AM_RANGE(0xc000, 0xc000) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) // To Sound CPU AM_RANGE(0xc002, 0xc002) AM_WRITE(rranger_bankswitch_w ) // ROM Banking AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P1") // P1 (Inputs) AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2") // P2 @@ -733,7 +732,7 @@ static ADDRESS_MAP_START( brickzn11_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM - AM_RANGE(0xc000, 0xc000) AM_WRITE(soundlatch_byte_w ) // To Sound CPU + AM_RANGE(0xc000, 0xc000) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) // To Sound CPU AM_RANGE(0xc040, 0xc040) AM_WRITE(brickzn_sprbank_w ) // Sprite RAM Bank + Flip Screen + Protection AM_RANGE(0xc060, 0xc060) AM_WRITE(brickzn_rombank_w ) // ROM Bank AM_RANGE(0xc080, 0xc080) AM_WRITE(brickzn_leds_w ) // Leds @@ -784,7 +783,7 @@ WRITE8_MEMBER(suna8_state::brickzn_multi_w) */ UINT8 remap = (m_remap_sound ? BITSWAP8(data, 7,6,3,4,5,2,1,0) : data); - soundlatch_byte_w(space, 0, remap); + m_soundlatch->write(space, 0, remap); logerror("CPU #0 - PC %04X: soundlatch = %02X (->%02X)\n",space.device().safe_pc(),data,remap); } @@ -990,7 +989,7 @@ static ADDRESS_MAP_START( hardhea2_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xc380, 0xc380) AM_WRITE(hardhea2_nmi_w ) // ? NMI related ? AM_RANGE(0xc400, 0xc400) AM_WRITE(hardhea2_leds_w ) // Leds + Coin Counter AM_RANGE(0xc480, 0xc480) AM_WRITENOP // ~ROM Bank - AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_byte_w ) // To Sound CPU + AM_RANGE(0xc500, 0xc500) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) // To Sound CPU // *** Protection AM_RANGE(0xc50f, 0xc50f) AM_WRITE(hardhea2_spritebank_1_w ) @@ -1034,7 +1033,7 @@ WRITE8_MEMBER(suna8_state::starfigh_rombank_latch_w) WRITE8_MEMBER(suna8_state::starfigh_sound_latch_w) { if ( !(m_rombank_latch & 0x20) ) - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); } /* @@ -1262,8 +1261,8 @@ static ADDRESS_MAP_START( hardhead_sound_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xa002, 0xa003) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) AM_RANGE(0xc000, 0xc7ff) AM_RAM // RAM AM_RANGE(0xc800, 0xc800) AM_DEVREAD("ymsnd", ym3812_device, status_port_r) // ? unsure - AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_byte_w ) // - AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r ) // From Main CPU + AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // + AM_RANGE(0xd800, 0xd800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU ADDRESS_MAP_END @@ -1282,8 +1281,8 @@ static ADDRESS_MAP_START( rranger_sound_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xa000, 0xa001) AM_DEVWRITE("ym1", ym2203_device, write) // Samples + Music AM_RANGE(0xa002, 0xa003) AM_DEVWRITE("ym2", ym2203_device, write) // Music + FX AM_RANGE(0xc000, 0xc7ff) AM_RAM // RAM - AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_byte_w ) // To Sound CPU - AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r ) // From Main CPU + AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // To Sound CPU + AM_RANGE(0xd800, 0xd800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU ADDRESS_MAP_END @@ -1296,8 +1295,8 @@ static ADDRESS_MAP_START( brickzn_sound_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xc000, 0xc001) AM_DEVWRITE("ymsnd", ym3812_device, write) AM_RANGE(0xc002, 0xc003) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) AM_RANGE(0xe000, 0xe7ff) AM_RAM // RAM - AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_byte_w ) // To PCM CPU - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r ) // From Main CPU + AM_RANGE(0xf000, 0xf000) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // To PCM CPU + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU ADDRESS_MAP_END @@ -1317,7 +1316,7 @@ WRITE8_MEMBER(suna8_state::brickzn_pcm_w) static ADDRESS_MAP_START( brickzn_pcm_io_map, AS_IO, 8, suna8_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r ) // From Sound CPU + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) // From Sound CPU AM_RANGE(0x00, 0x03) AM_WRITE(brickzn_pcm_w ) // 4 x DAC ADDRESS_MAP_END @@ -1901,6 +1900,9 @@ static MACHINE_CONFIG_START( hardhead, suna8_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) /* verified on pcb */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -1957,6 +1959,9 @@ static MACHINE_CONFIG_START( rranger, suna8_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ym1", YM2203, SUNA8_MASTER_CLOCK / 16) /* verified on pcb */ MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, rranger_play_samples_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suna8_state, suna8_samples_number_w)) @@ -2023,6 +2028,9 @@ static MACHINE_CONFIG_START( brickzn11, suna8_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) // 3MHz (measured) MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -2133,6 +2141,9 @@ static MACHINE_CONFIG_START( starfigh, suna8_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -2184,6 +2195,9 @@ static MACHINE_CONFIG_START( sparkman, suna8_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/suprloco.cpp b/src/mame/drivers/suprloco.cpp index 5144ebc1da2..a6c4b414340 100644 --- a/src/mame/drivers/suprloco.cpp +++ b/src/mame/drivers/suprloco.cpp @@ -29,7 +29,7 @@ Sega PCB 834-5137 WRITE8_MEMBER(suprloco_state::soundport_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); /* spin for a while to let the Z80 read the command (fixes hanging sound in Regulus) */ space.device().execute().spin_until_time(attotime::from_usec(50)); @@ -61,7 +61,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, suprloco_state ) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0xa000, 0xa003) AM_DEVWRITE("sn1", sn76496_device, write) AM_RANGE(0xc000, 0xc003) AM_DEVWRITE("sn2", sn76496_device, write) - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -193,6 +193,8 @@ static MACHINE_CONFIG_START( suprloco, suprloco_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("sn1", SN76496, 4000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/system1.cpp b/src/mame/drivers/system1.cpp index 2243b0f1e66..cbbf982a3a1 100644 --- a/src/mame/drivers/system1.cpp +++ b/src/mame/drivers/system1.cpp @@ -210,7 +210,7 @@ DIPs are also shared 100% with each other. flickys1, flickys2 ------------------ -Very noticibly more difficult than the other two sets. DIPs have changes (less lives +Very noticeably more difficult than the other two sets. DIPs have changes (less lives and bonus options). There is no screen which shows the bonus lives values like the other two sets, either. flickys1 allows for DEMO SOUND which none of the others sets seem to have access to. @@ -218,10 +218,8 @@ seem to have access to. ******************************************************************************/ #include "emu.h" -#include "cpu/z80/z80.h" #include "cpu/mcs51/mcs51.h" #include "machine/z80pio.h" -#include "machine/i8255.h" #include "machine/segacrpt_device.h" #include "machine/mc8123.h" #include "sound/sn76496.h" @@ -529,7 +527,7 @@ READ8_MEMBER(system1_state::sound_data_r) { m_ppi8255->pc6_w(0); m_ppi8255->pc6_w(1); - return soundlatch_byte_r(space, offset); + return m_soundlatch->read(space, offset); } /* if we have a Z80 PIO, get the data from the port and toggle the strobe */ @@ -548,7 +546,7 @@ READ8_MEMBER(system1_state::sound_data_r) WRITE8_MEMBER(system1_state::soundport_w) { /* boost interleave when communicating with the sound CPU */ - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100)); } @@ -2177,6 +2175,8 @@ static MACHINE_CONFIG_START( sys1ppi, system1_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("sn1", SN76489A, SOUND_CLOCK/4) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) diff --git a/src/mame/drivers/system16.cpp b/src/mame/drivers/system16.cpp index c7c9bf7015e..264921fbf39 100644 --- a/src/mame/drivers/system16.cpp +++ b/src/mame/drivers/system16.cpp @@ -18,7 +18,7 @@ - Bay Route (set 1) - Golden Axe (set 1) - These share a common encryption, Bay Route is also proteceted, the Golden Axe set has a strange + These share a common encryption, Bay Route is also protected, the Golden Axe set has a strange unknown rom, maybe it's related to an MCU that isn't present on the GA board? --- @@ -92,11 +92,9 @@ #include "cpu/z80/z80.h" #include "includes/system16.h" #include "cpu/m68000/m68000.h" -#include "sound/msm5205.h" #include "sound/2151intf.h" #include "sound/2612intf.h" #include "sound/rf5c68.h" -#include "video/segaic16.h" #include "sound/2203intf.h" #define SHADOW_COLORS_MULTIPLIER 3 @@ -114,7 +112,7 @@ WRITE16_MEMBER(segas1x_bootleg_state::sound_command_nmi_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } @@ -123,7 +121,7 @@ WRITE16_MEMBER(segas1x_bootleg_state::sound_command_irq_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_soundcpu->set_input_line(0, HOLD_LINE); } } @@ -414,7 +412,7 @@ static ADDRESS_MAP_START(tturfbl_sound_map, AS_PROGRAM, 8, segas1x_bootleg_state AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_READ(tturfbl_soundbank_r) AM_RANGE(0xe000, 0xe000) AM_WRITE(tturfbl_soundbank_w) - AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe800, 0xe800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf000, 0xf000) AM_WRITE(tturfbl_msm5205_data_w) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -433,7 +431,7 @@ static ADDRESS_MAP_START(shinobi_datsu_sound_map, AS_PROGRAM, 8, segas1x_bootleg AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE("ym1", ym2203_device, read, write) AM_RANGE(0xe400, 0xe401) AM_DEVREADWRITE("ym2", ym2203_device, read, write) - AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe800, 0xe800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -448,14 +446,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segas1x_bootleg_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe800, 0xe800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, segas1x_bootleg_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -463,7 +461,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_7759_map, AS_PROGRAM, 8, segas1x_bootleg_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xdfff) AM_ROMBANK("bank1") - AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe800, 0xe800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -483,7 +481,7 @@ static ADDRESS_MAP_START( sound_7759_io_map, AS_IO, 8, segas1x_bootleg_state ) AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) AM_RANGE(0x40, 0x40) AM_WRITE(upd7759_bank_w) AM_RANGE(0x80, 0x80) AM_DEVWRITE("7759", upd7759_device, port_w) - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -1018,7 +1016,7 @@ static ADDRESS_MAP_START( sound_18_io_map, AS_IO, 8, segas1x_bootleg_state ) AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("3438.0", ym3438_device, read, write) AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("3438.1", ym3438_device, read, write) AM_RANGE(0xa0, 0xa0) AM_WRITE(sys18_soundbank_w) - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -1123,7 +1121,7 @@ ADDRESS_MAP_END The unused memory locations and I/O port access seem to be remnants of the original code that were not patched out: - - Program accesses RF5C68A channel registes at $C000-$C007 + - Program accesses RF5C68A channel registers at $C000-$C007 - Program clears RF5C68A wave memory at $DF00-$DFFF - Program writes to port $A0 to access sound ROM banking control latch - Program reads port $C0 to access sound command @@ -1192,7 +1190,7 @@ static ADDRESS_MAP_START(shdancbl_sound_map, AS_PROGRAM, 8, segas1x_bootleg_stat AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_READ(shdancbl_soundbank_r) AM_RANGE(0xc000, 0xc00f) AM_WRITENOP - AM_RANGE(0xc400, 0xc400) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc400, 0xc400) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xc800, 0xc800) AM_WRITE(shdancbl_msm5205_data_w) AM_RANGE(0xcc00, 0xcc03) AM_DEVREADWRITE("3438.0", ym3438_device, read, write) AM_RANGE(0xd000, 0xd003) AM_DEVREADWRITE("3438.1", ym3438_device, read, write) @@ -1212,7 +1210,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START(shdancbla_sound_map, AS_PROGRAM, 8, segas1x_bootleg_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_READ(shdancbl_soundbank_r) - AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc000, 0xc000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE("3438.0", ym3438_device, read, write) AM_RANGE(0xc400, 0xc403) AM_DEVREADWRITE("3438.1", ym3438_device, read, write) @@ -1989,6 +1987,8 @@ static MACHINE_CONFIG_START( system16_base, segas1x_bootleg_state ) MCFG_PALETTE_ADD("palette", 2048*SHADOW_COLORS_MULTIPLIER) MCFG_VIDEO_START_OVERRIDE(segas1x_bootleg_state,system16) + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system16, system16_base ) @@ -2039,6 +2039,8 @@ static MACHINE_CONFIG_FRAGMENT( system16_datsu_sound ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", 4000000) MCFG_SOUND_ROUTE(0, "lspeaker", 0.32) MCFG_SOUND_ROUTE(1, "rspeaker", 0.32) @@ -2293,6 +2295,8 @@ static MACHINE_CONFIG_START( system18, segas1x_bootleg_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("3438.0", YM3438, 8000000) MCFG_SOUND_ROUTE(0, "lspeaker", 0.40) MCFG_SOUND_ROUTE(1, "rspeaker", 0.40) diff --git a/src/mame/drivers/toki.cpp b/src/mame/drivers/toki.cpp index 0feb9b2a13e..f3616913453 100644 --- a/src/mame/drivers/toki.cpp +++ b/src/mame/drivers/toki.cpp @@ -97,13 +97,12 @@ Notes: #include "cpu/z80/z80.h" #include "machine/watchdog.h" #include "sound/3812intf.h" -#include "sound/msm5205.h" #include "sound/3812intf.h" #include "includes/toki.h" WRITE16_MEMBER(toki_state::tokib_soundcommand_w) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -187,7 +186,7 @@ static ADDRESS_MAP_START( tokib_audio_map, AS_PROGRAM, 8, toki_state ) AM_RANGE(0xe400, 0xe400) AM_WRITE(tokib_adpcm_data_w) AM_RANGE(0xec00, 0xec01) AM_MIRROR(0x0008) AM_DEVREADWRITE("ymsnd", ym3812_device, read, write) AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END /*****************************************************************************/ @@ -498,6 +497,8 @@ static MACHINE_CONFIG_START( tokib, toki_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, 3579545) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/wiz.cpp b/src/mame/drivers/wiz.cpp index 82909dfc4c2..bef40970050 100644 --- a/src/mame/drivers/wiz.cpp +++ b/src/mame/drivers/wiz.cpp @@ -178,6 +178,7 @@ Stephh's notes (based on the games Z80 code and some tests) : #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/ay8910.h" #include "includes/wiz.h" @@ -325,7 +326,7 @@ static ADDRESS_MAP_START( kungfut_main_map, AS_PROGRAM, 8, wiz_state ) AM_RANGE(0xf008, 0xf008) AM_READ_PORT("DSW1") AM_RANGE(0xf010, 0xf010) AM_READ_PORT("IN0") AM_RANGE(0xf018, 0xf018) AM_READ_PORT("IN1") - AM_RANGE(0xf800, 0xf800) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xf800, 0xf800) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xf818, 0xf818) AM_WRITE(wiz_bgcolor_w) ADDRESS_MAP_END @@ -364,14 +365,14 @@ static ADDRESS_MAP_START( kungfut_sound_map, AS_PROGRAM, 8, wiz_state ) AM_RANGE(0x4000, 0x4001) AM_DEVWRITE("8910.3", ay8910_device, address_data_w) AM_RANGE(0x5000, 0x5001) AM_DEVWRITE("8910.1", ay8910_device, address_data_w) AM_RANGE(0x6000, 0x6001) AM_DEVWRITE("8910.2", ay8910_device, address_data_w) - AM_RANGE(0x7000, 0x7000) AM_READWRITE(soundlatch_byte_r, wiz_sound_nmi_mask_w) + AM_RANGE(0x7000, 0x7000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(wiz_sound_nmi_mask_w) ADDRESS_MAP_END static ADDRESS_MAP_START( stinger_sound_map, AS_PROGRAM, 8, wiz_state ) ADDRESS_MAP_GLOBAL_MASK(0x7fff) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x23ff) AM_RAM - AM_RANGE(0x3000, 0x3000) AM_READWRITE(soundlatch_byte_r, wiz_sound_nmi_mask_w) + AM_RANGE(0x3000, 0x3000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(wiz_sound_nmi_mask_w) AM_RANGE(0x4000, 0x4000) AM_WRITENOP // ? AM_RANGE(0x5000, 0x5001) AM_DEVWRITE("8910.1", ay8910_device, address_data_w) AM_RANGE(0x6000, 0x6001) AM_DEVWRITE("8910.2", ay8910_device, address_data_w) @@ -807,6 +808,8 @@ static MACHINE_CONFIG_START( kungfut, wiz_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("8910.1", AY8910, 18432000/12) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) diff --git a/src/mame/drivers/zaxxon.cpp b/src/mame/drivers/zaxxon.cpp index ace1f3e2fbd..11eff72f6a6 100644 --- a/src/mame/drivers/zaxxon.cpp +++ b/src/mame/drivers/zaxxon.cpp @@ -257,6 +257,7 @@ #include "cpu/z80/z80.h" #include "sound/sn76496.h" #include "sound/samples.h" +#include "machine/gen_latch.h" #include "machine/segacrpt_device.h" #include "machine/i8255.h" #include "audio/segasnd.h" @@ -487,7 +488,7 @@ static ADDRESS_MAP_START( congo_map, AS_PROGRAM, 8, zaxxon_state ) AM_RANGE(0xc027, 0xc027) AM_MIRROR(0x1fc0) AM_WRITE(congo_color_bank_w) AM_RANGE(0xc028, 0xc029) AM_MIRROR(0x1fc4) AM_WRITE(zaxxon_bg_position_w) AM_RANGE(0xc030, 0xc033) AM_MIRROR(0x1fc4) AM_WRITE(congo_sprite_custom_w) - AM_RANGE(0xc038, 0xc03f) AM_MIRROR(0x1fc0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xc038, 0xc03f) AM_MIRROR(0x1fc0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END @@ -1019,7 +1020,7 @@ static MACHINE_CONFIG_DERIVED( congo, root ) MCFG_DEVICE_REMOVE("ppi8255") MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_I8255_OUT_PORTB_CB(WRITE8(zaxxon_state, congo_sound_b_w)) MCFG_I8255_OUT_PORTC_CB(WRITE8(zaxxon_state, congo_sound_c_w)) @@ -1039,6 +1040,8 @@ static MACHINE_CONFIG_DERIVED( congo, root ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("sn1", SN76489A, SOUND_CLOCK) // schematic shows sn76489A MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/zn.cpp b/src/mame/drivers/zn.cpp index caf7941fd06..4cf97facf15 100644 --- a/src/mame/drivers/zn.cpp +++ b/src/mame/drivers/zn.cpp @@ -23,6 +23,7 @@ #include "machine/zndip.h" #include "machine/ataintf.h" #include "machine/vt83c461.h" +#include "machine/gen_latch.h" #include "audio/taitosnd.h" #include "sound/2610intf.h" #include "sound/ymz280b.h" @@ -52,6 +53,8 @@ public: m_mb3773(*this, "mb3773"), m_zoom(*this, "taito_zoom"), m_vt83c461(*this, "ide"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch16(*this, "soundlatch16"), m_cat702_1_dataout(1), m_cat702_2_dataout(1), m_zndip_dataout(1) @@ -145,6 +148,8 @@ private: optional_device m_mb3773; optional_device m_zoom; optional_device m_vt83c461; + optional_device m_soundlatch; + optional_device m_soundlatch16; int m_cat702_1_dataout; int m_cat702_2_dataout; @@ -358,6 +363,8 @@ static MACHINE_CONFIG_START( zn1_1mb_vram, zn_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 ) MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) MCFG_SOUND_ROUTE(1, "rspeaker", 0.35) @@ -402,6 +409,8 @@ static MACHINE_CONFIG_START( zn2, zn_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 ) MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) MCFG_SOUND_ROUTE(1, "rspeaker", 0.35) @@ -547,7 +556,7 @@ INTERRUPT_GEN_MEMBER(zn_state::qsound_interrupt) WRITE8_MEMBER(zn_state::zn_qsound_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -585,7 +594,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( qsound_portmap, AS_IO, 8, zn_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END static MACHINE_CONFIG_DERIVED( coh1000c, zn1_1mb_vram ) @@ -1629,7 +1638,7 @@ WRITE8_MEMBER(zn_state::coh1002e_sound_irq_w) static ADDRESS_MAP_START(coh1002e_map, AS_PROGRAM, 32, zn_state) AM_RANGE(0x1f000000, 0x1f7fffff) AM_ROMBANK("bankedroms") AM_RANGE(0x1fa10300, 0x1fa10303) AM_WRITE8(coh1002e_bank_w, 0x000000ff) - AM_RANGE(0x1fb00000, 0x1fb00003) AM_WRITE8(soundlatch_byte_w, 0x000000ff) + AM_RANGE(0x1fb00000, 0x1fb00003) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x000000ff) AM_RANGE(0x1fb00004, 0x1fb00007) AM_WRITE8(coh1002e_sound_irq_w, 0x000000ff) AM_IMPORT_FROM(zn_map) @@ -1644,7 +1653,7 @@ static ADDRESS_MAP_START( psarc_snd_map, AS_PROGRAM, 16, zn_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x0fffff) AM_RAM AM_RANGE(0x100000, 0x10001f) AM_DEVREADWRITE8("ymf", ymf271_device, read, write, 0x00ff ) - AM_RANGE(0x180008, 0x180009) AM_READ8(soundlatch_byte_r, 0x00ff ) + AM_RANGE(0x180008, 0x180009) AM_DEVREAD8("soundlatch", generic_latch_8_device, read, 0x00ff ) AM_RANGE(0x000000, 0x07ffff) AM_WRITENOP AM_RANGE(0x100020, 0xffffff) AM_WRITENOP ADDRESS_MAP_END @@ -2263,7 +2272,7 @@ WRITE16_MEMBER(zn_state::coh1001l_sound_unk_w) WRITE16_MEMBER(zn_state::coh1001l_latch_w) { - soundlatch_word_w(space, 0, data); + m_soundlatch16->write(space, 0, data); m_audiocpu->set_input_line(3, HOLD_LINE); } @@ -2287,7 +2296,7 @@ MACHINE_RESET_MEMBER(zn_state,coh1001l) static ADDRESS_MAP_START( atlus_snd_map, AS_PROGRAM, 16, zn_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM - AM_RANGE(0x100000, 0x100001) AM_READWRITE(soundlatch_word_r, coh1001l_sound_unk_w) + AM_RANGE(0x100000, 0x100001) AM_DEVREAD("soundlatch16", generic_latch_16_device, read) AM_WRITE(coh1001l_sound_unk_w) AM_RANGE(0x200000, 0x200003) AM_DEVREADWRITE8("ymz", ymz280b_device, read, write, 0x00ff) AM_RANGE(0x700000, 0x70ffff) AM_RAM ADDRESS_MAP_END @@ -2302,6 +2311,8 @@ static MACHINE_CONFIG_DERIVED(coh1001l, zn1_2mb_vram) MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1001l) + MCFG_GENERIC_LATCH_16_ADD("soundlatch16") + MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) MCFG_YMZ280B_IRQ_HANDLER(INPUTLINE("audiocpu", 2)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) diff --git a/src/mame/includes/bbusters.h b/src/mame/includes/bbusters.h index c2c4526502f..ed50f90ff56 100644 --- a/src/mame/includes/bbusters.h +++ b/src/mame/includes/bbusters.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail + +#include "machine/gen_latch.h" #include "video/bufsprite.h" class bbusters_state : public driver_device @@ -12,6 +14,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_spriteram(*this, "spriteram"), m_spriteram2(*this, "spriteram2"), + m_soundlatch(*this, "soundlatch"), m_eprom_data(*this, "eeprom"), m_ram(*this, "ram"), m_videoram(*this, "videoram"), @@ -25,6 +28,7 @@ public: required_device m_gfxdecode; required_device m_spriteram; optional_device m_spriteram2; + required_device m_soundlatch; optional_shared_ptr m_eprom_data; required_shared_ptr m_ram; diff --git a/src/mame/includes/goal92.h b/src/mame/includes/goal92.h index a1b6a996e0f..1df735acf23 100644 --- a/src/mame/includes/goal92.h +++ b/src/mame/includes/goal92.h @@ -5,7 +5,10 @@ Goal! '92 *************************************************************************/ + +#include "machine/gen_latch.h" #include "sound/msm5205.h" + class goal92_state : public driver_device { public: @@ -16,11 +19,12 @@ public: m_tx_data(*this, "tx_data"), m_spriteram(*this, "spriteram"), m_scrollram(*this, "scrollram"), - m_audiocpu(*this, "audiocpu"), m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_bg_data; @@ -41,7 +45,13 @@ public: int m_adpcm_toggle; /* devices */ + required_device m_maincpu; required_device m_audiocpu; + required_device m_msm; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + DECLARE_WRITE16_MEMBER(goal92_sound_command_w); DECLARE_READ16_MEMBER(goal92_inputs_r); DECLARE_WRITE8_MEMBER(adpcm_data_w); @@ -62,8 +72,4 @@ public: void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); DECLARE_WRITE_LINE_MEMBER(irqhandler); DECLARE_WRITE_LINE_MEMBER(goal92_adpcm_int); - required_device m_maincpu; - required_device m_msm; - required_device m_gfxdecode; - required_device m_palette; }; diff --git a/src/mame/includes/kncljoe.h b/src/mame/includes/kncljoe.h index cafa96ed3da..2bcf5405658 100644 --- a/src/mame/includes/kncljoe.h +++ b/src/mame/includes/kncljoe.h @@ -6,6 +6,9 @@ *************************************************************************/ +#include "machine/gen_latch.h" +#include "sound/ay8910.h" + class kncljoe_state : public driver_device { public: @@ -14,11 +17,13 @@ public: m_videoram(*this, "videoram"), m_scrollregs(*this, "scrollregs"), m_spriteram(*this, "spriteram"), - m_soundcpu(*this, "soundcpu"), m_maincpu(*this, "maincpu"), + m_soundcpu(*this, "soundcpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_ay8910(*this, "aysnd"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_videoram; @@ -36,7 +41,14 @@ public: UINT8 m_port2; /* devices */ + required_device m_maincpu; required_device m_soundcpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_ay8910; + required_device m_soundlatch; + DECLARE_WRITE8_MEMBER(sound_cmd_w); DECLARE_WRITE8_MEMBER(sound_irq_ack_w); DECLARE_WRITE8_MEMBER(kncljoe_videoram_w); @@ -55,8 +67,4 @@ public: UINT32 screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_nmi); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; }; diff --git a/src/mame/includes/lasso.h b/src/mame/includes/lasso.h index 617f03aeba9..fd241605c37 100644 --- a/src/mame/includes/lasso.h +++ b/src/mame/includes/lasso.h @@ -6,6 +6,7 @@ ***************************************************************************/ +#include "machine/gen_latch.h" #include "sound/sn76496.h" class lasso_state : public driver_device @@ -26,7 +27,8 @@ public: m_sn_1(*this, "sn76489.1"), m_sn_2(*this, "sn76489.2"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_videoram; @@ -51,6 +53,7 @@ public: optional_device m_sn_2; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; DECLARE_WRITE8_MEMBER(sound_command_w); DECLARE_READ8_MEMBER(sound_status_r); diff --git a/src/mame/includes/legionna.h b/src/mame/includes/legionna.h index 9ed3a94ada2..5305b00cd82 100644 --- a/src/mame/includes/legionna.h +++ b/src/mame/includes/legionna.h @@ -1,7 +1,9 @@ // license:BSD-3-Clause // copyright-holders:David Graves, Angelo Salese, David Haywood, Tomasz Slanina + #include "sound/okim6295.h" #include "audio/seibu.h" +#include "machine/gen_latch.h" #include "machine/raiden2cop.h" #include "video/seibu_crtc.h" @@ -21,6 +23,7 @@ public: m_oki(*this, "oki"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_wordswapram(*this, "wordswapram"), m_raiden2cop(*this, "raiden2cop") { @@ -93,6 +96,7 @@ public: required_device m_oki; required_device m_gfxdecode; required_device m_palette; + optional_device m_soundlatch; optional_shared_ptr m_wordswapram; optional_device m_raiden2cop; diff --git a/src/mame/includes/mainsnk.h b/src/mame/includes/mainsnk.h index e1240a8d8c2..e6f183aef31 100644 --- a/src/mame/includes/mainsnk.h +++ b/src/mame/includes/mainsnk.h @@ -1,5 +1,8 @@ // license:BSD-3-Clause // copyright-holders:David Haywood, Tomasz Slanina + +#include "machine/gen_latch.h" + class mainsnk_state : public driver_device { public: @@ -9,6 +12,7 @@ public: m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_bgram(*this, "bgram"), m_spriteram(*this, "spriteram"), m_fgram(*this, "fgram") { } @@ -17,6 +21,7 @@ public: required_device m_audiocpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; required_shared_ptr m_bgram; required_shared_ptr m_spriteram; diff --git a/src/mame/includes/munchmo.h b/src/mame/includes/munchmo.h index 6606f5591ab..a0ae8bb3b18 100644 --- a/src/mame/includes/munchmo.h +++ b/src/mame/includes/munchmo.h @@ -6,6 +6,8 @@ *************************************************************************/ +#include "machine/gen_latch.h" + class munchmo_state : public driver_device { public: @@ -20,7 +22,8 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"){ } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_sprite_xpos; @@ -43,6 +46,7 @@ public: required_device m_audiocpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; DECLARE_WRITE8_MEMBER(mnchmobl_nmi_enable_w); DECLARE_WRITE8_MEMBER(mnchmobl_soundlatch_w); diff --git a/src/mame/includes/prehisle.h b/src/mame/includes/prehisle.h index 1b3d1c0a35d..b8d3eb22e64 100644 --- a/src/mame/includes/prehisle.h +++ b/src/mame/includes/prehisle.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail + +#include "machine/gen_latch.h" #include "sound/upd7759.h" class prehisle_state : public driver_device @@ -15,7 +17,8 @@ public: m_audiocpu(*this, "audiocpu"), m_upd7759(*this, "upd"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } required_shared_ptr m_tx_vram; @@ -47,4 +50,5 @@ public: required_device m_upd7759; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; }; diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h index 77e690fc86e..687a34d649c 100644 --- a/src/mame/includes/segag80r.h +++ b/src/mame/includes/segag80r.h @@ -9,6 +9,7 @@ #include "machine/segag80.h" #include "sound/sn76496.h" #include "audio/segasnd.h" +#include "machine/gen_latch.h" class sega005_sound_device; @@ -36,6 +37,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_shared_ptr m_mainram; @@ -52,6 +54,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + optional_device m_soundlatch; optional_shared_ptr m_decrypted_opcodes; std::vector m_paletteram; diff --git a/src/mame/includes/segahang.h b/src/mame/includes/segahang.h index 6de20b3b774..c82cfb05172 100644 --- a/src/mame/includes/segahang.h +++ b/src/mame/includes/segahang.h @@ -10,6 +10,7 @@ #include "cpu/mcs51/mcs51.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" +#include "machine/gen_latch.h" #include "machine/segaic16.h" #include "video/segaic16.h" #include "video/segaic16_road.h" @@ -33,6 +34,7 @@ public: m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), m_segaic16road(*this, "segaic16road"), + m_soundlatch(*this, "soundlatch"), m_workram(*this, "workram"), m_sharrier_video(false), m_adc_select(0), @@ -97,6 +99,7 @@ protected: required_device m_sprites; required_device m_segaic16vid; required_device m_segaic16road; + required_device m_soundlatch; // memory pointers required_shared_ptr m_workram; diff --git a/src/mame/includes/segaorun.h b/src/mame/includes/segaorun.h index 09c5f254b2d..5e7ff05144b 100644 --- a/src/mame/includes/segaorun.h +++ b/src/mame/includes/segaorun.h @@ -9,6 +9,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/segaic16.h" #include "machine/watchdog.h" @@ -35,6 +36,7 @@ public: m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), m_segaic16road(*this, "segaic16road"), + m_soundlatch(*this, "soundlatch"), m_bankmotor_timer(*this, "bankmotor"), m_digital_ports(*this, digital_ports), m_adc_ports(*this, "ADC"), @@ -125,6 +127,7 @@ protected: required_device m_sprites; required_device m_segaic16vid; required_device m_segaic16road; + required_device m_soundlatch; optional_device m_bankmotor_timer; // input ports diff --git a/src/mame/includes/segas16a.h b/src/mame/includes/segas16a.h index cdf7d34ceab..d29c18ef35f 100644 --- a/src/mame/includes/segas16a.h +++ b/src/mame/includes/segas16a.h @@ -10,6 +10,7 @@ #include "cpu/mcs48/mcs48.h" #include "cpu/mcs51/mcs51.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/i8255.h" #include "machine/i8243.h" #include "machine/nvram.h" @@ -38,6 +39,7 @@ public: m_nvram(*this, "nvram"), m_watchdog(*this, "watchdog"), m_segaic16vid(*this, "segaic16vid"), + m_soundlatch(*this, "soundlatch"), m_sprites(*this, "sprites"), m_workram(*this, "nvram"), m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes"), @@ -136,6 +138,7 @@ protected: required_device m_nvram; required_device m_watchdog; required_device m_segaic16vid; + required_device m_soundlatch; required_device m_sprites; // memory pointers diff --git a/src/mame/includes/segas16b.h b/src/mame/includes/segas16b.h index 1615d5a6da7..e03fead08b6 100644 --- a/src/mame/includes/segas16b.h +++ b/src/mame/includes/segas16b.h @@ -9,6 +9,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/mcs51/mcs51.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/segaic16.h" #include "sound/2151intf.h" @@ -39,6 +40,7 @@ public: m_nvram(*this, "nvram"), m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), + m_soundlatch(*this, "soundlatch"), m_workram(*this, "workram"), m_romboard(ROM_BOARD_INVALID), m_tilemap_type(SEGAIC16_TILEMAP_16B), @@ -196,6 +198,7 @@ protected: required_device m_nvram; optional_device m_sprites; required_device m_segaic16vid; + optional_device m_soundlatch; // not for atomicp // memory pointers required_shared_ptr m_workram; diff --git a/src/mame/includes/segas18.h b/src/mame/includes/segas18.h index 79726c3c253..c8b9ad67268 100644 --- a/src/mame/includes/segas18.h +++ b/src/mame/includes/segas18.h @@ -9,6 +9,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/mcs51/mcs51.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/segaic16.h" #include "machine/315_5296.h" @@ -36,6 +37,7 @@ public: m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), m_gfxdecode(*this, "gfxdecode"), + m_soundlatch(*this, "soundlatch"), m_workram(*this, "workram"), m_romboard(ROM_BOARD_INVALID), m_grayscale_enable(false), @@ -138,6 +140,7 @@ protected: required_device m_sprites; required_device m_segaic16vid; required_device m_gfxdecode; + required_device m_soundlatch; // memory pointers required_shared_ptr m_workram; diff --git a/src/mame/includes/segaxbd.h b/src/mame/includes/segaxbd.h index 8fe15bdc04a..768d86595fc 100644 --- a/src/mame/includes/segaxbd.h +++ b/src/mame/includes/segaxbd.h @@ -9,6 +9,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/mcs51/mcs51.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "machine/segaic16.h" #include "video/segaic16.h" @@ -106,6 +107,7 @@ protected: required_device m_sprites; required_device m_segaic16vid; required_device m_segaic16road; + required_device m_soundlatch; required_shared_ptr m_subram0; // configuration @@ -137,21 +139,6 @@ protected: required_device m_screen; required_device m_palette; - UINT16 m_latched_value[4]; - UINT8 m_latch_read[4]; - - UINT32 soundlatch_read(UINT8 index = 0) { m_latch_read[index] = 1; return m_latched_value[index]; }; - void soundlatch_write(UINT8 index, UINT32 data) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(segaxbd_state::soundlatch_sync_callback), this), index | (data << 8)); }; - void soundlatch_write(UINT32 data) { soundlatch_write(0, data); } - - void soundlatch_sync_callback(void *ptr, INT32 param) - { - UINT16 value = param >> 8; - int which = param & 0xff; - m_latched_value[which] = value; - m_latch_read[which] = 0; - }; - protected: virtual void device_start() override; virtual void device_reset() override; diff --git a/src/mame/includes/segaybd.h b/src/mame/includes/segaybd.h index 2de9cf50fad..9666c1fce23 100644 --- a/src/mame/includes/segaybd.h +++ b/src/mame/includes/segaybd.h @@ -8,6 +8,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "machine/segaic16.h" #include "video/segaic16.h" @@ -31,6 +32,7 @@ public: m_bsprites(*this, "bsprites"), m_ysprites(*this, "ysprites"), m_segaic16vid(*this, "segaic16vid"), + m_soundlatch(*this, "soundlatch"), m_digital_ports(*this, digital_ports), m_adc_ports(*this, "ADC"), m_pdrift_bank(0), @@ -112,6 +114,7 @@ protected: required_device m_bsprites; required_device m_ysprites; required_device m_segaic16vid; + required_device m_soundlatch; // input ports DECLARE_IOPORT_ARRAY(digital_ports); diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h index 1f1c5d0a920..b9a347e51d8 100644 --- a/src/mame/includes/seta.h +++ b/src/mame/includes/seta.h @@ -1,11 +1,13 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia + /*************************************************************************** -= Seta Hardware =- ***************************************************************************/ +#include "machine/gen_latch.h" #include "sound/x1_010.h" #include "video/seta001.h" @@ -37,6 +39,8 @@ public: m_subcpu(*this,"sub"), m_seta001(*this, "spritegen"), m_x1(*this, "x1snd"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2"), m_sharedram(*this,"sharedram"), m_workram(*this,"workram"), m_vregs(*this,"vregs"), @@ -57,6 +61,8 @@ public: optional_device m_subcpu; required_device m_seta001; optional_device m_x1; + optional_device m_soundlatch; + optional_device m_soundlatch2; optional_shared_ptr m_sharedram; optional_shared_ptr m_workram; diff --git a/src/mame/includes/shangha3.h b/src/mame/includes/shangha3.h index 1a75aaa8cfb..deaf039aa8e 100644 --- a/src/mame/includes/shangha3.h +++ b/src/mame/includes/shangha3.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria + +#include "machine/gen_latch.h" #include "sound/okim6295.h" class shangha3_state : public driver_device @@ -13,6 +15,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_ram(*this, "ram") { } required_device m_maincpu; @@ -21,6 +24,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + optional_device m_soundlatch; required_shared_ptr m_ram; diff --git a/src/mame/includes/snk.h b/src/mame/includes/snk.h index 81744602a36..1810707bf33 100644 --- a/src/mame/includes/snk.h +++ b/src/mame/includes/snk.h @@ -1,12 +1,15 @@ // license:BSD-3-Clause // copyright-holders:Ernesto Corvi,Tim Lindquist,Carlos A. Lozano,Bryan McPhail,Jarek Parchanski,Nicola Salmoria,Tomasz Slanina,Phil Stroffolino,Acho A. Tang,Victor Trucco // thanks-to:Marco Cassili + /************************************************************************* various SNK triple Z80 games *************************************************************************/ +#include "machine/gen_latch.h" + class snk_state : public driver_device { public: @@ -18,6 +21,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_spriteram(*this, "spriteram"), m_fg_videoram(*this, "fg_videoram"), m_bg_videoram(*this, "bg_videoram"), @@ -29,6 +33,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + optional_device m_soundlatch; required_shared_ptr m_spriteram; optional_shared_ptr m_fg_videoram; diff --git a/src/mame/includes/snk68.h b/src/mame/includes/snk68.h index d2743e85683..e79febfe760 100644 --- a/src/mame/includes/snk68.h +++ b/src/mame/includes/snk68.h @@ -1,7 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail, Acho A. Tang, Nicola Salmoria + +#include "machine/gen_latch.h" #include "sound/upd7759.h" #include "video/snk68_spr.h" + class snk68_state : public driver_device { public: @@ -12,9 +15,10 @@ public: m_upd7759(*this, "upd"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), + m_sprites(*this, "sprites"), + m_soundlatch(*this, "soundlatch"), m_pow_fg_videoram(*this, "pow_fg_videoram"), - m_spriteram(*this, "spriteram"), - m_sprites(*this, "sprites") + m_spriteram(*this, "spriteram") { } required_device m_maincpu; @@ -22,12 +26,12 @@ public: required_device m_upd7759; required_device m_gfxdecode; required_device m_screen; + required_device m_sprites; + required_device m_soundlatch; required_shared_ptr m_pow_fg_videoram; required_shared_ptr m_spriteram; - required_device m_sprites; - UINT8 m_invert_controls; bool m_sprite_flip_axis; tilemap_t *m_fg_tilemap; diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 8a18c08957a..284d722b3f0 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -2,6 +2,7 @@ // copyright-holders:David Haywood, Angelo Salese, Olivier Galibert, Mariusz Wojcieszek, R. Belmont #include "includes/saturn.h" +#include "machine/gen_latch.h" class stv_state : public saturn_state { @@ -11,7 +12,8 @@ public: m_adsp(*this, "adsp"), m_adsp_pram(*this, "adsp_pram"), m_cryptdevice(*this, "315_5881"), - m_5838crypt(*this, "315_5838") + m_5838crypt(*this, "315_5838"), + m_soundlatch(*this, "soundlatch") { } @@ -122,6 +124,7 @@ public: optional_device m_cryptdevice; optional_device m_5838crypt; + optional_device m_soundlatch; // batmanfr UINT16 crypt_read_callback(UINT32 addr); UINT16 crypt_read_callback_ch1(UINT32 addr); UINT16 crypt_read_callback_ch2(UINT32 addr); diff --git a/src/mame/includes/suna16.h b/src/mame/includes/suna16.h index d7f7ed7d029..094c95647af 100644 --- a/src/mame/includes/suna16.h +++ b/src/mame/includes/suna16.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia + +#include "machine/gen_latch.h" #include "sound/dac.h" class suna16_state : public driver_device @@ -15,6 +17,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_spriteram(*this, "spriteram"), m_spriteram2(*this, "spriteram2"), m_bank1(*this, "bank1"), @@ -31,6 +34,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + required_device m_soundlatch; required_shared_ptr m_spriteram; optional_shared_ptr m_spriteram2; diff --git a/src/mame/includes/suna8.h b/src/mame/includes/suna8.h index 1ee773edb15..f15725507f6 100644 --- a/src/mame/includes/suna8.h +++ b/src/mame/includes/suna8.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia + +#include "machine/gen_latch.h" #include "sound/samples.h" #define TILEMAPS 0 @@ -19,6 +21,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2"), m_bank0d(*this, "bank0d"), m_bank1(*this, "bank1"), m_bank1d(*this, "bank1d"), @@ -36,6 +40,8 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + required_device m_soundlatch; + required_device m_soundlatch2; optional_memory_bank m_bank0d; required_memory_bank m_bank1; optional_memory_bank m_bank1d; diff --git a/src/mame/includes/suprloco.h b/src/mame/includes/suprloco.h index 4db13e5ea33..9aa77824569 100644 --- a/src/mame/includes/suprloco.h +++ b/src/mame/includes/suprloco.h @@ -1,5 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Zsolt Vasvari + +#include "machine/gen_latch.h" + class suprloco_state : public driver_device { public: @@ -8,6 +11,7 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), + m_soundlatch(*this, "soundlatch"), m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_scrollram(*this, "scrollram"), @@ -16,6 +20,7 @@ public: required_device m_maincpu; required_device m_audiocpu; required_device m_gfxdecode; + required_device m_soundlatch; required_shared_ptr m_spriteram; required_shared_ptr m_videoram; diff --git a/src/mame/includes/system1.h b/src/mame/includes/system1.h index 86f437f732e..5449cdfbaad 100644 --- a/src/mame/includes/system1.h +++ b/src/mame/includes/system1.h @@ -1,6 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Jarek Parchanski, Nicola Salmoria, Mirko Buffoni + #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/i8255.h" #include "machine/segacrp2_device.h" @@ -22,6 +24,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_decrypted_opcodes(*this, "decrypted_opcodes"), m_maincpu_region(*this, "maincpu"), m_color_prom(*this, "palette"), @@ -130,6 +133,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + required_device m_soundlatch; optional_shared_ptr m_decrypted_opcodes; required_memory_region m_maincpu_region; optional_region_ptr m_color_prom; diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index 65b28f457b1..cf4bde12f5f 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -2,6 +2,7 @@ // copyright-holders:Nicola Salmoria, Phil Stroffolino, Mirko Buffoni #include "video/sega16sp.h" +#include "machine/gen_latch.h" #include "machine/segaic16.h" #include "sound/msm5205.h" #include "sound/upd7759.h" @@ -23,6 +24,7 @@ public: m_msm(*this, "5205"), m_upd7759(*this, "7759"), m_gfxdecode(*this, "gfxdecode"), + m_soundlatch(*this, "soundlatch"), m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_shared_ptr m_textram; @@ -120,6 +122,7 @@ public: optional_device m_msm; optional_device m_upd7759; required_device m_gfxdecode; + optional_device m_soundlatch; optional_shared_ptr m_decrypted_opcodes; DECLARE_WRITE16_MEMBER(sound_command_nmi_w); diff --git a/src/mame/includes/toki.h b/src/mame/includes/toki.h index 23718749380..ca8af3876ee 100644 --- a/src/mame/includes/toki.h +++ b/src/mame/includes/toki.h @@ -1,6 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Jarek Parchanski + #include "audio/seibu.h" +#include "machine/gen_latch.h" #include "sound/msm5205.h" #include "video/bufsprite.h" @@ -16,7 +18,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_spriteram(*this, "spriteram") , + m_soundlatch(*this, "soundlatch"), + m_spriteram(*this, "spriteram"), m_background1_videoram(*this, "bg1_vram"), m_background2_videoram(*this, "bg2_vram"), m_videoram(*this, "videoram"), @@ -29,6 +32,7 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + optional_device m_soundlatch; // tokib required_device m_spriteram; required_shared_ptr m_background1_videoram; diff --git a/src/mame/machine/seicop.cpp b/src/mame/machine/seicop.cpp index d5640aa6881..7588bb1b41e 100644 --- a/src/mame/machine/seicop.cpp +++ b/src/mame/machine/seicop.cpp @@ -212,7 +212,7 @@ WRITE16_MEMBER( seibu_cop_bootleg_device::copdxbl_0_w ) case (0x740/2): { - state->soundlatch_byte_w(space, 0, data & 0xff); + state->m_soundlatch->write(space, 0, data & 0xff); state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); break; }