summaryrefslogtreecommitdiffstats
path: root/src/mame/machine/bert.cpp
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:42 +0200
committer Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:57 +0200
commit22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch)
tree3cf84032cc6482d685a8dbb57e015bd17c7f7fdc /src/mame/machine/bert.cpp
parente42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (diff)
emumem: A little more speedup. cache and specific change syntax, and are not pointers anymore [O. Galibert]
The last(?) two changes are: - Add a template parameter to everything (theoretically the address space width, in practice a level derived from it to keep as much compatibility between widths as possible) so that the shift size becomes a constant. - Change the syntax of declaring and initializing the caches and specifics so that they're embedded in the owner device. Solves lifetime issues and also removes one indirection (looking up the base dispatch pointer through the cache/specific pointer).
Diffstat (limited to 'src/mame/machine/bert.cpp')
-rw-r--r--src/mame/machine/bert.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mame/machine/bert.cpp b/src/mame/machine/bert.cpp
index 4311a861e65..b175a3efad7 100644
--- a/src/mame/machine/bert.cpp
+++ b/src/mame/machine/bert.cpp
@@ -16,7 +16,6 @@ DEFINE_DEVICE_TYPE(BERT, bert_device, "ncd_bert_asic", "NCD BERT ASIC")
bert_device::bert_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, BERT, tag, owner, clock)
, m_memory_space(*this, finder_base::DUMMY_TAG, 24, 16)
- , m_memory(nullptr)
{
}
@@ -27,7 +26,7 @@ void bert_device::device_start()
save_item(NAME(m_step));
save_item(NAME(m_qlc_mode));
save_item(NAME(m_qlc_src));
- m_memory = m_memory_space->cache<1, 0, ENDIANNESS_BIG>();
+ m_memory_space->cache(m_memory);
}
void bert_device::device_reset()
@@ -57,7 +56,7 @@ u16 bert_device::read(offs_t offset)
}
constexpr u16 type = 0x00ca;
- u16 data = m_memory->read_word(offset << 1);
+ u16 data = m_memory.read_word(offset << 1);
u16 res;
if(type & (1 << (((m_control >> 8) & 0xc) | m_step))) {
@@ -82,12 +81,12 @@ void bert_device::write(offs_t offset, u16 data, u16 mem_mask)
if(m_qlc_mode) {
u32 dest = offset << 1;
for(u32 i=0; i<512; i+=2)
- m_memory->write_word(dest + i, m_memory->read_word(m_qlc_src + i));
+ m_memory.write_word(dest + i, m_memory.read_word(m_qlc_src + i));
return;
}
m_step = 0;
- m_memory->write_word(offset << 1, data, mem_mask);
+ m_memory.write_word(offset << 1, data, mem_mask);
if(!offset) {
COMBINE_DATA(&m_control);
m_step = 0;