diff options
Diffstat (limited to 'src/devices/sound')
74 files changed, 175 insertions, 131 deletions
diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp index e6f24c7fef0..1bc634d34c2 100644 --- a/src/devices/sound/2608intf.cpp +++ b/src/devices/sound/2608intf.cpp @@ -156,7 +156,7 @@ DEFINE_DEVICE_TYPE(YM2608, ym2608_device, "ym2608", "YM2608 OPNA") ym2608_device::ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ay8910_device(mconfig, YM2608, tag, owner, clock, PSG_TYPE_YM, 1, 2) - , device_rom_interface(mconfig, *this, 21) + , device_rom_interface(mconfig, *this) , m_stream(nullptr) , m_timer{ nullptr, nullptr } , m_chip(nullptr) diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h index b9b34f9cfd8..97e488805c4 100644 --- a/src/devices/sound/2608intf.h +++ b/src/devices/sound/2608intf.h @@ -5,6 +5,7 @@ #pragma once +#include "dirom.h" #include "ay8910.h" @@ -12,7 +13,7 @@ struct ssg_callbacks; class ym2608_device : public ay8910_device, - public device_rom_interface + public device_rom_interface<21> { public: ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp index af981b756be..3907daa4700 100644 --- a/src/devices/sound/8950intf.cpp +++ b/src/devices/sound/8950intf.cpp @@ -160,7 +160,7 @@ DEFINE_DEVICE_TYPE(Y8950, y8950_device, "y8950", "Y8950 MSX-Audio") y8950_device::y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, Y8950, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 21) + , device_rom_interface(mconfig, *this) , m_stream(nullptr) , m_timer{ nullptr, nullptr } , m_chip(nullptr) diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h index ac4584626e4..221c02bfb20 100644 --- a/src/devices/sound/8950intf.h +++ b/src/devices/sound/8950intf.h @@ -5,10 +5,11 @@ #pragma once +#include "dirom.h" class y8950_device : public device_t, - public device_sound_interface, - public device_rom_interface + public device_sound_interface, + public device_rom_interface<21> { public: y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp index 7143a116490..f3ce7c337e0 100644 --- a/src/devices/sound/aica.cpp +++ b/src/devices/sound/aica.cpp @@ -435,8 +435,8 @@ void aica_device::Init() m_MidiR = m_MidiW = 0; m_MidiOutR = m_MidiOutW = 0; - m_DSP.space = m_data; - m_DSP.cache = m_cache; + space().specific(m_DSP.space); + space().cache(m_DSP.cache); m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerA_cb), this)); m_timerB = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerB_cb), this)); m_timerC = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerC_cb), this)); @@ -1112,8 +1112,8 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot) if (PCMS(slot) == 1) // 8-bit signed { - s8 p1 = m_cache->read_byte(SA(slot) + addr1); - s8 p2 = m_cache->read_byte(SA(slot) + addr2); + s8 p1 = m_cache.read_byte(SA(slot) + addr1); + s8 p2 = m_cache.read_byte(SA(slot) + addr2); s32 s; s32 fpart=slot->cur_addr & ((1 << SHIFT) - 1); s = (int)(p1 << 8) * ((1 << SHIFT) - fpart) + (int)(p2 << 8) * fpart; @@ -1121,8 +1121,8 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot) } else if (PCMS(slot) == 0) //16 bit signed { - s16 p1 = m_cache->read_word(SA(slot) + addr1); - s16 p2 = m_cache->read_word(SA(slot) + addr2); + s16 p1 = m_cache.read_word(SA(slot) + addr1); + s16 p2 = m_cache.read_word(SA(slot) + addr2); s32 s; s32 fpart = slot->cur_addr & ((1 << SHIFT) - 1); s = (int)(p1) * ((1 << SHIFT) - fpart) + (int)(p2) * fpart; @@ -1142,7 +1142,7 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot) while (curstep < steps_to_go) { int shift1 = 4 & (curstep << 2); - u8 delta1 = (m_cache->read_byte(base) >> shift1) & 0xf; + u8 delta1 = (m_cache.read_byte(base) >> shift1) & 0xf; DecodeADPCM(&(slot->cur_sample), delta1, &(slot->cur_quant)); if (!(++curstep & 1)) base++; @@ -1329,7 +1329,7 @@ void aica_device::exec_dma() { for (i = 0; i < m_dma.dlg; i+=2) { - m_data->write_word(m_dma.dmea, 0); + m_data.write_word(m_dma.dmea, 0); m_dma.dmea += 2; } } @@ -1339,7 +1339,7 @@ void aica_device::exec_dma() { u16 tmp; tmp = r16(m_dma.drga); - m_data->write_word(m_dma.dmea, tmp); + m_data.write_word(m_dma.dmea, tmp); m_dma.dmea += 4; m_dma.drga += 4; } @@ -1359,7 +1359,7 @@ void aica_device::exec_dma() { for (i = 0; i < m_dma.dlg; i+=2) { - u16 tmp = m_cache->read_word(m_dma.dmea); + u16 tmp = m_cache.read_word(m_dma.dmea); w16(m_dma.drga, tmp); m_dma.dmea += 4; m_dma.drga += 4; @@ -1408,9 +1408,8 @@ void aica_device::sound_stream_update(sound_stream &stream, stream_sample_t **in void aica_device::device_start() { - m_data = &space(0); - // Find our direct access - m_cache = space().cache<1, 0, ENDIANNESS_LITTLE>(); + space().specific(m_data); + space().cache(m_cache); // init the emulation Init(); diff --git a/src/devices/sound/aica.h b/src/devices/sound/aica.h index 0f2c33d4355..7c5597b5aa6 100644 --- a/src/devices/sound/aica.h +++ b/src/devices/sound/aica.h @@ -147,8 +147,8 @@ private: u16 m_EFSPAN[0x48]; AICA_SLOT m_Slots[64]; - address_space *m_data; - memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache m_cache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::specific m_data; sound_stream * m_stream; u32 m_IrqTimA; diff --git a/src/devices/sound/aicadsp.cpp b/src/devices/sound/aicadsp.cpp index 4ff8f6fa7d2..20faff8e5b8 100644 --- a/src/devices/sound/aicadsp.cpp +++ b/src/devices/sound/aicadsp.cpp @@ -273,21 +273,21 @@ void AICADSP::step() ADDR &= 0xFFFF; //ADDR <<= 1; //ADDR += RBP << 13; - //MEMVAL = space->read_word(ADDR >> 1); + //MEMVAL = space.read_word(ADDR >> 1); ADDR += RBP << 10; if (MRD && (step & 1)) //memory only allowed on odd? DoA inserts NOPs on even { if (NOFL) - MEMVAL = cache->read_word(ADDR) << 8; + MEMVAL = cache.read_word(ADDR) << 8; else - MEMVAL = UNPACK(cache->read_word(ADDR)); + MEMVAL = UNPACK(cache.read_word(ADDR)); } if (MWT && (step&1)) { if (NOFL) - space->write_word(ADDR, SHIFTED>>8); + space.write_word(ADDR, SHIFTED>>8); else - space->write_word(ADDR, PACK(SHIFTED)); + space.write_word(ADDR, PACK(SHIFTED)); } } diff --git a/src/devices/sound/aicadsp.h b/src/devices/sound/aicadsp.h index 5820970e020..b7b38a27d03 100644 --- a/src/devices/sound/aicadsp.h +++ b/src/devices/sound/aicadsp.h @@ -14,8 +14,8 @@ struct AICADSP void start(); //Config - address_space *space; - memory_access_cache<1, 0, ENDIANNESS_LITTLE> *cache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache cache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::specific space; u32 RBP; //Ring buf pointer u32 RBL; //Delay ram (Ring buffer) size in words diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp index 9b5610fac5c..e316e370ee0 100644 --- a/src/devices/sound/bsmt2000.cpp +++ b/src/devices/sound/bsmt2000.cpp @@ -64,7 +64,7 @@ ROM_END bsmt2000_device::bsmt2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, BSMT2000, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 32) + , device_rom_interface(mconfig, *this) , m_ready_callback(*this) , m_stream(nullptr) , m_cpu(*this, "bsmt2000") diff --git a/src/devices/sound/bsmt2000.h b/src/devices/sound/bsmt2000.h index 361d270b282..7e91afa06aa 100644 --- a/src/devices/sound/bsmt2000.h +++ b/src/devices/sound/bsmt2000.h @@ -14,6 +14,7 @@ #pragma once #include "cpu/tms32010/tms32010.h" +#include "dirom.h" //************************************************************************** @@ -25,7 +26,7 @@ class bsmt2000_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<32> { public: typedef device_delegate<void ()> ready_callback; diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp index 7b0b13b9cb4..37573b2b530 100644 --- a/src/devices/sound/c140.cpp +++ b/src/devices/sound/c140.cpp @@ -95,7 +95,7 @@ c140_device::c140_device(const machine_config &mconfig, const char *tag, device_ c140_device::c140_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 25, ENDIANNESS_BIG, 16) // Verified from schematics (24 bit address, 12(16? for C219) bit data) + , device_rom_interface(mconfig, *this) , m_int1_callback(*this) , m_sample_rate(0) , m_stream(nullptr) diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h index 1d3279730ee..6f645a06d9e 100644 --- a/src/devices/sound/c140.h +++ b/src/devices/sound/c140.h @@ -7,6 +7,7 @@ #pragma once +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -14,10 +15,11 @@ // ======================> c140_device + // Verified from schematics (24 bit address, 12(16? for C219) bit data) class c140_device : public device_t, - public device_sound_interface, - public device_rom_interface + public device_sound_interface, + public device_rom_interface<25, 1, 0, ENDIANNESS_BIG> { public: c140_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/c352.cpp b/src/devices/sound/c352.cpp index 73fe655522d..91cc2ba6671 100644 --- a/src/devices/sound/c352.cpp +++ b/src/devices/sound/c352.cpp @@ -44,7 +44,7 @@ DEFINE_DEVICE_TYPE(C352, c352_device, "c352", "Namco C352") c352_device::c352_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, C352, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 24) + , device_rom_interface(mconfig, *this) , m_stream(nullptr) { } diff --git a/src/devices/sound/c352.h b/src/devices/sound/c352.h index e5cc155dae5..c00aa667b05 100644 --- a/src/devices/sound/c352.h +++ b/src/devices/sound/c352.h @@ -5,6 +5,7 @@ #pragma once +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -14,7 +15,7 @@ class c352_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<24> { public: // construction/destruction diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index bdabc86a2de..fccc2f3a6e4 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -55,7 +55,7 @@ static constexpr int resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 }; es5503_device::es5503_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ES5503, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 17), + device_rom_interface(mconfig, *this), m_irq_func(*this), m_adc_func(*this) { diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h index 0fdfcd45786..18305d500bb 100644 --- a/src/devices/sound/es5503.h +++ b/src/devices/sound/es5503.h @@ -5,11 +5,13 @@ #pragma once +#include "dirom.h" + // ======================> es5503_device class es5503_device : public device_t, - public device_sound_interface, - public device_rom_interface + public device_sound_interface, + public device_rom_interface<17> { public: // construction/destruction diff --git a/src/devices/sound/es8712.cpp b/src/devices/sound/es8712.cpp index f927f942bd0..7efb7647be4 100644 --- a/src/devices/sound/es8712.cpp +++ b/src/devices/sound/es8712.cpp @@ -39,7 +39,7 @@ DEFINE_DEVICE_TYPE(ES8712, es8712_device, "es8712", "Excellent Systems ES8712 So es8712_device::es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ES8712, tag, owner, clock) - , device_rom_interface(mconfig, *this, 20) // TODO : 20 address bits? + , device_rom_interface(mconfig, *this) , m_adpcm_select(*this, "adpcm_select") , m_msm(*this, finder_base::DUMMY_TAG) , m_reset_handler(*this) diff --git a/src/devices/sound/es8712.h b/src/devices/sound/es8712.h index aa87135426d..02a51a23c16 100644 --- a/src/devices/sound/es8712.h +++ b/src/devices/sound/es8712.h @@ -9,6 +9,7 @@ #include "machine/74157.h" #include "sound/msm5205.h" +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -17,7 +18,7 @@ // ======================> es8712_device -class es8712_device : public device_t, public device_rom_interface +class es8712_device : public device_t, public device_rom_interface<20> // TODO : 20 address bits? { public: es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp index af34c9ee80f..f340c5dfa4d 100644 --- a/src/devices/sound/gaelco.cpp +++ b/src/devices/sound/gaelco.cpp @@ -64,7 +64,7 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 27) // Unknown address bits + , device_rom_interface(mconfig, *this) , m_stream(nullptr) { } diff --git a/src/devices/sound/gaelco.h b/src/devices/sound/gaelco.h index 5d26292d086..f10cf4446e2 100644 --- a/src/devices/sound/gaelco.h +++ b/src/devices/sound/gaelco.h @@ -5,6 +5,7 @@ #pragma once +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -12,9 +13,11 @@ // ======================> gaelco_gae1_device +#include "dirom.h" + class gaelco_gae1_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<27> // Unknown address bits { public: gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); diff --git a/src/devices/sound/iremga20.cpp b/src/devices/sound/iremga20.cpp index be8b00e85c2..041ec44241e 100644 --- a/src/devices/sound/iremga20.cpp +++ b/src/devices/sound/iremga20.cpp @@ -61,7 +61,7 @@ DEFINE_DEVICE_TYPE(IREMGA20, iremga20_device, "iremga20", "Irem GA20") iremga20_device::iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, IREMGA20, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 20), + device_rom_interface(mconfig, *this), m_stream(nullptr) { } diff --git a/src/devices/sound/iremga20.h b/src/devices/sound/iremga20.h index 61a37d40f8c..dfe5040f65e 100644 --- a/src/devices/sound/iremga20.h +++ b/src/devices/sound/iremga20.h @@ -10,6 +10,7 @@ #pragma once +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -20,7 +21,7 @@ class iremga20_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<20> { public: iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 82bca0fe3f9..116b1aec9b1 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -94,7 +94,7 @@ const int k053260_device::pan_mul[8][2] = { k053260_device::k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, K053260, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 21) + , device_rom_interface(mconfig, *this) , m_sh1_cb(*this) , m_sh2_cb(*this) , m_stream(nullptr) diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h index aacff441281..e556e23a7a6 100644 --- a/src/devices/sound/k053260.h +++ b/src/devices/sound/k053260.h @@ -11,6 +11,8 @@ #pragma once +#include "dirom.h" + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -18,8 +20,8 @@ // ======================> k053260_device class k053260_device : public device_t, - public device_sound_interface, - public device_rom_interface + public device_sound_interface, + public device_rom_interface<21> { public: k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp index b824650544d..6178afa7af7 100644 --- a/src/devices/sound/k054539.cpp +++ b/src/devices/sound/k054539.cpp @@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(K054539, k054539_device, "k054539", "K054539 ADPCM") k054539_device::k054539_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, K054539, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 24) + , device_rom_interface(mconfig, *this) , flags(0) , ram(nullptr) , reverb_pos(0) diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h index 65a551b1c4b..b2732b8cad3 100644 --- a/src/devices/sound/k054539.h +++ b/src/devices/sound/k054539.h @@ -11,11 +11,13 @@ #pragma once +#include "dirom.h" + #define K054539_CB_MEMBER(_name) void _name(double left, double right) class k054539_device : public device_t, - public device_sound_interface, - public device_rom_interface + public device_sound_interface, + public device_rom_interface<24> { public: // control flags, may be set at DRIVER_INIT(). diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp index 3c88e69b7a2..e56c7c8dce0 100644 --- a/src/devices/sound/ks0164.cpp +++ b/src/devices/sound/ks0164.cpp @@ -51,7 +51,7 @@ void ks0164_device::device_start() } m_stream = stream_alloc(0, 2, clock()/3/2/2/32); - m_mem_cache = space().cache<1, 0, ENDIANNESS_BIG>(); + space().cache(m_mem_cache); m_timer = timer_alloc(0); save_item(NAME(m_bank1_base)); @@ -176,32 +176,32 @@ void ks0164_device::mpu401_w(u8 data) u16 ks0164_device::vec_r(offs_t offset, u16 mem_mask) { - return m_mem_cache->read_word(offset << 1, mem_mask); + return m_mem_cache.read_word(offset << 1, mem_mask); } u16 ks0164_device::rom_r(offs_t offset, u16 mem_mask) { - return m_mem_cache->read_word((offset << 1) + 0x80, mem_mask); + return m_mem_cache.read_word((offset << 1) + 0x80, mem_mask); } u16 ks0164_device::bank1_r(offs_t offset, u16 mem_mask) { - return m_mem_cache->read_word(((offset << 1) & 0x3fff) | m_bank1_base, mem_mask); + return m_mem_cache.read_word(((offset << 1) & 0x3fff) | m_bank1_base, mem_mask); } void ks0164_device::bank1_w(offs_t offset, u16 data, u16 mem_mask) { - m_mem_cache->write_word(((offset << 1) & 0x3fff) | m_bank1_base, data, mem_mask); + m_mem_cache.write_word(((offset << 1) & 0x3fff) | m_bank1_base, data, mem_mask); } u16 ks0164_device::bank2_r(offs_t offset, u16 mem_mask) { - return m_mem_cache->read_word(((offset << 1) & 0x3fff) | m_bank2_base, mem_mask); + return m_mem_cache.read_word(((offset << 1) & 0x3fff) | m_bank2_base, mem_mask); } void ks0164_device::bank2_w(offs_t offset, u16 data, u16 mem_mask) { - m_mem_cache->write_word(((offset << 1) & 0x3fff) | m_bank2_base, data, mem_mask); + m_mem_cache.write_word(((offset << 1) & 0x3fff) | m_bank2_base, data, mem_mask); } u16 ks0164_device::bank1_select_r() @@ -393,13 +393,13 @@ void ks0164_device::sound_stream_update(sound_stream &stream, stream_sample_t ** s16 samp0, samp1; switch(regs[0] & 0x8400) { case 0x0000: // 16 bits linear - samp0 = m_mem_cache->read_word(2*adr); - samp1 = m_mem_cache->read_word(2*adr+2); + samp0 = m_mem_cache.read_word(2*adr); + samp1 = m_mem_cache.read_word(2*adr+2); break; case 0x8400: // 8 bits compressed - samp0 = uncomp_8_16(m_mem_cache->read_byte(adr)); - samp1 = uncomp_8_16(m_mem_cache->read_byte(adr+1)); + samp0 = uncomp_8_16(m_mem_cache.read_byte(adr)); + samp1 = uncomp_8_16(m_mem_cache.read_byte(adr+1)); break; default: diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h index f99d4952aab..bb654c83cc4 100644 --- a/src/devices/sound/ks0164.h +++ b/src/devices/sound/ks0164.h @@ -42,7 +42,7 @@ private: address_space_config m_mem_config; sound_stream *m_stream; emu_timer *m_timer; - memory_access_cache<1, 0, ENDIANNESS_BIG> *m_mem_cache; + memory_access<23, 1, 0, ENDIANNESS_BIG>::cache m_mem_cache; u32 m_bank1_base, m_bank2_base; u16 m_bank1_select, m_bank2_select; diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp index 8cc00b649d7..6698792fbe1 100644 --- a/src/devices/sound/multipcm.cpp +++ b/src/devices/sound/multipcm.cpp @@ -453,7 +453,7 @@ DEFINE_DEVICE_TYPE(MULTIPCM, multipcm_device, "ymw258f", "Yamaha YMW-258-F") multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, MULTIPCM, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 24), + device_rom_interface(mconfig, *this), m_stream(nullptr), m_slots(nullptr), m_cur_slot(0), diff --git a/src/devices/sound/multipcm.h b/src/devices/sound/multipcm.h index 135478239fa..7a4bc55fc2c 100644 --- a/src/devices/sound/multipcm.h +++ b/src/devices/sound/multipcm.h @@ -5,6 +5,8 @@ #pragma once +#include "dirom.h" + #define MULTIPCM_LOG_SAMPLES 0 #if MULTIPCM_LOG_SAMPLES @@ -13,7 +15,7 @@ class multipcm_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<24> { public: multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp index 10375f7736a..ec845dbd522 100644 --- a/src/devices/sound/okim6295.cpp +++ b/src/devices/sound/okim6295.cpp @@ -88,7 +88,7 @@ const uint8_t okim6295_device::s_volume_table[16] = okim6295_device::okim6295_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, OKIM6295, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 18), + device_rom_interface(mconfig, *this), m_region(*this, DEVICE_SELF), m_command(-1), m_stream(nullptr), diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h index 0e836c29ad9..ee7c38f03c1 100644 --- a/src/devices/sound/okim6295.h +++ b/src/devices/sound/okim6295.h @@ -14,6 +14,7 @@ #pragma once #include "sound/okiadpcm.h" +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -24,7 +25,7 @@ class okim6295_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<18> { public: enum pin7_state diff --git a/src/devices/sound/okim6376.cpp b/src/devices/sound/okim6376.cpp index 2170bd5e898..76ee6a5f0a7 100644 --- a/src/devices/sound/okim6376.cpp +++ b/src/devices/sound/okim6376.cpp @@ -116,7 +116,7 @@ DEFINE_DEVICE_TYPE(OKIM6650, okim6650_device, "okim6650", "OKI MSM6650 ADPCM") okim6376_device::okim6376_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int addrbits) : device_t(mconfig, type, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, addrbits, ENDIANNESS_BIG, 8), + device_rom_interface(mconfig, *this), //m_command[OKIM6376_VOICES], m_latch(0), //m_stage[OKIM6376_VOICES], @@ -132,6 +132,7 @@ okim6376_device::okim6376_device(const machine_config &mconfig, device_type type m_ch2_update(0), m_st_update(0) { + override_address_width(addrbits); } okim6376_device::okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) diff --git a/src/devices/sound/okim6376.h b/src/devices/sound/okim6376.h index 361a9d2ccb0..5a73bae88e3 100644 --- a/src/devices/sound/okim6376.h +++ b/src/devices/sound/okim6376.h @@ -5,9 +5,11 @@ #pragma once +#include "dirom.h" + /* an interface for the OKIM6376 and similar chips (CPU interface only) */ -class okim6376_device : public device_t, public device_sound_interface, public device_rom_interface +class okim6376_device : public device_t, public device_sound_interface, public device_rom_interface<23, 0, 0, ENDIANNESS_BIG> { public: okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp index d2426cb4947..c9ae6e29c4a 100644 --- a/src/devices/sound/okim9810.cpp +++ b/src/devices/sound/okim9810.cpp @@ -80,7 +80,7 @@ const uint32_t okim9810_device::s_sampling_freq_div_table[16] = okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, OKIM9810, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 24), + device_rom_interface(mconfig, *this), m_stream(nullptr), m_TMP_register(0x00), m_global_volume(0x00), diff --git a/src/devices/sound/okim9810.h b/src/devices/sound/okim9810.h index b9fcb2db367..b5c8d566de0 100644 --- a/src/devices/sound/okim9810.h +++ b/src/devices/sound/okim9810.h @@ -17,6 +17,7 @@ #pragma once +#include "dirom.h" #include "okiadpcm.h" @@ -29,7 +30,7 @@ class okim9810_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<24> { public: // construction/destruction diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp index 1d9ddcee7e4..4f6f86fa6d1 100644 --- a/src/devices/sound/qs1000.cpp +++ b/src/devices/sound/qs1000.cpp @@ -167,7 +167,7 @@ ROM_END qs1000_device::qs1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, QS1000, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 24), + device_rom_interface(mconfig, *this), m_external_rom(false), m_in_p1_cb(*this), m_in_p2_cb(*this), diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h index e9e9b615951..d8e5fa8c545 100644 --- a/src/devices/sound/qs1000.h +++ b/src/devices/sound/qs1000.h @@ -15,6 +15,7 @@ #include "cpu/mcs51/mcs51.h" #include "sound/okiadpcm.h" +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -24,7 +25,7 @@ class qs1000_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<24> { public: static constexpr feature_type imperfect_features() { return feature::SOUND; } diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp index 84a28073621..6d2e4479e9b 100644 --- a/src/devices/sound/qsound.cpp +++ b/src/devices/sound/qsound.cpp @@ -133,7 +133,7 @@ ROM_END qsound_device::qsound_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : device_t(mconfig, QSOUND, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 24) + , device_rom_interface(mconfig, *this) , m_dsp(*this, "dsp"), m_stream(nullptr) , m_rom_bank(0U), m_rom_offset(0U), m_cmd_addr(0U), m_cmd_data(0U), m_new_data(0U), m_cmd_pending(0U), m_dsp_ready(1U) , m_samples{ 0, 0 }, m_sr(0U), m_fsr(0U), m_ock(1U), m_old(1U), m_ready(0U), m_channel(0U) diff --git a/src/devices/sound/qsound.h b/src/devices/sound/qsound.h index e63d3ac5fd0..d4694f1bf5f 100644 --- a/src/devices/sound/qsound.h +++ b/src/devices/sound/qsound.h @@ -10,10 +10,11 @@ #pragma once +#include "dirom.h" #include "cpu/dsp16/dsp16.h" -class qsound_device : public device_t, public device_sound_interface, public device_rom_interface +class qsound_device : public device_t, public device_sound_interface, public device_rom_interface<24> { public: // default 60MHz clock (divided by 2 for DSP core clock, and then by 1248 for sample rate) diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp index e332add2977..ef99f0ee837 100644 --- a/src/devices/sound/qsoundhle.cpp +++ b/src/devices/sound/qsoundhle.cpp @@ -42,7 +42,7 @@ ROM_END qsound_hle_device::qsound_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, QSOUND_HLE, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 24) + , device_rom_interface(mconfig, *this) , m_stream(nullptr) , m_dsp_rom(*this, "dsp") , m_data_latch(0) diff --git a/src/devices/sound/qsoundhle.h b/src/devices/sound/qsoundhle.h index 744569184cd..6c9872fcc9d 100644 --- a/src/devices/sound/qsoundhle.h +++ b/src/devices/sound/qsoundhle.h @@ -11,9 +11,10 @@ #pragma once #include "cpu/dsp16/dsp16.h" +#include "dirom.h" -class qsound_hle_device : public device_t, public device_sound_interface, public device_rom_interface +class qsound_hle_device : public device_t, public device_sound_interface, public device_rom_interface<24> { public: // default 60MHz clock (divided by 2 for DSP core clock, and then by 1248 for sample rate) diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index 27dfa033118..4436ee07a5e 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -129,7 +129,7 @@ void rf5c400_device::envelope_tables::init(uint32_t clock) rf5c400_device::rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, RF5C400, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 25, ENDIANNESS_LITTLE, 16) + , device_rom_interface(mconfig, *this) , m_stream(nullptr) , m_env_tables() { diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h index 7b5d420049b..d6b17ccaa3c 100644 --- a/src/devices/sound/rf5c400.h +++ b/src/devices/sound/rf5c400.h @@ -7,6 +7,8 @@ #pragma once +#include "dirom.h" + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -15,8 +17,8 @@ // ======================> rf5c400_device class rf5c400_device : public device_t, - public device_sound_interface, - public device_rom_interface + public device_sound_interface, + public device_rom_interface<25, 2, 0, ENDIANNESS_LITTLE> { public: rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp index 56661d9a6d4..1f1159b0afa 100644 --- a/src/devices/sound/rf5c68.cpp +++ b/src/devices/sound/rf5c68.cpp @@ -59,9 +59,8 @@ rf5c164_device::rf5c164_device(const machine_config &mconfig, const char *tag, d void rf5c68_device::device_start() { - m_data = &space(0); // Find our direct access - m_cache = space().cache<0, 0, ENDIANNESS_LITTLE>(); + space(0).cache(m_cache); m_sample_end_cb.resolve(); /* allocate the stream */ @@ -140,11 +139,11 @@ void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t ** } /* fetch the sample and handle looping */ - sample = m_cache->read_byte((chan.addr >> 11) & 0xffff); + sample = m_cache.read_byte((chan.addr >> 11) & 0xffff); if (sample == 0xff) { chan.addr = chan.loopst << 11; - sample = m_cache->read_byte((chan.addr >> 11) & 0xffff); + sample = m_cache.read_byte((chan.addr >> 11) & 0xffff); /* if we loop to a loop point, we're effectively dead */ if (sample == 0xff) @@ -269,7 +268,7 @@ void rf5c68_device::rf5c68_w(offs_t offset, u8 data) u8 rf5c68_device::rf5c68_mem_r(offs_t offset) { - return m_cache->read_byte(m_wbank | offset); + return m_cache.read_byte(m_wbank | offset); } @@ -279,5 +278,5 @@ u8 rf5c68_device::rf5c68_mem_r(offs_t offset) void rf5c68_device::rf5c68_mem_w(offs_t offset, u8 data) { - m_data->write_byte(m_wbank | offset, data); + m_cache.write_byte(m_wbank | offset, data); } diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h index d8cd3bf344a..7681c8940ef 100644 --- a/src/devices/sound/rf5c68.h +++ b/src/devices/sound/rf5c68.h @@ -50,6 +50,7 @@ protected: virtual space_config_vector memory_space_config() const override; address_space_config m_data_config; + private: static constexpr unsigned NUM_CHANNELS = 8; @@ -66,13 +67,12 @@ private: uint16_t loopst = 0; }; - address_space *m_data; - memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache; - sound_stream* m_stream; - pcm_channel m_chan[NUM_CHANNELS]; - uint8_t m_cbank; - uint16_t m_wbank; - uint8_t m_enable; + memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache; + sound_stream* m_stream; + pcm_channel m_chan[NUM_CHANNELS]; + uint8_t m_cbank; + uint16_t m_wbank; + uint8_t m_enable; sample_end_cb_delegate m_sample_end_cb; }; diff --git a/src/devices/sound/rolandpcm.cpp b/src/devices/sound/rolandpcm.cpp index af79f20f9aa..08e8158afbe 100644 --- a/src/devices/sound/rolandpcm.cpp +++ b/src/devices/sound/rolandpcm.cpp @@ -32,7 +32,7 @@ DEFINE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device, "mb87419_mb87420", " mb87419_mb87420_device::mb87419_mb87420_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, MB87419_MB87420, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 22) + , device_rom_interface(mconfig, *this) , m_int_callback(*this) , m_clock(0) , m_rate(0) diff --git a/src/devices/sound/rolandpcm.h b/src/devices/sound/rolandpcm.h index 08815f398e7..42dfa91efba 100644 --- a/src/devices/sound/rolandpcm.h +++ b/src/devices/sound/rolandpcm.h @@ -5,7 +5,9 @@ #pragma once -class mb87419_mb87420_device : public device_t, public device_sound_interface, public device_rom_interface +#include "dirom.h" + +class mb87419_mb87420_device : public device_t, public device_sound_interface, public device_rom_interface<22> { public: mb87419_mb87420_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp index 976fb33f5a2..487b77bff2f 100644 --- a/src/devices/sound/s_dsp.cpp +++ b/src/devices/sound/s_dsp.cpp @@ -156,9 +156,9 @@ s_dsp_device::s_dsp_device(const machine_config &mconfig, const char *tag, devic void s_dsp_device::device_start() { - m_data = &space(0); // Find our direct access - m_cache = m_data->cache<0, 0, ENDIANNESS_LITTLE>(); + space().cache(m_cache); + space().specific(m_data); m_channel = machine().sound().stream_alloc(*this, 0, 2, clock() / 64); diff --git a/src/devices/sound/s_dsp.h b/src/devices/sound/s_dsp.h index 296ac0c4dca..953991dcd2c 100644 --- a/src/devices/sound/s_dsp.h +++ b/src/devices/sound/s_dsp.h @@ -38,11 +38,11 @@ protected: address_space_config m_data_config; private: - address_space *m_data; - memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache; - inline u8 read_byte(offs_t a) { return m_cache->read_byte(a); } + memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache; + memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_data; + inline u8 read_byte(offs_t a) { return m_cache.read_byte(a); } inline u16 read_word(offs_t a) { return read_byte(a) | (read_byte(a + 1) << 8); } - inline void write_byte(offs_t a, u8 d) { m_data->write_byte(a, d); } + inline void write_byte(offs_t a, u8 d) { m_data.write_byte(a, d); } inline void write_word(offs_t a, u16 d) { write_byte(a, d & 0xff); write_byte(a + 1, (d >> 8) & 0xff); } enum class env_state_t32 : u8 diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp index 2ee00c22880..63faf391116 100644 --- a/src/devices/sound/scsp.cpp +++ b/src/devices/sound/scsp.cpp @@ -148,7 +148,7 @@ DEFINE_DEVICE_TYPE(SCSP, scsp_device, "scsp", "Yamaha YMF292-F SCSP") scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, SCSP, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 20, ENDIANNESS_BIG, 16), + device_rom_interface(mconfig, *this), m_irq_cb(*this), m_main_irq_cb(*this), m_BUFPTR(0), diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h index 725dff85914..c349339c463 100644 --- a/src/devices/sound/scsp.h +++ b/src/devices/sound/scsp.h @@ -9,6 +9,7 @@ #pragma once +#include "dirom.h" #include "scspdsp.h" #define SCSP_FM_DELAY 0 // delay in number of slots processed before samples are written to the FM ring buffer @@ -17,7 +18,7 @@ class scsp_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<20, 1, 0, ENDIANNESS_BIG> { public: static constexpr feature_type imperfect_features() { return feature::SOUND; } // DSP / EG incorrections, etc diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp index c9a9f6be8ab..576bc3d2cd0 100644 --- a/src/devices/sound/segapcm.cpp +++ b/src/devices/sound/segapcm.cpp @@ -20,7 +20,7 @@ DEFINE_DEVICE_TYPE(SEGAPCM, segapcm_device, "segapcm", "Sega PCM") segapcm_device::segapcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SEGAPCM, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 21) + , device_rom_interface(mconfig, *this) , m_ram(nullptr) , m_bankshift(12) , m_bankmask(0x70) diff --git a/src/devices/sound/segapcm.h b/src/devices/sound/segapcm.h index 2a25c1eefeb..666a0efed2c 100644 --- a/src/devices/sound/segapcm.h +++ b/src/devices/sound/segapcm.h @@ -9,6 +9,7 @@ #pragma once +#include "dirom.h" //************************************************************************** // TYPE DEFINITIONS @@ -16,7 +17,7 @@ class segapcm_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<21> { public: static constexpr int BANK_256 = 11; diff --git a/src/devices/sound/swp00.cpp b/src/devices/sound/swp00.cpp index eb0d7c59107..0fa494658b1 100644 --- a/src/devices/sound/swp00.cpp +++ b/src/devices/sound/swp00.cpp @@ -11,7 +11,7 @@ DEFINE_DEVICE_TYPE(SWP00, swp00_device, "swp00", "Yamaha SWP00 (TC170C120SF / XQ swp00_device::swp00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SWP00, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32) + device_rom_interface(mconfig, *this) { } diff --git a/src/devices/sound/swp00.h b/src/devices/sound/swp00.h index f440c96d46e..9ada0cdaadb 100644 --- a/src/devices/sound/swp00.h +++ b/src/devices/sound/swp00.h @@ -9,8 +9,9 @@ #pragma once #include "meg.h" +#include "dirom.h" -class swp00_device : public device_t, public device_sound_interface, public device_rom_interface +class swp00_device : public device_t, public device_sound_interface, public device_rom_interface<25+2, 2, 0, ENDIANNESS_LITTLE> { public: swp00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 33868800); diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp index aa4bddaad7d..c5127168f11 100644 --- a/src/devices/sound/swp20.cpp +++ b/src/devices/sound/swp20.cpp @@ -11,7 +11,7 @@ DEFINE_DEVICE_TYPE(SWP20, swp20_device, "swp20", "Yamaha SWP20 sound chip") swp20_device::swp20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SWP20, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 23+2, ENDIANNESS_LITTLE, 16) + device_rom_interface(mconfig, *this) { } diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h index fa1c2e1de9f..b2aca4c8a71 100644 --- a/src/devices/sound/swp20.h +++ b/src/devices/sound/swp20.h @@ -8,7 +8,9 @@ #pragma once -class swp20_device : public device_t, public device_sound_interface, public device_rom_interface +#include "dirom.h" + +class swp20_device : public device_t, public device_sound_interface, public device_rom_interface<23+2, 1, 0, ENDIANNESS_LITTLE> { public: swp20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 11289600); diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp index f43df8084f9..18b4f498c1b 100644 --- a/src/devices/sound/swp30.cpp +++ b/src/devices/sound/swp30.cpp @@ -150,7 +150,7 @@ DEFINE_DEVICE_TYPE(SWP30, swp30_device, "swp30", "Yamaha SWP30 sound chip") swp30_device::swp30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SWP30, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32), + device_rom_interface(mconfig, *this), m_meg(*this, "meg") { (void)m_map; diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h index dd95a8dd85f..35a90341bf3 100644 --- a/src/devices/sound/swp30.h +++ b/src/devices/sound/swp30.h @@ -9,8 +9,9 @@ #pragma once #include "meg.h" +#include "dirom.h" -class swp30_device : public device_t, public device_sound_interface, public device_rom_interface +class swp30_device : public device_t, public device_sound_interface, public device_rom_interface<25+2, 2, 0, ENDIANNESS_LITTLE> { public: swp30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 33868800); diff --git a/src/devices/sound/upd7759.cpp b/src/devices/sound/upd7759.cpp index 3cb175bcdd8..35a66d0b736 100644 --- a/src/devices/sound/upd7759.cpp +++ b/src/devices/sound/upd7759.cpp @@ -145,7 +145,7 @@ upd775x_device::upd775x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 17) + , device_rom_interface(mconfig, *this) , m_channel(nullptr) , m_sample_offset_shift(0) , m_pos(0) diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h index e65b26b9fec..813f5270d89 100644 --- a/src/devices/sound/upd7759.h +++ b/src/devices/sound/upd7759.h @@ -5,6 +5,8 @@ #pragma once +#include "dirom.h" + /* NEC uPD7759/55/56/P56/57/58 ADPCM Speech Processor */ /* There are two modes for the uPD7759, selected through the !MD pin. @@ -15,7 +17,7 @@ class upd775x_device : public device_t, public device_sound_interface, - public device_rom_interface + public device_rom_interface<17> { public: enum : u32 { STANDARD_CLOCK = 640'000 }; diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp index f58540558d4..0d71f7e60b9 100644 --- a/src/devices/sound/vlm5030.cpp +++ b/src/devices/sound/vlm5030.cpp @@ -162,7 +162,7 @@ DEFINE_DEVICE_TYPE(VLM5030, vlm5030_device, "vlm5030", "Sanyo VLM5030") vlm5030_device::vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VLM5030, tag, owner, clock), device_sound_interface(mconfig, *this), - device_rom_interface(mconfig, *this, 16), + device_rom_interface(mconfig, *this), m_channel(nullptr), m_coeff(nullptr), m_address(0), diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h index adbd9173c2b..891fb7ca595 100644 --- a/src/devices/sound/vlm5030.h +++ b/src/devices/sound/vlm5030.h @@ -5,7 +5,9 @@ #pragma once -class vlm5030_device : public device_t, public device_sound_interface, public device_rom_interface +#include "dirom.h" + +class vlm5030_device : public device_t, public device_sound_interface, public device_rom_interface<16> { public: vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/vrender0.cpp b/src/devices/sound/vrender0.cpp index 833acdc46bb..370bc2f44e0 100644 --- a/src/devices/sound/vrender0.cpp +++ b/src/devices/sound/vrender0.cpp @@ -142,11 +142,11 @@ void vr0sound_device::device_start() m_irq_cb.resolve_safe(); // Find our direct access - m_texcache = space(AS_TEXTURE).cache<1, 0, ENDIANNESS_LITTLE>(); - m_fbcache = space(AS_FRAME).cache<1, 0, ENDIANNESS_LITTLE>(); - m_texcache_ctrl = m_fbcache; + space(AS_TEXTURE).cache(m_texcache); + space(AS_FRAME).cache(m_fbcache); + m_texcache_ctrl = &m_fbcache; for (auto &elem : m_channel) - elem.Cache = m_fbcache; + elem.Cache = &m_fbcache; m_stream = stream_alloc(0, 2, clock() / 972); // TODO : Correct source / divider? @@ -229,7 +229,7 @@ void vr0sound_device::channel_w(offs_t offset, u16 data, u16 mem_mask) m_channel[(offset >> 4) & 0x1f].write(offset & 0xf, data, mem_mask); if ((old_mode ^ channel->Modes) & MODE_TEXTURE) { - channel->Cache = (channel->Modes & MODE_TEXTURE) ? m_texcache_ctrl : m_fbcache; + channel->Cache = (channel->Modes & MODE_TEXTURE) ? m_texcache_ctrl : &m_fbcache; } } @@ -356,7 +356,7 @@ void vr0sound_device::ctrl_w(offs_t offset, u16 data, u16 mem_mask) const u16 old_ctrl = m_Ctrl; COMBINE_DATA(&m_Ctrl); if ((old_ctrl ^ m_Ctrl) & CTRL_TM) - m_texcache_ctrl = (m_Ctrl & CTRL_TM) ? m_texcache : m_fbcache; + m_texcache_ctrl = (m_Ctrl & CTRL_TM) ? &m_texcache : &m_fbcache; } /* diff --git a/src/devices/sound/vrender0.h b/src/devices/sound/vrender0.h index 89432d4303b..324276b8ff0 100644 --- a/src/devices/sound/vrender0.h +++ b/src/devices/sound/vrender0.h @@ -115,7 +115,7 @@ private: std::fill(std::begin(EnvTarget), std::end(EnvTarget), 0); } - memory_access_cache<1, 0, ENDIANNESS_LITTLE> *Cache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache *Cache; u32 CurSAddr = 0; // Current Address Pointer, 22.10 Fixed Point s32 EnvVol = 0; // Envelope Volume (Overall Volume), S.7.16 Fixed Point u8 EnvStage = 1; // Envelope Stage @@ -132,9 +132,9 @@ private: void write(offs_t offset, u16 data, u16 mem_mask); }; - memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_texcache; - memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_fbcache; - memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_texcache_ctrl; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache m_texcache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache m_fbcache; + memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache *m_texcache_ctrl; channel_t m_channel[32]; sound_stream *m_stream; diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp index a52f8504ddd..fdb824c0df7 100644 --- a/src/devices/sound/x1_010.cpp +++ b/src/devices/sound/x1_010.cpp @@ -89,7 +89,7 @@ DEFINE_DEVICE_TYPE(X1_010, x1_010_device, "x1_010", "Seta X1-010") x1_010_device::x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, X1_010, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 20) + , device_rom_interface(mconfig, *this) , m_rate(0) , m_stream(nullptr) , m_sound_enable(0) diff --git a/src/devices/sound/x1_010.h b/src/devices/sound/x1_010.h index 5f85fe77671..1664e2abd4c 100644 --- a/src/devices/sound/x1_010.h +++ b/src/devices/sound/x1_010.h @@ -5,7 +5,9 @@ #pragma once -class x1_010_device : public device_t, public device_sound_interface, public device_rom_interface +#include "dirom.h" + +class x1_010_device : public device_t, public device_sound_interface, public device_rom_interface<20> { public: x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp index f2ef28cfeeb..4032a2b6bd8 100644 --- a/src/devices/sound/ymf271.cpp +++ b/src/devices/sound/ymf271.cpp @@ -1805,7 +1805,7 @@ DEFINE_DEVICE_TYPE(YMF271, ymf271_device, "ymf271", "Yamaha YMF271 OPX") ymf271_device::ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, YMF271, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 23) + , device_rom_interface(mconfig, *this) , m_timerA(0) , m_timerB(0) , m_irqstate(0) diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h index efee18db0ad..18ddd4e7b67 100644 --- a/src/devices/sound/ymf271.h +++ b/src/devices/sound/ymf271.h @@ -5,8 +5,9 @@ #pragma once +#include "dirom.h" -class ymf271_device : public device_t, public device_sound_interface, public device_rom_interface +class ymf271_device : public device_t, public device_sound_interface, public device_rom_interface<23> { public: static constexpr feature_type imperfect_features() { return feature::SOUND; } diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp index 0f6c6eb3fad..4e8ed1005ee 100644 --- a/src/devices/sound/ymf278b.cpp +++ b/src/devices/sound/ymf278b.cpp @@ -1055,7 +1055,7 @@ DEFINE_DEVICE_TYPE(YMF278B, ymf278b_device, "ymf278b", "Yamaha YMF278B OPL4") ymf278b_device::ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, YMF278B, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 22) + , device_rom_interface(mconfig, *this) , m_irq_handler(*this) , m_last_fm_data(0) { diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h index 524ed7aebd2..039662fed1a 100644 --- a/src/devices/sound/ymf278b.h +++ b/src/devices/sound/ymf278b.h @@ -5,8 +5,9 @@ #pragma once +#include "dirom.h" -class ymf278b_device : public device_t, public device_sound_interface, public device_rom_interface +class ymf278b_device : public device_t, public device_sound_interface, public device_rom_interface<22> { public: ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp index 0b182509fb5..570b4e64990 100644 --- a/src/devices/sound/ymz280b.cpp +++ b/src/devices/sound/ymz280b.cpp @@ -927,7 +927,7 @@ DEFINE_DEVICE_TYPE(YMZ280B, ymz280b_device, "ymz280b", "Yamaha YMZ280B PCMD8") ymz280b_device::ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, YMZ280B, tag, owner, clock) , device_sound_interface(mconfig, *this) - , device_rom_interface(mconfig, *this, 24) + , device_rom_interface(mconfig, *this) , m_current_register(0) , m_status_register(0) , m_irq_state(0) diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h index 0a8ada2ae5b..898d952c0d2 100644 --- a/src/devices/sound/ymz280b.h +++ b/src/devices/sound/ymz280b.h @@ -12,10 +12,11 @@ #pragma once +#include "dirom.h" #define YMZ280B_MAKE_WAVS 0 -class ymz280b_device : public device_t, public device_sound_interface, public device_rom_interface +class ymz280b_device : public device_t, public device_sound_interface, public device_rom_interface<24> { public: ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |