summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2020-08-28 04:28:01 +0900
committer GitHub <noreply@github.com>2020-08-27 15:28:01 -0400
commit314c80ea0ea9060777fee430005ebcf850a04a07 (patch)
tree5e1ce9369c75f78e5cbe1fb1966fffaa379693a4 /src/mame/audio
parent471781f99ae8242319beb474649dd4afefa5e3f7 (diff)
es5506.cpp: Updates [cam900]
* Correct Taito ES5505 Bankswitching behavior * Sample bank per ES5505 voice is actually taito_en.cpp specific * Move external bank behavior into taito_en.cpp, Add getter for voice index * Add precalculated ES5505 bank table for reduce performance issue, Add getter for CPU
Diffstat (limited to 'src/mame/audio')
-rw-r--r--src/mame/audio/taito_en.cpp49
-rw-r--r--src/mame/audio/taito_en.h14
2 files changed, 47 insertions, 16 deletions
diff --git a/src/mame/audio/taito_en.cpp b/src/mame/audio/taito_en.cpp
index 893daf22bae..daccefe8ae2 100644
--- a/src/mame/audio/taito_en.cpp
+++ b/src/mame/audio/taito_en.cpp
@@ -16,7 +16,6 @@
#include "emu.h"
#include "taito_en.h"
-#include "speaker.h"
#include <algorithm>
@@ -24,6 +23,7 @@ DEFINE_DEVICE_TYPE(TAITO_EN, taito_en_device, "taito_en", "Taito Ensoniq Sound S
taito_en_device::taito_en_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TAITO_EN, tag, owner, clock)
+ , device_mixer_interface(mconfig, *this, 2)
, m_audiocpu(*this, "audiocpu")
, m_ensoniq(*this, "ensoniq")
, m_esp(*this, "esp")
@@ -31,6 +31,8 @@ taito_en_device::taito_en_device(const machine_config &mconfig, const char *tag,
, m_duart68681(*this, "duart68681")
, m_mb87078(*this, "mb87078")
, m_osram(*this, "osram")
+ , m_otisbank(*this, "otisbank")
+ , m_otisrom(*this, "ensoniq")
, m_osrom(*this, "audiocpu")
, m_cpubank(*this, "cpubank%u", 1)
{
@@ -48,7 +50,14 @@ void taito_en_device::device_start()
for (int i = 0; i < 3; i++)
m_cpubank[i]->configure_entries(0, max, &ROM[0x100000], 0x20000);
- m_bankmask = (memregion(":ensoniq.0")->bytes()/0x200000)-1;
+ m_bankmask = ((m_otisrom.bytes()) / 0x200000) - 1;
+
+ // initialize precalculated ES5505 bank table
+ const size_t otisbank_size = m_otisbank.bytes() / 2;
+ m_calculated_otisbank = make_unique_clear<offs_t[]>(otisbank_size);
+
+ save_item(NAME(m_old_clock));
+ save_pointer(NAME(m_calculated_otisbank), otisbank_size);
}
@@ -77,8 +86,8 @@ void taito_en_device::device_reset()
void taito_en_device::en_es5505_bank_w(offs_t offset, uint16_t data)
{
/* mask out unused bits */
- data &= m_bankmask;
- m_ensoniq->voice_bank_w(offset,data<<20);
+ m_otisbank[offset] = data;
+ m_calculated_otisbank[offset] = (m_otisbank[offset] & m_bankmask) << 20;
}
void taito_en_device::en_volume_w(offs_t offset, uint8_t data)
@@ -100,7 +109,7 @@ void taito_en_device::en_sound_map(address_map &map)
map(0x200000, 0x20001f).rw("ensoniq", FUNC(es5505_device::read), FUNC(es5505_device::write));
map(0x260000, 0x2601ff).rw("esp", FUNC(es5510_device::host_r), FUNC(es5510_device::host_w)).umask16(0x00ff);
map(0x280000, 0x28001f).rw("duart68681", FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff);
- map(0x300000, 0x30003f).w(FUNC(taito_en_device::en_es5505_bank_w));
+ map(0x300000, 0x30003f).w(FUNC(taito_en_device::en_es5505_bank_w)).share("otisbank");
map(0x340000, 0x340003).w(FUNC(taito_en_device::en_volume_w)).umask16(0xff00);
map(0xc00000, 0xc1ffff).bankr("cpubank1");
map(0xc20000, 0xc3ffff).bankr("cpubank2");
@@ -116,6 +125,19 @@ void taito_en_device::fc7_map(address_map &map)
/*************************************
*
+ * ES5505 memory map
+ *
+ *************************************/
+
+void taito_en_device::en_otis_map(address_map &map)
+{
+ map(0x000000, 0x0fffff).lr16(
+ [this](offs_t offset) -> u16 { return m_otisrom[(m_calculated_otisbank[m_ensoniq->get_voice_index()] + offset) & m_otisrom.mask()]; }, "banked_otisrom");
+}
+
+
+/*************************************
+ *
* MB87078 callback
*
*************************************/
@@ -142,7 +164,11 @@ void taito_en_device::mb87078_gain_changed(offs_t offset, uint8_t data)
void taito_en_device::es5505_clock_changed(u32 data)
{
- m_pump->set_unscaled_clock(data);
+ if (m_old_clock != data)
+ {
+ m_pump->set_unscaled_clock(data);
+ m_old_clock = data;
+ }
}
@@ -209,18 +235,15 @@ void taito_en_device::device_add_mconfig(machine_config &config)
MB8421(config, "dpram", 0); // host accesses this from the other side
/* sound hardware */
- SPEAKER(config, "lspeaker").front_left();
- SPEAKER(config, "rspeaker").front_right();
-
ESQ_5505_5510_PUMP(config, m_pump, XTAL(30'476'180) / (2 * 16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, "lspeaker", 1.0);
- m_pump->add_route(1, "rspeaker", 1.0);
+ m_pump->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
+ m_pump->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
ES5505(config, m_ensoniq, XTAL(30'476'180) / 2);
m_ensoniq->sample_rate_changed().set(FUNC(taito_en_device::es5505_clock_changed));
- m_ensoniq->set_region0("ensoniq.0");
- m_ensoniq->set_region1("ensoniq.0");
+ m_ensoniq->set_addrmap(0, &taito_en_device::en_otis_map);
+ m_ensoniq->set_addrmap(1, &taito_en_device::en_otis_map);
m_ensoniq->set_channels(4);
m_ensoniq->add_route(0, "pump", 1.0, 0);
m_ensoniq->add_route(1, "pump", 1.0, 1);
diff --git a/src/mame/audio/taito_en.h b/src/mame/audio/taito_en.h
index d995228aec5..6d7aad2da3f 100644
--- a/src/mame/audio/taito_en.h
+++ b/src/mame/audio/taito_en.h
@@ -18,7 +18,7 @@
#include "machine/mb87078.h"
#include "machine/mb8421.h"
-class taito_en_device : public device_t
+class taito_en_device : public device_t, public device_mixer_interface
{
public:
@@ -26,6 +26,8 @@ public:
taito_en_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ m68000_device &audiocpu() { return *m_audiocpu; }
+
void set_bank(int bank, int entry) { m_cpubank[bank]->set_entry(entry); }
protected:
@@ -36,10 +38,11 @@ protected:
private:
void en_sound_map(address_map &map);
+ void en_otis_map(address_map &map);
void fc7_map(address_map &map);
// inherited devices/pointers
- required_device<cpu_device> m_audiocpu;
+ required_device<m68000_device> m_audiocpu;
required_device<es5505_device> m_ensoniq;
required_device<es5510_device> m_esp;
required_device<esq_5505_5510_pump_device> m_pump;
@@ -47,11 +50,16 @@ private:
required_device<mb87078_device> m_mb87078;
required_shared_ptr<uint16_t> m_osram;
+ required_shared_ptr<uint16_t> m_otisbank;
+ required_region_ptr<uint16_t> m_otisrom;
required_memory_region m_osrom;
required_memory_bank_array<3> m_cpubank;
- uint32_t m_bankmask;
+ uint32_t m_bankmask = 0;
+ uint32_t m_old_clock = ~0;
+
+ std::unique_ptr<offs_t[]> m_calculated_otisbank;
IRQ_CALLBACK_MEMBER(duart_iack);
void duart_output(uint8_t data);