diff options
author | 2016-08-15 22:04:01 +0200 | |
---|---|---|
committer | 2016-08-15 22:36:39 +0200 | |
commit | 82c408f54c2c81b5af956a34c1320c7b0dfa04e9 (patch) | |
tree | 23c00a3165998e427229b62feb2fec9ecca63dbd | |
parent | 2f798287051c79b155e73b41c6678e10ffda87b2 (diff) |
dirom: device_rom_interface for sound chips with rom/memory map alternative [O. Galibert]
-rw-r--r-- | scripts/src/emu.lua | 2 | ||||
-rw-r--r-- | src/devices/sound/bsmt2000.cpp | 27 | ||||
-rw-r--r-- | src/devices/sound/bsmt2000.h | 7 | ||||
-rw-r--r-- | src/devices/sound/c352.cpp | 24 | ||||
-rw-r--r-- | src/devices/sound/c352.h | 8 | ||||
-rw-r--r-- | src/devices/sound/es5503.cpp | 24 | ||||
-rw-r--r-- | src/devices/sound/es5503.h | 9 | ||||
-rw-r--r-- | src/devices/sound/multipcm.cpp | 26 | ||||
-rw-r--r-- | src/devices/sound/multipcm.h | 9 | ||||
-rw-r--r-- | src/devices/sound/okim6295.cpp | 35 | ||||
-rw-r--r-- | src/devices/sound/okim6295.h | 6 | ||||
-rw-r--r-- | src/devices/sound/okim9810.cpp | 59 | ||||
-rw-r--r-- | src/devices/sound/okim9810.h | 9 | ||||
-rw-r--r-- | src/devices/sound/qs1000.cpp | 68 | ||||
-rw-r--r-- | src/devices/sound/qs1000.h | 7 | ||||
-rw-r--r-- | src/devices/sound/vlm5030.cpp | 26 | ||||
-rw-r--r-- | src/devices/sound/vlm5030.h | 5 | ||||
-rw-r--r-- | src/devices/sound/ymf278b.cpp | 29 | ||||
-rw-r--r-- | src/devices/sound/ymf278b.h | 7 | ||||
-rw-r--r-- | src/emu/dirom.cpp | 55 | ||||
-rw-r--r-- | src/emu/dirom.h | 46 | ||||
-rw-r--r-- | src/emu/emu.h | 1 |
22 files changed, 189 insertions, 300 deletions
diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index dc2a7a46a56..4dbdb38f191 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -82,6 +82,8 @@ files { MAME_DIR .. "src/emu/dioutput.h", MAME_DIR .. "src/emu/dipty.cpp", MAME_DIR .. "src/emu/dipty.h", + MAME_DIR .. "src/emu/dirom.cpp", + MAME_DIR .. "src/emu/dirom.h", MAME_DIR .. "src/emu/dirtc.cpp", MAME_DIR .. "src/emu/dirtc.h", MAME_DIR .. "src/emu/diserial.cpp", diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp index 26df9eb080f..7e92bcb80fb 100644 --- a/src/devices/sound/bsmt2000.cpp +++ b/src/devices/sound/bsmt2000.cpp @@ -52,13 +52,6 @@ static MACHINE_CONFIG_FRAGMENT( bsmt2000 ) MACHINE_CONFIG_END -// default address map for the external memory interface -// the BSMT can address a full 32 bits but typically only 24 are used -static ADDRESS_MAP_START( bsmt2000, AS_0, 8, bsmt2000_device) - AM_RANGE(0x00000, 0xffffff) AM_ROM -ADDRESS_MAP_END - - // ROM definition for the BSMT2000 program ROM ROM_START( bsmt2000 ) ROM_REGION( 0x2000, "bsmt2000", 0 ) @@ -79,11 +72,9 @@ ROM_END bsmt2000_device::bsmt2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, BSMT2000, "BSMT2000", tag, owner, clock, "bsmt2000", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("samples", ENDIANNESS_LITTLE, 8, 32, 0, nullptr), + device_rom_interface(mconfig, *this, 32), m_ready_callback(nullptr), m_stream(nullptr), - m_direct(nullptr), m_cpu(nullptr), m_register_select(0), m_write_data(0), @@ -93,7 +84,6 @@ bsmt2000_device::bsmt2000_device(const machine_config &mconfig, const char *tag, m_right_data(0), m_write_pending(false) { - m_address_map[0] = *ADDRESS_MAP_NAME(bsmt2000); } @@ -140,9 +130,6 @@ void bsmt2000_device::device_start() // find our CPU m_cpu = subdevice<tms32015_device>("bsmt2000"); - // find our direct access - m_direct = &space().direct(); - // create the stream; BSMT typically runs at 24MHz and writes to a DAC, so // in theory we should generate a 24MHz stream, but that's certainly overkill // internally at 24MHz the max output sample rate is 32kHz @@ -170,16 +157,6 @@ void bsmt2000_device::device_reset() } -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *bsmt2000_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} - //------------------------------------------------- // device_timer - handle deferred writes and @@ -296,7 +273,7 @@ READ16_MEMBER( bsmt2000_device::tms_data_r ) READ16_MEMBER( bsmt2000_device::tms_rom_r ) { // underlying logic assumes this is a sign-extended value - return (INT8)m_direct->read_byte((m_rom_bank << 16) + m_rom_address); + return (INT8)read_byte((m_rom_bank << 16) + m_rom_address); } diff --git a/src/devices/sound/bsmt2000.h b/src/devices/sound/bsmt2000.h index 41490230566..2b80c685418 100644 --- a/src/devices/sound/bsmt2000.h +++ b/src/devices/sound/bsmt2000.h @@ -37,7 +37,7 @@ class bsmt2000_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { typedef void (*ready_callback)(bsmt2000_device &device); @@ -61,9 +61,6 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - // device_sound_interface overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -88,12 +85,10 @@ private: }; // configuration state - const address_space_config m_space_config; ready_callback m_ready_callback; // internal state sound_stream * m_stream; - direct_read_data * m_direct; tms32015_device * m_cpu; UINT16 m_register_select; UINT16 m_write_data; diff --git a/src/devices/sound/c352.cpp b/src/devices/sound/c352.cpp index 2da83f0dd4d..bece41a7389 100644 --- a/src/devices/sound/c352.cpp +++ b/src/devices/sound/c352.cpp @@ -32,11 +32,6 @@ // device type definition const device_type C352 = &device_creator<c352_device>; -// default address map -static ADDRESS_MAP_START( c352, AS_0, 8, c352_device ) - AM_RANGE(0x000000, 0xffffff) AM_ROM -ADDRESS_MAP_END - //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -48,8 +43,7 @@ ADDRESS_MAP_END c352_device::c352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, C352, "C352", tag, owner, clock, "c352", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("samples", ENDIANNESS_LITTLE, 8, 24, 0, nullptr, *ADDRESS_MAP_NAME(c352)) + device_rom_interface(mconfig, *this, 24) { } @@ -64,15 +58,6 @@ void c352_device::static_set_divider(device_t &device, int setting) c352.m_divider = setting; } -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *c352_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} // noise generator int c352_device::get_mseq_bit() @@ -132,8 +117,8 @@ void c352_device::mix_one_channel(unsigned long ch, long sample_count) return; } - sample = (char)m_direct->read_byte(pos); - nextsample = (char)m_direct->read_byte(pos+cnt); + sample = (char)read_byte(pos); + nextsample = (char)read_byte(pos+cnt); // sample is muLaw, not 8-bit linear (Fighting Layer uses this extensively) if (flag & C352_FLG_MULAW) @@ -481,9 +466,6 @@ void c352_device::device_start() double y_max = 127.0; double u = 10.0; - // find our direct access - m_direct = &space().direct(); - m_sample_rate_base = clock() / m_divider; m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base); diff --git a/src/devices/sound/c352.h b/src/devices/sound/c352.h index d64917d3252..5a673384e70 100644 --- a/src/devices/sound/c352.h +++ b/src/devices/sound/c352.h @@ -24,7 +24,7 @@ class c352_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: // construction/destruction @@ -46,11 +46,6 @@ protected: // device_sound_interface overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - - const address_space_config m_space_config; - private: enum { C352_FLG_BUSY = 0x8000, // channel is busy @@ -105,7 +100,6 @@ private: short m_mulaw_table[256]; unsigned int m_mseq_reg; - direct_read_data *m_direct; // private functions int get_mseq_bit(void); diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index 8103ffbc456..c5fe731717e 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -44,11 +44,6 @@ static const UINT32 wavemasks[8] = { 0x1ff00, 0x1fe00, 0x1fc00, 0x1f800, 0x1f000 static const UINT32 accmasks[8] = { 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff }; static const int resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 }; -// default address map -static ADDRESS_MAP_START( es5503, AS_0, 8, es5503_device ) - AM_RANGE(0x000000, 0x1ffff) AM_ROM -ADDRESS_MAP_END - //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -60,22 +55,12 @@ ADDRESS_MAP_END es5503_device::es5503_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ES5503, "Ensoniq ES5503", tag, owner, clock, "es5503", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("es5503_samples", ENDIANNESS_LITTLE, 8, 17, 0, nullptr, *ADDRESS_MAP_NAME(es5503)), + device_rom_interface(mconfig, *this, 17), m_irq_func(*this), m_adc_func(*this) { } -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *es5503_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} //------------------------------------------------- // static_set_type - configuration helper to set @@ -184,9 +169,9 @@ void es5503_device::sound_stream_update(sound_stream &stream, stream_sample_t ** // channel strobe is always valid when reading; this allows potentially banking per voice m_channel_strobe = (ctrl>>4) & 0xf; - data = (INT32)m_direct->read_byte(ramptr + wtptr) ^ 0x80; + data = (INT32)read_byte(ramptr + wtptr) ^ 0x80; - if (m_direct->read_byte(ramptr + wtptr) == 0x00) + if (read_byte(ramptr + wtptr) == 0x00) { halt_osc(osc, 1, &acc, resshift); } @@ -227,9 +212,6 @@ void es5503_device::device_start() { int osc; - // find our direct access - m_direct = &space().direct(); - m_irq_func.resolve_safe(); m_adc_func.resolve_safe(0); diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h index 941c56ef8c4..075cde4cf02 100644 --- a/src/devices/sound/es5503.h +++ b/src/devices/sound/es5503.h @@ -23,7 +23,7 @@ class es5503_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: // construction/destruction @@ -50,11 +50,6 @@ protected: // device_sound_interface overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - - const address_space_config m_space_config; - devcb_write_line m_irq_func; devcb_read8 m_adc_func; @@ -96,8 +91,6 @@ private: emu_timer *m_timer; - direct_read_data *m_direct; - void halt_osc(int onum, int type, UINT32 *accumulator, int resshift); }; diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp index 0ce61d419f7..60583bf04dc 100644 --- a/src/devices/sound/multipcm.cpp +++ b/src/devices/sound/multipcm.cpp @@ -448,16 +448,10 @@ void multipcm_device::set_bank(UINT32 leftoffs, UINT32 rightoffs) const device_type MULTIPCM = &device_creator<multipcm_device>; -// default address map -static ADDRESS_MAP_START( multipcm, AS_0, 8, multipcm_device ) - AM_RANGE(0x000000, 0x3fffff) AM_ROM -ADDRESS_MAP_END - multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, MULTIPCM, "Sega/Yamaha 315-5560", tag, owner, clock, "multipcm", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("mpcm_samples", ENDIANNESS_LITTLE, 8, 24, 0, nullptr), + device_rom_interface(mconfig, *this, 24), m_stream(nullptr), m_samples(nullptr), m_slots(nullptr), @@ -469,7 +463,6 @@ multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, m_attack_step(nullptr), m_decay_release_step(nullptr), m_freq_step_table(nullptr), - m_direct(nullptr), m_left_pan_table(nullptr), m_right_pan_table(nullptr), m_linear_to_exp_volume(nullptr), @@ -477,18 +470,8 @@ multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, m_pitch_scale_tables(nullptr), m_amplitude_scale_tables(nullptr) { - m_address_map[0] = *ADDRESS_MAP_NAME(multipcm); } -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *multipcm_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} //------------------------------------------------- // device_config_complete - perform any @@ -506,9 +489,6 @@ void multipcm_device::device_config_complete() void multipcm_device::device_start() { - // find our direct access - m_direct = &space().direct(); - const float clock_divider = 180.0f; m_rate = (float)clock() / clock_divider; @@ -612,7 +592,7 @@ void multipcm_device::device_start() for (INT32 sample_byte = 0; sample_byte < 12; sample_byte++) { - data[sample_byte] = (UINT8)m_direct->read_byte((sample * 12) + sample_byte); + data[sample_byte] = (UINT8)read_byte((sample * 12) + sample_byte); } m_samples[sample].m_start = (data[0] << 16) | (data[1] << 8) | (data[2] << 0); @@ -711,7 +691,7 @@ void multipcm_device::sound_stream_update(sound_stream &stream, stream_sample_t UINT32 vol = (slot->m_total_level >> TL_SHIFT) | (slot->m_pan << 7); UINT32 adr = slot->m_offset >> TL_SHIFT; UINT32 step = slot->m_step; - INT32 csample = (INT16) (m_direct->read_byte(slot->m_base + adr) << 8); + INT32 csample = (INT16) (read_byte(slot->m_base + adr) << 8); INT32 fpart = slot->m_offset & ((1 << TL_SHIFT) - 1); INT32 sample = (csample * fpart + slot->m_prev_sample * ((1 << TL_SHIFT) - fpart)) >> TL_SHIFT; diff --git a/src/devices/sound/multipcm.h b/src/devices/sound/multipcm.h index 3abb6bd214e..8b66783f67e 100644 --- a/src/devices/sound/multipcm.h +++ b/src/devices/sound/multipcm.h @@ -7,7 +7,7 @@ class multipcm_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -26,11 +26,6 @@ protected: // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - - const address_space_config m_space_config; - private: struct sample_t { @@ -110,8 +105,6 @@ private: UINT32 *m_decay_release_step; // Envelope step tables UINT32 *m_freq_step_table; // Frequency step table - direct_read_data *m_direct; - INT32 *m_left_pan_table; INT32 *m_right_pan_table; INT32 *m_linear_to_exp_volume; diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp index d7af7157792..796534cb4fb 100644 --- a/src/devices/sound/okim6295.cpp +++ b/src/devices/sound/okim6295.cpp @@ -71,12 +71,6 @@ const UINT8 okim6295_device::s_volume_table[16] = 0x00, }; -// default address map -static ADDRESS_MAP_START( okim6295, AS_0, 8, okim6295_device ) - AM_RANGE(0x00000, 0x3ffff) AM_ROM -ADDRESS_MAP_END - - //************************************************************************** // LIVE DEVICE @@ -89,8 +83,7 @@ ADDRESS_MAP_END okim6295_device::okim6295_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, OKIM6295, "OKI6295", tag, owner, clock, "okim6295", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("samples", ENDIANNESS_LITTLE, 8, 18, 0, nullptr, *ADDRESS_MAP_NAME(okim6295)), + device_rom_interface(mconfig, *this, 18), m_region(*this, DEVICE_SELF), m_command(-1), m_bank_installed(false), @@ -120,9 +113,6 @@ void okim6295_device::static_set_pin7(device_t &device, int pin7) void okim6295_device::device_start() { - // find our direct access - m_direct = &space().direct(); - // create the stream int divisor = m_pin7_state ? 132 : 165; m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / divisor); @@ -180,17 +170,6 @@ void okim6295_device::device_clock_changed() //------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *okim6295_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} - - -//------------------------------------------------- // stream_generate - handle update requests for // our sound stream //------------------------------------------------- @@ -304,14 +283,14 @@ void okim6295_device::write_command(UINT8 command) // determine the start/stop positions offs_t base = m_command * 8; - offs_t start = m_direct->read_byte(base + 0) << 16; - start |= m_direct->read_byte(base + 1) << 8; - start |= m_direct->read_byte(base + 2) << 0; + offs_t start = read_byte(base + 0) << 16; + start |= read_byte(base + 1) << 8; + start |= read_byte(base + 2) << 0; start &= 0x3ffff; - offs_t stop = m_direct->read_byte(base + 3) << 16; - stop |= m_direct->read_byte(base + 4) << 8; - stop |= m_direct->read_byte(base + 5) << 0; + offs_t stop = read_byte(base + 3) << 16; + stop |= read_byte(base + 4) << 8; + stop |= read_byte(base + 5) << 0; stop &= 0x3ffff; if (start < stop) diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h index 4fb85839f5c..84a2d1bb85e 100644 --- a/src/devices/sound/okim6295.h +++ b/src/devices/sound/okim6295.h @@ -54,7 +54,7 @@ enum class okim6295_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: // construction/destruction @@ -80,9 +80,6 @@ protected: virtual void device_post_load() override; virtual void device_clock_changed() override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - // device_sound_interface overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -102,7 +99,6 @@ protected: }; // configuration state - const address_space_config m_space_config; optional_memory_region m_region; // internal state diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp index cd89d77a3e0..059cdb63b4d 100644 --- a/src/devices/sound/okim9810.cpp +++ b/src/devices/sound/okim9810.cpp @@ -62,11 +62,6 @@ const UINT32 okim9810_device::s_sampling_freq_table[16] = 0 }; -// default address map -static ADDRESS_MAP_START( okim9810, AS_0, 8, okim9810_device ) - AM_RANGE(0x000000, 0xffffff) AM_ROM -ADDRESS_MAP_END - //************************************************************************** @@ -80,8 +75,7 @@ ADDRESS_MAP_END okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, OKIM9810, "OKI9810", tag, owner, clock, "okim9810", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("samples", ENDIANNESS_BIG, 8, 24, 0, nullptr, *ADDRESS_MAP_NAME(okim9810)), + device_rom_interface(mconfig, *this, 24), m_stream(nullptr), m_TMP_register(0x00), m_global_volume(0x00), @@ -97,9 +91,6 @@ okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag, void okim9810_device::device_start() { - // find our direct access - m_direct = &space().direct(); - // create the stream //int divisor = m_pin7 ? 132 : 165; m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()); @@ -168,16 +159,6 @@ void okim9810_device::device_clock_changed() } -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *okim9810_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} - //------------------------------------------------- // stream_generate - handle update requests for @@ -192,7 +173,7 @@ void okim9810_device::sound_stream_update(sound_stream &stream, stream_sample_t // iterate over voices and accumulate sample data for (auto & elem : m_voice) - elem.generate_audio(*m_direct, outputs, samples, m_global_volume, clock(), m_filter_type); + elem.generate_audio(*this, outputs, samples, m_global_volume, clock(), m_filter_type); } @@ -313,31 +294,31 @@ void okim9810_device::write_command(UINT8 data) const offs_t base = m_TMP_register * 8; offs_t startAddr; - UINT8 startFlags = m_direct->read_byte(base + 0); - startAddr = m_direct->read_byte(base + 1) << 16; - startAddr |= m_direct->read_byte(base + 2) << 8; - startAddr |= m_direct->read_byte(base + 3) << 0; + UINT8 startFlags = read_byte(base + 0); + startAddr = read_byte(base + 1) << 16; + startAddr |= read_byte(base + 2) << 8; + startAddr |= read_byte(base + 3) << 0; offs_t endAddr; - UINT8 endFlags = m_direct->read_byte(base + 4); - endAddr = m_direct->read_byte(base + 5) << 16; - endAddr |= m_direct->read_byte(base + 6) << 8; - endAddr |= m_direct->read_byte(base + 7) << 0; + UINT8 endFlags = read_byte(base + 4); + endAddr = read_byte(base + 5) << 16; + endAddr |= read_byte(base + 6) << 8; + endAddr |= read_byte(base + 7) << 0; // Sub-table if (startFlags & 0x80) { offs_t subTable = startAddr; // TODO: New startFlags &= 0x80. Are there further subtables? - startFlags = m_direct->read_byte(subTable + 0); - startAddr = m_direct->read_byte(subTable + 1) << 16; - startAddr |= m_direct->read_byte(subTable + 2) << 8; - startAddr |= m_direct->read_byte(subTable + 3) << 0; + startFlags = read_byte(subTable + 0); + startAddr = read_byte(subTable + 1) << 16; + startAddr |= read_byte(subTable + 2) << 8; + startAddr |= read_byte(subTable + 3) << 0; // TODO: What does byte (subTable + 4) refer to? - endAddr = m_direct->read_byte(subTable + 5) << 16; - endAddr |= m_direct->read_byte(subTable + 6) << 8; - endAddr |= m_direct->read_byte(subTable + 7) << 0; + endAddr = read_byte(subTable + 5) << 16; + endAddr |= read_byte(subTable + 6) << 8; + endAddr |= read_byte(subTable + 7) << 0; } m_voice[channel].m_sample = 0; @@ -446,7 +427,7 @@ okim9810_device::okim_voice::okim_voice() // add them to an output stream //------------------------------------------------- -void okim9810_device::okim_voice::generate_audio(direct_read_data &direct, +void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom, stream_sample_t **buffers, int samples, const UINT8 global_volume, @@ -478,7 +459,7 @@ void okim9810_device::okim_voice::generate_audio(direct_read_data &direct, if (m_sample == 0) { // fetch the first sample nibble - int nibble0 = direct.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); + int nibble0 = rom.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); switch (m_playbackAlgo) { case OKIM9810_ADPCM_PLAYBACK: @@ -504,7 +485,7 @@ void okim9810_device::okim_voice::generate_audio(direct_read_data &direct, } // And fetch the second sample nibble - int nibble1 = direct.read_byte(m_base_offset + (m_sample+1) / 2) >> ((((m_sample+1) & 1) << 2) ^ 4); + int nibble1 = rom.read_byte(m_base_offset + (m_sample+1) / 2) >> ((((m_sample+1) & 1) << 2) ^ 4); switch (m_playbackAlgo) { case OKIM9810_ADPCM_PLAYBACK: diff --git a/src/devices/sound/okim9810.h b/src/devices/sound/okim9810.h index ea37366288e..5bdafed1f3b 100644 --- a/src/devices/sound/okim9810.h +++ b/src/devices/sound/okim9810.h @@ -68,7 +68,7 @@ enum class okim9810_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: // construction/destruction @@ -89,9 +89,6 @@ protected: virtual void device_post_load() override; virtual void device_clock_changed() override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - // device_sound_interface overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -100,7 +97,7 @@ protected: { public: okim_voice(); - void generate_audio(direct_read_data &direct, + void generate_audio(device_rom_interface &rom, stream_sample_t **buffers, int samples, const UINT8 global_volume, @@ -137,10 +134,8 @@ protected: }; // internal state - const address_space_config m_space_config; sound_stream* m_stream; - direct_read_data* m_direct; UINT8 m_TMP_register; diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp index 07a8fc1223e..80e7526b7be 100644 --- a/src/devices/sound/qs1000.cpp +++ b/src/devices/sound/qs1000.cpp @@ -167,12 +167,6 @@ ROM_START( qs1000 ) ROM_END -// Wavetable ROM address map -static ADDRESS_MAP_START( qs1000, AS_0, 8, qs1000_device ) - AM_RANGE(0x000000, 0xffffff) AM_ROM AM_REGION("qs1000", 0) -ADDRESS_MAP_END - - //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -183,7 +177,7 @@ ADDRESS_MAP_END qs1000_device::qs1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, QS1000, "QS1000", tag, owner, clock, "qs1000", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), + device_rom_interface(mconfig, *this, 24), m_external_rom(false), m_in_p1_cb(*this), m_in_p2_cb(*this), @@ -192,12 +186,9 @@ qs1000_device::qs1000_device(const machine_config &mconfig, const char *tag, dev m_out_p2_cb(*this), m_out_p3_cb(*this), //m_serial_w_cb(*this), - m_space_config("samples", ENDIANNESS_LITTLE, 8, 24, 0, nullptr), m_stream(nullptr), - m_direct(nullptr), m_cpu(*this, "cpu") { - m_address_map[0] = *ADDRESS_MAP_NAME(qs1000); } @@ -226,9 +217,6 @@ machine_config_constructor qs1000_device::device_mconfig_additions() const //------------------------------------------------- void qs1000_device::device_start() { - // Find our direct access - m_direct = &space().direct(); - // The QS1000 operates at 24MHz. Creating a stream at that rate // would be overkill so we opt for a fraction of that rate which // gives reasonable results @@ -312,16 +300,6 @@ void qs1000_device::device_reset() //------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- -const address_space_config *qs1000_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : nullptr; -} - - -//------------------------------------------------- // device_timer - handle deferred writes and // resets as a timer callback //------------------------------------------------- @@ -520,7 +498,7 @@ void qs1000_device::sound_stream_update(sound_stream &stream, stream_sample_t ** if (chan.m_start + chan.m_adpcm_addr >= chan.m_loop_end) chan.m_adpcm_addr = chan.m_loop_start - chan.m_start; - UINT8 data = m_direct->read_byte(chan.m_start + (chan.m_adpcm_addr >> 1)); + UINT8 data = read_byte(chan.m_start + (chan.m_adpcm_addr >> 1)); UINT8 nibble = (chan.m_adpcm_addr & 1 ? data : data >> 4) & 0xf; chan.m_adpcm_signal = chan.m_adpcm.clock(nibble); } @@ -553,7 +531,7 @@ void qs1000_device::sound_stream_update(sound_stream &stream, stream_sample_t ** } } - INT8 result = m_direct->read_byte(chan.m_addr) - 128; + INT8 result = read_byte(chan.m_addr) - 128; chan.m_acc += chan.m_freq; chan.m_addr = (chan.m_addr + (chan.m_acc >> 18)) & QS1000_ADDRESS_MASK; @@ -573,9 +551,9 @@ void qs1000_device::start_voice(int ch) UINT32 table_addr = (m_channels[ch].m_regs[0x01] << 16) | (m_channels[ch].m_regs[0x02] << 8) | m_channels[ch].m_regs[0x03]; // Fetch the sound information - UINT16 freq = (m_direct->read_byte(table_addr + 0) << 8) | m_direct->read_byte(table_addr + 1); - UINT16 word1 = (m_direct->read_byte(table_addr + 2) << 8) | m_direct->read_byte(table_addr + 3); - UINT16 base = (m_direct->read_byte(table_addr + 4) << 8) | m_direct->read_byte(table_addr + 5); + UINT16 freq = (read_byte(table_addr + 0) << 8) | read_byte(table_addr + 1); + UINT16 word1 = (read_byte(table_addr + 2) << 8) | read_byte(table_addr + 3); + UINT16 base = (read_byte(table_addr + 4) << 8) | read_byte(table_addr + 5); if (LOGGING_ENABLED) printf("[%.6x] Freq:%.4x ????:%.4x Addr:%.4x\n", table_addr, freq, word1, base); @@ -585,42 +563,42 @@ void qs1000_device::start_voice(int ch) return; // Fetch the sample pointers and flags - UINT8 byte0 = m_direct->read_byte(base); + UINT8 byte0 = read_byte(base); UINT32 start_addr; start_addr = byte0 << 16; - start_addr |= m_direct->read_byte(base + 1) << 8; - start_addr |= m_direct->read_byte(base + 2) << 0; + start_addr |= read_byte(base + 1) << 8; + start_addr |= read_byte(base + 2) << 0; start_addr &= QS1000_ADDRESS_MASK; UINT32 loop_start; loop_start = (byte0 & 0xf0) << 16; - loop_start |= m_direct->read_byte(base + 3) << 12; - loop_start |= m_direct->read_byte(base + 4) << 4; - loop_start |= m_direct->read_byte(base + 5) >> 4; + loop_start |= read_byte(base + 3) << 12; + loop_start |= read_byte(base + 4) << 4; + loop_start |= read_byte(base + 5) >> 4; loop_start &= QS1000_ADDRESS_MASK; UINT32 loop_end; loop_end = (byte0 & 0xf0) << 16; - loop_end |= (m_direct->read_byte(base + 5) & 0xf) << 16; - loop_end |= m_direct->read_byte(base + 6) << 8; - loop_end |= m_direct->read_byte(base + 7); + loop_end |= (read_byte(base + 5) & 0xf) << 16; + loop_end |= read_byte(base + 6) << 8; + loop_end |= read_byte(base + 7); loop_end &= QS1000_ADDRESS_MASK; - UINT8 byte8 = m_direct->read_byte(base + 8); + UINT8 byte8 = read_byte(base + 8); if (LOGGING_ENABLED) { - UINT8 byte9 = m_direct->read_byte(base + 9); - UINT8 byte10 = m_direct->read_byte(base + 10); - UINT8 byte11 = m_direct->read_byte(base + 11); - UINT8 byte12 = m_direct->read_byte(base + 12); - UINT8 byte13 = m_direct->read_byte(base + 13); - UINT8 byte14 = m_direct->read_byte(base + 14); - UINT8 byte15 = m_direct->read_byte(base + 15); + UINT8 byte9 = read_byte(base + 9); + UINT8 byte10 = read_byte(base + 10); + UINT8 byte11 = read_byte(base + 11); + UINT8 byte12 = read_byte(base + 12); + UINT8 byte13 = read_byte(base + 13); + UINT8 byte14 = read_byte(base + 14); + UINT8 byte15 = read_byte(base + 15); printf("[%.6x] Sample Start:%.6x Loop Start:%.6x Loop End:%.6x Params: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", base, start_addr, loop_start, loop_end, byte8, byte9, byte10, byte11, byte12, byte13, byte14, byte15); } diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h index 48545485169..b47576a7245 100644 --- a/src/devices/sound/qs1000.h +++ b/src/devices/sound/qs1000.h @@ -55,7 +55,7 @@ class qs1000_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: // construction/destruction @@ -82,9 +82,6 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - // device_sound_interface overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -128,9 +125,7 @@ public: //devcb_write8 m_serial_w_cb; // Internal state - const address_space_config m_space_config; sound_stream * m_stream; - direct_read_data * m_direct; required_device<i8052_device> m_cpu; // Wavetable engine diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp index 90295f2807e..eabdbccb89e 100644 --- a/src/devices/sound/vlm5030.cpp +++ b/src/devices/sound/vlm5030.cpp @@ -159,16 +159,10 @@ static const int vlm5030_speed_table[8] = const device_type VLM5030 = &device_creator<vlm5030_device>; -// default address map -static ADDRESS_MAP_START( vlm5030, AS_0, 8, vlm5030_device ) - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - vlm5030_device::vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, VLM5030, "VLM5030", tag, owner, clock, "vlm5030", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("samples", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(vlm5030)), + device_rom_interface(mconfig, *this, 16), m_channel(nullptr), m_coeff(nullptr), m_address(0), @@ -203,16 +197,6 @@ vlm5030_device::vlm5030_device(const machine_config &mconfig, const char *tag, d } //------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *vlm5030_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == AS_0) ? &m_space_config : nullptr; -} - -//------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -284,8 +268,7 @@ int vlm5030_device::get_bits(int sbit,int bits) int offset = m_address + (sbit>>3); int data; - data = space(AS_0).read_byte(offset) | - space(AS_0).read_byte(offset+1)<<8; + data = read_byte(offset) | (read_byte(offset+1)<<8); data >>= (sbit&7); data &= (0xff>>(8-bits)); @@ -305,7 +288,7 @@ int vlm5030_device::parse_frame() m_old_k[i] = m_new_k[i]; /* command byte check */ - cmd = space(AS_0).read_byte(m_address); + cmd = read_byte(m_address); if( cmd & 0x01 ) { /* extend frame */ m_new_energy = m_new_pitch = 0; @@ -469,8 +452,7 @@ WRITE_LINE_MEMBER( vlm5030_device::st ) else { /* indirect accedd mode */ table = (m_latch_data&0xfe) + (((int)m_latch_data&1)<<8); - m_address = (space(AS_0).read_byte(table)<<8) - | space(AS_0).read_byte(table+1); + m_address = (read_byte(table)<<8) | read_byte(table+1); #if 0 /* show unsupported parameter message */ if( m_interp_step != 1) diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h index ca5dca436d7..93768a8c14f 100644 --- a/src/devices/sound/vlm5030.h +++ b/src/devices/sound/vlm5030.h @@ -6,7 +6,7 @@ #define __VLM5030_H__ class vlm5030_device : public device_t, - public device_sound_interface, public device_memory_interface + public device_sound_interface, public device_rom_interface { public: vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -32,9 +32,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; - // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp index 67db79498e7..30984c780c5 100644 --- a/src/devices/sound/ymf278b.cpp +++ b/src/devices/sound/ymf278b.cpp @@ -54,12 +54,6 @@ #define LOG(x) do { if (VERBOSE) logerror x; } while (0) -// default address map -static ADDRESS_MAP_START( ymf278b, AS_0, 8, ymf278b_device ) - AM_RANGE(0x000000, 0x3fffff) AM_ROM -ADDRESS_MAP_END - - /**************************************************************************/ int ymf278b_device::compute_rate(YMF278BSlot *slot, int val) @@ -255,23 +249,23 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t * { // 8 bit case 0: - sample = m_direct->read_byte(slot->startaddr + (slot->stepptr>>16))<<8; + sample = read_byte(slot->startaddr + (slot->stepptr>>16))<<8; break; // 12 bit case 1: if (slot->stepptr & 0x10000) - sample = m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3+2)<<8 | - (m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3+1) << 4 & 0xf0); + sample = read_byte(slot->startaddr + (slot->stepptr>>17)*3+2)<<8 | + (read_byte(slot->startaddr + (slot->stepptr>>17)*3+1) << 4 & 0xf0); else - sample = m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3)<<8 | - (m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3+1) & 0xf0); + sample = read_byte(slot->startaddr + (slot->stepptr>>17)*3)<<8 | + (read_byte(slot->startaddr + (slot->stepptr>>17)*3+1) & 0xf0); break; // 16 bit case 2: - sample = m_direct->read_byte(slot->startaddr + ((slot->stepptr>>16)*2))<<8 | - m_direct->read_byte(slot->startaddr + ((slot->stepptr>>16)*2)+1); + sample = read_byte(slot->startaddr + ((slot->stepptr>>16)*2))<<8 | + read_byte(slot->startaddr + ((slot->stepptr>>16)*2)+1); break; // ?? bit, effect is unknown, datasheet says it's prohibited @@ -485,7 +479,7 @@ void ymf278b_device::C_w(UINT8 reg, UINT8 data) else offset = m_wavetblhdr*0x80000 + (slot->wave - 384) * 12; for (i = 0; i < 12; i++) - p[i] = m_direct->read_byte(offset+i); + p[i] = read_byte(offset+i); slot->bits = (p[0]&0xc0)>>6; slot->startaddr = (p[2] | (p[1]<<8) | ((p[0]&0x3f)<<16)); @@ -762,7 +756,7 @@ READ8_MEMBER( ymf278b_device::read ) ret = (m_pcmregs[m_port_C] & 0x1f) | 0x20; // device ID in upper bits break; case 6: - ret = m_direct->read_byte(m_memadr); + ret = read_byte(m_memadr); m_memadr = (m_memadr + 1) & 0x3fffff; break; @@ -969,7 +963,6 @@ void ymf278b_device::device_start() { int i; - m_direct = &space().direct(); m_clock = clock(); m_irq_handler.resolve(); @@ -1032,12 +1025,10 @@ const device_type YMF278B = &device_creator<ymf278b_device>; ymf278b_device::ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, YMF278B, "YMF278B", tag, owner, clock, "ymf278b", __FILE__), device_sound_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - m_space_config("samples", ENDIANNESS_BIG, 8, 22, 0, nullptr), + device_rom_interface(mconfig, *this, 22), m_irq_handler(*this), m_last_fm_data(0) { - m_address_map[0] = *ADDRESS_MAP_NAME(ymf278b); } //------------------------------------------------- diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h index 6c750fcfd91..508afb5dd60 100644 --- a/src/devices/sound/ymf278b.h +++ b/src/devices/sound/ymf278b.h @@ -14,7 +14,7 @@ class ymf278b_device : public device_t, public device_sound_interface, - public device_memory_interface + public device_rom_interface { public: ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -36,9 +36,6 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_0) ? &m_space_config : nullptr; } - // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -131,8 +128,6 @@ private: sound_stream * m_stream; std::unique_ptr<INT32[]> m_mix_buffer; - direct_read_data * m_direct; - const address_space_config m_space_config; devcb_write_line m_irq_handler; UINT8 m_last_fm_data; diff --git a/src/emu/dirom.cpp b/src/emu/dirom.cpp new file mode 100644 index 00000000000..3ac69bd4531 --- /dev/null +++ b/src/emu/dirom.cpp @@ -0,0 +1,55 @@ +#include "emu.h" + + +device_rom_interface::device_rom_interface(const machine_config &mconfig, device_t &device, UINT8 addrwidth, endianness_t endian, UINT8 datawidth) : + device_memory_interface(mconfig, device), + m_rom_config("rom", endian, datawidth, addrwidth) +{ +} + +device_rom_interface::~device_rom_interface() +{ +} + +const address_space_config *device_rom_interface::memory_space_config(address_spacenum spacenum) const +{ + return spacenum ? nullptr : &m_rom_config; +} + +void device_rom_interface::set_rom(const void *base, UINT32 size) +{ + UINT32 mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1; + UINT32 rend = size-1; + if(rend == mend) + space().install_rom(0, mend, const_cast<void *>(base)); + else { + // Round up to the nearest power-of-two-minus-one + UINT32 rmask = rend; + rmask |= rmask >> 1; + rmask |= rmask >> 2; + rmask |= rmask >> 4; + rmask |= rmask >> 8; + rmask |= rmask >> 16; + if(rmask != rend) + space().unmap_read(0, mend); + // Mirror over the high bits. mend and rmask are both + // powers-of-two-minus-one, so the xor works + space().install_rom(0, rend, mend ^ rmask, const_cast<void *>(base)); + } +} + +void device_rom_interface::interface_pre_start() +{ + m_rom_direct = &space().direct(); + + if(!has_configured_map(0)) { + memory_region *reg = device().memregion(DEVICE_SELF); + if(reg) + set_rom(reg->base(), reg->bytes()); + else { + UINT32 end = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1; + space().unmap_read(0, end); + } + } +} + diff --git a/src/emu/dirom.h b/src/emu/dirom.h new file mode 100644 index 00000000000..900b5a09517 --- /dev/null +++ b/src/emu/dirom.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + dirom.h + + Interface to a rom, either through a memory map or a region + +***************************************************************************/ + +#pragma once + +#ifndef __EMU_H__ +#error Dont include this file directly; include emu.h instead. +#endif + +#ifndef __DIROM_H__ +#define __DIROM_H__ + +class device_rom_interface : public device_memory_interface +{ +public: + device_rom_interface(const machine_config &mconfig, device_t &device, UINT8 addrwidth, endianness_t endian = ENDIANNESS_LITTLE, UINT8 datawidth = 8); + virtual ~device_rom_interface(); + + inline UINT8 read_byte(offs_t byteaddress) { return m_rom_direct->read_byte(byteaddress); } + inline UINT16 read_word(offs_t byteaddress) { return m_rom_direct->read_word(byteaddress); } + inline UINT32 read_dword(offs_t byteaddress) { return m_rom_direct->read_dword(byteaddress); } + inline UINT64 read_qword(offs_t byteaddress) { return m_rom_direct->read_qword(byteaddress); } + + void set_rom(const void *base, UINT32 size); + +private: + const address_space_config m_rom_config; + direct_read_data *m_rom_direct; + + virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override; + virtual void interface_pre_start() override; + + DECLARE_READ8_MEMBER(z8_r); + DECLARE_READ16_MEMBER(z16_r); + DECLARE_READ32_MEMBER(z32_r); + DECLARE_READ64_MEMBER(z64_r); +}; + +#endif diff --git a/src/emu/emu.h b/src/emu/emu.h index 54a3b2787ad..6424c4efec5 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -67,6 +67,7 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_ #include "devfind.h" #include "distate.h" #include "dimemory.h" +#include "dirom.h" #include "diexec.h" #include "opresolv.h" #include "digfx.h" |