diff --git a/src/mame/audio/mario.cpp b/src/mame/audio/mario.cpp index ba8c797f147..d30fada6968 100644 --- a/src/mame/audio/mario.cpp +++ b/src/mame/audio/mario.cpp @@ -24,17 +24,17 @@ #define ACTIVELOW_PORT_BIT(P,A,D) ((P & (~(1 << A))) | ((D ^ 1) << A)) #define ACTIVEHIGH_PORT_BIT(P,A,D) ((P & (~(1 << A))) | (D << A)) -#define I8035_T_R(M,N) ((soundlatch2_byte_r(M,0) >> (N)) & 1) -#define I8035_T_W_AH(M,N,D) do { m_portT = ACTIVEHIGH_PORT_BIT(m_portT,N,D); soundlatch2_byte_w(M, 0, m_portT); } while (0) +#define I8035_T_R(M,N) ((m_soundlatch2->read(M,0) >> (N)) & 1) +#define I8035_T_W_AH(M,N,D) do { m_portT = ACTIVEHIGH_PORT_BIT(m_portT,N,D); m_soundlatch2->write(M, 0, m_portT); } while (0) -#define I8035_P1_R(M) (soundlatch3_byte_r(M,0)) -#define I8035_P2_R(M) (soundlatch4_byte_r(M,0)) -#define I8035_P1_W(M,D) soundlatch3_byte_w(M,0,D) +#define I8035_P1_R(M) (m_soundlatch3->read(M,0)) +#define I8035_P2_R(M) (m_soundlatch4->read(M,0)) +#define I8035_P1_W(M,D) m_soundlatch3->write(M,0,D) #if (USE_8039) -#define I8035_P2_W(M,D) do { soundlatch4_byte_w(M,0,D); } while (0) +#define I8035_P2_W(M,D) do { m_soundlatch4->write(M,0,D); } while (0) #else -#define I8035_P2_W(M,D) do { set_ea(M, ((D) & 0x20) ? 0 : 1); soundlatch4_byte_w(M,0,D); } while (0) +#define I8035_P2_W(M,D) do { set_ea(M, ((D) & 0x20) ? 0 : 1); m_soundlatch4->write(M,0,D); } while (0) #endif #define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D))) @@ -691,12 +691,12 @@ void mario_state::sound_reset() #endif /* FIXME: convert to latch8 */ - soundlatch_clear_byte_w(space, 0, 0); - soundlatch2_clear_byte_w(space, 0, 0); - soundlatch3_clear_byte_w(space, 0, 0); - soundlatch4_clear_byte_w(space, 0, 0); - I8035_P1_W(space, 0x00); /* Input port */ - I8035_P2_W(space, 0xff); /* Port is in high impedance state after reset */ + m_soundlatch->clear_w(space, 0, 0); + if (m_soundlatch2) m_soundlatch2->clear_w(space, 0, 0); + if (m_soundlatch3) m_soundlatch3->clear_w(space, 0, 0); + if (m_soundlatch4) m_soundlatch4->clear_w(space, 0, 0); + if (m_soundlatch3) I8035_P1_W(space, 0x00); /* Input port */ + if (m_soundlatch4) I8035_P2_W(space, 0xff); /* Port is in high impedance state after reset */ m_last = 0; } @@ -734,7 +734,7 @@ READ8_MEMBER(mario_state::mario_sh_tune_r) UINT8 p2 = I8035_P2_R(space); if ((p2 >> 7) & 1) - return soundlatch_byte_r(space, offset); + return m_soundlatch->read(space, offset); else return (SND[(0x1000 + (p2 & 0x0f) * 256 + offset) & mask]); } @@ -777,7 +777,7 @@ WRITE8_MEMBER(mario_state::masao_sh_irqtrigger_w) WRITE8_MEMBER(mario_state::mario_sh_tuneselect_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); } /* Sound 0 and 1 are pulsed !*/ @@ -883,6 +883,11 @@ MACHINE_CONFIG_FRAGMENT( mario_audio ) MCFG_CPU_IO_MAP(mario_sound_io_map) MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_GENERIC_LATCH_8_ADD("soundlatch3") + MCFG_GENERIC_LATCH_8_ADD("soundlatch4") #if OLD_SOUND MCFG_SOUND_ADD("discrete", DISCRETE, 0) @@ -910,8 +915,10 @@ MACHINE_CONFIG_FRAGMENT( masao_audio ) MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, 14318000/6) - 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_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/armedf.cpp b/src/mame/drivers/armedf.cpp index e2a9dd65b3a..0dbc5915b60 100644 --- a/src/mame/drivers/armedf.cpp +++ b/src/mame/drivers/armedf.cpp @@ -361,12 +361,12 @@ WRITE16_MEMBER(armedf_state::bootleg_io_w) WRITE16_MEMBER(armedf_state::sound_command_w) { if (ACCESSING_BITS_0_7) - soundlatch_byte_w(space, 0, ((data & 0x7f) << 1) | 1); + m_soundlatch->write(space, 0, ((data & 0x7f) << 1) | 1); } READ8_MEMBER(armedf_state::soundlatch_clear_r) { - soundlatch_clear_byte_w(space, 0, 0); + m_soundlatch->clear_w(space, 0, 0); return 0; } @@ -750,7 +750,7 @@ static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, armedf_state ) AM_RANGE(0x2, 0x2) AM_DEVWRITE("dac1", dac_device, write_signed8) AM_RANGE(0x3, 0x3) AM_DEVWRITE("dac2", dac_device, write_signed8) AM_RANGE(0x4, 0x4) AM_READ(soundlatch_clear_r) - AM_RANGE(0x6, 0x6) AM_READ(soundlatch_byte_r) + AM_RANGE(0x6, 0x6) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -1205,6 +1205,8 @@ static MACHINE_CONFIG_START( terraf, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1255,6 +1257,8 @@ static MACHINE_CONFIG_START( terrafjb, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1307,6 +1311,8 @@ static MACHINE_CONFIG_START( kozure, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1353,6 +1359,8 @@ static MACHINE_CONFIG_START( armedf, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1401,6 +1409,8 @@ static MACHINE_CONFIG_START( cclimbr2, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1449,6 +1459,8 @@ static MACHINE_CONFIG_START( legion, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1496,6 +1508,8 @@ static MACHINE_CONFIG_START( legionjb, armedf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -1553,6 +1567,8 @@ static MACHINE_CONFIG_START( bigfghtr, bigfghtr_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) diff --git a/src/mame/drivers/astrocde.cpp b/src/mame/drivers/astrocde.cpp index a9c1e34ac1b..89bb2b7e725 100644 --- a/src/mame/drivers/astrocde.cpp +++ b/src/mame/drivers/astrocde.cpp @@ -465,7 +465,7 @@ WRITE8_MEMBER(astrocde_state::demndrgn_sound_w) WRITE8_MEMBER(astrocde_state::tenpindx_sound_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -660,7 +660,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tenpin_sub_io_map, AS_IO, 8, astrocde_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) - AM_RANGE(0x97, 0x97) AM_READ(soundlatch_byte_r) + AM_RANGE(0x97, 0x97) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x98, 0x98) AM_DEVWRITE("aysnd", ay8910_device, address_w) AM_RANGE(0x98, 0x98) AM_DEVREAD("aysnd", ay8910_device, data_r) AM_RANGE(0x9a, 0x9a) AM_DEVWRITE("aysnd", ay8910_device, data_w) @@ -1453,6 +1453,9 @@ static MACHINE_CONFIG_DERIVED( tenpindx, astrocade_16color_base ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8912, ASTROCADE_CLOCK/4) /* real clock unknown */ MCFG_AY8910_PORT_A_READ_CB(IOPORT("DIPSW")) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) diff --git a/src/mame/drivers/bingoc.cpp b/src/mame/drivers/bingoc.cpp index 868fd3c3563..388d813a5bb 100644 --- a/src/mame/drivers/bingoc.cpp +++ b/src/mame/drivers/bingoc.cpp @@ -12,7 +12,7 @@ TODO: -terminal pcb(s) roms aren't dumped,so no video can be shown,a cabinet snap is here -> http://www.system16.com/hardware.php?id=840&page=1#2743 ,every player should have his own screen. --inconsistant (likely wrong) sound banking. +-inconsistent (likely wrong) sound banking. ============================================================================================ BINGO CIRCUS (MAIN PCB) @@ -32,6 +32,7 @@ SOUND : YM2151 uPD7759C #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/2151intf.h" #include "sound/upd7759.h" @@ -43,7 +44,8 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), - m_upd7759(*this, "upd") { } + m_upd7759(*this, "upd"), + m_soundlatch(*this, "soundlatch") { } UINT8 m_x; DECLARE_READ16_MEMBER(unknown_r); @@ -54,6 +56,7 @@ public: required_device m_maincpu; required_device m_soundcpu; required_device m_upd7759; + required_device m_soundlatch; }; @@ -97,7 +100,7 @@ READ8_MEMBER(bingoc_state::sound_test_r) #else WRITE16_MEMBER(bingoc_state::main_sound_latch_w) { - soundlatch_byte_w(space,0,data&0xff); + m_soundlatch->write(space,0,data&0xff); m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } #endif @@ -135,7 +138,7 @@ static ADDRESS_MAP_START( sound_io, AS_IO, 8, bingoc_state ) AM_RANGE(0x40, 0x40) AM_WRITE(sound_play_w) AM_RANGE(0x80, 0x80) AM_DEVWRITE("upd", upd7759_device, port_w) #if !SOUND_TEST - AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) //soundlatch + AM_RANGE(0xc0, 0xc0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) #else AM_RANGE(0xc0, 0xc0) AM_READ(sound_test_r) #endif @@ -173,6 +176,8 @@ static MACHINE_CONFIG_START( bingoc, bingoc_state ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") //might just be mono... + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", 7159160/2) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) diff --git a/src/mame/drivers/calorie.cpp b/src/mame/drivers/calorie.cpp index 1faa6b62bb8..24a3466befa 100644 --- a/src/mame/drivers/calorie.cpp +++ b/src/mame/drivers/calorie.cpp @@ -81,6 +81,7 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/segacrp2_device.h" #include "sound/ay8910.h" @@ -95,6 +96,7 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ @@ -120,6 +122,7 @@ public: required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; optional_shared_ptr m_decrypted_opcodes; }; @@ -237,8 +240,8 @@ WRITE8_MEMBER(calorie_state::calorie_flipscreen_w) READ8_MEMBER(calorie_state::calorie_soundlatch_r) { - UINT8 latch = soundlatch_byte_r(space, 0); - soundlatch_clear_byte_w(space, 0, 0); + UINT8 latch = m_soundlatch->read(space, 0); + m_soundlatch->clear_w(space, 0, 0); return latch; } @@ -266,7 +269,7 @@ static ADDRESS_MAP_START( calorie_map, AS_PROGRAM, 8, calorie_state ) AM_RANGE(0xf002, 0xf002) AM_READ_PORT("SYSTEM") AM_RANGE(0xf004, 0xf004) AM_READ_PORT("DSW1") AM_WRITE(calorie_flipscreen_w) AM_RANGE(0xf005, 0xf005) AM_READ_PORT("DSW2") - AM_RANGE(0xf800, 0xf800) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xf800, 0xf800) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, calorie_state ) @@ -477,6 +480,8 @@ static MACHINE_CONFIG_START( calorie, calorie_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, 1500000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.8) /* YM2149 really */ diff --git a/src/mame/drivers/carjmbre.cpp b/src/mame/drivers/carjmbre.cpp index 4484a1d80e6..61f1e3c2a57 100644 --- a/src/mame/drivers/carjmbre.cpp +++ b/src/mame/drivers/carjmbre.cpp @@ -40,6 +40,7 @@ #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "video/resnet.h" #include "sound/ay8910.h" @@ -241,7 +242,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, carjmbre_state ) AM_RANGE(0x9800, 0x98ff) AM_RAM AM_SHARE("spriteram") // 5101*2 AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN1") AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN2") - AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW") AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW") AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END @@ -254,7 +255,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, carjmbre_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(0x20, 0x21) AM_DEVWRITE("ay1", ay8910_device, address_data_w) AM_RANGE(0x22, 0x22) AM_WRITENOP // bdir/bc2/bc1 1/0/1 inactive write AM_RANGE(0x24, 0x24) AM_DEVREAD("ay1", ay8910_device, data_r) @@ -368,8 +369,12 @@ static MACHINE_CONFIG_START( carjmbre, carjmbre_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, XTAL_18_432MHz/6/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay2", AY8910, XTAL_18_432MHz/6/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END diff --git a/src/mame/drivers/cclimber.cpp b/src/mame/drivers/cclimber.cpp index 6886598ada6..d6dffce1624 100644 --- a/src/mame/drivers/cclimber.cpp +++ b/src/mame/drivers/cclimber.cpp @@ -256,7 +256,7 @@ void cclimber_state::machine_start() WRITE8_MEMBER(cclimber_state::swimmer_sh_soundlatch_w) { - soundlatch_byte_w(space,offset,data); + m_soundlatch->write(space,offset,data); m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); } @@ -454,7 +454,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( swimmer_audio_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x2000, 0x23ff) AM_RAM - AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) + AM_RANGE(0x3000, 0x3000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x4000, 0x4001) AM_RAM /* ??? */ ADDRESS_MAP_END @@ -1172,6 +1172,9 @@ static MACHINE_CONFIG_START( swimmer, cclimber_state ) /* audio hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, XTAL_4MHz/2) /* verified on pcb */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/drivers/cop01.cpp b/src/mame/drivers/cop01.cpp index 36ccca372bc..650895fd373 100644 --- a/src/mame/drivers/cop01.cpp +++ b/src/mame/drivers/cop01.cpp @@ -74,13 +74,13 @@ Mighty Guy board layout: WRITE8_MEMBER(cop01_state::cop01_sound_command_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(0, ASSERT_LINE ); } READ8_MEMBER(cop01_state::cop01_sound_command_r) { - int res = (soundlatch_byte_r(space, offset) & 0x7f) << 1; + int res = (m_soundlatch->read(space, offset) & 0x7f) << 1; /* bit 0 seems to be a timer */ if ((m_audiocpu->total_cycles() / TIMER_RATE) & 1) @@ -473,6 +473,8 @@ static MACHINE_CONFIG_START( cop01, cop01_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, 1250000) /* unknown clock / divider, hand-tuned to match audio reference */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -513,6 +515,8 @@ static MACHINE_CONFIG_START( mightguy, cop01_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3526, AUDIOCPU_CLOCK/2) /* unknown divider */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/csplayh5.cpp b/src/mame/drivers/csplayh5.cpp index aadf7ecbdb6..589e47cdc05 100644 --- a/src/mame/drivers/csplayh5.cpp +++ b/src/mame/drivers/csplayh5.cpp @@ -30,6 +30,7 @@ #include "cpu/z80/tmpz84c011.h" #include "sound/dac.h" #include "sound/3812intf.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "cpu/h8/h83002.h" @@ -44,6 +45,7 @@ public: m_v9958(*this, "v9958"), m_dac1(*this, "dac1"), m_dac2(*this, "dac2"), + m_soundlatch(*this, "soundlatch"), m_key(*this, "KEY"), m_region_maincpu(*this, "maincpu"), m_region_audiocpu(*this, "audiocpu"), @@ -55,6 +57,7 @@ public: required_device m_v9958; required_device m_dac1; required_device m_dac2; + required_device m_soundlatch; required_ioport_array<5> m_key; required_memory_region m_region_maincpu; required_memory_region m_region_audiocpu; @@ -123,7 +126,7 @@ WRITE16_MEMBER(csplayh5_state::csplayh5_mux_w) WRITE16_MEMBER(csplayh5_state::csplayh5_sound_w) { - soundlatch_byte_w(space, 0, ((data >> 8) & 0xff)); + m_soundlatch->write(space, 0, ((data >> 8) & 0xff)); } @@ -186,12 +189,12 @@ void csplayh5_state::soundbank_w(int data) READ8_MEMBER(csplayh5_state::csplayh5_sound_r) { - return soundlatch_byte_r(space, 0); + return m_soundlatch->read(space, 0); } WRITE8_MEMBER(csplayh5_state::csplayh5_soundclr_w) { - soundlatch_clear_byte_w(space, 0, 0); + m_soundlatch->clear_w(space, 0, 0); } @@ -486,6 +489,8 @@ static MACHINE_CONFIG_START( csplayh5, csplayh5_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) diff --git a/src/mame/drivers/dacholer.cpp b/src/mame/drivers/dacholer.cpp index d9e701f6295..4d3e4cbc34c 100644 --- a/src/mame/drivers/dacholer.cpp +++ b/src/mame/drivers/dacholer.cpp @@ -34,6 +34,7 @@ #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/dac.h" #include "sound/msm5205.h" #include "sound/ay8910.h" @@ -46,25 +47,27 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_audiocpu(*this,"audiocpu"), - m_bgvideoram(*this, "bgvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_spriteram(*this, "spriteram"), m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), + m_bgvideoram(*this, "bgvideoram"), + m_fgvideoram(*this, "fgvideoram"), + m_spriteram(*this, "spriteram") { } /* devices */ required_device m_maincpu; required_device m_audiocpu; + optional_device m_msm; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + /* memory pointers */ required_shared_ptr m_bgvideoram; required_shared_ptr m_fgvideoram; required_shared_ptr m_spriteram; - optional_device m_msm; - required_device m_gfxdecode; - required_device m_palette; - /* video-related */ tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; @@ -217,7 +220,7 @@ WRITE8_MEMBER(dacholer_state::coins_w) WRITE8_MEMBER(dacholer_state::snd_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -298,7 +301,7 @@ WRITE8_MEMBER(dacholer_state::music_irq_w) static ADDRESS_MAP_START( snd_io_map, AS_IO, 8, dacholer_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w ) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, clear_w) AM_RANGE(0x04, 0x04) AM_WRITE(music_irq_w) AM_RANGE(0x08, 0x08) AM_WRITE(snd_irq_w) AM_RANGE(0x0c, 0x0c) AM_WRITE(snd_ack_w) @@ -310,7 +313,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( itaten_snd_io_map, AS_IO, 8, dacholer_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w ) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, clear_w) AM_RANGE(0x86, 0x87) AM_DEVWRITE("ay1", ay8910_device, data_address_w) AM_RANGE(0x8a, 0x8b) AM_DEVWRITE("ay2", ay8910_device, data_address_w) AM_RANGE(0x8e, 0x8f) AM_DEVWRITE("ay3", ay8910_device, data_address_w) @@ -675,6 +678,8 @@ static MACHINE_CONFIG_START( dacholer, dacholer_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, XTAL_19_968MHz/16) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) diff --git a/src/mame/drivers/deniam.cpp b/src/mame/drivers/deniam.cpp index d39a9227077..49a076dda15 100644 --- a/src/mame/drivers/deniam.cpp +++ b/src/mame/drivers/deniam.cpp @@ -55,7 +55,7 @@ WRITE16_MEMBER(deniam_state::sound_command_w) { if (ACCESSING_BITS_8_15) { - soundlatch_byte_w(space,offset, (data >> 8) & 0xff); + m_soundlatch->write(space,offset, (data >> 8) & 0xff); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } @@ -103,7 +103,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, deniam_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x01, 0x01) AM_READ(soundlatch_byte_r) + AM_RANGE(0x01, 0x01) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x02, 0x03) AM_DEVWRITE("ymsnd", ym3812_device, write) AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("oki", okim6295_device, read, write) AM_RANGE(0x07, 0x07) AM_WRITE(deniam16b_oki_rom_bank_w) @@ -281,6 +281,8 @@ static MACHINE_CONFIG_START( deniam16b, deniam_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_25MHz/6) /* "SM64" ym3812 clone; 4.166470 measured, = 4.166666Mhz verified */ MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) diff --git a/src/mame/drivers/espial.cpp b/src/mame/drivers/espial.cpp index ff6fc3d5c85..599b1b464eb 100644 --- a/src/mame/drivers/espial.cpp +++ b/src/mame/drivers/espial.cpp @@ -17,7 +17,7 @@ Stephh's notes (based on the games Z80 code and some tests) : - The games read both players controls for player 2 when "Cabinet" is set to "Upright" (code at 0x0321). - The games read both buttons status regardless of settings. They are - then comnbined if Dip Switch is set to "1" (code at 0x32a). + then combined if Dip Switch is set to "1" (code at 0x32a). - The "CRE." displayed at the bottom right of the screen is in fact not really the number of credits (especially when coinage isn't 1C_1C) as it relies on a transformation of real number of credits (stored at @@ -94,7 +94,7 @@ INTERRUPT_GEN_MEMBER(espial_state::espial_sound_nmi_gen) WRITE8_MEMBER(espial_state::espial_master_soundlatch_w) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -106,7 +106,7 @@ static ADDRESS_MAP_START( espial_map, AS_PROGRAM, 8, espial_state ) AM_RANGE(0x6082, 0x6082) AM_READ_PORT("DSW1") AM_RANGE(0x6083, 0x6083) AM_READ_PORT("IN1") AM_RANGE(0x6084, 0x6084) AM_READ_PORT("IN2") - AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch2_byte_r) AM_WRITE(espial_master_soundlatch_w) + AM_RANGE(0x6090, 0x6090) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_WRITE(espial_master_soundlatch_w) AM_RANGE(0x7000, 0x7000) AM_DEVREADWRITE("watchdog", watchdog_timer_device, reset_r, reset_w) AM_RANGE(0x7100, 0x7100) AM_WRITE(espial_master_interrupt_mask_w) AM_RANGE(0x7200, 0x7200) AM_WRITE(espial_flipscreen_w) @@ -131,7 +131,7 @@ static ADDRESS_MAP_START( netwars_map, AS_PROGRAM, 8, espial_state ) AM_RANGE(0x6082, 0x6082) AM_READ_PORT("DSW1") AM_RANGE(0x6083, 0x6083) AM_READ_PORT("IN1") AM_RANGE(0x6084, 0x6084) AM_READ_PORT("IN2") - AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch2_byte_r) AM_WRITE(espial_master_soundlatch_w) + AM_RANGE(0x6090, 0x6090) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_WRITE(espial_master_soundlatch_w) AM_RANGE(0x7000, 0x7000) AM_DEVREADWRITE("watchdog", watchdog_timer_device, reset_r, reset_w) AM_RANGE(0x7100, 0x7100) AM_WRITE(espial_master_interrupt_mask_w) AM_RANGE(0x7200, 0x7200) AM_WRITE(espial_flipscreen_w) @@ -149,7 +149,7 @@ static ADDRESS_MAP_START( espial_sound_map, AS_PROGRAM, 8, espial_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x23ff) AM_RAM AM_RANGE(0x4000, 0x4000) AM_WRITE(espial_sound_nmi_mask_w) - AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) + AM_RANGE(0x6000, 0x6000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( espial_sound_io_map, AS_IO, 8, espial_state ) @@ -342,6 +342,10 @@ static MACHINE_CONFIG_START( espial, espial_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("aysnd", AY8910, 1500000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index ef9d8459e72..48e8b85747c 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -30,7 +30,7 @@ filtered output, while a "FIRE" line triggers a fixed short duration pulse (controlled by another 555 timer) of modulated noise. - See video/galaxian.c for a description of the video section. + See video/galaxian.cpp for a description of the video section. **************************************************************************** @@ -657,10 +657,8 @@ TODO: #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/s2650/s2650.h" -#include "machine/i8255.h" #include "machine/watchdog.h" #include "sound/sn76496.h" -#include "sound/dac.h" #include "sound/discrete.h" #include "audio/cclimber.h" #include "audio/galaxian.h" @@ -949,7 +947,7 @@ WRITE8_MEMBER(galaxian_state::explorer_sound_control_w) READ8_MEMBER(galaxian_state::explorer_sound_latch_r) { m_audiocpu->set_input_line(0, CLEAR_LINE); - return soundlatch_byte_r(m_audiocpu->space(AS_PROGRAM), 0); + return m_soundlatch->read(m_audiocpu->space(AS_PROGRAM), 0); } @@ -1343,7 +1341,7 @@ WRITE8_MEMBER(galaxian_state::kingball_sound1_w) WRITE8_MEMBER(galaxian_state::kingball_sound2_w) { m_kingball_sound = (m_kingball_sound & ~0x02) | (data << 1); - soundlatch_byte_w(space, 0, m_kingball_sound | 0xf0); + m_soundlatch->write(space, 0, m_kingball_sound | 0xf0); } @@ -1419,7 +1417,7 @@ READ8_MEMBER(galaxian_state::jumpbug_protection_r) WRITE8_MEMBER(galaxian_state::checkman_sound_command_w) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -1718,7 +1716,7 @@ static ADDRESS_MAP_START( explorer_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0x6807, 0x6807) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w) AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x07ff) AM_DEVREADWRITE("watchdog", watchdog_timer_device, reset_r, reset_w) /* watchdog works for writes as well? (or is it just disabled?) */ AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ffc) AM_READ_PORT("IN0"); - AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ffc) AM_READ_PORT("IN1"); AM_RANGE(0x8002, 0x8002) AM_MIRROR(0x0ffc) AM_READ_PORT("IN2"); AM_RANGE(0x8003, 0x8003) AM_MIRROR(0x0ffc) AM_READ_PORT("IN3"); @@ -2084,7 +2082,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( checkman_sound_portmap, AS_IO, 8, galaxian_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x03, 0x03) AM_READ(soundlatch_byte_r) + AM_RANGE(0x03, 0x03) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x04, 0x05) AM_DEVWRITE("8910.0", ay8910_device, address_data_w) AM_RANGE(0x06, 0x06) AM_DEVREAD("8910.0", ay8910_device, data_r) ADDRESS_MAP_END @@ -2126,7 +2124,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( kingball_sound_portmap, AS_IO, 8, galaxian_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_READ(soundlatch_byte_r) AM_WRITE(kingball_dac_w) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(kingball_dac_w) ADDRESS_MAP_END @@ -5527,7 +5525,7 @@ static MACHINE_CONFIG_DERIVED( konami_base, galaxian_base ) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_0_w)) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 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(galaxian_state, konami_sound_control_w)) MCFG_I8255_IN_PORTC_CB(IOPORT("IN3")) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_1_w)) @@ -5541,11 +5539,13 @@ static MACHINE_CONFIG_FRAGMENT( konami_sound_1x_ay8910 ) MCFG_CPU_PROGRAM_MAP(frogger_sound_map) MCFG_CPU_IO_MAP(frogger_sound_portmap) + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_SOUND_ADD("8910.0", AY8910, KONAMI_SOUND_CLOCK/8) MCFG_AY8910_OUTPUT_TYPE(AY8910_DISCRETE_OUTPUT) MCFG_AY8910_RES_LOADS(RES_K(5.1), RES_K(5.1), RES_K(5.1)) - 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_READ_CB(READ8(galaxian_state, frogger_sound_timer_r)) MCFG_SOUND_ROUTE_EX(0, "konami", 1.0, 0) MCFG_SOUND_ROUTE_EX(1, "konami", 1.0, 1) @@ -5564,11 +5564,13 @@ static MACHINE_CONFIG_FRAGMENT( konami_sound_2x_ay8910 ) MCFG_CPU_PROGRAM_MAP(konami_sound_map) MCFG_CPU_IO_MAP(konami_sound_portmap) + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_SOUND_ADD("8910.0", AY8910, KONAMI_SOUND_CLOCK/8) MCFG_AY8910_OUTPUT_TYPE(AY8910_DISCRETE_OUTPUT) MCFG_AY8910_RES_LOADS(RES_K(5.1), RES_K(5.1), RES_K(5.1)) - 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_READ_CB(READ8(galaxian_state, konami_sound_timer_r)) MCFG_SOUND_ROUTE_EX(0, "konami", 1.0, 0) MCFG_SOUND_ROUTE_EX(1, "konami", 1.0, 1) @@ -5732,6 +5734,8 @@ static MACHINE_CONFIG_DERIVED( checkman, mooncrst ) MCFG_CPU_IO_MAP(checkman_sound_portmap) MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxian_state, irq0_line_hold) /* NMIs are triggered by the main CPU */ + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_SOUND_ADD("8910.0", AY8910, 1789750) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -5750,9 +5754,11 @@ static MACHINE_CONFIG_DERIVED( checkmaj, galaxian_base ) MCFG_TIMER_DRIVER_ADD_SCANLINE("irq0", galaxian_state, checkmaj_irq0_gen, "screen", 0, 8) + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_SOUND_ADD("8910.0", AY8910, 1620000) - 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_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2) MACHINE_CONFIG_END @@ -5777,6 +5783,8 @@ static MACHINE_CONFIG_DERIVED( kingball, mooncrst ) MCFG_CPU_PROGRAM_MAP(kingball_sound_map) MCFG_CPU_IO_MAP(kingball_sound_portmap) + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_DAC_ADD("dac") MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -5845,7 +5853,7 @@ static MACHINE_CONFIG_DERIVED( theend, galaxian_base ) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, theend_coin_counter_w)) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 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(galaxian_state, konami_sound_control_w)) MCFG_I8255_IN_PORTC_CB(IOPORT("IN3")) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_1_w)) @@ -5866,7 +5874,7 @@ static MACHINE_CONFIG_DERIVED( scramble, galaxian_base ) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_0_w)) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 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(galaxian_state, konami_sound_control_w)) MCFG_I8255_IN_PORTC_CB(READ8(galaxian_state, scramble_protection_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, scramble_protection_w)) @@ -5884,6 +5892,8 @@ static MACHINE_CONFIG_DERIVED( explorer, galaxian_base ) MCFG_CPU_PROGRAM_MAP(konami_sound_map) MCFG_CPU_IO_MAP(konami_sound_portmap) + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* sound hardware */ MCFG_SOUND_ADD("8910.0", AY8910, KONAMI_SOUND_CLOCK/8) MCFG_AY8910_PORT_A_READ_CB(READ8(galaxian_state, explorer_sound_latch_r)) @@ -5922,7 +5932,7 @@ static MACHINE_CONFIG_DERIVED( scorpion, theend ) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_0_w)) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 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(galaxian_state, konami_sound_control_w)) MCFG_I8255_IN_PORTC_CB(READ8(galaxian_state, scorpion_protection_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, scorpion_protection_w)) @@ -5959,17 +5969,19 @@ static MACHINE_CONFIG_DERIVED( sfx, galaxian_base ) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_0_w)) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 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(galaxian_state, konami_sound_control_w)) MCFG_I8255_IN_PORTC_CB(IOPORT("IN3")) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_1_w)) MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(driver_device, soundlatch2_byte_r)) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("soundlatch2", generic_latch_8_device, read)) + + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") /* port on 2nd 8910 is used for communication */ MCFG_SOUND_MODIFY("8910.1") - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(driver_device, soundlatch2_byte_w)) + MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("soundlatch2", generic_latch_8_device, write)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(galaxian_state, sfx_sample_control_w)) /* DAC for the sample player */ @@ -6119,7 +6131,7 @@ static MACHINE_CONFIG_DERIVED( moonwar, scobra ) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, moonwar_port_select_w)) MCFG_DEVICE_ADD("ppi8255_1", I8255A, 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(galaxian_state, konami_sound_control_w)) MCFG_I8255_IN_PORTC_CB(IOPORT("IN3")) MCFG_I8255_OUT_PORTC_CB(WRITE8(galaxian_state, konami_portc_1_w)) @@ -7076,7 +7088,7 @@ DRIVER_INIT_MEMBER(galaxian_state,froggermc) /* video extensions */ common_init(nullptr, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); - space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),this)); + space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(generic_latch_8_device::write), (generic_latch_8_device*)m_soundlatch)); space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggermc_sound_control_w),this)); /* actually needs 2k of RAM */ diff --git a/src/mame/drivers/galivan.cpp b/src/mame/drivers/galivan.cpp index 4af2dd90117..32edd23bf72 100644 --- a/src/mame/drivers/galivan.cpp +++ b/src/mame/drivers/galivan.cpp @@ -42,12 +42,12 @@ TODO WRITE8_MEMBER(galivan_state::galivan_sound_command_w) { - soundlatch_byte_w(space,0,((data & 0x7f) << 1) | 1); + m_soundlatch->write(space,0,((data & 0x7f) << 1) | 1); } READ8_MEMBER(galivan_state::soundlatch_clear_r) { - soundlatch_clear_byte_w(space, 0, 0); + m_soundlatch->clear_w(space, 0, 0); return 0; } @@ -122,7 +122,7 @@ static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, galivan_state ) AM_RANGE(0x02, 0x02) AM_DEVWRITE("dac1", dac_device, write_unsigned8) AM_RANGE(0x03, 0x03) AM_DEVWRITE("dac2", dac_device, write_unsigned8) AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r) - AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r) + AM_RANGE(0x06, 0x06) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -452,6 +452,8 @@ static MACHINE_CONFIG_START( galivan, galivan_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -501,6 +503,9 @@ static MACHINE_CONFIG_START( ninjemak, galivan_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_8MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 5351f5f1b79..64c34ac3cf2 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -28,6 +28,7 @@ $c088-$c095 player tiles #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m6800/m6800.h" +#include "machine/gen_latch.h" #include "sound/ay8910.h" #include "sound/hc55516.h" #include "sound/msm5205.h" @@ -48,7 +49,8 @@ public: m_msm(*this, "msm"), m_cvsd(*this, "cvsd"), m_palette(*this, "palette"), - m_blitter(*this, "blitter") { } + m_blitter(*this, "blitter"), + m_soundlatch(*this, "soundlatch") { } /* sound-related */ // Jangou CVSD Sound @@ -72,6 +74,7 @@ public: optional_device m_cvsd; required_device m_palette; required_device m_blitter; + optional_device m_soundlatch; /* video-related */ DECLARE_WRITE8_MEMBER(mux_w); @@ -233,14 +236,14 @@ READ8_MEMBER(jangou_state::input_system_r) WRITE8_MEMBER(jangou_state::sound_latch_w) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_cpu_1->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } READ8_MEMBER(jangou_state::sound_latch_r) { m_cpu_1->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return soundlatch_byte_r(space, 0); + return m_soundlatch->read(space, 0); } /* Jangou HC-55516 CVSD */ @@ -859,6 +862,8 @@ static MACHINE_CONFIG_START( jangou, jangou_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, MASTER_CLOCK / 16) MCFG_AY8910_PORT_A_READ_CB(READ8(jangou_state, input_mux_r)) MCFG_AY8910_PORT_B_READ_CB(READ8(jangou_state, input_system_r)) @@ -909,6 +914,7 @@ static MACHINE_CONFIG_DERIVED( cntrygrl, jangou ) /* sound hardware */ MCFG_DEVICE_REMOVE("cvsd") + MCFG_DEVICE_REMOVE("soundlatch") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( roylcrdn, jangou ) @@ -928,6 +934,7 @@ static MACHINE_CONFIG_DERIVED( roylcrdn, jangou ) /* sound hardware */ MCFG_DEVICE_REMOVE("cvsd") + MCFG_DEVICE_REMOVE("soundlatch") MACHINE_CONFIG_END diff --git a/src/mame/drivers/macrossp.cpp b/src/mame/drivers/macrossp.cpp index 17fdd2aed35..06ac837ff20 100644 --- a/src/mame/drivers/macrossp.cpp +++ b/src/mame/drivers/macrossp.cpp @@ -307,7 +307,7 @@ WRITE32_MEMBER(macrossp_state::macrossp_soundcmd_w) if (ACCESSING_BITS_16_31) { //logerror("%08x write soundcmd %08x (%08x)\n",space.device().safe_pc(),data,mem_mask); - soundlatch_word_w(space, 0, data >> 16, 0xffff); + m_soundlatch->write(space, 0, data >> 16, 0xffff); m_sndpending = 1; m_audiocpu->set_input_line(2, HOLD_LINE); /* spin for a while to let the sound CPU read the command */ @@ -319,7 +319,7 @@ READ16_MEMBER(macrossp_state::macrossp_soundcmd_r) { // logerror("%06x read soundcmd\n",space.device().safe_pc()); m_sndpending = 0; - return soundlatch_word_r(space, offset, mem_mask); + return m_soundlatch->read(space, offset, mem_mask); } WRITE16_MEMBER(macrossp_state::palette_fade_w) @@ -564,6 +564,8 @@ static MACHINE_CONFIG_START( macrossp, macrossp_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_16_ADD("soundlatch") + MCFG_SOUND_ADD("ensoniq", ES5506, 16000000) MCFG_ES5506_REGION0("ensoniq.0") MCFG_ES5506_REGION1("ensoniq.1") diff --git a/src/mame/drivers/mario.cpp b/src/mame/drivers/mario.cpp index b4d736fbfdc..5c21955bfab 100644 --- a/src/mame/drivers/mario.cpp +++ b/src/mame/drivers/mario.cpp @@ -159,7 +159,7 @@ static ADDRESS_MAP_START( masao_map, AS_PROGRAM, 8, mario_state) AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_RANGE(0x7d00, 0x7d00) AM_WRITE(mario_scroll_w) - AM_RANGE(0x7e00, 0x7e00) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x7e00, 0x7e00) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x7e80, 0x7e80) AM_WRITE(mario_gfxbank_w) AM_RANGE(0x7e82, 0x7e82) AM_WRITE(mario_flip_w) AM_RANGE(0x7e83, 0x7e83) AM_WRITE(mario_palettebank_w) diff --git a/src/mame/drivers/metro.cpp b/src/mame/drivers/metro.cpp index 8c1981adcee..6c598b3764e 100644 --- a/src/mame/drivers/metro.cpp +++ b/src/mame/drivers/metro.cpp @@ -105,12 +105,9 @@ driver modified by Hau #include "cpu/upd7810/upd7810.h" #include "cpu/h8/h83006.h" #include "includes/metro.h" -#include "machine/eepromser.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" #include "sound/2413intf.h" #include "sound/2610intf.h" -#include "sound/okim6295.h" #include "sound/ymf278b.h" @@ -270,9 +267,9 @@ INTERRUPT_GEN_MEMBER(metro_state::puzzlet_interrupt) READ_LINE_MEMBER(metro_state::metro_rxd_r) { address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 data = soundlatch_byte_r(space, 0); + UINT8 data = m_soundlatch->read(space, 0); - soundlatch_byte_w(space, 0, data >> 1); + m_soundlatch->write(space, 0, data >> 1); return data & 1; @@ -282,7 +279,7 @@ WRITE16_MEMBER(metro_state::metro_soundlatch_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); space.device().execute().spin_until_interrupt(); m_busy_sndcpu = 1; @@ -1593,7 +1590,7 @@ ADDRESS_MAP_END WRITE16_MEMBER(metro_state::blzntrnd_sound_w) { - soundlatch_byte_w(space, offset, data >> 8); + m_soundlatch->write(space, offset, data >> 8); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -1615,7 +1612,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( blzntrnd_sound_io_map, AS_IO, 8, metro_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITE(blzntrnd_sh_bankswitch_w) - AM_RANGE(0x40, 0x40) AM_READ(soundlatch_byte_r) AM_WRITENOP + AM_RANGE(0x40, 0x40) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITENOP AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) ADDRESS_MAP_END @@ -3717,6 +3714,8 @@ static MACHINE_CONFIG_START( daitorid, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", UPD7810_INTF2)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.80) @@ -3758,6 +3757,8 @@ static MACHINE_CONFIG_START( dharma, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // sample rate = M6295 clock / 132 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -3798,6 +3799,8 @@ static MACHINE_CONFIG_START( karatour, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // was /128.. so pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -3838,6 +3841,8 @@ static MACHINE_CONFIG_START( 3kokushi, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // was /128.. so pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -3878,6 +3883,8 @@ static MACHINE_CONFIG_START( lastfort, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_LOW) // sample rate = M6295 clock / 165 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -3917,6 +3924,8 @@ static MACHINE_CONFIG_START( lastforg, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // was /128.. so pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -4107,6 +4116,8 @@ static MACHINE_CONFIG_START( pangpoms, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // was /128.. so pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -4147,6 +4158,8 @@ static MACHINE_CONFIG_START( poitto, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // was /128.. so pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -4187,6 +4200,8 @@ static MACHINE_CONFIG_START( pururun, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* Confirmed match to reference video */ MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", UPD7810_INTF2)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.80) @@ -4228,6 +4243,8 @@ static MACHINE_CONFIG_START( skyalert, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_LOW) // sample rate = M6295 clock / 165 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -4268,6 +4285,8 @@ static MACHINE_CONFIG_START( toride2g, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_24MHz/20, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) @@ -4384,6 +4403,8 @@ static MACHINE_CONFIG_START( blzntrnd, metro_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_16MHz/2) MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) @@ -6130,7 +6151,7 @@ Notes: M6585 - Oki M6585 ADPCM Voice Synthesizer IC (DIP18). Clock 640kHz. Sample rate = 16kHz (selection - pin 1 LOW, pin 2 HIGH = 16kHz) This is a version-up to the previous M5205 with some additional - capabilies and improvements. + capabilities and improvements. MM1035 - Mitsumi Monolithic IC MM1035 System Reset and Watchdog Timer (DIP8) uPC3403 - NEC uPC3403 High Performance Quad Operational Amplifier (DIP14) 62256 - 32k x8 SRAM (DIP28) diff --git a/src/mame/drivers/midyunit.cpp b/src/mame/drivers/midyunit.cpp index 3bf9d593def..c09981584a8 100644 --- a/src/mame/drivers/midyunit.cpp +++ b/src/mame/drivers/midyunit.cpp @@ -116,8 +116,6 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" -#include "cpu/tms34010/tms34010.h" -#include "sound/okim6295.h" #include "includes/midyunit.h" @@ -198,7 +196,7 @@ static ADDRESS_MAP_START( yawdim_sound_map, AS_PROGRAM, 8, midyunit_state ) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x9000, 0x97ff) AM_WRITE(yawdim_oki_bank_w) AM_RANGE(0x9800, 0x9fff) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0xa000, 0xa7ff) AM_READ(soundlatch_byte_r) + AM_RANGE(0xa000, 0xa7ff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END @@ -1229,6 +1227,9 @@ static MACHINE_CONFIG_DERIVED( mkyawdim, yunit_core ) MCFG_VIDEO_START_OVERRIDE(midyunit_state,mkyawdim) /* sound hardware */ + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", XTAL_8MHz / 8, OKIM6295_PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/nbmj8991.cpp b/src/mame/drivers/nbmj8991.cpp index d72dc2067c2..cff29c44ec6 100644 --- a/src/mame/drivers/nbmj8991.cpp +++ b/src/mame/drivers/nbmj8991.cpp @@ -41,7 +41,7 @@ Notes: WRITE8_MEMBER(nbmj8991_state::soundbank_w) { - if (!(data & 0x80)) soundlatch_clear_byte_w(space, 0, 0); + if (!(data & 0x80)) m_soundlatch->clear_w(space, 0, 0); membank("bank1")->set_entry(data & 0x03); } @@ -188,7 +188,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pstadium_io_map, AS_IO, 8, nbmj8991_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x7f) AM_WRITE(blitter_w) - AM_RANGE(0x80, 0x80) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x80, 0x80) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x90, 0x90) AM_DEVREAD("nb1413m3", nb1413m3_device, inputport0_r) AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("nb1413m3", nb1413m3_device, inputport1_r, inputportsel_w) AM_RANGE(0xb0, 0xb0) AM_DEVREAD("nb1413m3", nb1413m3_device, inputport2_r) //AM_WRITENOP @@ -201,7 +201,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( av2mj1bb_io_map, AS_IO, 8, nbmj8991_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x7f) AM_WRITE(blitter_w) - AM_RANGE(0x80, 0x80) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x80, 0x80) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x90, 0x90) AM_DEVREAD("nb1413m3", nb1413m3_device, inputport0_r) AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("nb1413m3", nb1413m3_device, inputport1_r, inputportsel_w) AM_RANGE(0xb0, 0xb0) AM_DEVREADWRITE("nb1413m3", nb1413m3_device, inputport2_r, vcrctrl_w) @@ -221,7 +221,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( nbmj8991_sound_io_map, AS_IO, 8, nbmj8991_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) AM_DEVWRITE("dac1", dac_device, write_unsigned8) + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("dac1", dac_device, write_unsigned8) AM_RANGE(0x02, 0x02) AM_DEVWRITE("dac2", dac_device, write_unsigned8) AM_RANGE(0x04, 0x04) AM_WRITE(soundbank_w) AM_RANGE(0x06, 0x06) AM_WRITENOP @@ -1431,6 +1431,8 @@ static MACHINE_CONFIG_START( nbmjdrv2, nbmj8991_state ) // pstadium /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("fmsnd", YM3812, 25000000/6.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) diff --git a/src/mame/drivers/nbmj9195.cpp b/src/mame/drivers/nbmj9195.cpp index a9f97f5ec8e..da6720a65b6 100644 --- a/src/mame/drivers/nbmj9195.cpp +++ b/src/mame/drivers/nbmj9195.cpp @@ -12,7 +12,7 @@ Notes: -- Screen position sometimes be strange while frame skip != 0. +- Screen position sometimes is strange while frame skip != 0. - Some games display "GFXROM BANK OVER!!" or "GFXROM ADDRESS OVER!!" in Debug build. @@ -24,6 +24,7 @@ Notes: #include "emu.h" #include "machine/nvram.h" #include "includes/nb1413m3.h" // needed for mahjong input controller +#include "machine/gen_latch.h" #include "sound/3812intf.h" #include "sound/dac.h" #include "includes/nbmj9195.h" @@ -202,7 +203,7 @@ READ8_MEMBER(nbmj9195_state::others_cpu_portc_r) WRITE8_MEMBER(nbmj9195_state::soundcpu_porte_w) { - if (!(data & 0x01)) soundlatch_clear_byte_w(space, 0, 0); + if (!(data & 0x01)) m_soundlatch->clear_w(space, 0, 0); } @@ -275,7 +276,7 @@ static ADDRESS_MAP_START( mjuraden_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_0_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_0_w) - AM_RANGE(0xb0, 0xb0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xb0, 0xb0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xb2, 0xb2) AM_WRITENOP AM_RANGE(0xb4, 0xb4) AM_WRITENOP AM_RANGE(0xb6, 0xb6) AM_WRITE(inputportsel_w) @@ -292,7 +293,7 @@ static ADDRESS_MAP_START( koinomp_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xa0, 0xaf) AM_WRITE(blitter_1_w) AM_RANGE(0xb0, 0xbf) AM_WRITE(clut_1_w) - AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xc0, 0xc0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xc2, 0xc2) AM_WRITENOP AM_RANGE(0xc4, 0xc4) AM_WRITENOP AM_RANGE(0xc6, 0xc6) AM_WRITE(inputportsel_w) @@ -306,7 +307,7 @@ static ADDRESS_MAP_START( patimono_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_1_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_0_w) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa4, 0xa4) AM_WRITENOP AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb8) AM_WRITE(inputportsel_w) @@ -323,7 +324,7 @@ static ADDRESS_MAP_START( mmehyou_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_0_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_0_w) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa4, 0xa4) AM_WRITENOP AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITE(inputportsel_w) @@ -340,7 +341,7 @@ static ADDRESS_MAP_START( gal10ren_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xa0, 0xaf) AM_WRITE(blitter_1_w) AM_RANGE(0xb0, 0xbf) AM_WRITE(clut_1_w) - AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xc0, 0xc0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xc8, 0xc8) AM_WRITENOP AM_RANGE(0xd0, 0xd0) AM_WRITENOP AM_RANGE(0xd8, 0xd8) AM_WRITE(inputportsel_w) @@ -349,7 +350,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( renaiclb_io_map, AS_IO, 8, nbmj9195_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x20, 0x20) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x20, 0x20) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x24, 0x24) AM_WRITENOP AM_RANGE(0x28, 0x28) AM_WRITENOP AM_RANGE(0x2c, 0x2c) AM_WRITE(inputportsel_w) @@ -366,7 +367,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mjlaman_io_map, AS_IO, 8, nbmj9195_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x20, 0x20) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x20, 0x20) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x22, 0x22) AM_WRITENOP AM_RANGE(0x24, 0x24) AM_WRITENOP AM_RANGE(0x26, 0x26) AM_WRITE(inputportsel_w) @@ -391,7 +392,7 @@ static ADDRESS_MAP_START( mkeibaou_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xa0, 0xaf) AM_WRITE(blitter_1_w) AM_RANGE(0xb0, 0xbf) AM_WRITE(clut_1_w) - AM_RANGE(0xd8, 0xd8) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xd8, 0xd8) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xda, 0xda) AM_WRITENOP AM_RANGE(0xdc, 0xdc) AM_WRITENOP AM_RANGE(0xde, 0xde) AM_WRITE(inputportsel_w) @@ -408,7 +409,7 @@ static ADDRESS_MAP_START( pachiten_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xa0, 0xaf) AM_WRITE(blitter_1_w) AM_RANGE(0xb0, 0xbf) AM_WRITE(clut_1_w) - AM_RANGE(0xe0, 0xe0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xe0, 0xe0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xe2, 0xe2) AM_WRITENOP AM_RANGE(0xe4, 0xe4) AM_WRITENOP AM_RANGE(0xe6, 0xe6) AM_WRITE(inputportsel_w) @@ -425,7 +426,7 @@ static ADDRESS_MAP_START( sailorws_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_1_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_1_w) - AM_RANGE(0xf0, 0xf0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xf2, 0xf2) AM_WRITENOP AM_RANGE(0xf4, 0xf4) AM_WRITENOP AM_RANGE(0xf6, 0xf6) AM_WRITE(inputportsel_w) @@ -442,7 +443,7 @@ static ADDRESS_MAP_START( sailorwr_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_1_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_1_w) - AM_RANGE(0xf8, 0xf8) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xf8, 0xf8) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xfa, 0xfa) AM_WRITENOP AM_RANGE(0xfc, 0xfc) AM_WRITENOP AM_RANGE(0xfe, 0xfe) AM_WRITE(inputportsel_w) @@ -459,7 +460,7 @@ static ADDRESS_MAP_START( psailor1_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xc0, 0xcf) AM_WRITE(blitter_1_w) AM_RANGE(0xd0, 0xdf) AM_WRITE(clut_1_w) - AM_RANGE(0xf0, 0xf0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xf2, 0xf2) AM_WRITENOP AM_RANGE(0xf4, 0xf4) AM_WRITENOP AM_RANGE(0xf6, 0xf6) AM_WRITE(inputportsel_w) @@ -476,7 +477,7 @@ static ADDRESS_MAP_START( psailor2_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xa0, 0xaf) AM_WRITE(blitter_1_w) AM_RANGE(0xb0, 0xbf) AM_WRITE(clut_1_w) - AM_RANGE(0xe0, 0xe0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xe0, 0xe0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xe2, 0xe2) AM_WRITENOP AM_RANGE(0xe4, 0xe4) AM_WRITENOP AM_RANGE(0xf6, 0xf6) AM_WRITE(inputportsel_w) @@ -493,7 +494,7 @@ static ADDRESS_MAP_START( otatidai_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_1_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_1_w) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITENOP AM_RANGE(0xb8, 0xb8) AM_WRITE(inputportsel_w) @@ -506,7 +507,7 @@ static ADDRESS_MAP_START( yosimoto_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x60, 0x6f) AM_WRITE(blitter_0_w) AM_RANGE(0x70, 0x7f) AM_WRITE(clut_0_w) - AM_RANGE(0x90, 0x90) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x90, 0x90) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x94, 0x94) AM_WRITENOP AM_RANGE(0x98, 0x98) AM_WRITENOP AM_RANGE(0x9c, 0x9c) AM_WRITE(inputportsel_w) @@ -528,7 +529,7 @@ static ADDRESS_MAP_START( yosimotm_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_1_w) AM_RANGE(0xf0, 0xf0) AM_WRITE(inputportsel_w) - AM_RANGE(0xfc, 0xfc) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xfc, 0xfc) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xf4, 0xf4) AM_NOP AM_RANGE(0xf8, 0xf8) AM_NOP ADDRESS_MAP_END @@ -544,7 +545,7 @@ static ADDRESS_MAP_START( jituroku_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xc0, 0xcf) AM_WRITE(blitter_1_w) AM_RANGE(0xd0, 0xdf) AM_WRITE(clut_1_w) - AM_RANGE(0xe0, 0xe0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xe0, 0xe0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xe8, 0xe8) AM_WRITENOP AM_RANGE(0xf0, 0xf0) AM_WRITENOP AM_RANGE(0xf8, 0xf8) AM_WRITE(inputportsel_w) @@ -553,7 +554,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ngpgal_io_map, AS_IO, 8, nbmj9195_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa4, 0xa4) AM_WRITENOP AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITE(inputportsel_w) @@ -570,7 +571,7 @@ static ADDRESS_MAP_START( mjgottsu_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_0_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_0_w) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa4, 0xa4) AM_WRITENOP AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITE(inputportsel_w) @@ -579,7 +580,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cmehyou_io_map, AS_IO, 8, nbmj9195_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITE(inputportsel_w) AM_RANGE(0xb4, 0xb4) AM_WRITENOP @@ -596,7 +597,7 @@ static ADDRESS_MAP_START( mjkoiura_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x8f) AM_WRITE(blitter_0_w) AM_RANGE(0x90, 0x9f) AM_WRITE(clut_0_w) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa4, 0xa4) AM_WRITENOP AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITE(inputportsel_w) @@ -605,7 +606,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mkoiuraa_io_map, AS_IO, 8, nbmj9195_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xa0, 0xa0) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa4, 0xa4) AM_WRITENOP AM_RANGE(0xa8, 0xa8) AM_WRITENOP AM_RANGE(0xb0, 0xb0) AM_WRITE(inputportsel_w) @@ -620,7 +621,7 @@ static ADDRESS_MAP_START( mscoutm_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x80) AM_READ(mscoutm_dipsw_1_r) AM_RANGE(0x82, 0x82) AM_READ(mscoutm_dipsw_0_r) - AM_RANGE(0x84, 0x84) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x84, 0x84) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa0, 0xa6) AM_WRITENOP // nb22090 param ? @@ -639,7 +640,7 @@ static ADDRESS_MAP_START( imekura_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0x80, 0x80) AM_READ(mscoutm_dipsw_1_r) AM_RANGE(0x82, 0x82) AM_READ(mscoutm_dipsw_0_r) - AM_RANGE(0x84, 0x84) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x84, 0x84) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xb0, 0xb6) AM_WRITENOP // nb22090 param ? @@ -669,7 +670,7 @@ static ADDRESS_MAP_START( mjegolf_io_map, AS_IO, 8, nbmj9195_state ) AM_RANGE(0xe0, 0xe0) AM_READ(mscoutm_dipsw_1_r) AM_RANGE(0xe2, 0xe2) AM_READ(mscoutm_dipsw_0_r) - AM_RANGE(0xe4, 0xe4) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xe4, 0xe4) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END @@ -2680,13 +2681,13 @@ static const z80_daisy_config daisy_chain_sound[] = MCFG_TMPZ84C011_PORTA_WRITE_CB(WRITE8(nbmj9195_state, soundbank_w)) \ MCFG_TMPZ84C011_PORTB_WRITE_CB(DEVWRITE8("dac1", dac_device, write_unsigned8)) \ MCFG_TMPZ84C011_PORTC_WRITE_CB(DEVWRITE8("dac2", dac_device, write_unsigned8)) \ - MCFG_TMPZ84C011_PORTD_READ_CB(READ8(nbmj9195_state, soundlatch_byte_r)) \ + MCFG_TMPZ84C011_PORTD_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) \ MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_porte_w)) #define MSCOUTM_TMZ84C011_SOUND_PORTS \ MCFG_TMPZ84C011_PORTA_WRITE_CB(WRITE8(nbmj9195_state, soundbank_w)) \ MCFG_TMPZ84C011_PORTB_WRITE_CB(DEVWRITE8("dac2", dac_device, write_unsigned8)) \ MCFG_TMPZ84C011_PORTC_WRITE_CB(DEVWRITE8("dac1", dac_device, write_unsigned8)) \ - MCFG_TMPZ84C011_PORTD_READ_CB(READ8(nbmj9195_state, soundlatch_byte_r)) \ + MCFG_TMPZ84C011_PORTD_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) \ MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_porte_w)) @@ -2735,6 +2736,8 @@ static MACHINE_CONFIG_START( NBMJDRV1_base, nbmj9195_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp index 6ed800c3006..ad5757cf0b6 100644 --- a/src/mame/drivers/neogeo.cpp +++ b/src/mame/drivers/neogeo.cpp @@ -793,7 +793,7 @@ WRITE16_MEMBER(neogeo_state::memcard_w) WRITE8_MEMBER(neogeo_state::audio_command_w) { - soundlatch_write(data); + m_soundlatch->write(space, 0, data); m_audio_cpu_nmi_pending = true; audio_cpu_check_nmi(); @@ -805,7 +805,7 @@ WRITE8_MEMBER(neogeo_state::audio_command_w) READ8_MEMBER(neogeo_state::audio_command_r) { - UINT8 ret = soundlatch_read(); + UINT8 ret = m_soundlatch->read(space, 0); m_audio_cpu_nmi_pending = false; audio_cpu_check_nmi(); @@ -816,7 +816,7 @@ READ8_MEMBER(neogeo_state::audio_command_r) CUSTOM_INPUT_MEMBER(neogeo_state::get_audio_result) { - UINT8 ret = soundlatch_read(1); // soundlatch2_byte_r + UINT8 ret = m_soundlatch2->read(m_audiocpu->space(AS_PROGRAM), 0); return ret; } @@ -1522,11 +1522,11 @@ ADDRESS_MAP_END *************************************/ static ADDRESS_MAP_START( audio_io_map, AS_IO, 8, neogeo_state ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, soundlatch_clear_byte_w) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) AM_RANGE(0x08, 0x08) AM_MIRROR(0xff10) AM_MASK(0x0010) AM_WRITE(audio_cpu_enable_nmi_w) AM_RANGE(0x08, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xff03) AM_READ(audio_cpu_bank_select_r) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(soundlatch2_byte_w) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) ADDRESS_MAP_END @@ -1661,6 +1661,9 @@ MACHINE_CONFIG_START( neogeo_base, neogeo_state ) /* audio hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM2610, NEOGEO_YM2610_CLOCK) MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.28) diff --git a/src/mame/drivers/neogeocd.cpp b/src/mame/drivers/neogeocd.cpp index a901c5c88eb..9aadcb830b4 100644 --- a/src/mame/drivers/neogeocd.cpp +++ b/src/mame/drivers/neogeocd.cpp @@ -924,12 +924,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( neocd_audio_io_map, AS_IO, 8, ngcd_state ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, soundlatch_clear_byte_w) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) AM_RANGE(0x08, 0x08) AM_MIRROR(0xff10) AM_MASK(0x0010) AM_WRITE(audio_cpu_enable_nmi_w) // banking reads are actually NOP on NeoCD? but some games still access them // AM_RANGE(0x08, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xff03) AM_READ(audio_cpu_bank_select_r) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(soundlatch2_byte_w) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // ?? AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_WRITENOP diff --git a/src/mame/drivers/niyanpai.cpp b/src/mame/drivers/niyanpai.cpp index 6a45d78eba4..367515eea74 100644 --- a/src/mame/drivers/niyanpai.cpp +++ b/src/mame/drivers/niyanpai.cpp @@ -53,7 +53,7 @@ WRITE8_MEMBER(niyanpai_state::soundbank_w) WRITE8_MEMBER(niyanpai_state::soundlatch_clear_w) { - if (!(data & 0x01)) soundlatch_clear_byte_w(space, 0, 0); + if (!(data & 0x01)) m_soundlatch->clear_w(space, 0, 0); } @@ -144,7 +144,7 @@ static ADDRESS_MAP_START( niyanpai_map, AS_PROGRAM, 16, niyanpai_state ) AM_RANGE(0x0bf800, 0x0bffff) AM_RAM - AM_RANGE(0x200000, 0x200001) AM_WRITE8(soundlatch_byte_w, 0xff00) + AM_RANGE(0x200000, 0x200001) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0xff00) AM_RANGE(0x200200, 0x200201) AM_WRITENOP // unknown AM_RANGE(0x240000, 0x240009) AM_WRITENOP // unknown @@ -180,7 +180,7 @@ static ADDRESS_MAP_START( musobana_map, AS_PROGRAM, 16, niyanpai_state ) AM_RANGE(0x0a8000, 0x0a87ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x0bf800, 0x0bffff) AM_RAM - AM_RANGE(0x200000, 0x200001) AM_WRITE8(soundlatch_byte_w, 0xff00) + AM_RANGE(0x200000, 0x200001) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0xff00) AM_RANGE(0x200200, 0x200201) AM_WRITE(musobana_inputport_w) // inputport select AM_RANGE(0x240000, 0x240009) AM_WRITENOP // unknown @@ -219,7 +219,7 @@ static ADDRESS_MAP_START( mhhonban_map, AS_PROGRAM, 16, niyanpai_state ) AM_RANGE(0x0a8000, 0x0a87ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x0bf000, 0x0bffff) AM_RAM - AM_RANGE(0x200000, 0x200001) AM_WRITE8(soundlatch_byte_w, 0xff00) + AM_RANGE(0x200000, 0x200001) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0xff00) AM_RANGE(0x200200, 0x200201) AM_WRITE(musobana_inputport_w) // inputport select AM_RANGE(0x240000, 0x240009) AM_WRITENOP // unknown @@ -258,7 +258,7 @@ static ADDRESS_MAP_START( zokumahj_map, AS_PROGRAM, 16, niyanpai_state ) AM_RANGE(0x0a8000, 0x0a87ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x0c0000, 0x0cffff) AM_RAM - AM_RANGE(0x200000, 0x200001) AM_WRITE8(soundlatch_byte_w, 0xff00) + AM_RANGE(0x200000, 0x200001) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0xff00) AM_RANGE(0x200200, 0x200201) AM_WRITE(musobana_inputport_w) // inputport select AM_RANGE(0x240000, 0x240009) AM_WRITENOP // unknown @@ -743,7 +743,7 @@ static MACHINE_CONFIG_START( niyanpai, niyanpai_state ) MCFG_Z80_DAISY_CHAIN(daisy_chain_sound) MCFG_CPU_PROGRAM_MAP(niyanpai_sound_map) MCFG_CPU_IO_MAP(niyanpai_sound_io_map) - MCFG_TMPZ84C011_PORTD_READ_CB(READ8(niyanpai_state, soundlatch_byte_r)) + MCFG_TMPZ84C011_PORTD_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_TMPZ84C011_PORTA_WRITE_CB(WRITE8(niyanpai_state, soundbank_w)) MCFG_TMPZ84C011_PORTB_WRITE_CB(DEVWRITE8("dac1", dac_device, write_unsigned8)) MCFG_TMPZ84C011_PORTC_WRITE_CB(DEVWRITE8("dac2", dac_device, write_unsigned8)) @@ -766,6 +766,8 @@ static MACHINE_CONFIG_START( niyanpai, niyanpai_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) diff --git a/src/mame/drivers/nmk16.cpp b/src/mame/drivers/nmk16.cpp index 2d1152f9c03..5b959e64f33 100644 --- a/src/mame/drivers/nmk16.cpp +++ b/src/mame/drivers/nmk16.cpp @@ -222,7 +222,7 @@ WRITE16_MEMBER(nmk16_state::ssmissin_sound_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(0, HOLD_LINE); } } @@ -284,7 +284,7 @@ WRITE16_MEMBER(nmk16_state::macross2_sound_reset_w) WRITE16_MEMBER(nmk16_state::macross2_sound_command_w) { if (ACCESSING_BITS_0_7) - soundlatch_byte_w(space,0,data & 0xff); + m_soundlatch->write(space,0,data & 0xff); } WRITE8_MEMBER(nmk16_state::macross2_sound_bank_w) @@ -310,7 +310,7 @@ WRITE16_MEMBER(nmk16_state::afega_soundlatch_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(0, HOLD_LINE); } } @@ -363,7 +363,7 @@ static ADDRESS_MAP_START( manybloc_map, AS_PROGRAM, 16, nmk16_state ) AM_RANGE(0x080012, 0x080013) AM_WRITENOP /* See notes at the top of the driver */ AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w) AM_RANGE(0x08001c, 0x08001d) AM_WRITENOP /* See notes at the top of the driver */ - AM_RANGE(0x08001e, 0x08001f) AM_READWRITE(soundlatch2_word_r,soundlatch_word_w) + AM_RANGE(0x08001e, 0x08001f) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0x088000, 0x0883ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_SHARE("nmk_bgvideoram0") AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(manybloc_scroll_w) AM_SHARE("scrollram") @@ -376,12 +376,12 @@ static ADDRESS_MAP_START( tharrier_map, AS_PROGRAM, 16, nmk16_state ) AM_RANGE(0x080000, 0x080001) AM_READ_PORT("IN0") AM_RANGE(0x080002, 0x080003) AM_READ(tharrier_mcu_r) // AM_READ_PORT("IN1") AM_RANGE(0x080004, 0x080005) AM_READ_PORT("DSW1") - AM_RANGE(0x08000e, 0x08000f) AM_READ(soundlatch2_word_r) /* from Z80 */ + AM_RANGE(0x08000e, 0x08000f) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) /* from Z80 */ AM_RANGE(0x080010, 0x080011) AM_WRITE(tharrier_mcu_control_w) AM_RANGE(0x080012, 0x080013) AM_WRITENOP // AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w) // AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w) - AM_RANGE(0x08001e, 0x08001f) AM_WRITE(soundlatch_word_w) + AM_RANGE(0x08001e, 0x08001f) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0x080202, 0x080203) AM_READ_PORT("IN2") AM_RANGE(0x088000, 0x0883ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w) @@ -394,7 +394,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tharrier_sound_map, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xf000, 0xf000) AM_READWRITE(soundlatch_byte_r,soundlatch2_byte_w) + AM_RANGE(0xf000, 0xf000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) AM_RANGE(0xf400, 0xf400) AM_DEVREADWRITE("oki1", okim6295_device, read, write) AM_RANGE(0xf500, 0xf500) AM_DEVREADWRITE("oki2", okim6295_device, read, write) AM_RANGE(0xf600, 0xf600) AM_WRITE(tharrier_oki6295_bankswitch_0_w) @@ -953,7 +953,7 @@ static ADDRESS_MAP_START( ssmissin_sound_map, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x9000, 0x9000) AM_WRITE(ssmissin_soundbank_w) AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki1", 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 static ADDRESS_MAP_START( oki1_map, AS_0, 8, nmk16_state ) @@ -1029,7 +1029,7 @@ static ADDRESS_MAP_START( macross2_map, AS_PROGRAM, 16, nmk16_state ) AM_RANGE(0x100002, 0x100003) AM_READ_PORT("IN1") AM_RANGE(0x100008, 0x100009) AM_READ_PORT("DSW1") AM_RANGE(0x10000a, 0x10000b) AM_READ_PORT("DSW2") - AM_RANGE(0x10000e, 0x10000f) AM_READ(soundlatch2_word_r) /* from Z80 */ + AM_RANGE(0x10000e, 0x10000f) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) /* from Z80 */ AM_RANGE(0x100014, 0x100015) AM_WRITE(nmk_flipscreen_w) AM_RANGE(0x100016, 0x100017) AM_WRITE(macross2_sound_reset_w) /* Z80 reset */ AM_RANGE(0x100018, 0x100019) AM_WRITE(nmk_tilebank_w) @@ -1055,7 +1055,7 @@ static ADDRESS_MAP_START( raphero_map, AS_PROGRAM, 16, nmk16_state ) AM_RANGE(0x100002, 0x100003) AM_READ_PORT("IN1") AM_RANGE(0x100008, 0x100009) AM_READ_PORT("DSW1") AM_RANGE(0x10000a, 0x10000b) AM_READ_PORT("DSW2") - AM_RANGE(0x10000e, 0x10000f) AM_READ(soundlatch2_word_r) /* from Z80 */ + AM_RANGE(0x10000e, 0x10000f) AM_DEVREAD8("soundlatch2", generic_latch_8_device, read, 0x00ff) /* from Z80 */ AM_RANGE(0x100014, 0x100015) AM_WRITE(nmk_flipscreen_w) AM_RANGE(0x100016, 0x100017) AM_WRITENOP /* IRQ enable or z80 sound reset like in Macross 2? */ AM_RANGE(0x100018, 0x100019) AM_WRITE(nmk_tilebank_w) @@ -1084,7 +1084,7 @@ static ADDRESS_MAP_START( raphero_sound_mem_map, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0xc808, 0xc808) AM_DEVREADWRITE("oki2", okim6295_device, read, write) AM_RANGE(0xc810, 0xc817) AM_DEVWRITE("nmk112", nmk112_device, okibank_w) AM_RANGE(0xd000, 0xd000) AM_WRITE(macross2_sound_bank_w) - AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) // main cpu + AM_RANGE(0xd800, 0xd800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) // main cpu AM_RANGE(0xe000, 0xffff) AM_RAM ADDRESS_MAP_END @@ -1094,7 +1094,7 @@ static ADDRESS_MAP_START( macross2_sound_map, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0xa000, 0xa000) AM_READNOP /* IRQ ack? watchdog? */ AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe001, 0xe001) AM_WRITE(macross2_sound_bank_w) - AM_RANGE(0xf000, 0xf000) AM_READWRITE(soundlatch_byte_r,soundlatch2_byte_w) /* from 68000 */ + AM_RANGE(0xf000, 0xf000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) /* from 68000 */ ADDRESS_MAP_END static ADDRESS_MAP_START( macross2_sound_io_map, AS_IO, 8, nmk16_state ) @@ -3886,6 +3886,9 @@ static MACHINE_CONFIG_START( tharrier, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.50) @@ -4205,6 +4208,8 @@ static MACHINE_CONFIG_START( ssmissin, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki1", 8000000/8, OKIM6295_PIN7_HIGH) /* 1 Mhz, pin 7 high */ MCFG_DEVICE_ADDRESS_MAP(AS_0, oki1_map) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -4433,6 +4438,9 @@ static MACHINE_CONFIG_START( macross2, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.50) @@ -4476,6 +4484,9 @@ static MACHINE_CONFIG_START( tdragon2, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.50) @@ -4518,6 +4529,9 @@ static MACHINE_CONFIG_START( raphero, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.50) @@ -4648,6 +4662,9 @@ static MACHINE_CONFIG_START( manybloc, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.50) @@ -5018,7 +5035,7 @@ static ADDRESS_MAP_START( afega_sound_cpu, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0x0004, 0x0004) AM_WRITENOP // bug in sound prg? AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM // RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) // From Main CPU + AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU AM_RANGE(0xf808, 0xf809) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) // YM2151 AM_RANGE(0xf80a, 0xf80a) AM_DEVREADWRITE("oki1", okim6295_device, read, write) // M6295 ADDRESS_MAP_END @@ -5026,7 +5043,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( firehawk_sound_cpu, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xfff0, 0xfff0) AM_READ(soundlatch_byte_r) + AM_RANGE(0xfff0, 0xfff0) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xfff2, 0xfff2) AM_WRITE(spec2k_oki1_banking_w ) AM_RANGE(0xfff8, 0xfff8) AM_DEVREADWRITE("oki2", okim6295_device, read, write) AM_RANGE(0xfffa, 0xfffa) AM_DEVREADWRITE("oki1", okim6295_device, read, write) @@ -5049,7 +5066,7 @@ static ADDRESS_MAP_START( twinactn_sound_cpu, AS_PROGRAM, 8, nmk16_state ) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x9000, 0x9000) AM_WRITE(twinactn_oki_bank_w) AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki1", okim6295_device, read, write) - AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) // From Main CPU + AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU ADDRESS_MAP_END /*************************************************************************** @@ -5156,6 +5173,8 @@ static MACHINE_CONFIG_START( stagger1, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_YM2151_ADD("ymsnd", XTAL_4MHz) /* verified on pcb */ MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.30) @@ -5238,6 +5257,8 @@ static MACHINE_CONFIG_START( firehawk, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki1", 1000000, OKIM6295_PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -5275,6 +5296,8 @@ static MACHINE_CONFIG_START( twinactn, nmk16_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki1", 1000000, OKIM6295_PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp index 500607e78ef..b8e34a87292 100644 --- a/src/mame/drivers/omegrace.cpp +++ b/src/mame/drivers/omegrace.cpp @@ -220,6 +220,7 @@ #include "video/vector.h" #include "video/avgdvg.h" #include "sound/ay8910.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/watchdog.h" @@ -233,11 +234,13 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), - m_dvg(*this, "dvg") { } + m_dvg(*this, "dvg"), + m_soundlatch(*this, "soundlatch") { } required_device m_maincpu; required_device m_audiocpu; required_device m_dvg; + required_device m_soundlatch; DECLARE_READ8_MEMBER(omegrace_vg_go_r); DECLARE_READ8_MEMBER(omegrace_spinner1_r); @@ -258,7 +261,7 @@ void omegrace_state::machine_reset() { address_space &space = m_maincpu->space(AS_PROGRAM); /* Omega Race expects the vector processor to be ready. */ -m_dvg->reset_w(space, 0, 0); + m_dvg->reset_w(space, 0, 0); } @@ -338,7 +341,7 @@ WRITE8_MEMBER(omegrace_state::omegrace_leds_w) WRITE8_MEMBER(omegrace_state::omegrace_soundlatch_w) { - soundlatch_byte_w (space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -390,7 +393,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_port, AS_IO, 8, omegrace_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) // the game reads from ay1 port b, but ay8912 only has port a + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // the game reads from ay1 port b, but ay8912 only has port a AM_RANGE(0x00, 0x01) AM_DEVWRITE("ay1", ay8912_device, address_data_w) AM_RANGE(0x02, 0x03) AM_DEVWRITE("ay2", ay8912_device, address_data_w) ADDRESS_MAP_END @@ -530,6 +533,8 @@ static MACHINE_CONFIG_START( omegrace, omegrace_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* XTAL101 Crystal @ 12mhz */ /* through 74LS92, Pin 8 = divide by 12 */ MCFG_SOUND_ADD("ay1", AY8912, XTAL_12MHz/12) diff --git a/src/mame/drivers/portrait.cpp b/src/mame/drivers/portrait.cpp index cbf6bbf80d4..b21d2f4c39f 100644 --- a/src/mame/drivers/portrait.cpp +++ b/src/mame/drivers/portrait.cpp @@ -88,6 +88,7 @@ DM81LS95 = TriState buffer #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/mcs48/mcs48.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "includes/portrait.h" @@ -123,7 +124,7 @@ static ADDRESS_MAP_START( portrait_map, AS_PROGRAM, 8, portrait_state ) AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(fgvideo_write) AM_SHARE("fgvideoram") AM_RANGE(0x9000, 0x91ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x9200, 0x97ff) AM_RAM - AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa000, 0xa000) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa010, 0xa010) AM_WRITENOP // ? AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW1") AM_RANGE(0xa004, 0xa004) AM_READ_PORT("DSW2") @@ -268,6 +269,9 @@ static MACHINE_CONFIG_START( portrait, portrait_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("tms", TMS5200, 640000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/punchout.cpp b/src/mame/drivers/punchout.cpp index 9355d7f7726..777cc13f30b 100644 --- a/src/mame/drivers/punchout.cpp +++ b/src/mame/drivers/punchout.cpp @@ -117,6 +117,7 @@ DIP locations verified for: #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m6502/n2a03.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "rendlay.h" #include "includes/punchout.h" @@ -189,8 +190,8 @@ static ADDRESS_MAP_START( punchout_io_map, AS_IO, 8, punchout_state ) AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") AM_RANGE(0x00, 0x01) AM_WRITENOP // the 2A03 #1 is not present - AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW2") AM_WRITE(soundlatch_byte_w) - AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(soundlatch2_byte_w) + AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW2") AM_DEVWRITE("soundlatch", generic_latch_8_device, write) + AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) AM_RANGE(0x04, 0x04) AM_DEVWRITE("vlm", vlm5030_device, data_w) AM_RANGE(0x05, 0x07) AM_WRITENOP // spunchout protection AM_RANGE(0x08, 0x08) AM_WRITE(nmi_mask_w) @@ -262,8 +263,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( punchout_sound_map, AS_PROGRAM, 8, punchout_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM - AM_RANGE(0x4016, 0x4016) AM_READ(soundlatch_byte_r) - AM_RANGE(0x4017, 0x4017) AM_READ(soundlatch2_byte_r) + AM_RANGE(0x4016, 0x4016) AM_DEVREAD("soundlatch", generic_latch_8_device, read) + AM_RANGE(0x4017, 0x4017) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_RANGE(0xe000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -668,6 +669,9 @@ static MACHINE_CONFIG_START( punchout, punchout_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("vlm", VLM5030, XTAL_21_4772MHz/6) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/sslam.cpp b/src/mame/drivers/sslam.cpp index 70fa00b7b44..48c3464b42a 100644 --- a/src/mame/drivers/sslam.cpp +++ b/src/mame/drivers/sslam.cpp @@ -364,7 +364,7 @@ WRITE8_MEMBER(sslam_state::sslam_snd_w) WRITE16_MEMBER(sslam_state::powerbls_sound_w) { - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); m_audiocpu->set_input_line(MCS51_INT1_LINE, HOLD_LINE); } @@ -423,7 +423,7 @@ READ8_MEMBER(sslam_state::playmark_snd_command_r) UINT8 data = 0; if ((m_oki_control & 0x38) == 0x30) { - data = soundlatch_byte_r(space,0); + data = m_soundlatch->read(space,0); } else if ((m_oki_control & 0x38) == 0x28) { data = (m_oki->read(space,0) & 0x0f); @@ -751,6 +751,8 @@ static MACHINE_CONFIG_START( powerbls, sslam_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki", 1000000, OKIM6295_PIN7_HIGH) /* verified on original PCB */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) MACHINE_CONFIG_END diff --git a/src/mame/drivers/terracre.cpp b/src/mame/drivers/terracre.cpp index dab4575a2b8..9bf4104be33 100644 --- a/src/mame/drivers/terracre.cpp +++ b/src/mame/drivers/terracre.cpp @@ -133,12 +133,12 @@ static const UINT16 mHoreKidProtData[] = WRITE16_MEMBER(terracre_state::amazon_sound_w) { - soundlatch_byte_w(space,0,((data & 0x7f) << 1) | 1); + m_soundlatch->write(space,0,((data & 0x7f) << 1) | 1); } READ8_MEMBER(terracre_state::soundlatch_clear_r) { - soundlatch_clear_byte_w(space,0,0); + m_soundlatch->clear_w(space,0,0); return 0; } @@ -225,7 +225,7 @@ static ADDRESS_MAP_START( sound_3526_io_map, AS_IO, 8, terracre_state ) AM_RANGE(0x02, 0x02) AM_DEVWRITE("dac1", dac_device, write_signed8) AM_RANGE(0x03, 0x03) AM_DEVWRITE("dac2", dac_device, write_signed8) AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r) - AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r) + AM_RANGE(0x06, 0x06) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_2203_io_map, AS_IO, 8, terracre_state ) @@ -234,7 +234,7 @@ static ADDRESS_MAP_START( sound_2203_io_map, AS_IO, 8, terracre_state ) AM_RANGE(0x02, 0x02) AM_DEVWRITE("dac1", dac_device, write_signed8) AM_RANGE(0x03, 0x03) AM_DEVWRITE("dac2", dac_device, write_signed8) AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r) - AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r) + AM_RANGE(0x06, 0x06) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END static INPUT_PORTS_START( terracre ) @@ -541,6 +541,8 @@ static MACHINE_CONFIG_START( ym3526, terracre_state ) MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_16MHz/4) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/thepit.cpp b/src/mame/drivers/thepit.cpp index 9e73f41bfb5..44155688cb5 100644 --- a/src/mame/drivers/thepit.cpp +++ b/src/mame/drivers/thepit.cpp @@ -154,6 +154,7 @@ Player 2 and Player 1 share the same controls ! #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/ay8910.h" #include "includes/thepit.h" @@ -211,7 +212,7 @@ static ADDRESS_MAP_START( thepit_main_map, AS_PROGRAM, 8, thepit_state ) AM_RANGE(0xb004, 0xb005) AM_WRITENOP // Unused, but initialized AM_RANGE(0xb006, 0xb006) AM_WRITE(flip_screen_x_w) AM_RANGE(0xb007, 0xb007) AM_WRITE(flip_screen_y_w) - AM_RANGE(0xb800, 0xb800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xb800, 0xb800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( desertdan_main_map, AS_PROGRAM, 8, thepit_state ) @@ -231,7 +232,7 @@ static ADDRESS_MAP_START( desertdan_main_map, AS_PROGRAM, 8, thepit_state ) AM_RANGE(0xb004, 0xb005) AM_WRITENOP // Unused, but initialized AM_RANGE(0xb006, 0xb006) AM_WRITE(flip_screen_x_w) AM_RANGE(0xb007, 0xb007) AM_WRITE(flip_screen_y_w) - AM_RANGE(0xb800, 0xb800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xb800, 0xb800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( intrepid_main_map, AS_PROGRAM, 8, thepit_state ) @@ -253,7 +254,7 @@ static ADDRESS_MAP_START( intrepid_main_map, AS_PROGRAM, 8, thepit_state ) AM_RANGE(0xb005, 0xb005) AM_WRITE(intrepid_graphics_bank_w) AM_RANGE(0xb006, 0xb006) AM_WRITE(flip_screen_x_w) AM_RANGE(0xb007, 0xb007) AM_WRITE(flip_screen_y_w) - AM_RANGE(0xb800, 0xb800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xb800, 0xb800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) ADDRESS_MAP_END @@ -265,7 +266,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( audio_io_map, AS_IO, 8, thepit_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_byte_w) + AM_RANGE(0x00, 0x00) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0x8c, 0x8d) AM_DEVWRITE("ay2", ay8910_device, address_data_w) AM_RANGE(0x8d, 0x8d) AM_DEVREAD("ay2", ay8910_device, data_r) AM_RANGE(0x8e, 0x8f) AM_DEVWRITE("ay1", ay8910_device, address_data_w) @@ -732,8 +733,10 @@ static MACHINE_CONFIG_START( thepit, thepit_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, PIXEL_CLOCK/4) - 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_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MCFG_SOUND_ADD("ay2", AY8910, PIXEL_CLOCK/4) diff --git a/src/mame/drivers/wink.cpp b/src/mame/drivers/wink.cpp index df9e42a26f7..855a0ab47c1 100644 --- a/src/mame/drivers/wink.cpp +++ b/src/mame/drivers/wink.cpp @@ -15,6 +15,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" @@ -171,7 +172,7 @@ static ADDRESS_MAP_START( wink_io, AS_IO, 8, wink_state ) // AM_RANGE(0x23, 0x23) AM_WRITENOP //? // AM_RANGE(0x24, 0x24) AM_WRITENOP //cab Knocker like in q-bert! AM_RANGE(0x25, 0x27) AM_WRITE(wink_coin_counter_w) - AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x40, 0x40) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0x60, 0x60) AM_WRITE(sound_irq_w) AM_RANGE(0x80, 0x80) AM_READ(analog_port_r) AM_RANGE(0xa0, 0xa0) AM_READ(player_inputs_r) @@ -188,7 +189,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( wink_sound_map, AS_PROGRAM, 8, wink_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_RAM - AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r) + AM_RANGE(0x8000, 0x8000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END static ADDRESS_MAP_START( wink_sound_io, AS_IO, 8, wink_state ) @@ -381,6 +382,9 @@ static MACHINE_CONFIG_START( wink, wink_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8912, 12000000 / 8) MCFG_AY8910_PORT_A_READ_CB(READ8(wink_state, sound_r)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/zodiack.cpp b/src/mame/drivers/zodiack.cpp index b2d0cba7791..67a087a0f26 100644 --- a/src/mame/drivers/zodiack.cpp +++ b/src/mame/drivers/zodiack.cpp @@ -130,7 +130,7 @@ INTERRUPT_GEN_MEMBER(zodiack_state::zodiack_sound_nmi_gen) WRITE8_MEMBER( zodiack_state::master_soundlatch_w ) { - soundlatch_byte_w(space, offset, data); + m_soundlatch->write(space, offset, data); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -150,7 +150,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, zodiack_state ) AM_RANGE(0x6082, 0x6082) AM_READ_PORT("DSW1") AM_RANGE(0x6083, 0x6083) AM_READ_PORT("IN0") AM_RANGE(0x6084, 0x6084) AM_READ_PORT("IN1") - AM_RANGE(0x6090, 0x6090) AM_READWRITE(soundlatch_byte_r, master_soundlatch_w) + AM_RANGE(0x6090, 0x6090) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_WRITE(master_soundlatch_w) AM_RANGE(0x7000, 0x7000) AM_READNOP AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) /* NOP??? */ AM_RANGE(0x7100, 0x7100) AM_WRITE(nmi_mask_w) AM_RANGE(0x7200, 0x7200) AM_WRITE(flipscreen_w) @@ -167,7 +167,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, zodiack_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x23ff) AM_RAM AM_RANGE(0x4000, 0x4000) AM_WRITE(sound_nmi_enable_w) - AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w) + AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, write) ADDRESS_MAP_END static ADDRESS_MAP_START( io_map, AS_IO, 8, zodiack_state ) @@ -588,6 +588,8 @@ static MACHINE_CONFIG_START( zodiack, zodiack_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, XTAL_18_432MHz/12) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/includes/armedf.h b/src/mame/includes/armedf.h index b09b256ee45..9ebc22e86e6 100644 --- a/src/mame/includes/armedf.h +++ b/src/mame/includes/armedf.h @@ -1,6 +1,8 @@ // license:BSD-3-Clause // copyright-holders:David Haywood, Phil Stroffolino, Carlos A. Lozano + #include "includes/nb1414m4.h" +#include "machine/gen_latch.h" #include "video/bufsprite.h" class armedf_state : public driver_device @@ -14,6 +16,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_spriteram(*this, "spriteram"), + m_soundlatch(*this, "soundlatch"), m_spr_pal_clut(*this, "spr_pal_clut"), m_fg_videoram(*this, "fg_videoram"), m_bg_videoram(*this, "bg_videoram") @@ -26,6 +29,7 @@ public: required_device m_gfxdecode; required_device m_palette; required_device m_spriteram; + required_device m_soundlatch; /* memory pointers */ std::unique_ptr m_text_videoram; diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h index 4f2b447439a..dd29b39b2e3 100644 --- a/src/mame/includes/astrocde.h +++ b/src/mame/includes/astrocde.h @@ -5,7 +5,9 @@ Bally Astrocade-based hardware ***************************************************************************/ + #include "machine/bankdev.h" +#include "machine/gen_latch.h" #include "sound/astrocde.h" #include "sound/samples.h" #include "sound/votrax.h" @@ -39,6 +41,7 @@ public: m_videoram(*this, "videoram"), m_protected_ram(*this, "protected_ram"), m_screen(*this, "screen"), + m_soundlatch(*this, "soundlatch"), m_bank4000(*this, "bank4000"), m_bank8000(*this, "bank8000"), m_p1handle(*this, "P1HANDLE"), @@ -65,6 +68,7 @@ public: optional_shared_ptr m_videoram; optional_shared_ptr m_protected_ram; required_device m_screen; + optional_device m_soundlatch; optional_device m_bank4000; optional_memory_bank m_bank8000; optional_ioport m_p1handle; diff --git a/src/mame/includes/cclimber.h b/src/mame/includes/cclimber.h index 2d0b64f566a..ad49bef6f5f 100644 --- a/src/mame/includes/cclimber.h +++ b/src/mame/includes/cclimber.h @@ -1,5 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria + +#include "machine/gen_latch.h" + class cclimber_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_bigsprite_videoram(*this, "bigspriteram"), m_videoram(*this, "videoram"), m_column_scroll(*this, "column_scroll"), @@ -27,6 +31,7 @@ public: optional_device m_audiocpu; required_device m_gfxdecode; required_device m_palette; + optional_device m_soundlatch; required_shared_ptr m_bigsprite_videoram; required_shared_ptr m_videoram; diff --git a/src/mame/includes/cop01.h b/src/mame/includes/cop01.h index 447775fab34..124fed9005c 100644 --- a/src/mame/includes/cop01.h +++ b/src/mame/includes/cop01.h @@ -6,6 +6,8 @@ *************************************************************************/ +#include "machine/gen_latch.h" + class cop01_state : public driver_device { public: @@ -17,7 +19,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_bgvideoram; @@ -38,6 +41,7 @@ public: required_device m_audiocpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; DECLARE_WRITE8_MEMBER(cop01_sound_command_w); DECLARE_READ8_MEMBER(cop01_sound_command_r); diff --git a/src/mame/includes/deniam.h b/src/mame/includes/deniam.h index 6f3d91de158..5beebbb7c37 100644 --- a/src/mame/includes/deniam.h +++ b/src/mame/includes/deniam.h @@ -1,10 +1,13 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria + /************************************************************************* Deniam games *************************************************************************/ + +#include "machine/gen_latch.h" #include "sound/okim6295.h" class deniam_state : public driver_device @@ -20,7 +23,8 @@ public: m_audiocpu(*this, "audiocpu"), m_oki(*this, "oki"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_videoram; @@ -76,4 +80,5 @@ public: required_device m_oki; required_device m_gfxdecode; required_device m_palette; + optional_device m_soundlatch; }; diff --git a/src/mame/includes/espial.h b/src/mame/includes/espial.h index 5b764363c4d..3c12252827e 100644 --- a/src/mame/includes/espial.h +++ b/src/mame/includes/espial.h @@ -1,11 +1,14 @@ // license:BSD-3-Clause // copyright-holders:Brad Oliver + /*************************************************************************** - Espial hardware games (drivers: espial.c) + Espial hardware games (drivers: espial.cpp) ***************************************************************************/ +#include "machine/gen_latch.h" + class espial_state : public driver_device { public: @@ -21,7 +24,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_videoram; required_shared_ptr m_attributeram; @@ -45,6 +49,7 @@ public: required_device m_audiocpu; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; DECLARE_WRITE8_MEMBER(espial_master_interrupt_mask_w); DECLARE_WRITE8_MEMBER(espial_master_soundlatch_w); diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index ad276a93f5d..2c9b6221ae9 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -6,6 +6,7 @@ ***************************************************************************/ +#include "machine/gen_latch.h" #include "machine/i8255.h" #include "sound/ay8910.h" #include "sound/dac.h" @@ -50,11 +51,12 @@ public: m_ppi8255_0(*this, "ppi8255_0"), m_ppi8255_1(*this, "ppi8255_1"), m_ppi8255_2(*this, "ppi8255_2"), - m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), + m_spriteram(*this, "spriteram"), + m_videoram(*this, "videoram"), m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device m_maincpu; @@ -66,14 +68,16 @@ public: optional_device m_ay8910_2; optional_device m_ay8910_cclimber; optional_device m_digitalker; - optional_device m_ppi8255_0; - optional_device m_ppi8255_1; - optional_device m_ppi8255_2; - required_shared_ptr m_spriteram; - required_shared_ptr m_videoram; + optional_device m_ppi8255_0; + optional_device m_ppi8255_1; + optional_device m_ppi8255_2; required_device m_gfxdecode; required_device m_screen; required_device m_palette; + optional_device m_soundlatch; + + required_shared_ptr m_spriteram; + required_shared_ptr m_videoram; optional_shared_ptr m_decrypted_opcodes; int m_bullets_base; diff --git a/src/mame/includes/galivan.h b/src/mame/includes/galivan.h index 5f098ff890f..feb92f13beb 100644 --- a/src/mame/includes/galivan.h +++ b/src/mame/includes/galivan.h @@ -7,6 +7,7 @@ ***************************************************************************/ #include "includes/nb1414m4.h" +#include "machine/gen_latch.h" #include "video/bufsprite.h" class galivan_state : public driver_device @@ -19,7 +20,8 @@ public: m_maincpu(*this, "maincpu"), m_nb1414m4(*this, "nb1414m4"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ required_shared_ptr m_videoram; @@ -70,4 +72,5 @@ public: optional_device m_nb1414m4; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; }; diff --git a/src/mame/includes/macrossp.h b/src/mame/includes/macrossp.h index ffcbb5e89f5..09f651b2555 100644 --- a/src/mame/includes/macrossp.h +++ b/src/mame/includes/macrossp.h @@ -1,11 +1,14 @@ // license:BSD-3-Clause // copyright-holders:David Haywood + /************************************************************************* Macross Plus *************************************************************************/ +#include "machine/gen_latch.h" + class macrossp_state : public driver_device { public: @@ -33,7 +36,8 @@ public: m_audiocpu(*this, "audiocpu"), m_screen(*this, "screen"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } @@ -71,6 +75,7 @@ public: required_device m_screen; required_device m_gfxdecode; required_device m_palette; + required_device m_soundlatch; DECLARE_READ32_MEMBER(macrossp_soundstatus_r); DECLARE_WRITE32_MEMBER(macrossp_soundcmd_w); diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h index b19a4faa211..df80da3d07d 100644 --- a/src/mame/includes/mario.h +++ b/src/mame/includes/mario.h @@ -3,6 +3,7 @@ #ifndef MARIO_H_ #define MARIO_H_ +#include "machine/gen_latch.h" #include "machine/z80dma.h" #define OLD_SOUND (1) @@ -52,6 +53,10 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_z80dma(*this, "z80dma"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2"), + m_soundlatch3(*this, "soundlatch3"), + m_soundlatch4(*this, "soundlatch4"), #if OLD_SOUND m_discrete(*this, "discrete"), #else @@ -69,6 +74,10 @@ public: required_device m_gfxdecode; required_device m_palette; optional_device m_z80dma; + optional_device m_soundlatch; + optional_device m_soundlatch2; + optional_device m_soundlatch3; + optional_device m_soundlatch4; #if OLD_SOUND optional_device m_discrete; #else diff --git a/src/mame/includes/metro.h b/src/mame/includes/metro.h index e47da64dfaa..ee2dbf233df 100644 --- a/src/mame/includes/metro.h +++ b/src/mame/includes/metro.h @@ -11,6 +11,7 @@ #include "sound/es8712.h" #include "video/k053936.h" #include "machine/eepromser.h" +#include "machine/gen_latch.h" class metro_state : public driver_device { @@ -30,6 +31,11 @@ public: m_ymsnd(*this, "ymsnd"), m_essnd(*this, "essnd"), m_k053936(*this, "k053936") , + m_eeprom(*this, "eeprom"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_vram_0(*this, "vram_0"), m_vram_1(*this, "vram_1"), m_vram_2(*this, "vram_2"), @@ -45,11 +51,7 @@ public: m_videoregs(*this, "videoregs"), m_screenctrl(*this, "screenctrl"), m_input_sel(*this, "input_sel"), - m_k053936_ram(*this, "k053936_ram"), - m_eeprom(*this, "eeprom"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") + m_k053936_ram(*this, "k053936_ram") { } /* devices */ @@ -59,6 +61,12 @@ public: optional_device m_ymsnd; // TODO set correct type optional_device m_essnd; optional_device m_k053936; + optional_device m_eeprom; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + optional_device m_soundlatch; + /* memory pointers */ optional_shared_ptr m_vram_0; optional_shared_ptr m_vram_1; @@ -77,11 +85,6 @@ public: optional_shared_ptr m_input_sel; optional_shared_ptr m_k053936_ram; - optional_device m_eeprom; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - int m_flip_screen; /* video-related */ diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h index 9ce2a855954..cdc61bfe2bf 100644 --- a/src/mame/includes/midyunit.h +++ b/src/mame/includes/midyunit.h @@ -7,8 +7,10 @@ **************************************************************************/ +#include "machine/gen_latch.h" #include "cpu/tms34010/tms34010.h" #include "audio/williams.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "sound/okim6295.h" @@ -50,6 +52,7 @@ public: m_narc_sound(*this, "narcsnd"), m_cvsd_sound(*this, "cvsd"), m_adpcm_sound(*this, "adpcm"), + m_soundlatch(*this, "soundlatch"), m_generic_paletteram_16(*this, "paletteram"), m_gfx_rom(*this, "gfx_rom", 16), m_mainram(*this, "mainram"), @@ -62,6 +65,7 @@ public: optional_device m_narc_sound; optional_device m_cvsd_sound; optional_device m_adpcm_sound; + optional_device m_soundlatch; required_shared_ptr m_generic_paletteram_16; optional_shared_ptr m_gfx_rom; diff --git a/src/mame/includes/nbmj8891.h b/src/mame/includes/nbmj8891.h index 0c5969010f6..fcb9f08542b 100644 --- a/src/mame/includes/nbmj8891.h +++ b/src/mame/includes/nbmj8891.h @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Takahiro Nogi + #include "includes/nb1413m3.h" class nbmj8891_state : public driver_device diff --git a/src/mame/includes/nbmj8991.h b/src/mame/includes/nbmj8991.h index 74920f3555f..9142e9a94ef 100644 --- a/src/mame/includes/nbmj8991.h +++ b/src/mame/includes/nbmj8991.h @@ -1,6 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Takahiro Nogi + #include "includes/nb1413m3.h" +#include "machine/gen_latch.h" class nbmj8991_state : public driver_device { @@ -12,6 +14,7 @@ public: m_nb1413m3(*this, "nb1413m3"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_generic_paletteram_8(*this, "paletteram") { } required_device m_maincpu; @@ -19,6 +22,7 @@ public: required_device m_nb1413m3; required_device m_screen; required_device m_palette; + optional_device m_soundlatch; required_shared_ptr m_generic_paletteram_8; diff --git a/src/mame/includes/nbmj9195.h b/src/mame/includes/nbmj9195.h index ec36eb8f168..6020b56fab7 100644 --- a/src/mame/includes/nbmj9195.h +++ b/src/mame/includes/nbmj9195.h @@ -7,6 +7,7 @@ ******************************************************************************/ #include "cpu/z80/tmpz84c011.h" +#include "machine/gen_latch.h" #include "sound/dac.h" #define VRAM_MAX 2 @@ -30,6 +31,7 @@ public: m_dac2(*this, "dac2"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_palette_ptr(*this, "paletteram") { } @@ -38,6 +40,7 @@ public: required_device m_dac2; required_device m_screen; required_device m_palette; + required_device m_soundlatch; optional_shared_ptr m_palette_ptr; //shabdama doesn't use it at least for now diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index e5f0ffaa303..77f692d2740 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -10,6 +10,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "sound/2610intf.h" +#include "machine/gen_latch.h" #include "machine/upd1990a.h" #include "machine/ng_memcard.h" #include "video/neogeo_spr.h" @@ -38,6 +39,8 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_memcard(*this, "memcard"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2"), m_region_maincpu(*this, "maincpu"), m_region_sprites(*this, "sprites"), m_region_fixed(*this, "fixed"), @@ -125,6 +128,8 @@ protected: required_device m_screen; optional_device m_palette; optional_device m_memcard; + required_device m_soundlatch; + required_device m_soundlatch2; // memory optional_memory_region m_region_maincpu; diff --git a/src/mame/includes/niyanpai.h b/src/mame/includes/niyanpai.h index 2115240a0da..4461b7b36c5 100644 --- a/src/mame/includes/niyanpai.h +++ b/src/mame/includes/niyanpai.h @@ -1,7 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Takahiro Nogi + #include "sound/dac.h" +#include "machine/gen_latch.h" #include "machine/tmp68301.h" + #define VRAM_MAX 3 class niyanpai_state : public driver_device @@ -19,7 +22,8 @@ public: m_dac1(*this, "dac1"), m_dac2(*this, "dac2"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } required_device m_maincpu; required_device m_tmp68301; @@ -27,6 +31,7 @@ public: required_device m_dac2; required_device m_screen; required_device m_palette; + required_device m_soundlatch; // common int m_scrollx[VRAM_MAX]; diff --git a/src/mame/includes/nmk16.h b/src/mame/includes/nmk16.h index c2e20116e50..5ec3b51de31 100644 --- a/src/mame/includes/nmk16.h +++ b/src/mame/includes/nmk16.h @@ -1,9 +1,11 @@ // license:BSD-3-Clause // copyright-holders:Mirko Buffoni,Nicola Salmoria,Bryan McPhail,David Haywood,R. Belmont,Alex Marshall,Angelo Salese,Luca Elia // thanks-to:Richard Bush + #include "machine/nmk112.h" #include "sound/okim6295.h" #include "machine/nmk004.h" +#include "machine/gen_latch.h" class nmk16_state : public driver_device { @@ -14,6 +16,10 @@ public: m_audiocpu(*this, "audiocpu"), m_oki1(*this, "oki1"), m_oki2(*this, "oki2"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_nmk004(*this, "nmk004"), + m_soundlatch(*this, "soundlatch"), m_nmk_bgvideoram0(*this, "nmk_bgvideoram0"), m_nmk_txvideoram(*this, "nmk_txvideoram"), m_mainram(*this, "mainram"), @@ -26,9 +32,6 @@ public: m_nmk_bgvideoram3(*this, "nmk_bgvideoram3"), m_afega_scroll_0(*this, "afega_scroll_0"), m_afega_scroll_1(*this, "afega_scroll_1"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_nmk004(*this, "nmk004"), m_sprdma_base(0x8000) {} @@ -36,6 +39,11 @@ public: optional_device m_audiocpu; optional_device m_oki1; optional_device m_oki2; + required_device m_gfxdecode; + required_device m_palette; + optional_device m_nmk004; + optional_device m_soundlatch; + required_shared_ptr m_nmk_bgvideoram0; optional_shared_ptr m_nmk_txvideoram; required_shared_ptr m_mainram; @@ -48,9 +56,8 @@ public: optional_shared_ptr m_nmk_bgvideoram3; optional_shared_ptr m_afega_scroll_0; optional_shared_ptr m_afega_scroll_1; - required_device m_gfxdecode; - required_device m_palette; - optional_device m_nmk004; + + int m_sprdma_base; int mask[4*2]; int m_simple_scroll; diff --git a/src/mame/includes/sslam.h b/src/mame/includes/sslam.h index c52ee6f3672..ba28d2227c1 100644 --- a/src/mame/includes/sslam.h +++ b/src/mame/includes/sslam.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Pierpaolo Prazzoli, Quench + +#include "machine/gen_latch.h" #include "sound/okim6295.h" class sslam_state : public driver_device @@ -12,6 +14,7 @@ public: m_oki(*this, "oki"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_bg_tileram(*this, "bg_tileram"), m_md_tileram(*this, "md_tileram"), m_tx_tileram(*this, "tx_tileram"), @@ -24,6 +27,7 @@ public: required_device m_oki; required_device m_gfxdecode; required_device m_palette; + optional_device m_soundlatch; required_shared_ptr m_bg_tileram; optional_shared_ptr m_md_tileram; diff --git a/src/mame/includes/terracre.h b/src/mame/includes/terracre.h index d055fa142a5..ba82b080442 100644 --- a/src/mame/includes/terracre.h +++ b/src/mame/includes/terracre.h @@ -1,5 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Carlos A. Lozano + +#include "machine/gen_latch.h" #include "video/bufsprite.h" class terracre_state : public driver_device @@ -11,6 +13,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_spriteram(*this, "spriteram"), + m_soundlatch(*this, "soundlatch"), m_bg_videoram(*this, "bg_videoram"), m_fg_videoram(*this, "fg_videoram") { } @@ -18,6 +21,7 @@ public: required_device m_gfxdecode; required_device m_palette; required_device m_spriteram; + required_device m_soundlatch; required_shared_ptr m_bg_videoram; required_shared_ptr m_fg_videoram; diff --git a/src/mame/includes/zodiack.h b/src/mame/includes/zodiack.h index 2497ecb3651..064db79a60c 100644 --- a/src/mame/includes/zodiack.h +++ b/src/mame/includes/zodiack.h @@ -1,7 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Zsolt Vasvari + #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" class zodiack_state : public driver_device { @@ -10,13 +12,14 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), m_videoram(*this, "videoram"), m_videoram_2(*this, "videoram_2"), m_attributeram(*this, "attributeram"), m_spriteram(*this, "spriteram"), - m_bulletsram(*this, "bulletsram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_bulletsram(*this, "bulletsram") { } // in drivers/zodiack.c @@ -37,6 +40,9 @@ public: // devices required_device m_maincpu; required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; // shared pointers required_shared_ptr m_videoram; @@ -45,9 +51,6 @@ public: required_shared_ptr m_spriteram; required_shared_ptr m_bulletsram; - required_device m_gfxdecode; - required_device m_palette; - // state tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; diff --git a/src/mame/machine/midyunit.cpp b/src/mame/machine/midyunit.cpp index 80d4c8efb5c..8c18d64fecb 100644 --- a/src/mame/machine/midyunit.cpp +++ b/src/mame/machine/midyunit.cpp @@ -8,7 +8,6 @@ **************************************************************************/ #include "emu.h" -#include "cpu/tms34010/tms34010.h" #include "cpu/m6809/m6809.h" #include "includes/midyunit.h" @@ -603,7 +602,7 @@ WRITE16_MEMBER(midyunit_state::midyunit_sound_w) break; case SOUND_YAWDIM: - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); break; }