summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-02-17 22:41:04 -0500
committer AJR <ajrhacker@users.noreply.github.com>2018-02-17 22:41:04 -0500
commitc6b9727c7fb36b0a7388eee544aa779508106cd6 (patch)
tree8faf8785abfcd1f2eb4402beafe61b4fdf302f30
parent576d271bf759d5ab1e14612a4bfd7cbbd2f0abad (diff)
bigevglf: Soundlatch modernization (nw)
-rw-r--r--src/mame/drivers/bigevglf.cpp105
-rw-r--r--src/mame/includes/bigevglf.h19
2 files changed, 23 insertions, 101 deletions
diff --git a/src/mame/drivers/bigevglf.cpp b/src/mame/drivers/bigevglf.cpp
index be5a949bb21..f0198bd7f03 100644
--- a/src/mame/drivers/bigevglf.cpp
+++ b/src/mame/drivers/bigevglf.cpp
@@ -62,6 +62,7 @@ J1100072A
#include "cpu/m6805/m6805.h"
#include "cpu/z80/z80.h"
+#include "machine/input_merger.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
#include "sound/volt_reg.h"
@@ -78,73 +79,11 @@ WRITE8_MEMBER(bigevglf_state::beg_banking_w)
membank("bank1")->set_entry(m_beg_bank & 0xff); /* empty sockets for IC37-IC44 ROMS */
}
-TIMER_CALLBACK_MEMBER(bigevglf_state::from_sound_latch_callback)
-{
- m_from_sound = param & 0xff;
- m_sound_state |= 2;
-}
-WRITE8_MEMBER(bigevglf_state::beg_fromsound_w)/* write to D800 sets bit 1 in status */
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(bigevglf_state::from_sound_latch_callback),this), (m_audiocpu->pc() << 16) | data);
-}
-
-READ8_MEMBER(bigevglf_state::beg_fromsound_r)
-{
- /* set a timer to force synchronization after the read */
- machine().scheduler().synchronize();
- return m_from_sound;
-}
-
-READ8_MEMBER(bigevglf_state::beg_soundstate_r)
-{
- uint8_t ret = m_sound_state;
- /* set a timer to force synchronization after the read */
- machine().scheduler().synchronize();
- m_sound_state &= ~2; /* read from port 21 clears bit 1 in status */
- return ret;
-}
-
READ8_MEMBER(bigevglf_state::soundstate_r)
{
- /* set a timer to force synchronization after the read */
- machine().scheduler().synchronize();
- return m_sound_state;
-}
-
-TIMER_CALLBACK_MEMBER(bigevglf_state::nmi_callback)
-{
- if (m_sound_nmi_enable)
- m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
- else
- m_pending_nmi = 1;
- m_sound_state &= ~1;
-}
-
-WRITE8_MEMBER(bigevglf_state::sound_command_w)/* write to port 20 clears bit 0 in status */
-{
- m_for_sound = data;
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(bigevglf_state::nmi_callback),this), data);
-}
-
-READ8_MEMBER(bigevglf_state::sound_command_r)/* read from D800 sets bit 0 in status */
-{
- m_sound_state |= 1;
- return m_for_sound;
-}
-
-WRITE8_MEMBER(bigevglf_state::nmi_disable_w)
-{
- m_sound_nmi_enable = 0;
-}
-
-WRITE8_MEMBER(bigevglf_state::nmi_enable_w)
-{
- m_sound_nmi_enable = 1;
- if (m_pending_nmi)
- {
- m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
- m_pending_nmi = 0;
- }
+ uint8_t sound_state = m_soundlatch[0]->pending_r() ? 0 : 1;
+ sound_state |= m_soundlatch[1]->pending_r() ? 2 : 0;
+ return sound_state;
}
TIMER_CALLBACK_MEMBER(bigevglf_state::deferred_ls74_w)
@@ -359,8 +298,9 @@ ADDRESS_MAP_START(bigevglf_state::bigevglf_sub_portmap)
AM_RANGE(0x0e, 0x0e) AM_WRITENOP /* 0-enable MCU, 1-keep reset line ASSERTED; D0 goes to the input of ls74 and the /Q of this ls74 goes to reset line on 68705 */
AM_RANGE(0x10, 0x17) AM_WRITE(beg13_a_clr_w)
AM_RANGE(0x18, 0x1f) AM_WRITE(beg13_b_set_w)
- AM_RANGE(0x20, 0x20) AM_READWRITE(beg_fromsound_r, sound_command_w)
- AM_RANGE(0x21, 0x21) AM_READ(beg_soundstate_r)
+ AM_RANGE(0x20, 0x20) AM_DEVREAD("soundlatch2", generic_latch_8_device, read)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE("soundlatch1", generic_latch_8_device, write)
+ AM_RANGE(0x21, 0x21) AM_READ(soundstate_r)
ADDRESS_MAP_END
@@ -376,9 +316,11 @@ ADDRESS_MAP_START(bigevglf_state::sound_map)
AM_RANGE(0xca00, 0xca0d) AM_DEVWRITE("msm", msm5232_device, write)
AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP
AM_RANGE(0xce00, 0xce00) AM_WRITENOP
- AM_RANGE(0xd800, 0xd800) AM_READWRITE(sound_command_r, beg_fromsound_w) /* write to D800 sets bit 1 in status */
- AM_RANGE(0xda00, 0xda00) AM_READWRITE(soundstate_r, nmi_enable_w)
- AM_RANGE(0xdc00, 0xdc00) AM_WRITE(nmi_disable_w)
+ AM_RANGE(0xd800, 0xd800) AM_DEVREAD("soundlatch1", generic_latch_8_device, read)
+ AM_RANGE(0xd800, 0xd800) AM_DEVWRITE("soundlatch2", generic_latch_8_device, write) /* write to D800 sets bit 1 in status */
+ AM_RANGE(0xda00, 0xda00) AM_READ(soundstate_r)
+ AM_RANGE(0xda00, 0xda00) AM_DEVWRITE("soundnmi", input_merger_device, in_set<1>) // enable NMI
+ AM_RANGE(0xdc00, 0xdc00) AM_DEVWRITE("soundnmi", input_merger_device, in_clear<1>) // disable NMI
AM_RANGE(0xde00, 0xde00) AM_READNOP AM_DEVWRITE("dac", dac_byte_interface, write) /* signed 8-bit DAC & unknown read */
AM_RANGE(0xe000, 0xefff) AM_READNOP /* space for diagnostics ROM */
ADDRESS_MAP_END
@@ -412,16 +354,7 @@ void bigevglf_state::machine_start()
save_item(NAME(m_beg_bank));
save_item(NAME(m_port_select));
- save_item(NAME(m_sound_nmi_enable));
- save_item(NAME(m_pending_nmi));
- save_item(NAME(m_for_sound));
- save_item(NAME(m_from_sound));
- save_item(NAME(m_sound_state));
-
-
save_item(NAME(m_mcu_coin_bit5));
-
-
}
void bigevglf_state::machine_reset()
@@ -435,12 +368,6 @@ void bigevglf_state::machine_reset()
m_beg_bank = 0;
m_port_select = 0;
- m_sound_nmi_enable = 0;
- m_pending_nmi = 0;
- m_for_sound = 0;
- m_from_sound = 0;
- m_sound_state = 0;
-
m_mcu_coin_bit5 = 0;
}
@@ -464,6 +391,14 @@ MACHINE_CONFIG_START(bigevglf_state::bigevglf)
2 irqs/frame give good music tempo but also SOUND ERROR in test mode,
4 irqs/frame give SOUND OK in test mode but music seems to be running too fast */
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch1")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundnmi", input_merger_device, in_w<0>))
+
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch2")
+
+ MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
+ MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+
MCFG_DEVICE_ADD("bmcu", TAITO68705_MCU, 2000000) /* ??? */
MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* 10 CPU slices per frame - interleaving is forced on the fly */
diff --git a/src/mame/includes/bigevglf.h b/src/mame/includes/bigevglf.h
index a433146eeb4..6c81155dd8d 100644
--- a/src/mame/includes/bigevglf.h
+++ b/src/mame/includes/bigevglf.h
@@ -1,6 +1,7 @@
// license:GPL-2.0+
// copyright-holders:Jarek Burczynski, Tomasz Slanina
#include "sound/msm5232.h"
+#include "machine/gen_latch.h"
#include "machine/taito68705interface.h"
#include "screen.h"
@@ -16,6 +17,7 @@ public:
m_bmcu(*this, "bmcu"),
m_maincpu(*this, "maincpu"),
m_msm(*this, "msm"),
+ m_soundlatch(*this, "soundlatch%u", 1),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette") { }
@@ -32,13 +34,6 @@ public:
uint32_t m_plane_selected;
uint32_t m_plane_visible;
- /* sound-related */
- int m_sound_nmi_enable;
- int m_pending_nmi;
- uint8_t m_for_sound;
- uint8_t m_from_sound;
- uint8_t m_sound_state;
-
/* MCU related */
int m_mcu_coin_bit5;
@@ -51,14 +46,7 @@ public:
required_device<cpu_device> m_audiocpu;
optional_device<taito68705_mcu_device> m_bmcu;
DECLARE_WRITE8_MEMBER(beg_banking_w);
- DECLARE_WRITE8_MEMBER(beg_fromsound_w);
- DECLARE_READ8_MEMBER(beg_fromsound_r);
- DECLARE_READ8_MEMBER(beg_soundstate_r);
DECLARE_READ8_MEMBER(soundstate_r);
- DECLARE_WRITE8_MEMBER(sound_command_w);
- DECLARE_READ8_MEMBER(sound_command_r);
- DECLARE_WRITE8_MEMBER(nmi_disable_w);
- DECLARE_WRITE8_MEMBER(nmi_enable_w);
DECLARE_WRITE8_MEMBER(beg13_a_clr_w);
DECLARE_WRITE8_MEMBER(beg13_b_clr_w);
DECLARE_WRITE8_MEMBER(beg13_a_set_w);
@@ -78,12 +66,11 @@ public:
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update_bigevglf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(from_sound_latch_callback);
- TIMER_CALLBACK_MEMBER(nmi_callback);
TIMER_CALLBACK_MEMBER(deferred_ls74_w);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
required_device<msm5232_device> m_msm;
+ required_device_array<generic_latch_8_device, 2> m_soundlatch;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;