summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ajrhacker <ajrhacker@users.noreply.github.com>2018-02-18 21:36:21 -0500
committer GitHub <noreply@github.com>2018-02-18 21:36:21 -0500
commit371b7d48becd4d7a926672f19f1c42ea4c0d2425 (patch)
treefb93b2e66f4e838eb8954487373a1392d4a9062b
parentbf90bb676dacdd514bf67b83cd24bfb0d56b57a1 (diff)
parent5db1c2fc0b5ba63994afe93a84e8301a8a1e354e (diff)
Merge pull request #3237 from ajrhacker/rstbuf
Create RST interrupt buffer device
-rw-r--r--scripts/src/machine.lua12
-rw-r--r--scripts/target/mame/arcade.lua1
-rw-r--r--scripts/target/mame/mess.lua1
-rw-r--r--src/devices/machine/msm6242.cpp35
-rw-r--r--src/devices/machine/msm6242.h1
-rw-r--r--src/devices/machine/rstbuf.cpp180
-rw-r--r--src/devices/machine/rstbuf.h111
-rw-r--r--src/devices/sound/2203intf.cpp17
-rw-r--r--src/devices/sound/2203intf.h9
-rw-r--r--src/mame/audio/m72.cpp66
-rw-r--r--src/mame/audio/m72.h18
-rw-r--r--src/mame/drivers/ddenlovr.cpp6
-rw-r--r--src/mame/drivers/dynax.cpp173
-rw-r--r--src/mame/drivers/kurukuru.cpp79
-rw-r--r--src/mame/drivers/m72.cpp35
-rw-r--r--src/mame/drivers/m90.cpp21
-rw-r--r--src/mame/drivers/shisen.cpp15
-rw-r--r--src/mame/drivers/vigilant.cpp33
-rw-r--r--src/mame/includes/dynax.h21
-rw-r--r--src/mame/includes/m90.h4
20 files changed, 520 insertions, 318 deletions
diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua
index 7e55d344f92..fc21510f620 100644
--- a/scripts/src/machine.lua
+++ b/scripts/src/machine.lua
@@ -2342,6 +2342,18 @@ end
---------------------------------------------------
--
+--@src/devices/machine/rstbuf.h,MACHINES["RSTBUF"] = true
+---------------------------------------------------
+
+if (MACHINES["RSTBUF"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/machine/rstbuf.cpp",
+ MAME_DIR .. "src/devices/machine/rstbuf.h",
+ }
+end
+
+---------------------------------------------------
+--
--@src/devices/machine/rtc4543.h,MACHINES["RTC4543"] = true
---------------------------------------------------
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua
index 6c152e13daa..b0c3c36fd9d 100644
--- a/scripts/target/mame/arcade.lua
+++ b/scripts/target/mame/arcade.lua
@@ -543,6 +543,7 @@ MACHINES["ROC10937"] = true
MACHINES["RP5C01"] = true
MACHINES["RP5C15"] = true
MACHINES["RP5H01"] = true
+MACHINES["RSTBUF"] = true
MACHINES["RTC4543"] = true
MACHINES["RTC65271"] = true
MACHINES["RTC9701"] = true
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index c38eb46c82b..ef78a3546be 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -532,6 +532,7 @@ MACHINES["ROC10937"] = true
MACHINES["RP5C01"] = true
MACHINES["RP5C15"] = true
MACHINES["RP5H01"] = true
+--MACHINES["RSTBUF"] = true
MACHINES["RTC4543"] = true
MACHINES["RTC65271"] = true
MACHINES["RTC9701"] = true
diff --git a/src/devices/machine/msm6242.cpp b/src/devices/machine/msm6242.cpp
index 63742faa087..62cb24b641f 100644
--- a/src/devices/machine/msm6242.cpp
+++ b/src/devices/machine/msm6242.cpp
@@ -129,8 +129,7 @@ void msm6242_device::device_start()
void msm6242_device::device_reset()
{
- if (!m_out_int_handler.isnull())
- m_out_int_handler(CLEAR_LINE);
+ set_irq(false);
}
@@ -180,6 +179,21 @@ void msm6242_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
+//-------------------------------------------------
+// set_irq - set the IRQ flag and output
+//-------------------------------------------------
+
+void msm6242_device::set_irq(bool active)
+{
+ if (active)
+ m_reg[0] |= 0x04;
+ else
+ m_reg[0] &= 0x0b;
+
+ if (!m_out_int_handler.isnull())
+ m_out_int_handler(active ? ASSERT_LINE : CLEAR_LINE);
+}
+
//-------------------------------------------------
// irq
@@ -194,8 +208,7 @@ void msm6242_device::irq(uint8_t irq_type)
LOGIRQ("%s: MSM6242 logging IRQ #%u\n", machine().describe_context(), irq_type);
// ...and assert the output line
- if (!m_out_int_handler.isnull())
- m_out_int_handler(ASSERT_LINE);
+ set_irq(true);
}
}
@@ -515,10 +528,15 @@ WRITE8_MEMBER( msm6242_device::write )
{
case MSM6242_REG_CD:
// x--- 30s ADJ
- // -x-- IRQ FLAG
- // --x- BUSY
+ // -x-- IRQ FLAG (software can only clear this)
+ // --x- BUSY (read-only)
// ---x HOLD
- m_reg[0] = data & 0x0f;
+ if (!BIT(data, 2) && BIT(m_reg[0], 2))
+ {
+ LOGIRQENABLE("%s: MSM6242 acknowledging irq\n", machine().describe_context());
+ set_irq(false);
+ }
+ m_reg[0] = (data & 0x09) | (m_reg[0] & 0x06);
break;
case MSM6242_REG_CE:
@@ -536,8 +554,7 @@ WRITE8_MEMBER( msm6242_device::write )
else
{
m_irq_flag = 0;
- if ( !m_out_int_handler.isnull() )
- m_out_int_handler( CLEAR_LINE );
+ set_irq(false);
LOGIRQENABLE("%s: MSM6242 disabling irq\n", machine().describe_context());
}
diff --git a/src/devices/machine/msm6242.h b/src/devices/machine/msm6242.h
index 0a1ee9b1863..2c99b9eada3 100644
--- a/src/devices/machine/msm6242.h
+++ b/src/devices/machine/msm6242.h
@@ -93,6 +93,7 @@ private:
// methods
void rtc_timer_callback();
uint64_t current_time();
+ void set_irq(bool active);
void irq(uint8_t irq_type);
uint64_t bump(int rtc_register, uint64_t delta, uint64_t register_min, uint64_t register_range);
void update_rtc_registers();
diff --git a/src/devices/machine/rstbuf.cpp b/src/devices/machine/rstbuf.cpp
new file mode 100644
index 00000000000..9e13d72743a
--- /dev/null
+++ b/src/devices/machine/rstbuf.cpp
@@ -0,0 +1,180 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/**********************************************************************
+
+ RST interrupt vector buffer
+
+ The hardware circuit emulated by this device, which is generally
+ made of various TTL gates and buffers, combines three independent
+ interrupt request lines into a single level trigger and also
+ generates a 8080-compatible RST opcode vector when the CPU
+ acknowledges the interrupt, reflecting the current state of all
+ three inputs.
+
+ The positive version of this device treats all of its inputs and
+ outputs as active high, in accordance with 8080 convention and
+ some actual practice. An active-low IRQ would need to be supplied
+ for a Z80, which may be used with this type of circuit in IM 0,
+ though the negative polarity of the Z80 IRQ is not currently
+ accounted for by MAME.
+
+ Table of interrupt vectors for positive version:
+
+ Active Vector Instruction Address of
+ inputs fetched executed service routine
+ ------- ------- ----------- ---------------
+ 1 only CF RST 1 0008
+ 2 only D7 RST 2 0010
+ 4 only E7 RST 4 0020
+ 1 and 2 DF RST 3 0018
+ 1 and 4 EF RST 5 0028
+ 2 and 4 F7 RST 6 0030
+ 1, 2, 4 FF RST 7 0038
+
+ An alternate version of this device buffers the logical negative
+ of the request lines. This variant is primarily associated with
+ Z80-based sound systems. Here the inputs, asserted singly, will
+ produce a RST 18H, RST 28H or RST 30H interrupt (using Zilog
+ rather than Intel syntax). When multiple request lines are active
+ at once, the result is equivalent to the logical AND of the
+ corresponding base vectors.
+
+ This type of circuit features no built-in edge triggers or
+ prioritization. Since its inputs are not latched, a spurious
+ interrupt may occur if one or more lines are asserted just long
+ enough for the CPU to accept the interrupt, but deasserted before
+ the CPU's interrupt acknowledge cycle completes. In the positive
+ version, the vector placed on the bus (C7) is a RST 0 instruction,
+ which (after the return address is pushed onto the stack) will
+ transfer control to 0000 as if the CPU had just been reset. The
+ negative version provides a more useful vector (RST 7/RST 38H)
+ for spurious interrupts, but will still generate RST 0 if all
+ three inputs are active at once, though this situation cannot
+ occur if the buffer only admits two request lines (as is
+ generally the case with this version).
+
+**********************************************************************/
+
+#include "emu.h"
+#include "machine/rstbuf.h"
+
+// device type definition
+DEFINE_DEVICE_TYPE(RST_POS_BUFFER, rst_pos_buffer_device, "rst_pos_buffer", "RST Interrupt Buffer (positive modification)")
+DEFINE_DEVICE_TYPE(RST_NEG_BUFFER, rst_neg_buffer_device, "rst_neg_buffer", "RST Interrupt Buffer (negative modification)")
+
+
+//**************************************************************************
+// RST INTERRUPT BUFFER DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// rst_buffer_device - constructor
+//-------------------------------------------------
+
+rst_buffer_device::rst_buffer_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_int_cb(*this)
+ , m_input_buffer(0)
+{
+}
+
+
+//-------------------------------------------------
+// rst_pos_buffer_device - constructor
+//-------------------------------------------------
+
+rst_pos_buffer_device::rst_pos_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : rst_buffer_device(mconfig, RST_POS_BUFFER, tag, owner, clock)
+{
+}
+
+
+//-------------------------------------------------
+// rst_neg_buffer_device - constructor
+//-------------------------------------------------
+
+rst_neg_buffer_device::rst_neg_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : rst_buffer_device(mconfig, RST_NEG_BUFFER, tag, owner, clock)
+{
+}
+
+
+//-------------------------------------------------
+// device_resolve_objects - resolve objects that
+// may be needed for other devices to set
+// initial conditions at start time
+//-------------------------------------------------
+
+void rst_buffer_device::device_resolve_objects()
+{
+ m_int_cb.resolve_safe();
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void rst_buffer_device::device_start()
+{
+ // save input state
+ save_item(NAME(m_input_buffer));
+}
+
+
+//-------------------------------------------------
+// sync_set_input - synchronize asserted input
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(rst_buffer_device::sync_set_input)
+{
+ if (m_input_buffer == 0)
+ {
+ // assert interrupt when one line becomes active
+ m_input_buffer = param;
+ m_int_cb(1);
+ }
+ else
+ m_input_buffer |= param;
+}
+
+
+//-------------------------------------------------
+// sync_clear_input - synchronize cleared input
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(rst_buffer_device::sync_clear_input)
+{
+ if (m_input_buffer == param)
+ {
+ // deassert interrupt when no more lines are active
+ m_input_buffer = 0;
+ m_int_cb(0);
+ }
+ else
+ m_input_buffer &= ~param;
+}
+
+
+//-------------------------------------------------
+// sync_input - helper to synchronize input lines
+//-------------------------------------------------
+
+void rst_buffer_device::sync_input(bool state, u8 mask)
+{
+ if (state)
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(rst_pos_buffer_device::sync_set_input), this), mask);
+ else
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(rst_pos_buffer_device::sync_clear_input), this), mask);
+}
+
+
+//-------------------------------------------------
+// inta_cb - provide vector when interrupt is
+// acknowledged by CPU
+//-------------------------------------------------
+
+IRQ_CALLBACK_MEMBER(rst_buffer_device::inta_cb)
+{
+ return get_vector();
+}
diff --git a/src/devices/machine/rstbuf.h b/src/devices/machine/rstbuf.h
new file mode 100644
index 00000000000..39a45400ee3
--- /dev/null
+++ b/src/devices/machine/rstbuf.h
@@ -0,0 +1,111 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/**********************************************************************
+
+ RST interrupt vector buffer
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef MAME_DEVICES_MACHINE_RSTBUF_H
+#define MAME_DEVICES_MACHINE_RSTBUF_H
+
+//**************************************************************************
+// CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_RST_BUFFER_INT_CALLBACK(_devcb) \
+ devcb = &rst_buffer_device::set_int_callback(*device, DEVCB_##_devcb);
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> rst_buffer_device
+
+class rst_buffer_device : public device_t
+{
+public:
+ // static configuration
+ template<class Object>
+ static devcb_base &set_int_callback(device_t &device, Object &&object)
+ {
+ return downcast<rst_buffer_device &>(device).m_int_cb.set_callback(std::forward<Object>(object));
+ }
+
+ // getter (required override)
+ virtual u8 get_vector() const = 0;
+
+ // INTA handler
+ IRQ_CALLBACK_MEMBER(inta_cb);
+
+protected:
+ // device base class constructor
+ rst_buffer_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
+
+ // device-level overrides
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+
+ // synchronization helpers
+ void sync_input(bool state, u8 mask);
+ TIMER_CALLBACK_MEMBER(sync_set_input);
+ TIMER_CALLBACK_MEMBER(sync_clear_input);
+
+ // interrupt output callback
+ devcb_write_line m_int_cb;
+
+ // input state (D3-D5 of interrupt vector)
+ u8 m_input_buffer;
+};
+
+// ======================> rst_pos_buffer_device
+
+class rst_pos_buffer_device : public rst_buffer_device
+{
+public:
+ // device constructor
+ rst_pos_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ // set RST 1/RST 08H request line (modifies bit 3 of vector)
+ DECLARE_WRITE_LINE_MEMBER(rst1_w) { sync_input(state, 0x08); }
+
+ // set RST 2/RST 10H request line (modifies bit 4 of vector)
+ DECLARE_WRITE_LINE_MEMBER(rst2_w) { sync_input(state, 0x10); }
+
+ // set RST 3/RST 20H request line (modifies bit 5 of vector)
+ DECLARE_WRITE_LINE_MEMBER(rst4_w) { sync_input(state, 0x20); }
+
+protected:
+ // getter (required override)
+ virtual u8 get_vector() const override { return 0xc7 | m_input_buffer; }
+};
+
+// ======================> rst_neg_buffer_device
+
+class rst_neg_buffer_device : public rst_buffer_device
+{
+public:
+ // device constructor
+ rst_neg_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ // set RST 30H request line (modifies bit 3 of vector)
+ DECLARE_WRITE_LINE_MEMBER(rst30_w) { sync_input(state, 0x08); }
+
+ // set RST 28H request line (modifies bit 4 of vector)
+ DECLARE_WRITE_LINE_MEMBER(rst28_w) { sync_input(state, 0x10); }
+
+ // set RST 18H request line (modifies bit 5 of vector)
+ DECLARE_WRITE_LINE_MEMBER(rst18_w) { sync_input(state, 0x20); }
+
+protected:
+ // getter (required override)
+ virtual u8 get_vector() const override { return 0xff ^ m_input_buffer; }
+};
+
+// device type definitions
+DECLARE_DEVICE_TYPE(RST_POS_BUFFER, rst_pos_buffer_device)
+DECLARE_DEVICE_TYPE(RST_NEG_BUFFER, rst_neg_buffer_device)
+
+#endif // MAME_DEVICES_MACHINE_RSTBUF_H
diff --git a/src/devices/sound/2203intf.cpp b/src/devices/sound/2203intf.cpp
index 3307e8b798d..8b415d08b5d 100644
--- a/src/devices/sound/2203intf.cpp
+++ b/src/devices/sound/2203intf.cpp
@@ -15,8 +15,7 @@ const ssg_callbacks ym2203_device::psgintf =
/* IRQ Handler */
void ym2203_device::irq_handler(int irq)
{
- if (!m_irq_handler.isnull())
- m_irq_handler(irq);
+ m_timer[2]->adjust(attotime::zero, irq);
}
/* Timer overflow callback from timer.c */
@@ -24,13 +23,18 @@ void ym2203_device::device_timer(emu_timer &timer, device_timer_id id, int param
{
switch(id)
{
- case 0:
+ case TIMER_A:
ym2203_timer_over(m_chip,0);
break;
- case 1:
+ case TIMER_B:
ym2203_timer_over(m_chip,1);
break;
+
+ case TIMER_IRQ_SYNC:
+ if (!m_irq_handler.isnull())
+ m_irq_handler(param);
+ break;
}
}
@@ -77,8 +81,9 @@ void ym2203_device::device_start()
m_irq_handler.resolve();
/* Timer Handler set */
- m_timer[0] = timer_alloc(0);
- m_timer[1] = timer_alloc(1);
+ m_timer[0] = timer_alloc(TIMER_A);
+ m_timer[1] = timer_alloc(TIMER_B);
+ m_timer[2] = timer_alloc(TIMER_IRQ_SYNC);
/* stream system initialize */
calculate_rates();
diff --git a/src/devices/sound/2203intf.h b/src/devices/sound/2203intf.h
index af1a2f622a9..d06de139d8b 100644
--- a/src/devices/sound/2203intf.h
+++ b/src/devices/sound/2203intf.h
@@ -45,6 +45,13 @@ protected:
void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
private:
+ enum
+ {
+ TIMER_A,
+ TIMER_B,
+ TIMER_IRQ_SYNC
+ };
+
void irq_handler(int irq);
void timer_handler(int c, int count, int clock);
void update_request() { m_stream->update(); }
@@ -56,7 +63,7 @@ private:
// internal state
sound_stream * m_stream;
- emu_timer * m_timer[2];
+ emu_timer * m_timer[3];
void * m_chip;
devcb_write_line m_irq_handler;
diff --git a/src/mame/audio/m72.cpp b/src/mame/audio/m72.cpp
index ba5f99bd90f..428bf1de639 100644
--- a/src/mame/audio/m72.cpp
+++ b/src/mame/audio/m72.cpp
@@ -52,12 +52,10 @@ DEFINE_DEVICE_TYPE(IREM_M72_AUDIO, m72_audio_device, "m72_audio", "Irem M72 Audi
m72_audio_device::m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, IREM_M72_AUDIO, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , m_irqvector(0)
, m_sample_addr(0)
, m_samples(*this, "^samples")
, m_samples_size(0)
, m_dac(*this, "^dac")
- , m_soundlatch(*this, "^soundlatch")
{
}
@@ -68,74 +66,10 @@ m72_audio_device::m72_audio_device(const machine_config &mconfig, const char *ta
void m72_audio_device::device_start()
{
m_samples_size = m_samples.bytes();
- m_space = &machine().device("soundcpu")->memory().space(AS_IO);
- save_item(NAME(m_irqvector));
save_item(NAME(m_sample_addr));
}
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void m72_audio_device::device_reset()
-{
- m_irqvector = 0xff;
-}
-
-
-/*
-
- The sound CPU runs in interrup mode 0. IRQ is shared by two sources: the
- YM2151 (bit 4 of the vector), and the main CPU (bit 5).
- Since the vector can be changed from different contexts (the YM2151 timer
- callback, the main CPU context, and the sound CPU context), it's important
- to accurately arbitrate the changes to avoid out-of-order execution. We do
- that by handling all vector changes in a single timer callback.
-
-*/
-
-TIMER_CALLBACK_MEMBER( m72_audio_device::setvector_callback )
-{
- switch(param)
- {
- case YM2151_ASSERT:
- m_irqvector &= 0xef;
- break;
-
- case YM2151_CLEAR:
- m_irqvector |= 0x10;
- break;
-
- case Z80_ASSERT:
- m_irqvector &= 0xdf;
- break;
-
- case Z80_CLEAR:
- m_irqvector |= 0x20;
- break;
- }
-
- machine().device("soundcpu")->execute().set_input_line_and_vector(0, (m_irqvector == 0xff) ? CLEAR_LINE : ASSERT_LINE, m_irqvector);
-}
-
-
-WRITE_LINE_MEMBER(m72_audio_device::ym2151_irq_handler)
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(m72_audio_device::setvector_callback), this), state ? YM2151_ASSERT : YM2151_CLEAR);
-}
-
-WRITE8_MEMBER( m72_audio_device::sound_command_w )
-{
- m_soundlatch->write(*m_space, offset, data);
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(m72_audio_device::setvector_callback), this), Z80_ASSERT);
-}
-
-WRITE8_MEMBER( m72_audio_device::sound_irq_ack_w )
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(m72_audio_device::setvector_callback), this), Z80_CLEAR);
-}
-
void m72_audio_device::set_sample_start(int start)
diff --git a/src/mame/audio/m72.h b/src/mame/audio/m72.h
index b091391d8cf..131a2bf3cf1 100644
--- a/src/mame/audio/m72.h
+++ b/src/mame/audio/m72.h
@@ -10,7 +10,6 @@
#pragma once
-#include "machine/gen_latch.h"
#include "sound/dac.h"
class m72_audio_device : public device_t, public device_sound_interface
@@ -19,17 +18,6 @@ public:
m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~m72_audio_device() {}
- enum
- {
- YM2151_ASSERT,
- YM2151_CLEAR,
- Z80_ASSERT,
- Z80_CLEAR
- };
-
- WRITE_LINE_MEMBER(ym2151_irq_handler);
- DECLARE_WRITE8_MEMBER(sound_command_w);
- DECLARE_WRITE8_MEMBER(sound_irq_ack_w);
DECLARE_READ8_MEMBER(sample_r);
DECLARE_WRITE8_MEMBER(sample_w);
@@ -43,22 +31,16 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_reset() override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
private:
// internal state
- uint8_t m_irqvector;
uint32_t m_sample_addr;
optional_region_ptr<uint8_t> m_samples;
uint32_t m_samples_size;
- address_space *m_space;
optional_device<dac_byte_interface> m_dac;
- required_device<generic_latch_8_device> m_soundlatch;
-
- TIMER_CALLBACK_MEMBER( setvector_callback );
};
DECLARE_DEVICE_TYPE(IREM_M72_AUDIO, m72_audio_device)
diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp
index 9c3b4a5ff97..2daf04e9e75 100644
--- a/src/mame/drivers/ddenlovr.cpp
+++ b/src/mame/drivers/ddenlovr.cpp
@@ -4353,7 +4353,7 @@ MACHINE_CONFIG_START(ddenlovr_state::htengoku)
MCFG_CPU_PROGRAM_MAP(htengoku_mem_map)
MCFG_CPU_IO_MAP(htengoku_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", ddenlovr_state, sprtmtch_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
- MCFG_CPU_PERIODIC_INT_DRIVER(ddenlovr_state, yarunara_clock_interrupt, 60) // RTC
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_DEVICE_ADD("bankdev", ADDRESS_MAP_BANK, 0)
MCFG_DEVICE_PROGRAM_MAP(htengoku_banked_map)
@@ -4366,6 +4366,9 @@ MACHINE_CONFIG_START(ddenlovr_state::htengoku)
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0)
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(dynax_state, flipscreen_w))
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(dynax_state, layer_half_w)) // half of the interleaved layer to write to
@@ -4399,6 +4402,7 @@ MACHINE_CONFIG_START(ddenlovr_state::htengoku)
/* devices */
MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768))
+ MCFG_MSM6242_OUT_INT_HANDLER(DEVWRITELINE("mainirq", rst_pos_buffer_device, rst1_w))
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp
index c4bc96cc585..ede6a78500b 100644
--- a/src/mame/drivers/dynax.cpp
+++ b/src/mame/drivers/dynax.cpp
@@ -112,37 +112,27 @@ TODO:
/* It runs in IM 0, thus needs an opcode on the data bus */
void dynax_state::sprtmtch_update_irq()
{
- int irq = (m_sound_irq ? 0x08 : 0) | ((m_vblank_irq) ? 0x10 : 0) | ((m_blitter_irq && m_blitter_irq_mask) ? 0x20 : 0) ;
- m_maincpu->set_input_line_and_vector(0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */
+ m_mainirq->rst4_w(m_blitter_irq && m_blitter_irq_mask);
}
WRITE8_MEMBER(dynax_state::dynax_vblank_ack_w)
{
- m_vblank_irq = 0;
- sprtmtch_update_irq();
+ m_mainirq->rst2_w(0);
}
WRITE_LINE_MEMBER(dynax_state::blitter_ack_w)
{
m_blitter_irq_mask = state;
-
- // this must be acknowledged somewhere else
if (!m_blitter_irq_mask)
+ {
m_blitter_irq = 0;
-
- sprtmtch_update_irq();
+ m_mainirq->rst4_w(0);
+ }
}
INTERRUPT_GEN_MEMBER(dynax_state::sprtmtch_vblank_interrupt)
{
- m_vblank_irq = 1;
- sprtmtch_update_irq();
-}
-
-WRITE_LINE_MEMBER(dynax_state::sprtmtch_sound_callback)
-{
- m_sound_irq = state;
- sprtmtch_update_irq();
+ m_mainirq->rst2_w(1);
}
@@ -153,42 +143,38 @@ WRITE_LINE_MEMBER(dynax_state::sprtmtch_sound_callback)
/* It runs in IM 0, thus needs an opcode on the data bus */
void dynax_state::jantouki_update_irq()
{
- int irq = ((m_blitter_irq && m_blitter_irq_mask) ? 0x08 : 0) | ((m_blitter2_irq && m_blitter2_irq_mask) ? 0x10 : 0) | ((m_vblank_irq) ? 0x20 : 0) ;
- m_maincpu->set_input_line_and_vector(0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */
+ m_mainirq->rst1_w(m_blitter_irq && m_blitter_irq_mask);
+ m_mainirq->rst2_w(m_blitter2_irq && m_blitter2_irq_mask);
}
WRITE8_MEMBER(dynax_state::jantouki_vblank_ack_w)
{
- m_vblank_irq = 0;
- jantouki_update_irq();
+ m_mainirq->rst4_w(0);
}
WRITE_LINE_MEMBER(dynax_state::jantouki_blitter_ack_w)
{
m_blitter_irq_mask = state;
-
- // this must be acknowledged somewhere else
if (!m_blitter_irq_mask)
+ {
m_blitter_irq = 0;
-
- jantouki_update_irq();
+ m_mainirq->rst1_w(0);
+ }
}
WRITE_LINE_MEMBER(dynax_state::jantouki_blitter2_ack_w)
{
m_blitter2_irq_mask = state;
-
- // this must be acknowledged somewhere else
if (!m_blitter2_irq_mask)
+ {
m_blitter2_irq = 0;
-
- jantouki_update_irq();
+ m_mainirq->rst2_w(0);
+ }
}
INTERRUPT_GEN_MEMBER(dynax_state::jantouki_vblank_interrupt)
{
- m_vblank_irq = 1;
- jantouki_update_irq();
+ m_mainirq->rst4_w(1);
}
@@ -196,28 +182,14 @@ INTERRUPT_GEN_MEMBER(dynax_state::jantouki_vblank_interrupt)
Jantouki - Sound CPU
***************************************************************************/
-void dynax_state::jantouki_sound_update_irq()
-{
- int irq = ((m_sound_irq) ? 0x08 : 0) | ((m_soundlatch_irq) ? 0x10 : 0) | ((m_sound_vblank_irq) ? 0x20 : 0) ;
- m_soundcpu->set_input_line_and_vector(0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */
-}
-
INTERRUPT_GEN_MEMBER(dynax_state::jantouki_sound_vblank_interrupt)
{
- m_sound_vblank_irq = 1;
- jantouki_sound_update_irq();
+ m_soundirq->rst4_w(1);
}
WRITE8_MEMBER(dynax_state::jantouki_sound_vblank_ack_w)
{
- m_sound_vblank_irq = 0;
- jantouki_sound_update_irq();
-}
-
-WRITE_LINE_MEMBER(dynax_state::jantouki_sound_callback)
-{
- m_sound_irq = state;
- jantouki_sound_update_irq();
+ m_soundirq->rst4_w(0);
}
@@ -879,16 +851,8 @@ ADDRESS_MAP_END
READ8_MEMBER(dynax_state::jantouki_soundlatch_ack_r)
{
- return (m_soundlatch_ack) ? 0x80 : 0;
-}
-
-WRITE8_MEMBER(dynax_state::jantouki_soundlatch_w)
-{
- m_soundlatch_ack = 1;
- m_soundlatch_full = 1;
- m_soundlatch_irq = 1;
- m_latch = data;
- jantouki_sound_update_irq();
+ machine().scheduler().synchronize();
+ return m_soundlatch->pending_r() ? 0x80 : 0;
}
READ8_MEMBER(dynax_state::jantouki_blitter_busy_r)
@@ -906,7 +870,7 @@ ADDRESS_MAP_START(dynax_state::jantouki_io_map)
ADDRESS_MAP_GLOBAL_MASK(0xff)
// AM_RANGE( 0x40, 0x41 ) AM_WRITENOP // CRT Controller
AM_RANGE( 0x48, 0x48 ) AM_WRITE(jantouki_rombank_w) // BANK ROM Select
- AM_RANGE( 0x49, 0x49 ) AM_WRITE(jantouki_soundlatch_w) // To Sound CPU
+ AM_RANGE( 0x49, 0x49 ) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) // To Sound CPU
AM_RANGE( 0x4a, 0x4a ) AM_READ(jantouki_soundlatch_ack_r) // Soundlatch status
AM_RANGE( 0x4b, 0x4b ) AM_WRITE(dynax_blit2_dest_w) // Destination Layer 2
AM_RANGE( 0x4d, 0x4d ) AM_WRITE(dynax_blit_dest_w) // Destination Layer
@@ -935,22 +899,9 @@ ADDRESS_MAP_END
Jantouki - Sound CPU
***************************************************************************/
-WRITE8_MEMBER(dynax_state::jantouki_soundlatch_ack_w)
-{
- m_soundlatch_ack = data;
- m_soundlatch_irq = 0;
- jantouki_sound_update_irq();
-}
-
-READ8_MEMBER(dynax_state::jantouki_soundlatch_r)
-{
- m_soundlatch_full = 0;
- return m_latch;
-}
-
READ8_MEMBER(dynax_state::jantouki_soundlatch_status_r)
{
- return (m_soundlatch_full) ? 0 : 0x80;
+ return m_soundlatch->pending_r() ? 0 : 0x80;
}
ADDRESS_MAP_START(dynax_state::jantouki_sound_io_map)
@@ -963,8 +914,8 @@ ADDRESS_MAP_START(dynax_state::jantouki_sound_io_map)
AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset
AM_RANGE( 0x40, 0x40 ) AM_WRITE(adpcm_data_w) // MSM5205 data
AM_RANGE( 0x50, 0x50 ) AM_READ(jantouki_soundlatch_status_r) // Soundlatch status
- AM_RANGE( 0x60, 0x60 ) AM_WRITE(jantouki_soundlatch_ack_w) // Soundlatch status
- AM_RANGE( 0x70, 0x70 ) AM_READ(jantouki_soundlatch_r) // From Main CPU
+ AM_RANGE( 0x60, 0x60 ) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
+ AM_RANGE( 0x70, 0x70 ) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU
ADDRESS_MAP_END
@@ -4094,14 +4045,10 @@ MACHINE_START_MEMBER(dynax_state,dynax)
m_blitter_irq_mask = 1;
m_blitter2_irq_mask = 1;
- save_item(NAME(m_sound_irq));
- save_item(NAME(m_vblank_irq));
save_item(NAME(m_blitter_irq));
save_item(NAME(m_blitter_irq_mask));
save_item(NAME(m_blitter2_irq));
save_item(NAME(m_blitter2_irq_mask));
- save_item(NAME(m_soundlatch_irq));
- save_item(NAME(m_sound_vblank_irq));
save_item(NAME(m_input_sel));
save_item(NAME(m_dsw_sel));
@@ -4113,10 +4060,6 @@ MACHINE_START_MEMBER(dynax_state,dynax)
save_item(NAME(m_resetkludge));
save_item(NAME(m_toggle));
save_item(NAME(m_toggle_cpu1));
- save_item(NAME(m_yarunara_clk_toggle));
- save_item(NAME(m_soundlatch_ack));
- save_item(NAME(m_soundlatch_full));
- save_item(NAME(m_latch));
save_item(NAME(m_rombank));
save_item(NAME(m_tenkai_p5_val));
save_item(NAME(m_tenkai_6c));
@@ -4130,12 +4073,8 @@ MACHINE_RESET_MEMBER(dynax_state,dynax)
if (m_msm != nullptr)
MACHINE_RESET_CALL_MEMBER(adpcm);
- m_sound_irq = 0;
- m_vblank_irq = 0;
m_blitter_irq = 0;
m_blitter2_irq = 0;
- m_soundlatch_irq = 0;
- m_sound_vblank_irq = 0;
m_input_sel = 0;
m_dsw_sel = 0;
@@ -4147,10 +4086,6 @@ MACHINE_RESET_MEMBER(dynax_state,dynax)
m_resetkludge = 0;
m_toggle = 0;
m_toggle_cpu1 = 0;
- m_yarunara_clk_toggle = 0;
- m_soundlatch_ack = 0;
- m_soundlatch_full = 0;
- m_latch = 0;
m_rombank = 0;
m_tenkai_p5_val = 0;
m_tenkai_6c = 0;
@@ -4188,15 +4123,19 @@ MACHINE_CONFIG_START(dynax_state::cdracula)
MCFG_CPU_PROGRAM_MAP(cdracula_mem_map)
MCFG_CPU_IO_MAP(cdracula_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dynax_state, sprtmtch_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_MACHINE_START_OVERRIDE(dynax_state,dynax)
MCFG_MACHINE_RESET_OVERRIDE(dynax_state,dynax)
// MCFG_NVRAM_ADD_0FILL("nvram") // no battery
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0)
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(dynax_state, flipscreen_w)) // Flip Screen
- MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(dynax_state, jantouki_blitter_ack_w)) // Blitter IRQ Ack
+ MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(dynax_state, blitter_ack_w)) // Blitter IRQ Ack
MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(dynax_state, blit_palbank_w)) // Layers Palettes (High Bit)
/* video hardware */
@@ -4232,12 +4171,16 @@ MACHINE_CONFIG_START(dynax_state::hanamai)
MCFG_CPU_PROGRAM_MAP(sprtmtch_mem_map)
MCFG_CPU_IO_MAP(hanamai_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dynax_state, sprtmtch_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_MACHINE_START_OVERRIDE(dynax_state,hanamai)
MCFG_MACHINE_RESET_OVERRIDE(dynax_state,dynax)
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0)
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(DEVWRITELINE("msm", msm5205_device, reset_w)) MCFG_DEVCB_INVERT // MSM5205 reset
MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(dynax_state, adpcm_reset_kludge_w))
@@ -4269,7 +4212,7 @@ MACHINE_CONFIG_START(dynax_state::hanamai)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
+ MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("mainirq", rst_pos_buffer_device, rst1_w))
MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW0"))
MCFG_SOUND_ROUTE(0, "mono", 0.20)
@@ -4296,6 +4239,7 @@ MACHINE_CONFIG_START(dynax_state::hnoridur)
MCFG_CPU_PROGRAM_MAP(hnoridur_mem_map)
MCFG_CPU_IO_MAP(hnoridur_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dynax_state, sprtmtch_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_MACHINE_START_OVERRIDE(dynax_state,dynax)
MCFG_MACHINE_RESET_OVERRIDE(dynax_state,dynax)
@@ -4308,6 +4252,9 @@ MACHINE_CONFIG_START(dynax_state::hnoridur)
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0) // IC25
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(dynax_state, flipscreen_w))
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(dynax_state, layer_half_w))
@@ -4359,6 +4306,7 @@ MACHINE_CONFIG_START(dynax_state::hjingi)
MCFG_CPU_PROGRAM_MAP(hjingi_mem_map)
MCFG_CPU_IO_MAP(hjingi_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dynax_state, sprtmtch_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_MACHINE_START_OVERRIDE(dynax_state,hjingi)
MCFG_MACHINE_RESET_OVERRIDE(dynax_state,dynax)
@@ -4371,6 +4319,9 @@ MACHINE_CONFIG_START(dynax_state::hjingi)
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0)
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(dynax_state, flipscreen_w))
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(dynax_state, layer_half_w))
@@ -4424,12 +4375,16 @@ MACHINE_CONFIG_START(dynax_state::sprtmtch)
MCFG_CPU_PROGRAM_MAP(sprtmtch_mem_map)
MCFG_CPU_IO_MAP(sprtmtch_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dynax_state, sprtmtch_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_MACHINE_START_OVERRIDE(dynax_state,hanamai)
MCFG_MACHINE_RESET_OVERRIDE(dynax_state,dynax)
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0) // UF12 on Intergirl
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(dynax_state, flipscreen_w))
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(dynax_state, coincounter_0_w))
@@ -4455,7 +4410,7 @@ MACHINE_CONFIG_START(dynax_state::sprtmtch)
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
+ MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("mainirq", rst_pos_buffer_device, rst1_w))
MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1"))
MCFG_SOUND_ROUTE(0, "mono", 0.20)
@@ -4531,22 +4486,6 @@ MACHINE_CONFIG_END
Yarunara / Quiz TV Q&Q / Mahjong Angels
***************************************************************************/
-/* the old code here didn't work..
- what was it trying to do?
- set an irq and clear it before its even taken? */
-
-INTERRUPT_GEN_MEMBER(dynax_state::yarunara_clock_interrupt)
-{
- m_yarunara_clk_toggle ^= 1;
-
- if (m_yarunara_clk_toggle == 1)
- m_sound_irq = 0;
- else
- m_sound_irq = 1;
-
- sprtmtch_update_irq();
-}
-
MACHINE_CONFIG_START(dynax_state::yarunara)
hnoridur(config);
@@ -4554,7 +4493,6 @@ MACHINE_CONFIG_START(dynax_state::yarunara)
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(yarunara_mem_map)
MCFG_CPU_IO_MAP(yarunara_io_map)
- MCFG_CPU_PERIODIC_INT_DRIVER(dynax_state, yarunara_clock_interrupt, 60) // RTC
MCFG_DEVICE_MODIFY("bankdev")
MCFG_DEVICE_PROGRAM_MAP(yarunara_banked_map)
@@ -4568,6 +4506,7 @@ MACHINE_CONFIG_START(dynax_state::yarunara)
/* devices */
MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768))
+ MCFG_MSM6242_OUT_INT_HANDLER(DEVWRITELINE("mainirq", rst_pos_buffer_device, rst1_w))
MACHINE_CONFIG_END
MACHINE_CONFIG_START(dynax_state::mjangels)
@@ -4640,17 +4579,25 @@ MACHINE_CONFIG_START(dynax_state::jantouki)
MCFG_CPU_PROGRAM_MAP(jantouki_mem_map)
MCFG_CPU_IO_MAP(jantouki_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("top", dynax_state, jantouki_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mainirq", rst_pos_buffer_device, inta_cb)
MCFG_CPU_ADD("soundcpu",Z80,22000000 / 4) /* 5.5MHz */
MCFG_CPU_PROGRAM_MAP(jantouki_sound_mem_map)
MCFG_CPU_IO_MAP(jantouki_sound_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("top", dynax_state, jantouki_sound_vblank_interrupt) /* IM 0 needs an opcode on the data bus */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("soundirq", rst_pos_buffer_device, inta_cb)
MCFG_MACHINE_START_OVERRIDE(dynax_state,jantouki)
MCFG_MACHINE_RESET_OVERRIDE(dynax_state,dynax)
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0))
+
+ MCFG_DEVICE_ADD("soundirq", RST_POS_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
+
MCFG_DEVICE_ADD("mainlatch", LS259, 0)
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(dynax_state, coincounter_0_w)) // Coin Counter
MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(dynax_state, blit2_palbank_w)) // Layers Palettes (High Bit)
@@ -4658,6 +4605,10 @@ MACHINE_CONFIG_START(dynax_state::jantouki)
MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(dynax_state, jantouki_blitter_ack_w)) // Blitter IRQ Ack
MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(dynax_state, jantouki_blitter2_ack_w)) // Blitter 2 IRQ Ack
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_pos_buffer_device, rst2_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
/* video hardware */
MCFG_PALETTE_ADD("palette", 512)
MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
@@ -4688,7 +4639,7 @@ MACHINE_CONFIG_START(dynax_state::jantouki)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, jantouki_sound_callback))
+ MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_pos_buffer_device, rst1_w))
MCFG_SOUND_ROUTE(0, "mono", 0.20)
MCFG_SOUND_ROUTE(1, "mono", 0.20)
MCFG_SOUND_ROUTE(2, "mono", 0.20)
@@ -4742,6 +4693,8 @@ MACHINE_CONFIG_START(dynax_state::mjelctrn)
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(dynax_state, layer_half2_w))
// Q3, Q4 seem to be related to wrap around enable
+ MCFG_DEVICE_REMOVE("mainirq")
+
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VBLANK_CALLBACK(DEVWRITELINE("maincpu", tmpz84c015_device, trg0)) MCFG_DEVCB_INVERT
diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp
index 72b8928d0fd..4e6ac675034 100644
--- a/src/mame/drivers/kurukuru.cpp
+++ b/src/mame/drivers/kurukuru.cpp
@@ -386,6 +386,7 @@
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "machine/nvram.h"
+#include "machine/rstbuf.h"
#include "machine/ticket.h"
#include "sound/ay8910.h"
#include "sound/msm5205.h"
@@ -404,6 +405,7 @@ public:
m_audiocpu(*this, "audiocpu"),
m_v9938(*this, "v9938"),
m_adpcm(*this, "adpcm"),
+ m_soundirq(*this, "soundirq"),
m_hopper(*this, "hopper"),
m_bank1(*this, "bank1")
{ }
@@ -412,22 +414,20 @@ public:
required_device<cpu_device> m_audiocpu;
required_device<v9938_device> m_v9938;
required_device<msm5205_device> m_adpcm;
+ required_device<rst_neg_buffer_device> m_soundirq;
required_device<ticket_dispenser_device> m_hopper;
required_memory_bank m_bank1;
- uint8_t m_sound_irq_cause;
uint8_t m_adpcm_data;
DECLARE_WRITE8_MEMBER(kurukuru_out_latch_w);
DECLARE_WRITE8_MEMBER(kurukuru_bankswitch_w);
- DECLARE_WRITE_LINE_MEMBER(soundlatch_irq_w);
DECLARE_WRITE8_MEMBER(kurukuru_adpcm_reset_w);
DECLARE_READ8_MEMBER(kurukuru_adpcm_timer_irqack_r);
DECLARE_WRITE8_MEMBER(kurukuru_adpcm_data_w);
DECLARE_WRITE8_MEMBER(ym2149_aout_w);
DECLARE_WRITE8_MEMBER(ym2149_bout_w);
- void update_sound_irq(uint8_t cause);
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_WRITE_LINE_MEMBER(kurukuru_msm5205_vck);
@@ -457,37 +457,9 @@ public:
*************************************************/
-void kurukuru_state::update_sound_irq(uint8_t cause)
-{
- m_sound_irq_cause = cause & 3;
- if (m_sound_irq_cause)
- {
- // use bit 0 for latch irq, and bit 1 for timer irq
- // latch irq vector is $ef (rst $28)
- // timer irq vector is $f7 (rst $30)
- // if both are asserted, the vector becomes $f7 AND $ef = $e7 (rst $20)
- const uint8_t irq_vector[4] = { 0x00, 0xef, 0xf7, 0xe7 };
- m_audiocpu->set_input_line_and_vector(0, ASSERT_LINE, irq_vector[m_sound_irq_cause]);
- }
- else
- {
- m_audiocpu->set_input_line(0, CLEAR_LINE);
- }
-}
-
-
-WRITE_LINE_MEMBER(kurukuru_state::soundlatch_irq_w)
-{
- if (state)
- update_sound_irq(m_sound_irq_cause | 1);
- else
- update_sound_irq(m_sound_irq_cause & ~1);
-}
-
-
WRITE_LINE_MEMBER(kurukuru_state::kurukuru_msm5205_vck)
{
- update_sound_irq(m_sound_irq_cause | 2);
+ m_soundirq->rst30_w(1);
m_adpcm->data_w(m_adpcm_data);
}
@@ -628,7 +600,8 @@ WRITE8_MEMBER(kurukuru_state::kurukuru_adpcm_reset_w)
READ8_MEMBER(kurukuru_state::kurukuru_adpcm_timer_irqack_r)
{
- update_sound_irq(m_sound_irq_cause & ~2);
+ if (!machine().side_effect_disabled())
+ m_soundirq->rst30_w(0);
return 0;
}
@@ -853,7 +826,6 @@ void kurukuru_state::machine_start()
void kurukuru_state::machine_reset()
{
- update_sound_irq(0);
}
/*************************************************
@@ -870,6 +842,7 @@ MACHINE_CONFIG_START(kurukuru_state::kurukuru)
MCFG_CPU_ADD("audiocpu", Z80, CPU_CLOCK)
MCFG_CPU_PROGRAM_MAP(kurukuru_audio_map)
MCFG_CPU_IO_MAP(kurukuru_audio_io)
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("soundirq", rst_neg_buffer_device, inta_cb)
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -884,7 +857,13 @@ MACHINE_CONFIG_START(kurukuru_state::kurukuru)
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
- MCFG_GENERIC_LATCH_DATA_PENDING_CB(WRITELINE(kurukuru_state, soundlatch_irq_w))
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
+
+ // latch irq vector is $ef (rst $28)
+ // timer irq vector is $f7 (rst $30)
+ // if both are asserted, the vector becomes $f7 AND $ef = $e7 (rst $20)
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("audiocpu", 0))
MCFG_SOUND_ADD("ym2149", YM2149, YM2149_CLOCK)
MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW2"))
@@ -900,40 +879,16 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(kurukuru_state::ppj)
+ kurukuru(config);
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu",Z80, CPU_CLOCK)
+ MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(ppj_map)
MCFG_CPU_IO_MAP(ppj_io)
- MCFG_CPU_ADD("audiocpu", Z80, CPU_CLOCK)
+ MCFG_CPU_MODIFY("audiocpu")
MCFG_CPU_PROGRAM_MAP(ppj_audio_map)
MCFG_CPU_IO_MAP(ppj_audio_io)
-
- MCFG_NVRAM_ADD_0FILL("nvram")
-
- /* video hardware */
- MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MAIN_CLOCK)
- MCFG_V99X8_INTERRUPT_CALLBACK(INPUTLINE("maincpu", 0))
- MCFG_V99X8_SCREEN_ADD_NTSC("screen", "v9938", MAIN_CLOCK)
-
- MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(HOPPER_PULSE), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH )
-
- /* sound hardware */
- MCFG_SPEAKER_STANDARD_MONO("mono")
-
- MCFG_GENERIC_LATCH_8_ADD("soundlatch")
-
- MCFG_SOUND_ADD("ym2149", YM2149, YM2149_CLOCK) // pin 26 (/SEL) is low so final clock is clk/2, handled inside the ym2149 core
- MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW2"))
- MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(kurukuru_state, ym2149_aout_w))
- MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(kurukuru_state, ym2149_bout_w))
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
-
- MCFG_SOUND_ADD("adpcm", MSM5205, M5205_CLOCK)
- MCFG_MSM5205_VCLK_CB(WRITELINE(kurukuru_state, kurukuru_msm5205_vck))
- MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) // changed on the fly
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/m72.cpp b/src/mame/drivers/m72.cpp
index f1c3cb2619e..4c122bbc944 100644
--- a/src/mame/drivers/m72.cpp
+++ b/src/mame/drivers/m72.cpp
@@ -192,7 +192,9 @@ other supported games as well.
#include "cpu/nec/nec.h"
#include "cpu/nec/v25.h"
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
#include "machine/irem_cpu.h"
+#include "machine/rstbuf.h"
#include "sound/ym2151.h"
#include "sound/volt_reg.h"
#include "speaker.h"
@@ -982,7 +984,7 @@ ADDRESS_MAP_START(m72_state::m72_portmap)
AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0")
AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE8(port02_w, 0x00ff) /* coin counters, reset sound cpu, other stuff? */
AM_RANGE(0x04, 0x05) AM_WRITE(dmaon_w)
AM_RANGE(0x06, 0x07) AM_WRITE(irq_line_w)
@@ -998,7 +1000,7 @@ ADDRESS_MAP_START(m72_state::m84_portmap)
AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0")
AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE8(rtype2_port02_w, 0x00ff)
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
@@ -1011,7 +1013,7 @@ ADDRESS_MAP_START(m72_state::m84_v33_portmap)
AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0")
AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE8(rtype2_port02_w, 0x00ff)
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w)
@@ -1026,7 +1028,7 @@ ADDRESS_MAP_START(m72_state::poundfor_portmap)
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
AM_RANGE(0x08, 0x0f) AM_DEVREAD8("upd4701l", upd4701_device, read_xy, 0x00ff)
AM_RANGE(0x08, 0x0f) AM_DEVREAD8("upd4701h", upd4701_device, read_xy, 0xff00)
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE8(poundfor_port02_w, 0x00ff)
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
@@ -1039,7 +1041,7 @@ ADDRESS_MAP_START(m72_state::m82_portmap)
AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0")
AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE8(rtype2_port02_w, 0x00ff)
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8("upd71059c", pic8259_device, read, write, 0x00ff)
AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w)
@@ -1056,7 +1058,7 @@ ADDRESS_MAP_START(m72_state::m81_portmap)
AM_RANGE(0x00, 0x01) AM_READ_PORT("IN0")
AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x02, 0x03) AM_WRITE8(rtype2_port02_w, 0x00ff) /* coin counters, reset sound cpu, other stuff? */
AM_RANGE(0x04, 0x05) AM_WRITE(dmaon_w)
AM_RANGE(0x06, 0x07) AM_WRITE(irq_line_w)
@@ -1082,15 +1084,14 @@ ADDRESS_MAP_START(m72_state::rtype_sound_portmap)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x02, 0x02) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
- AM_RANGE(0x06, 0x06) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
- AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
ADDRESS_MAP_END
ADDRESS_MAP_START(m72_state::sound_portmap)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x02, 0x02) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
- AM_RANGE(0x06, 0x06) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_audio_device, sample_w)
AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r)
ADDRESS_MAP_END
@@ -1101,7 +1102,7 @@ ADDRESS_MAP_START(m72_state::rtype2_sound_portmap)
AM_RANGE(0x80, 0x80) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
AM_RANGE(0x80, 0x81) AM_DEVWRITE("m72", m72_audio_device, rtype2_sample_addr_w)
AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_audio_device, sample_w)
- AM_RANGE(0x83, 0x83) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
+ AM_RANGE(0x83, 0x83) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r)
// AM_RANGE(0x87, 0x87) AM_WRITENOP /* ??? */
ADDRESS_MAP_END
@@ -1110,8 +1111,7 @@ ADDRESS_MAP_START(m72_state::poundfor_sound_portmap)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x10, 0x13) AM_DEVWRITE("m72", m72_audio_device, poundfor_sample_addr_w)
AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
- AM_RANGE(0x42, 0x42) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
- AM_RANGE(0x42, 0x42) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
+ AM_RANGE(0x42, 0x42) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, acknowledge_w)
ADDRESS_MAP_END
ADDRESS_MAP_START(m72_state::mcu_io_map)
@@ -1844,11 +1844,19 @@ MACHINE_CONFIG_START(m72_state::m72_audio_chips)
MCFG_SPEAKER_STANDARD_MONO("speaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst18_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
+
+ MCFG_CPU_MODIFY("soundcpu")
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("soundirq", rst_neg_buffer_device, inta_cb)
MCFG_SOUND_ADD("m72", IREM_M72_AUDIO, 0)
MCFG_YM2151_ADD("ymsnd", SOUND_CLOCK)
- MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("m72", m72_audio_device, ym2151_irq_handler))
+ MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
MCFG_SOUND_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.2) // unknown DAC
@@ -1908,6 +1916,7 @@ MACHINE_CONFIG_START(m72_state::rtype)
MCFG_CPU_MODIFY("soundcpu")
MCFG_CPU_IO_MAP(rtype_sound_portmap)
+ MCFG_DEVICE_REMOVE("m72")
MCFG_DEVICE_REMOVE("dac")
MCFG_DEVICE_REMOVE("vref")
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/m90.cpp b/src/mame/drivers/m90.cpp
index f4263036e97..957fe192352 100644
--- a/src/mame/drivers/m90.cpp
+++ b/src/mame/drivers/m90.cpp
@@ -25,7 +25,9 @@
#include "cpu/nec/nec.h"
#include "cpu/nec/v25.h"
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
#include "machine/irem_cpu.h"
+#include "machine/rstbuf.h"
#include "sound/dac.h"
#include "sound/ym2151.h"
#include "sound/volt_reg.h"
@@ -95,7 +97,7 @@ ADDRESS_MAP_START(m90_state::bomblord_main_cpu_map)
ADDRESS_MAP_END
ADDRESS_MAP_START(m90_state::m90_main_cpu_io_map)
- AM_RANGE(0x00, 0x01) AM_DEVWRITE8("m72", m72_audio_device, sound_command_w, 0x00ff)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
AM_RANGE(0x00, 0x01) AM_READ_PORT("P1_P2")
AM_RANGE(0x02, 0x03) AM_WRITE(m90_coincounter_w)
AM_RANGE(0x02, 0x03) AM_READ_PORT("SYSTEM")
@@ -129,7 +131,7 @@ ADDRESS_MAP_START(m90_state::m90_sound_cpu_io_map)
AM_RANGE(0x80, 0x80) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
AM_RANGE(0x80, 0x81) AM_DEVWRITE("m72", m72_audio_device, rtype2_sample_addr_w)
AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_audio_device, sample_w)
- AM_RANGE(0x83, 0x83) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
+ AM_RANGE(0x83, 0x83) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r)
ADDRESS_MAP_END
@@ -144,8 +146,7 @@ ADDRESS_MAP_START(m90_state::m99_sound_cpu_io_map)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, poundfor_sample_addr_w)
AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
- AM_RANGE(0x42, 0x42) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
- AM_RANGE(0x42, 0x42) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
+ AM_RANGE(0x42, 0x42) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, acknowledge_w)
ADDRESS_MAP_END
/*****************************************************************************/
@@ -726,7 +727,7 @@ MACHINE_CONFIG_START(m90_state::m90)
MCFG_CPU_IO_MAP(m90_sound_cpu_io_map)
MCFG_CPU_PERIODIC_INT_DRIVER(m90_state, nmi_line_pulse, 128*60) /* clocked by V1? (Vigilante) */
/* IRQs are generated by main Z80 and YM2151 */
-
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("soundirq", rst_neg_buffer_device, inta_cb)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -745,11 +746,16 @@ MACHINE_CONFIG_START(m90_state::m90)
MCFG_SPEAKER_STANDARD_MONO("speaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst18_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ADD("m72", IREM_M72_AUDIO, 0)
MCFG_YM2151_ADD("ymsnd", XTAL(3'579'545)) /* verified on pcb */
- MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("m72", m72_audio_device, ym2151_irq_handler))
+ MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
MCFG_SOUND_ROUTE(0, "speaker", 0.15)
MCFG_SOUND_ROUTE(1, "speaker", 0.15)
@@ -842,6 +848,7 @@ MACHINE_CONFIG_START(m90_state::dynablsb)
MCFG_CPU_MODIFY("soundcpu")
MCFG_CPU_IO_MAP(dynablsb_sound_cpu_io_map)
MCFG_CPU_PERIODIC_INT_DRIVER(m90_state, irq0_line_hold, 64*60) /* half the sample rate of the original */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_REMOVE()
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_SIZE(320, 240)
@@ -851,9 +858,11 @@ MACHINE_CONFIG_START(m90_state::dynablsb)
MCFG_VIDEO_START_OVERRIDE(m90_state,dynablsb)
MCFG_DEVICE_REMOVE("m72")
+ MCFG_DEVICE_REMOVE("soundirq")
MCFG_DEVICE_MODIFY("soundlatch")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("soundcpu", INPUT_LINE_NMI))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(false)
MCFG_SOUND_MODIFY("ymsnd")
MCFG_YM2151_IRQ_HANDLER(NOOP) /* this bootleg polls the YM2151 instead of taking interrupts from it */
diff --git a/src/mame/drivers/shisen.cpp b/src/mame/drivers/shisen.cpp
index cfadf844f6c..ca0fc67b533 100644
--- a/src/mame/drivers/shisen.cpp
+++ b/src/mame/drivers/shisen.cpp
@@ -12,6 +12,8 @@ driver by Nicola Salmoria
#include "includes/shisen.h"
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
+#include "machine/rstbuf.h"
#include "sound/ym2151.h"
#include "sound/volt_reg.h"
#include "screen.h"
@@ -58,7 +60,7 @@ ADDRESS_MAP_END
ADDRESS_MAP_START(shisen_state::shisen_io_map)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(dsw1_r, coin_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("DSW2") AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("DSW2") AM_DEVWRITE("soundlatch", generic_latch_8_device, write)
AM_RANGE(0x02, 0x02) AM_READ_PORT("P1") AM_WRITE(bankswitch_w)
AM_RANGE(0x03, 0x03) AM_READ_PORT("P2")
AM_RANGE(0x04, 0x04) AM_READ_PORT("COIN")
@@ -75,7 +77,7 @@ ADDRESS_MAP_START(shisen_state::shisen_sound_io_map)
AM_RANGE(0x80, 0x80) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
AM_RANGE(0x80, 0x81) AM_DEVWRITE("m72", m72_audio_device, shisen_sample_addr_w)
AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_audio_device, sample_w)
- AM_RANGE(0x83, 0x83) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w)
+ AM_RANGE(0x83, 0x83) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r)
ADDRESS_MAP_END
@@ -220,6 +222,8 @@ MACHINE_CONFIG_START(shisen_state::shisen)
MCFG_CPU_IO_MAP(shisen_sound_io_map)
MCFG_CPU_PERIODIC_INT_DRIVER(shisen_state, nmi_line_pulse, 128*55) /* clocked by V1? (Vigilante) */
/* IRQs are generated by main Z80 and YM2151 */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("soundirq", rst_neg_buffer_device, inta_cb)
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(55)
@@ -237,11 +241,16 @@ MACHINE_CONFIG_START(shisen_state::shisen)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst18_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ADD("m72", IREM_M72_AUDIO, 0)
MCFG_YM2151_ADD("ymsnd", 3579545)
- MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("m72", m72_audio_device, ym2151_irq_handler))
+ MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.5)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.5)
diff --git a/src/mame/drivers/vigilant.cpp b/src/mame/drivers/vigilant.cpp
index d1c0ad5e0ff..2dea471ef4c 100644
--- a/src/mame/drivers/vigilant.cpp
+++ b/src/mame/drivers/vigilant.cpp
@@ -26,6 +26,8 @@ Bottom board - M75-B-A (all versions regardless of mask ROM/EPROM)
#include "includes/iremipt.h"
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
+#include "machine/rstbuf.h"
#include "sound/2203intf.h"
#include "sound/volt_reg.h"
#include "sound/ym2151.h"
@@ -83,7 +85,7 @@ ADDRESS_MAP_END
ADDRESS_MAP_START(vigilant_state::vigilant_io_map)
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_DEVWRITE("m72", m72_audio_device, sound_command_w) /* SD */
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_DEVWRITE("soundlatch", generic_latch_8_device, write) /* SD */
AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") AM_WRITE(vigilant_out2_w) /* OUT2 */
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2")
AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1")
@@ -109,7 +111,7 @@ ADDRESS_MAP_START(vigilant_state::kikcubic_io_map)
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN0")
AM_RANGE(0x03, 0x03) AM_READ_PORT("IN1")
AM_RANGE(0x04, 0x04) AM_READ_PORT("IN2") AM_WRITE(bank_select_w)
- AM_RANGE(0x06, 0x06) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE("soundlatch", generic_latch_8_device, write)
// AM_RANGE(0x07, 0x07) AM_WRITENOP /* ?? */
ADDRESS_MAP_END
@@ -123,7 +125,7 @@ ADDRESS_MAP_START(vigilant_state::sound_io_map)
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x80, 0x81) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_DEVWRITE("m72", m72_audio_device, vigilant_sample_addr_w) /* STL / STH */
AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_audio_device, sample_w) /* COUNT UP */
- AM_RANGE(0x83, 0x83) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w) /* IRQ clear */
+ AM_RANGE(0x83, 0x83) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w) /* IRQ clear */
AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r) /* S ROM C */
ADDRESS_MAP_END
@@ -134,7 +136,7 @@ ADDRESS_MAP_START(vigilant_state::buccanrs_sound_io_map)
AM_RANGE(0x80, 0x80) AM_DEVREAD("soundlatch", generic_latch_8_device, read) /* SDRE */
AM_RANGE(0x80, 0x81) AM_DEVWRITE("m72", m72_audio_device, vigilant_sample_addr_w) /* STL / STH */
AM_RANGE(0x82, 0x82) AM_DEVWRITE("m72", m72_audio_device, sample_w) /* COUNT UP */
- AM_RANGE(0x83, 0x83) AM_DEVWRITE("m72", m72_audio_device, sound_irq_ack_w) /* IRQ clear */
+ AM_RANGE(0x83, 0x83) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w) /* IRQ clear */
AM_RANGE(0x84, 0x84) AM_DEVREAD("m72", m72_audio_device, sample_r) /* S ROM C */
ADDRESS_MAP_END
@@ -501,11 +503,16 @@ MACHINE_CONFIG_START(vigilant_state::vigilant)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst18_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ADD("m72", IREM_M72_AUDIO, 0)
MCFG_YM2151_ADD("ymsnd", 3579645)
- MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("m72", m72_audio_device, ym2151_irq_handler))
+ MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.55)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.55)
@@ -544,11 +551,16 @@ MACHINE_CONFIG_START(vigilant_state::buccanrs)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ADD("m72", IREM_M72_AUDIO, 0)
MCFG_SOUND_ADD("ym1", YM2203, 18432000/6)
- MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("m72", m72_audio_device, ym2151_irq_handler))
+ MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst30_w))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.35)
MCFG_SOUND_ROUTE(0, "rspeaker", 0.35)
MCFG_SOUND_ROUTE(1, "lspeaker", 0.35)
@@ -586,6 +598,8 @@ MACHINE_CONFIG_START(vigilant_state::kikcubic)
MCFG_CPU_IO_MAP(sound_io_map)
MCFG_CPU_PERIODIC_INT_DRIVER(vigilant_state, nmi_line_pulse, 128*55) /* clocked by V1 */
/* IRQs are generated by main Z80 and YM2151 */
+ MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("soundirq", rst_neg_buffer_device, inta_cb)
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(55)
@@ -603,11 +617,16 @@ MACHINE_CONFIG_START(vigilant_state::kikcubic)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst28_w))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
+
+ MCFG_DEVICE_ADD("soundirq", RST_NEG_BUFFER, 0)
+ MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ADD("m72", IREM_M72_AUDIO, 0)
MCFG_YM2151_ADD("ymsnd", 3579645)
- MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("m72", m72_audio_device, ym2151_irq_handler))
+ MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("soundirq", rst_neg_buffer_device, rst30_w))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.55)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.55)
diff --git a/src/mame/includes/dynax.h b/src/mame/includes/dynax.h
index 8a63d13893c..f93f264415e 100644
--- a/src/mame/includes/dynax.h
+++ b/src/mame/includes/dynax.h
@@ -7,6 +7,8 @@
***************************************************************************/
#include "machine/bankdev.h"
+#include "machine/gen_latch.h"
+#include "machine/rstbuf.h"
#include "sound/msm5205.h"
#include "sound/okim6295.h"
#include "machine/74259.h"
@@ -25,6 +27,9 @@ public:
, m_palette(*this, "palette")
, m_bankdev(*this, "bankdev")
, m_mainlatch(*this, "mainlatch")
+ , m_mainirq(*this, "mainirq")
+ , m_soundirq(*this, "soundirq")
+ , m_soundlatch(*this, "soundlatch")
, m_gfx_region1(*this, "gfx1")
, m_gfx_region2(*this, "gfx2")
, m_gfx_region3(*this, "gfx3")
@@ -33,7 +38,6 @@ public:
, m_gfx_region6(*this, "gfx6")
, m_gfx_region7(*this, "gfx7")
, m_gfx_region8(*this, "gfx8")
-
{
}
@@ -46,6 +50,9 @@ public:
required_device<palette_device> m_palette;
optional_device<address_map_bank_device> m_bankdev;
optional_device<ls259_device> m_mainlatch;
+ optional_device<rst_pos_buffer_device> m_mainirq;
+ optional_device<rst_pos_buffer_device> m_soundirq;
+ optional_device<generic_latch_8_device> m_soundlatch;
optional_region_ptr<uint8_t> m_gfx_region1;
optional_region_ptr<uint8_t> m_gfx_region2;
optional_region_ptr<uint8_t> m_gfx_region3;
@@ -63,14 +70,10 @@ public:
/* irq */
typedef void (dynax_state::*irq_func)(); // some games trigger IRQ at blitter end, some don't
irq_func m_update_irq_func;
- bool m_sound_irq;
- bool m_vblank_irq;
bool m_blitter_irq;
bool m_blitter_irq_mask;
bool m_blitter2_irq;
bool m_blitter2_irq_mask;
- bool m_soundlatch_irq;
- bool m_sound_vblank_irq;
/* blitters */
int m_blit_scroll_x;
@@ -124,10 +127,6 @@ public:
int m_resetkludge;
int m_toggle;
int m_toggle_cpu1;
- int m_yarunara_clk_toggle;
- uint8_t m_soundlatch_ack;
- uint8_t m_soundlatch_full;
- uint8_t m_latch;
int m_rombank;
uint8_t m_tenkai_p5_val;
int m_tenkai_6c;
@@ -257,12 +256,9 @@ public:
INTERRUPT_GEN_MEMBER(sprtmtch_vblank_interrupt);
INTERRUPT_GEN_MEMBER(jantouki_vblank_interrupt);
INTERRUPT_GEN_MEMBER(jantouki_sound_vblank_interrupt);
- INTERRUPT_GEN_MEMBER(yarunara_clock_interrupt);
void tenkai_update_rombank();
- DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback);
- DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback);
DECLARE_WRITE_LINE_MEMBER(adpcm_int);
DECLARE_WRITE_LINE_MEMBER(adpcm_int_cpu1);
@@ -305,7 +301,6 @@ public:
void jantouki_update_irq();
void mjelctrn_update_irq();
void tenkai_update_irq();
- void jantouki_sound_update_irq();
void tenkai_show_6c();
void mjfriday(machine_config &config);
void yarunara(machine_config &config);
diff --git a/src/mame/includes/m90.h b/src/mame/includes/m90.h
index c46a614ecef..9b1fc428eb9 100644
--- a/src/mame/includes/m90.h
+++ b/src/mame/includes/m90.h
@@ -13,8 +13,7 @@ public:
m_soundcpu(*this, "soundcpu"),
m_audio(*this, "m72"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_palette(*this, "palette") { }
required_shared_ptr<uint16_t> m_video_data;
optional_shared_ptr<uint16_t> m_spriteram;
@@ -24,7 +23,6 @@ public:
optional_device<m72_audio_device> m_audio;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
- required_device<generic_latch_8_device> m_soundlatch;
uint16_t m_video_control_data[8];
tilemap_t *m_pf1_layer;