summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
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/emu
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/emu')
-rw-r--r--src/emu/dirom.cpp285
-rw-r--r--src/emu/dirom.h30
-rw-r--r--src/emu/dirom.ipp109
-rw-r--r--src/emu/emu.h1
-rw-r--r--src/emu/emufwd.h1
-rw-r--r--src/emu/emumem.cpp317
-rw-r--r--src/emu/emumem.h222
-rw-r--r--src/emu/emumem_hea.h4
-rw-r--r--src/emu/emumem_hedp.cpp64
-rw-r--r--src/emu/emumem_hedp.h40
-rw-r--r--src/emu/emumem_hedr.h7
-rw-r--r--src/emu/emumem_hedr.ipp59
-rw-r--r--src/emu/emumem_hedw.h7
-rw-r--r--src/emu/emumem_hedw.ipp59
-rw-r--r--src/emu/emumem_hem.cpp32
-rw-r--r--src/emu/emumem_hem.h16
-rw-r--r--src/emu/emumem_hep.cpp8
-rw-r--r--src/emu/emumem_hep.h4
-rw-r--r--src/emu/emumem_het.cpp12
-rw-r--r--src/emu/emumem_het.h8
-rw-r--r--src/emu/emumem_heu.cpp32
-rw-r--r--src/emu/emumem_heu.h8
-rw-r--r--src/emu/emumem_heun.cpp16
-rw-r--r--src/emu/emumem_heun.h16
-rw-r--r--src/emu/emumem_mud.cpp4
-rw-r--r--src/emu/emumem_mud.h2
26 files changed, 585 insertions, 778 deletions
diff --git a/src/emu/dirom.cpp b/src/emu/dirom.cpp
deleted file mode 100644
index 6440fa2cfc6..00000000000
--- a/src/emu/dirom.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert
-
-#include "emu.h"
-
-
-device_rom_interface::device_rom_interface(const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian, u8 datawidth) :
- device_memory_interface(mconfig, device),
- m_rom_tag(device.basetag()),
- m_rom_config("rom", endian, datawidth, addrwidth),
- m_bank(nullptr),
- m_cur_bank(-1)
-{
-}
-
-device_rom_interface::~device_rom_interface()
-{
-}
-
-device_memory_interface::space_config_vector device_rom_interface::memory_space_config() const
-{
- return space_config_vector {
- std::make_pair(0, &m_rom_config)
- };
-}
-
-void device_rom_interface::rom_bank_updated()
-{
-}
-
-void device_rom_interface::set_rom_bank(int bank)
-{
- if(!m_bank)
- emu_fatalerror("%s: device_rom_interface::set_rom_bank called without banking setup", device().tag());
-
- if(bank >= m_bank_count) {
- device().logerror("Warning: requested bank %x higher than actual bank count %x\n", bank, m_bank_count);
- bank = bank % m_bank_count;
- }
-
- if (m_cur_bank != bank) {
- m_cur_bank = bank;
- m_bank->set_entry(bank);
- rom_bank_updated();
- }
-}
-
-void device_rom_interface::interface_post_load()
-{
- if(m_bank)
- m_bank->set_entry(m_cur_bank);
-}
-
-void device_rom_interface::set_rom(const void *base, u32 size)
-{
- u32 mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1;
- u32 rend = size-1;
- m_bank_count = mend == 0xffffffff ? 1 : (rend+1) / (mend+1);
- if(m_bank_count < 1)
- m_bank_count = 1;
-
- if(rend >= mend) {
- space().install_read_bank(0, mend, device().tag());
- m_bank = device().machine().memory().banks().find(device().tag())->second.get();
- m_bank->configure_entries(0, m_bank_count, const_cast<void *>(base), mend+1);
- m_cur_bank = 0;
-
- } else {
- // Round up to the nearest power-of-two-minus-one
- u32 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()
-{
- if(!has_space(0))
- return;
-
- switch(space().data_width()) {
- case 8:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<0, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<0, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
-
- case 16:
- switch(space().addr_shift()) {
- case 3:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<1, 3, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<1, 3, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case 0:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<1, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<1, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -1:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<1, -1, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<1, -1, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- }
- break;
-
- case 32:
- switch(space().addr_shift()) {
- case 0:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<2, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<2, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -1:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<2, -1, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<2, -1, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -2:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<2, -2, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<2, -2, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- }
- break;
-
- case 64:
- switch(space().addr_shift()) {
- case 0:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -1:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, -1, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, -1, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -2:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, -2, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, -2, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -3:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, -3, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = nullptr;
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, -3, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = nullptr;
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- }
- break;
- }
-
- device().save_item(NAME(m_cur_bank));
- device().save_item(NAME(m_bank_count));
-
- if(!has_configured_map(0)) {
- memory_region *reg = device().owner()->memregion(m_rom_tag);
- if(reg)
- set_rom(reg->base(), reg->bytes());
- else {
- device().logerror("ROM region '%s' not found\n", m_rom_tag);
- u32 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
index 761e1d357ec..62566f433d3 100644
--- a/src/emu/dirom.h
+++ b/src/emu/dirom.h
@@ -10,25 +10,22 @@
#pragma once
-#ifndef __EMU_H__
-#error Dont include this file directly; include emu.h instead.
-#endif
-
#ifndef MAME_EMU_DIROM_H
#define MAME_EMU_DIROM_H
-class device_rom_interface : public device_memory_interface
+// Beware, DataWidth is 0-3
+template<int AddrWidth, int DataWidth = 0, int AddrShift = 0, endianness_t Endian = ENDIANNESS_LITTLE> class device_rom_interface : public device_memory_interface
{
public:
- device_rom_interface(const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian = ENDIANNESS_LITTLE, u8 datawidth = 8);
- virtual ~device_rom_interface();
+ device_rom_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_rom_interface() = default;
void set_device_rom_tag(const char *tag) { m_rom_tag = tag; }
- inline u8 read_byte(offs_t byteaddress) { return m_r8(byteaddress); }
- inline u16 read_word(offs_t byteaddress) { return m_r16(byteaddress); }
- inline u32 read_dword(offs_t byteaddress) { return m_r32(byteaddress); }
- inline u64 read_qword(offs_t byteaddress) { return m_r64(byteaddress); }
+ inline u8 read_byte(offs_t byteaddress) { return m_rom_cache.read_byte(byteaddress); }
+ inline u16 read_word(offs_t byteaddress) { return m_rom_cache.read_word(byteaddress); }
+ inline u32 read_dword(offs_t byteaddress) { return m_rom_cache.read_dword(byteaddress); }
+ inline u64 read_qword(offs_t byteaddress) { return m_rom_cache.read_qword(byteaddress); }
void set_rom(const void *base, u32 size);
void set_rom_bank(int bank);
@@ -37,17 +34,12 @@ protected:
virtual void rom_bank_updated() = 0;
virtual space_config_vector memory_space_config() const override;
- void set_rom_endianness(endianness_t endian) { assert(!device().configured()); m_rom_config.m_endianness = endian; }
- void set_rom_data_width(u8 width) { assert(!device().configured()); m_rom_config.m_data_width = width; }
- void set_rom_addr_width(u8 width) { assert(!device().configured()); m_rom_config.m_addr_width = m_rom_config.m_logaddr_width = width; }
+ void override_address_width(u8 width);
private:
const char *m_rom_tag;
address_space_config m_rom_config;
- std::function<u8 (offs_t)> m_r8;
- std::function<u16 (offs_t)> m_r16;
- std::function<u32 (offs_t)> m_r32;
- std::function<u64 (offs_t)> m_r64;
+ typename memory_access<AddrWidth, DataWidth, AddrShift, Endian>::cache m_rom_cache;
memory_bank *m_bank;
int m_cur_bank, m_bank_count;
@@ -56,4 +48,6 @@ private:
virtual void interface_post_load() override;
};
+#include "dirom.ipp"
+
#endif // MAME_EMU_DIROM_H
diff --git a/src/emu/dirom.ipp b/src/emu/dirom.ipp
new file mode 100644
index 00000000000..42447932df9
--- /dev/null
+++ b/src/emu/dirom.ipp
@@ -0,0 +1,109 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::device_rom_interface(const machine_config &mconfig, device_t &device) :
+ device_memory_interface(mconfig, device),
+ m_rom_tag(device.basetag()),
+ m_rom_config("rom", Endian, 8 << DataWidth, AddrWidth, AddrShift),
+ m_bank(nullptr),
+ m_cur_bank(-1)
+{
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::override_address_width(u8 width)
+{
+ // cach does not need level match, only specific does at this point
+ // if(emu::detail::handler_entry_dispatch_level(AddrWidth) != emu::detail::handler_entry_dispatch_level(width))
+ // emu_fatalerror("%s: Widths %d and %d are incompatible", device().tag(), width, AddrWidth);
+
+ m_rom_config.m_addr_width = width;
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+device_memory_interface::space_config_vector device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(0, &m_rom_config)
+ };
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::set_rom_bank(int bank)
+{
+ if(!m_bank)
+ emu_fatalerror("%s: device_rom_interface::set_rom_bank called without banking setup", device().tag());
+
+ if(bank >= m_bank_count) {
+ device().logerror("Warning: requested bank %x higher than actual bank count %x\n", bank, m_bank_count);
+ bank = bank % m_bank_count;
+ }
+
+ if (m_cur_bank != bank) {
+ m_cur_bank = bank;
+ m_bank->set_entry(bank);
+ rom_bank_updated();
+ }
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::interface_post_load()
+{
+ if(m_bank)
+ m_bank->set_entry(m_cur_bank);
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::set_rom(const void *base, u32 size)
+{
+ u32 mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1;
+ u32 rend = size-1;
+ m_bank_count = mend == 0xffffffff ? 1 : (rend+1) / (mend+1);
+ if(m_bank_count < 1)
+ m_bank_count = 1;
+
+ if(rend >= mend) {
+ space().install_read_bank(0, mend, device().tag());
+ m_bank = device().machine().memory().banks().find(device().tag())->second.get();
+ m_bank->configure_entries(0, m_bank_count, const_cast<void *>(base), mend+1);
+ m_cur_bank = 0;
+
+ } else {
+ // Round up to the nearest power-of-two-minus-one
+ u32 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));
+ }
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::interface_pre_start()
+{
+ if(!has_space(0))
+ return;
+
+ space().cache(m_rom_cache);
+
+ device().save_item(NAME(m_cur_bank));
+ device().save_item(NAME(m_bank_count));
+
+ if(!has_configured_map(0)) {
+ memory_region *reg = device().owner()->memregion(m_rom_tag);
+ if(reg)
+ set_rom(reg->base(), reg->bytes());
+ else {
+ device().logerror("ROM region '%s' not found\n", m_rom_tag);
+ u32 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/emu.h b/src/emu/emu.h
index 35a5d6a3f60..6e1d90ba82f 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -67,7 +67,6 @@
#include "addrmap.h" // Needs optional_device<> and required_device<>
#include "distate.h"
#include "dimemory.h"
-#include "dirom.h"
#include "opresolv.h"
#include "dipalette.h"
#include "digfx.h"
diff --git a/src/emu/emufwd.h b/src/emu/emufwd.h
index 97955067865..275d1fecedd 100644
--- a/src/emu/emufwd.h
+++ b/src/emu/emufwd.h
@@ -140,7 +140,6 @@ class driver_device;
// declared in emumem.h
class address_space;
-template<int Width, int AddrShift, int Endian> class memory_access_cache;
class memory_bank;
class memory_block;
class memory_manager;
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index e0cbaf6c828..e48b13d9a51 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -80,103 +80,103 @@ void handler_entry::enumerate_references(handler_entry::reflist &refs) const
{
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int Width, int AddrShift, endianness_t Endian> const handler_entry_read<Width, AddrShift, Endian> *const *handler_entry_read<Width, AddrShift, Endian>::get_dispatch() const
{
fatalerror("get_dispatch called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
{
fatalerror("lookup called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_read<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_read<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return nullptr;
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
fatalerror("detach called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int Width, int AddrShift, endianness_t Endian> const handler_entry_write<Width, AddrShift, Endian> *const *handler_entry_write<Width, AddrShift, Endian>::get_dispatch() const
{
fatalerror("get_dispatch called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
{
fatalerror("lookup called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_write<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_write<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return nullptr;
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
fatalerror("detach called on non-dispatching class\n");
}
@@ -283,12 +283,12 @@ const int MEMORY_BLOCK_CHUNK = 65536; // minimum chunk size of
// ======================> address_space_specific
// this is a derived class of address_space with specific width, endianness, and table size
-template<int Width, int AddrShift, endianness_t Endian>
+template<int Level, int Width, int AddrShift, endianness_t Endian>
class address_space_specific : public address_space
{
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using NativeType = uX;
- using this_type = address_space_specific<Width, AddrShift, Endian>;
+ using this_type = address_space_specific<Level, Width, AddrShift, Endian>;
// constants describing the native size
static constexpr u32 NATIVE_BYTES = 1 << Width;
@@ -299,10 +299,8 @@ class address_space_specific : public address_space
static constexpr offs_t offset_to_byte(offs_t offset) { return AddrShift < 0 ? offset << iabs(AddrShift) : offset >> iabs(AddrShift); }
public:
- handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
- handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
- u8 m_shift_read;
- u8 m_shift_write;
+ const handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
+ const handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
std::string get_handler_string(read_or_write readorwrite, offs_t byteaddress) const override;
void dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const override;
@@ -519,16 +517,22 @@ public:
default: fatalerror("Unhandled address bus width %d\n", address_width);
}
- m_root_read->get_dispatch(m_dispatch_read, m_shift_read);
- m_root_write->get_dispatch(m_dispatch_write, m_shift_write);
+ m_dispatch_read = m_root_read ->get_dispatch();
+ m_dispatch_write = m_root_write->get_dispatch();
}
- void *create_cache() override {
- return new memory_access_cache<Width, AddrShift, Endian>(*this, m_root_read, m_root_write);
+ std::pair<void *, void *> get_cache_info() override {
+ std::pair<void *, void *> rw;
+ rw.first = m_root_read;
+ rw.second = m_root_write;
+ return rw;
}
- void *create_specific() override {
- return new memory_access_specific<Width, AddrShift, Endian>(*this, m_dispatch_read, m_shift_read, m_dispatch_write, m_shift_write);
+ std::pair<const void *, const void *> get_specific_info() override {
+ std::pair<const void *, const void *> rw;
+ rw.first = m_dispatch_read;
+ rw.second = m_dispatch_write;
+ return rw;
}
void delayed_ref(handler_entry *e) {
@@ -595,25 +599,25 @@ public:
// native read
NativeType read_native(offs_t offset, NativeType mask)
{
- return dispatch_read<Width, AddrShift, Endian>(offs_t(-1), m_shift_read, offset & m_addrmask, mask, m_dispatch_read);
+ return dispatch_read<Level, Width, AddrShift, Endian>(m_addrmask, offset, mask, m_dispatch_read);;
}
// mask-less native read
NativeType read_native(offs_t offset)
{
- return dispatch_read<Width, AddrShift, Endian>(offs_t(-1), m_shift_read, offset & m_addrmask, uX(0xffffffffffffffffU), m_dispatch_read);
+ return dispatch_read<Level, Width, AddrShift, Endian>(m_addrmask, offset, uX(0xffffffffffffffffU), m_dispatch_read);
}
// native write
void write_native(offs_t offset, NativeType data, NativeType mask)
{
- dispatch_write<Width, AddrShift, Endian>(offs_t(-1), m_shift_write, offset & m_addrmask, data, mask, m_dispatch_write);
+ dispatch_write<Level, Width, AddrShift, Endian>(m_addrmask, offset, data, mask, m_dispatch_write);;
}
// mask-less native write
void write_native(offs_t offset, NativeType data)
{
- dispatch_write<Width, AddrShift, Endian>(offs_t(-1), m_shift_write, offset & m_addrmask, data, uX(0xffffffffffffffffU), m_dispatch_write);
+ dispatch_write<Level, Width, AddrShift, Endian>(m_addrmask, offset, data, uX(0xffffffffffffffffU), m_dispatch_write);;
}
// virtual access to these functions
@@ -907,92 +911,69 @@ void memory_manager::allocate(device_memory_interface &memory)
address_space_config const *const spaceconfig = memory.space_config(spacenum);
if (spaceconfig)
{
+ int level = emu::detail::handler_entry_dispatch_level(spaceconfig->addr_width());
// allocate one of the appropriate type
- switch (spaceconfig->data_width() | (spaceconfig->addr_shift() + 4))
+ switch ((level << 8) | (spaceconfig->endianness() == ENDIANNESS_BIG ? 0x1000 : 0) |spaceconfig->data_width() | (spaceconfig->addr_shift() + 4))
{
- case 8|(4+1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<0, 1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<0, 1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 8|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<0, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<0, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 16|(4+3):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<1, 3, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<1, 3, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 16|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<1, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<1, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 16|(4-1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<1, -1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<1, -1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 32|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<2, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<2, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 32|(4-1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<2, -1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<2, -1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 32|(4-2):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<2, -2, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<2, -2, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, -1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, -1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-2):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, -2, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, -2, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-3):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, -3, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, -3, ENDIANNESS_BIG >>(*this, spacenum);
- break;
+ case 0x0000|0x000| 8|(4+1): memory.allocate<address_space_specific<0, 0, 1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000| 8|(4+1): memory.allocate<address_space_specific<0, 0, 1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100| 8|(4+1): memory.allocate<address_space_specific<1, 0, 1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100| 8|(4+1): memory.allocate<address_space_specific<1, 0, 1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000| 8|(4-0): memory.allocate<address_space_specific<0, 0, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000| 8|(4-0): memory.allocate<address_space_specific<0, 0, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100| 8|(4-0): memory.allocate<address_space_specific<1, 0, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100| 8|(4-0): memory.allocate<address_space_specific<1, 0, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|16|(4+3): memory.allocate<address_space_specific<0, 1, 3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|16|(4+3): memory.allocate<address_space_specific<0, 1, 3, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|16|(4+3): memory.allocate<address_space_specific<1, 1, 3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|16|(4+3): memory.allocate<address_space_specific<1, 1, 3, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|16|(4-0): memory.allocate<address_space_specific<0, 1, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|16|(4-0): memory.allocate<address_space_specific<0, 1, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|16|(4-0): memory.allocate<address_space_specific<1, 1, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|16|(4-0): memory.allocate<address_space_specific<1, 1, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|16|(4-1): memory.allocate<address_space_specific<0, 1, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|16|(4-1): memory.allocate<address_space_specific<0, 1, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|16|(4-1): memory.allocate<address_space_specific<1, 1, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|16|(4-1): memory.allocate<address_space_specific<1, 1, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|32|(4-0): memory.allocate<address_space_specific<0, 2, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|32|(4-0): memory.allocate<address_space_specific<0, 2, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|32|(4-0): memory.allocate<address_space_specific<1, 2, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|32|(4-0): memory.allocate<address_space_specific<1, 2, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|32|(4-1): memory.allocate<address_space_specific<0, 2, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|32|(4-1): memory.allocate<address_space_specific<0, 2, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|32|(4-1): memory.allocate<address_space_specific<1, 2, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|32|(4-1): memory.allocate<address_space_specific<1, 2, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|32|(4-2): memory.allocate<address_space_specific<0, 2, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|32|(4-2): memory.allocate<address_space_specific<0, 2, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|32|(4-2): memory.allocate<address_space_specific<1, 2, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|32|(4-2): memory.allocate<address_space_specific<1, 2, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-0): memory.allocate<address_space_specific<0, 3, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-0): memory.allocate<address_space_specific<0, 3, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-0): memory.allocate<address_space_specific<1, 3, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-0): memory.allocate<address_space_specific<1, 3, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-1): memory.allocate<address_space_specific<0, 3, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-1): memory.allocate<address_space_specific<0, 3, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-1): memory.allocate<address_space_specific<1, 3, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-1): memory.allocate<address_space_specific<1, 3, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-2): memory.allocate<address_space_specific<0, 3, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-2): memory.allocate<address_space_specific<0, 3, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-2): memory.allocate<address_space_specific<1, 3, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-2): memory.allocate<address_space_specific<1, 3, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-3): memory.allocate<address_space_specific<0, 3, -3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-3): memory.allocate<address_space_specific<0, 3, -3, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-3): memory.allocate<address_space_specific<1, 3, -3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-3): memory.allocate<address_space_specific<1, 3, -3, ENDIANNESS_BIG >>(*this, spacenum); break;
default:
throw emu_fatalerror("Invalid width %d/shift %d specified for address_space::allocate", spaceconfig->data_width(), spaceconfig->addr_shift());
@@ -1885,7 +1866,7 @@ memory_passthrough_handler *address_space::install_readwrite_tap(offs_t addrstar
// describing the handler at a particular offset
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> std::string address_space_specific<Width, AddrShift, Endian>::get_handler_string(read_or_write readorwrite, offs_t address) const
+template<int Level, int Width, int AddrShift, endianness_t Endian> std::string address_space_specific<Level, Width, AddrShift, Endian>::get_handler_string(read_or_write readorwrite, offs_t address) const
{
if (readorwrite == read_or_write::READ) {
offs_t start, end;
@@ -1900,7 +1881,7 @@ template<int Width, int AddrShift, endianness_t Endian> std::string address_spac
}
}
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const
{
read_map.clear();
write_map.clear();
@@ -1917,7 +1898,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// unmap - unmap a section of address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet)
{
VPRINTF(("address_space::unmap(%s-%s mirror=%s, %s, %s)\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -1949,7 +1930,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// install_read_tap - install a read tap on the bus
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Width, AddrShift, Endian>::install_read_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
+template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Level, Width, AddrShift, Endian>::install_read_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
{
offs_t nstart, nend, nmask, nmirror;
check_optimize_mirror("install_read_tap", addrstart, addrend, addrmirror, nstart, nend, nmask, nmirror);
@@ -1971,7 +1952,7 @@ template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handl
// install_write_tap - install a write tap on the bus
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Width, AddrShift, Endian>::install_write_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
+template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Level, Width, AddrShift, Endian>::install_write_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
{
offs_t nstart, nend, nmask, nmirror;
check_optimize_mirror("install_write_tap", addrstart, addrend, addrmirror, nstart, nend, nmask, nmirror);
@@ -1992,7 +1973,7 @@ template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handl
// install_write_tap - install a read and a write tap on the bus
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Width, AddrShift, Endian>::install_readwrite_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapr, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapw, memory_passthrough_handler *mph)
+template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Level, Width, AddrShift, Endian>::install_readwrite_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapr, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapw, memory_passthrough_handler *mph)
{
offs_t nstart, nend, nmask, nmirror;
check_optimize_mirror("install_readwrite_tap", addrstart, addrend, addrmirror, nstart, nend, nmask, nmirror);
@@ -2023,7 +2004,7 @@ template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handl
// of a live device into this address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth)
{
check_address("install_device_delegate", addrstart, addrend);
address_map map(*this, addrstart, addrend, unitmask, cswidth, m_device, delegate);
@@ -2038,7 +2019,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// handler into this address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
{
VPRINTF(("address_space::install_readwrite_port(%s-%s mirror=%s, read=\"%s\" / write=\"%s\")\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2082,7 +2063,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// mapping to a particular bank
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
{
VPRINTF(("address_space::install_readwrite_bank(%s-%s mirror=%s, read=\"%s\" / write=\"%s\")\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2118,7 +2099,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
}
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank)
{
VPRINTF(("address_space::install_readwrite_bank(%s-%s mirror=%s, read=\"%s\" / write=\"%s\")\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2153,7 +2134,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// RAM region into the given address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
{
VPRINTF(("address_space::install_ram_generic(%s-%s mirror=%s, %s, %p)\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2370,80 +2351,6 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
//**************************************************************************
-// CACHE MEMORY RANGES
-//**************************************************************************
-
-//-------------------------------------------------
-// memory_access_cache - constructor
-//-------------------------------------------------
-
-template<int Width, int AddrShift, int Endian> memory_access_cache<Width, AddrShift, Endian>::memory_access_cache(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *root_read,
- handler_entry_write<Width, AddrShift, Endian> *root_write)
- : m_space(space),
- m_addrmask(space.addrmask()),
- m_addrstart_r(1),
- m_addrend_r(0),
- m_addrstart_w(1),
- m_addrend_w(0),
- m_cache_r(nullptr),
- m_cache_w(nullptr),
- m_root_read(root_read),
- m_root_write(root_write)
-{
- m_notifier_id = space.add_change_notifier([this](read_or_write mode) {
- if(u32(mode) & u32(read_or_write::READ)) {
- m_addrend_r = 0;
- m_addrstart_r = 1;
- m_cache_r = nullptr;
- }
- if(u32(mode) & u32(read_or_write::WRITE)) {
- m_addrend_w = 0;
- m_addrstart_w = 1;
- m_cache_w = nullptr;
- }
- });
-}
-
-
-//-------------------------------------------------
-// ~memory_access_cache - destructor
-//-------------------------------------------------
-
-template<int Width, int AddrShift, int Endian> memory_access_cache<Width, AddrShift, Endian>::~memory_access_cache()
-{
- m_space.remove_change_notifier(m_notifier_id);
-}
-
-
-template class memory_access_cache<0, 1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<0, 1, ENDIANNESS_BIG>;
-template class memory_access_cache<0, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<0, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<1, 3, ENDIANNESS_LITTLE>;
-template class memory_access_cache<1, 3, ENDIANNESS_BIG>;
-template class memory_access_cache<1, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<1, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<1, -1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<1, -1, ENDIANNESS_BIG>;
-template class memory_access_cache<2, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<2, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<2, -1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<2, -1, ENDIANNESS_BIG>;
-template class memory_access_cache<2, -2, ENDIANNESS_LITTLE>;
-template class memory_access_cache<2, -2, ENDIANNESS_BIG>;
-template class memory_access_cache<3, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<3, -1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, -1, ENDIANNESS_BIG>;
-template class memory_access_cache<3, -2, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, -2, ENDIANNESS_BIG>;
-template class memory_access_cache<3, -3, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, -3, ENDIANNESS_BIG>;
-
-
-
-//**************************************************************************
// MEMORY BLOCK
//**************************************************************************
diff --git a/src/emu/emumem.h b/src/emu/emumem.h
index 995a09a1606..4554bea5ed6 100644
--- a/src/emu/emumem.h
+++ b/src/emu/emumem.h
@@ -438,6 +438,16 @@ template<> struct handler_entry_size<3> { using uX = u64; };
// =====================-> Address segmentation for the search tree
+constexpr int handler_entry_dispatch_level(int highbits)
+{
+ return (highbits > 48) ? 3 : (highbits > 32) ? 2 : (highbits > 14) ? 1 : 0;
+}
+
+constexpr int handler_entry_dispatch_level_to_lowbits(int level, int width, int ashift)
+{
+ return level == 3 ? 48 : level == 2 ? 32 : level == 1 ? 14 : width + ashift;
+}
+
constexpr int handler_entry_dispatch_lowbits(int highbits, int width, int ashift)
{
return (highbits > 48) ? 48 :
@@ -451,7 +461,7 @@ constexpr int handler_entry_dispatch_lowbits(int highbits, int width, int ashift
// ======================> memory_units_descritor forwards declaration
-template<int Width, int AddrShift, int Endian> class memory_units_descriptor;
+template<int Width, int AddrShift, endianness_t Endian> class memory_units_descriptor;
@@ -463,7 +473,7 @@ class handler_entry
{
DISABLE_COPYING(handler_entry);
- template<int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
+ template<int Level, int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
public:
// Typing flags
@@ -535,9 +545,9 @@ protected:
// Provides the populate/read/get_ptr/lookup API
-template<int Width, int AddrShift, int Endian> class handler_entry_read_passthrough;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_passthrough;
-template<int Width, int AddrShift, int Endian> class handler_entry_read : public handler_entry
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read : public handler_entry
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -553,7 +563,7 @@ public:
handler_entry_read(address_space *space, u32 flags) : handler_entry(space, flags) {}
~handler_entry_read() {}
- virtual uX read(offs_t offset, uX mem_mask) = 0;
+ virtual uX read(offs_t offset, uX mem_mask) const = 0;
virtual void *get_ptr(offs_t offset) const;
virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const;
@@ -599,16 +609,16 @@ public:
virtual void detach(const std::unordered_set<handler_entry *> &handlers);
// Return the internal structures of the root dispatch
- virtual void get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const;
+ virtual const handler_entry_read<Width, AddrShift, Endian> *const *get_dispatch() const;
};
// =====================-> The parent class of all write handlers
// Provides the populate/write/get_ptr/lookup API
-template<int Width, int AddrShift, int Endian> class handler_entry_write_passthrough;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_passthrough;
-template<int Width, int AddrShift, int Endian> class handler_entry_write : public handler_entry
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write : public handler_entry
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -624,7 +634,7 @@ public:
handler_entry_write(address_space *space, u32 flags) : handler_entry(space, flags) {}
virtual ~handler_entry_write() {}
- virtual void write(offs_t offset, uX data, uX mem_mask) = 0;
+ virtual void write(offs_t offset, uX data, uX mem_mask) const = 0;
virtual void *get_ptr(offs_t offset) const;
virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const;
@@ -671,14 +681,14 @@ public:
virtual void detach(const std::unordered_set<handler_entry *> &handlers);
// Return the internal structures of the root dispatch
- virtual void get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const;
+ virtual const handler_entry_write<Width, AddrShift, Endian> *const *get_dispatch() const;
};
// =====================-> Passthrough handler management structure
class memory_passthrough_handler
{
- template<int Width, int AddrShift, int Endian> friend class handler_entry_read_passthrough;
- template<int Width, int AddrShift, int Endian> friend class handler_entry_write_passthrough;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_read_passthrough;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_write_passthrough;
public:
memory_passthrough_handler(address_space &space) : m_space(space) {}
@@ -695,8 +705,8 @@ private:
// =====================-> Forward declaration for address_space
-template<int Width, int AddrShift, int Endian> class handler_entry_read_unmapped;
-template<int Width, int AddrShift, int Endian> class handler_entry_write_unmapped;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_unmapped;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_unmapped;
// ======================> address offset -> byte offset
@@ -705,7 +715,7 @@ constexpr offs_t memory_offset_to_byte(offs_t offset, int AddrShift) { return Ad
// ======================> generic read/write decomposition routines
// generic direct read
-template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> typename emu::detail::handler_entry_size<TargetWidth>::uX memory_read_generic(T rop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Aligned, typename T> typename emu::detail::handler_entry_size<TargetWidth>::uX memory_read_generic(T rop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using TargetType = typename emu::detail::handler_entry_size<TargetWidth>::uX;
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
@@ -839,7 +849,7 @@ template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, ty
}
// generic direct write
-template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> void memory_write_generic(T wop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX data, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Aligned, typename T> void memory_write_generic(T wop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX data, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
@@ -964,15 +974,17 @@ template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, ty
// ======================> Direct dispatching
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX dispatch_read(offs_t mask, u8 shift, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX mem_mask, handler_entry_read<Width, AddrShift, Endian> *const *dispatch)
+template<int Level, int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX dispatch_read(offs_t mask, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX mem_mask, const handler_entry_read<Width, AddrShift, Endian> *const *dispatch)
{
- return dispatch[(offset >> shift) & mask]->read(offset, mem_mask);
+ static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_level_to_lowbits(Level, Width, AddrShift);
+ return dispatch[(offset & mask) >> LowBits]->read(offset, mem_mask);
}
-template<int Width, int AddrShift, int Endian> void dispatch_write(offs_t mask, u8 shift, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mem_mask, handler_entry_write<Width, AddrShift, Endian> *const *dispatch)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void dispatch_write(offs_t mask, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mem_mask, const handler_entry_write<Width, AddrShift, Endian> *const *dispatch)
{
- return dispatch[(offset >> shift) & mask]->write(offset, data, mem_mask);
+ static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_level_to_lowbits(Level, Width, AddrShift);
+ return dispatch[(offset & mask) >> LowBits]->write(offset, data, mem_mask);
}
@@ -980,21 +992,29 @@ template<int Width, int AddrShift, int Endian> void dispatch_write(offs_t mask,
// memory_access_specific does uncached but faster accesses by shortcutting the address_space virtual call
-template<int Width, int AddrShift, int Endian> class memory_access_specific
+namespace emu { namespace detail {
+
+template<int Level, int Width, int AddrShift, endianness_t Endian> class memory_access_specific
{
+ friend class ::address_space;
+
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
static constexpr u32 NATIVE_BYTES = 1 << Width;
static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0;
public:
// construction/destruction
- memory_access_specific(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *const *dispatch_read, u8 shift_read,
- handler_entry_write<Width, AddrShift, Endian> *const *dispatch_write, u8 shift_write);
-
+ memory_access_specific()
+ : m_space(nullptr),
+ m_addrmask(0),
+ m_dispatch_read(nullptr),
+ m_dispatch_write(nullptr)
+ {
+ }
- // getters
- address_space &space() const { return m_space; }
+ inline address_space &space() const {
+ return *m_space;
+ }
u8 read_byte(offs_t address) { return Width == 0 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xff); }
u16 read_word(offs_t address) { return Width == 1 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
@@ -1025,22 +1045,22 @@ public:
void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
private:
- address_space & m_space;
+ address_space * m_space;
offs_t m_addrmask; // address mask
- handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
- handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
- u8 m_shift_read;
- u8 m_shift_write;
+ const handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
+ const handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
NativeType read_native(offs_t address, NativeType mask = ~NativeType(0)) {
- return dispatch_read<Width, AddrShift, Endian>(offs_t(-1), m_shift_read, address & m_addrmask, mask, m_dispatch_read);
+ return dispatch_read<Level, Width, AddrShift, Endian>(m_addrmask, address, mask, m_dispatch_read);;
}
void write_native(offs_t address, NativeType data, NativeType mask = ~NativeType(0)) {
- dispatch_write<Width, AddrShift, Endian>(offs_t(-1), m_shift_write, address & m_addrmask, data, mask, m_dispatch_write);
+ dispatch_write<Level, Width, AddrShift, Endian>(m_addrmask, address, data, mask, m_dispatch_write);;
}
+
+ void set(address_space *space, std::pair<const void *, const void *> rw);
};
@@ -1048,23 +1068,32 @@ private:
// ======================> memory_access_cache
// memory_access_cache contains state data for cached access
-template<int Width, int AddrShift, int Endian> class memory_access_cache
+template<int Width, int AddrShift, endianness_t Endian> class memory_access_cache
{
+ friend class ::address_space;
+
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
static constexpr u32 NATIVE_BYTES = 1 << Width;
static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0;
public:
// construction/destruction
- memory_access_cache(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *root_read,
- handler_entry_write<Width, AddrShift, Endian> *root_write);
+ memory_access_cache()
+ : m_space(nullptr),
+ m_addrmask(0),
+ m_addrstart_r(1),
+ m_addrend_r(0),
+ m_addrstart_w(1),
+ m_addrend_w(0),
+ m_cache_r(nullptr),
+ m_cache_w(nullptr),
+ m_root_read(nullptr),
+ m_root_write(nullptr)
+ {
+ }
~memory_access_cache();
- // getters
- address_space &space() const { return m_space; }
-
// see if an address is within bounds, update it if not
void check_address_r(offs_t address) {
if(address >= m_addrstart_r && address <= m_addrend_r)
@@ -1080,6 +1109,10 @@ public:
// accessor methods
+ inline address_space &space() const {
+ return *m_space;
+ }
+
void *read_ptr(offs_t address) {
address &= m_addrmask;
check_address_r(address);
@@ -1115,7 +1148,7 @@ public:
void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
private:
- address_space & m_space;
+ address_space * m_space;
int m_notifier_id; // id to remove the notifier on destruction
@@ -1124,7 +1157,7 @@ private:
offs_t m_addrend_r; // maximum valid address for reading
offs_t m_addrstart_w; // minimum valid address for writing
offs_t m_addrend_w; // maximum valid address for writing
- handler_entry_read<Width, AddrShift, Endian> *m_cache_r; // read cache
+ handler_entry_read <Width, AddrShift, Endian> *m_cache_r; // read cache
handler_entry_write<Width, AddrShift, Endian> *m_cache_w; // write cache
handler_entry_read <Width, AddrShift, Endian> *m_root_read; // decode tree roots
@@ -1132,9 +1165,23 @@ private:
NativeType read_native(offs_t address, NativeType mask = ~NativeType(0));
void write_native(offs_t address, NativeType data, NativeType mask = ~NativeType(0));
+
+ void set(address_space *space, std::pair<void *, void *> rw);
+};
+}}
+
+
+// ======================> memory_access cache/specific type dispatcher
+
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> struct memory_access {
+ static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
+
+ using cache = emu::detail::memory_access_cache<Width, AddrShift, Endian>;
+ using specific = emu::detail::memory_access_specific<Level, Width, AddrShift, Endian>;
};
+
// ======================> address_space_config
// describes an address space and provides basic functions to map addresses to bytes
@@ -1190,9 +1237,8 @@ class address_space
{
friend class memory_bank;
friend class memory_block;
- template<int Width, int AddrShift, int Endian> friend class handler_entry_read_unmapped;
- template<int Width, int AddrShift, int Endian> friend class handler_entry_write_unmapped;
- template<int Width, int AddrShift, int Endian> friend class memory_access_cache;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_read_unmapped;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_write_unmapped;
struct notifier_t {
std::function<void (read_or_write)> m_notifier;
@@ -1212,7 +1258,7 @@ public:
int spacenum() const { return m_spacenum; }
address_map *map() const { return m_map.get(); }
- template<int Width, int AddrShift, int Endian> memory_access_cache<Width, AddrShift, Endian> *cache() {
+ template<int Width, int AddrShift, endianness_t Endian> void cache(emu::detail::memory_access_cache<Width, AddrShift, Endian> &v) {
if(AddrShift != m_config.addr_shift())
fatalerror("Requesting cache() with address shift %d while the config says %d\n", AddrShift, m_config.addr_shift());
if(8 << Width != m_config.data_width())
@@ -1221,19 +1267,21 @@ public:
fatalerror("Requesting cache() with endianness %s while the config says %s\n",
endianness_names[Endian], endianness_names[m_config.endianness()]);
- return static_cast<memory_access_cache<Width, AddrShift, Endian> *>(create_cache());
+ v.set(this, get_cache_info());
}
- template<int Width, int AddrShift, int Endian> memory_access_specific<Width, AddrShift, Endian> *specific() {
+ template<int Level, int Width, int AddrShift, endianness_t Endian> void specific(emu::detail::memory_access_specific<Level, Width, AddrShift, Endian> &v) {
+ if(Level != emu::detail::handler_entry_dispatch_level(m_config.addr_width()))
+ fatalerror("Requesting specific() with wrong level, bad address witdh (the config says %d\n", m_config.addr_width());
if(AddrShift != m_config.addr_shift())
- fatalerror("Requesting cache() with address shift %d while the config says %d\n", AddrShift, m_config.addr_shift());
+ fatalerror("Requesting specific() with address shift %d while the config says %d\n", AddrShift, m_config.addr_shift());
if(8 << Width != m_config.data_width())
- fatalerror("Requesting cache() with data width %d while the config says %d\n", 8 << Width, m_config.data_width());
+ fatalerror("Requesting specific() with data width %d while the config says %d\n", 8 << Width, m_config.data_width());
if(Endian != m_config.endianness())
- fatalerror("Requesting cache() with endianness %s while the config says %s\n",
+ fatalerror("Requesting spefific() with endianness %s while the config says %s\n",
endianness_names[Endian], endianness_names[m_config.endianness()]);
- return static_cast<memory_access_specific<Width, AddrShift, Endian> *>(create_specific());
+ v.set(this, get_specific_info());
}
int add_change_notifier(std::function<void (read_or_write)> n);
@@ -1551,13 +1599,13 @@ public:
void allocate_memory();
void locate_memory();
- template<int Width, int AddrShift, int Endian> handler_entry_read_unmapped <Width, AddrShift, Endian> *get_unmap_r() const { return static_cast<handler_entry_read_unmapped <Width, AddrShift, Endian> *>(m_unmap_r); }
- template<int Width, int AddrShift, int Endian> handler_entry_write_unmapped<Width, AddrShift, Endian> *get_unmap_w() const { return static_cast<handler_entry_write_unmapped<Width, AddrShift, Endian> *>(m_unmap_w); }
+ template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_unmapped <Width, AddrShift, Endian> *get_unmap_r() const { return static_cast<handler_entry_read_unmapped <Width, AddrShift, Endian> *>(m_unmap_r); }
+ template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_unmapped<Width, AddrShift, Endian> *get_unmap_w() const { return static_cast<handler_entry_write_unmapped<Width, AddrShift, Endian> *>(m_unmap_w); }
protected:
// internal helpers
- virtual void *create_cache() = 0;
- virtual void *create_specific() = 0;
+ virtual std::pair<void *, void *> get_cache_info() = 0;
+ virtual std::pair<const void *, const void *> get_specific_info() = 0;
void populate_map_entry(const address_map_entry &entry, read_or_write readorwrite);
virtual void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet) = 0;
@@ -1797,7 +1845,7 @@ private:
class memory_manager
{
friend class address_space;
- template<int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
+ template<int Level, int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
friend memory_region::memory_region(running_machine &machine, const char *name, u32 length, u8 width, endianness_t endian);
public:
// construction/destruction
@@ -1913,14 +1961,19 @@ private:
#define QWORD_ALIGNED(a) (((a) & 7) == 0)
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX memory_access_cache<Width, AddrShift, Endian>::read_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian>
+typename emu::detail::handler_entry_size<Width>::uX
+emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+read_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX mask)
{
address &= m_addrmask;
check_address_r(address);
return m_cache_r->read(address, mask);
}
-template<int Width, int AddrShift, int Endian> void memory_access_cache<Width, AddrShift, Endian>::write_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian>
+void emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+write_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mask)
{
address &= m_addrmask;
check_address_w(address);
@@ -1932,16 +1985,47 @@ void memory_passthrough_handler::remove()
m_space.remove_passthrough(m_handlers);
}
-template<int Width, int AddrShift, int Endian> memory_access_specific<Width, AddrShift, Endian>::memory_access_specific(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *const *dispatch_read, u8 shift_read,
- handler_entry_write<Width, AddrShift, Endian> *const *dispatch_write, u8 shift_write)
- : m_space(space),
- m_addrmask(space.addrmask()),
- m_dispatch_read(dispatch_read),
- m_dispatch_write(dispatch_write),
- m_shift_read(shift_read),
- m_shift_write(shift_write)
+
+template<int Level, int Width, int AddrShift, endianness_t Endian>
+void emu::detail::memory_access_specific<Level, Width, AddrShift, Endian>::
+set(address_space *space, std::pair<const void *, const void *> rw)
+{
+ m_space = space;
+ m_addrmask = space->addrmask();
+ m_dispatch_read = (const handler_entry_read <Width, AddrShift, Endian> *const *)(rw.first);
+ m_dispatch_write = (const handler_entry_write<Width, AddrShift, Endian> *const *)(rw.second);
+}
+
+
+template<int Width, int AddrShift, endianness_t Endian>
+void emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+set(address_space *space, std::pair<void *, void *> rw)
+{
+ m_space = space;
+ m_addrmask = space->addrmask();
+
+ m_notifier_id = space->add_change_notifier([this](read_or_write mode) {
+ if(u32(mode) & u32(read_or_write::READ)) {
+ m_addrend_r = 0;
+ m_addrstart_r = 1;
+ m_cache_r = nullptr;
+ }
+ if(u32(mode) & u32(read_or_write::WRITE)) {
+ m_addrend_w = 0;
+ m_addrstart_w = 1;
+ m_cache_w = nullptr;
+ }
+ });
+ m_root_read = (handler_entry_read <Width, AddrShift, Endian> *)(rw.first);
+ m_root_write = (handler_entry_write<Width, AddrShift, Endian> *)(rw.second);
+}
+
+template<int Width, int AddrShift, endianness_t Endian>
+emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+~memory_access_cache()
{
+ if(m_space)
+ m_space->remove_change_notifier(m_notifier_id);
}
#endif /* MAME_EMU_EMUMEM_H */
diff --git a/src/emu/emumem_hea.h b/src/emu/emumem_hea.h
index 2dfb4eb2426..d7120ea0fd8 100644
--- a/src/emu/emumem_hea.h
+++ b/src/emu/emumem_hea.h
@@ -5,7 +5,7 @@
// parent class for final handlers which want an address base and a mask
-template<int Width, int AddrShift, int Endian> class handler_entry_read_address : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_address : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -22,7 +22,7 @@ protected:
offs_t m_address_base, m_address_mask;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_address : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_address : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
diff --git a/src/emu/emumem_hedp.cpp b/src/emu/emumem_hedp.cpp
index ccaa4ed650e..9a71f98184b 100644
--- a/src/emu/emumem_hedp.cpp
+++ b/src/emu/emumem_hedp.cpp
@@ -5,142 +5,142 @@
#include "emumem_hea.h"
#include "emumem_hedp.h"
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8_delegate>::value ||
std::is_same<R, read16_delegate>::value ||
std::is_same<R, read32_delegate>::value ||
std::is_same<R, read64_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8m_delegate>::value ||
std::is_same<R, read16m_delegate>::value ||
std::is_same<R, read32m_delegate>::value ||
std::is_same<R, read64m_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8s_delegate>::value ||
std::is_same<R, read16s_delegate>::value ||
std::is_same<R, read32s_delegate>::value ||
std::is_same<R, read64s_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8sm_delegate>::value ||
std::is_same<R, read16sm_delegate>::value ||
std::is_same<R, read32sm_delegate>::value ||
std::is_same<R, read64sm_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8mo_delegate>::value ||
std::is_same<R, read16mo_delegate>::value ||
std::is_same<R, read32mo_delegate>::value ||
std::is_same<R, read64mo_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(*inh::m_space);
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8smo_delegate>::value ||
std::is_same<R, read16smo_delegate>::value ||
std::is_same<R, read32smo_delegate>::value ||
std::is_same<R, read64smo_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate();
}
-template<int Width, int AddrShift, int Endian, typename READ> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian, typename READ> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read(offs_t offset, uX mem_mask) const
{
return read_impl<READ>(offset, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, Endian, READ>::name() const
+template<int Width, int AddrShift, endianness_t Endian, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, Endian, READ>::name() const
{
return m_delegate.name();
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8_delegate>::value ||
std::is_same<W, write16_delegate>::value ||
std::is_same<W, write32_delegate>::value ||
std::is_same<W, write64_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8m_delegate>::value ||
std::is_same<W, write16m_delegate>::value ||
std::is_same<W, write32m_delegate>::value ||
std::is_same<W, write64m_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8s_delegate>::value ||
std::is_same<W, write16s_delegate>::value ||
std::is_same<W, write32s_delegate>::value ||
std::is_same<W, write64s_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8sm_delegate>::value ||
std::is_same<W, write16sm_delegate>::value ||
std::is_same<W, write32sm_delegate>::value ||
std::is_same<W, write64sm_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8mo_delegate>::value ||
std::is_same<W, write16mo_delegate>::value ||
std::is_same<W, write32mo_delegate>::value ||
std::is_same<W, write64mo_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(*inh::m_space, data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8smo_delegate>::value ||
std::is_same<W, write16smo_delegate>::value ||
std::is_same<W, write32smo_delegate>::value ||
std::is_same<W, write64smo_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> void handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> void handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write(offs_t offset, uX data, uX mem_mask) const
{
write_impl<WRITE>(offset, data, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::name() const
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::name() const
{
return m_delegate.name();
}
@@ -148,22 +148,22 @@ template<int Width, int AddrShift, int Endian, typename WRITE> std::string handl
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_ioport<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_ioport<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return m_port->read();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_ioport<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_ioport<Width, AddrShift, Endian>::name() const
{
return m_port->tag();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_ioport<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_ioport<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
m_port->write(data, mem_mask);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_ioport<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_ioport<Width, AddrShift, Endian>::name() const
{
return m_port->tag();
}
diff --git a/src/emu/emumem_hedp.h b/src/emu/emumem_hedp.h
index 37b47747d61..3cd1c646f17 100644
--- a/src/emu/emumem_hedp.h
+++ b/src/emu/emumem_hedp.h
@@ -5,7 +5,7 @@
// Executes an access through called a delegate, usually containing a handler or a lambda
-template<int Width, int AddrShift, int Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,7 +14,7 @@ public:
handler_entry_read_delegate(address_space *space, const READ &delegate) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {}
~handler_entry_read_delegate() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -26,45 +26,45 @@ private:
std::is_same<R, read16_delegate>::value ||
std::is_same<R, read32_delegate>::value ||
std::is_same<R, read64_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8m_delegate>::value ||
std::is_same<R, read16m_delegate>::value ||
std::is_same<R, read32m_delegate>::value ||
std::is_same<R, read64m_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8s_delegate>::value ||
std::is_same<R, read16s_delegate>::value ||
std::is_same<R, read32s_delegate>::value ||
std::is_same<R, read64s_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8sm_delegate>::value ||
std::is_same<R, read16sm_delegate>::value ||
std::is_same<R, read32sm_delegate>::value ||
std::is_same<R, read64sm_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8mo_delegate>::value ||
std::is_same<R, read16mo_delegate>::value ||
std::is_same<R, read32mo_delegate>::value ||
std::is_same<R, read64mo_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8smo_delegate>::value ||
std::is_same<R, read16smo_delegate>::value ||
std::is_same<R, read32smo_delegate>::value ||
std::is_same<R, read64smo_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
};
-template<int Width, int AddrShift, int Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -73,7 +73,7 @@ public:
handler_entry_write_delegate(address_space *space, const WRITE &delegate) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {}
~handler_entry_write_delegate() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
@@ -85,42 +85,42 @@ private:
std::is_same<W, write16_delegate>::value ||
std::is_same<W, write32_delegate>::value ||
std::is_same<W, write64_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8m_delegate>::value ||
std::is_same<W, write16m_delegate>::value ||
std::is_same<W, write32m_delegate>::value ||
std::is_same<W, write64m_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8s_delegate>::value ||
std::is_same<W, write16s_delegate>::value ||
std::is_same<W, write32s_delegate>::value ||
std::is_same<W, write64s_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8sm_delegate>::value ||
std::is_same<W, write16sm_delegate>::value ||
std::is_same<W, write32sm_delegate>::value ||
std::is_same<W, write64sm_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8mo_delegate>::value ||
std::is_same<W, write16mo_delegate>::value ||
std::is_same<W, write32mo_delegate>::value ||
std::is_same<W, write64mo_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8smo_delegate>::value ||
std::is_same<W, write16smo_delegate>::value ||
std::is_same<W, write32smo_delegate>::value ||
std::is_same<W, write64smo_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
};
@@ -128,7 +128,7 @@ private:
// Accesses an ioport
-template<int Width, int AddrShift, int Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -137,7 +137,7 @@ public:
handler_entry_read_ioport(address_space *space, ioport_port *port) : handler_entry_read<Width, AddrShift, Endian>(space, 0), m_port(port) {}
~handler_entry_read_ioport() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -145,7 +145,7 @@ private:
ioport_port *m_port;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -154,7 +154,7 @@ public:
handler_entry_write_ioport(address_space *space, ioport_port *port) : handler_entry_write<Width, AddrShift, Endian>(space, 0), m_port(port) {}
~handler_entry_write_ioport() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
diff --git a/src/emu/emumem_hedr.h b/src/emu/emumem_hedr.h
index 90dfab6d130..30e819bd990 100644
--- a/src/emu/emumem_hedr.h
+++ b/src/emu/emumem_hedr.h
@@ -5,7 +5,7 @@
// dispatches an access among multiple handlers indexed on part of the address
-template<int HighBits, int Width, int AddrShift, int Endian> class handler_entry_read_dispatch : public handler_entry_read<Width, AddrShift, Endian>
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> class handler_entry_read_dispatch : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -15,7 +15,7 @@ public:
handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift, Endian> *handler);
~handler_entry_read_dispatch();
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const override;
@@ -35,9 +35,10 @@ public:
void enumerate_references(handler_entry::reflist &refs) const override;
- virtual void get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const override;
+ virtual const handler_entry_read<Width, AddrShift, Endian> *const *get_dispatch() const override;
protected:
+ static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_lowbits(HighBits, Width, AddrShift);
static constexpr u32 BITCOUNT = HighBits > LowBits ? HighBits - LowBits : 0;
static constexpr u32 COUNT = 1 << BITCOUNT;
diff --git a/src/emu/emumem_hedr.ipp b/src/emu/emumem_hedr.ipp
index 1f4484d0a15..844cae6dd90 100644
--- a/src/emu/emumem_hedr.ipp
+++ b/src/emu/emumem_hedr.ipp
@@ -9,13 +9,12 @@
#include "emumem_hep.h"
#include "emumem_hedr.h"
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> const handler_entry_read<Width, AddrShift, Endian> *const *handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch() const
{
- dispatch = m_dispatch;
- shift = LowBits;
+ return m_dispatch;
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift, Endian> *handler) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift, Endian> *handler) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
{
if (!handler)
handler = space->get_unmap_r<Width, AddrShift, Endian>();
@@ -26,19 +25,19 @@ template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_read_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_read_dispatch()
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_read_dispatch()
{
for(unsigned int i=0; i != COUNT; i++)
m_dispatch[i]->unref();
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(unsigned int i=0; i != COUNT; i++)
refs.add(m_dispatch[i]);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
{
offs_t cur = map.empty() ? 0 : map.back().end + 1;
offs_t base = cur & UPMASK;
@@ -53,22 +52,22 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
- return dispatch_read<Width, AddrShift, Endian>(BITMASK, LowBits, offset, mem_mask, m_dispatch);
+ return dispatch_read<Level, Width, AddrShift, Endian>(HIGHMASK, offset, mem_mask, m_dispatch);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void *handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void *handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
- return m_dispatch[(offset >> LowBits) & BITMASK]->get_ptr(offset);
+ return m_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset);
}
-template<int HighBits, int Width, int AddrShift, int Endian> std::string handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::name() const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::name() const
{
return "dispatch";
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
{
offs_t slot = (address >> LowBits) & BITMASK;
auto h = m_dispatch[slot];
@@ -81,7 +80,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
{
while(--start >= 0) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -94,7 +93,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
{
while(++start < COUNT) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -107,7 +106,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -120,7 +119,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
{
offs_t start_entry = start >> LowBits;
offs_t end_entry = end >> LowBits;
@@ -167,7 +166,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -181,7 +180,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -212,7 +211,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
{
u8 ukey = descriptor.rkey_to_ukey(rkey);
handler_entry_read<Width, AddrShift, Endian> *original = target->is_units() ? target : nullptr;
@@ -235,7 +234,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -248,7 +247,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
offs_t start_entry = start >> LowBits;
offs_t end_entry = end >> LowBits;
@@ -307,7 +306,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -320,7 +319,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -348,7 +347,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
{
handler_entry_read<Width, AddrShift, Endian> *original = target;
handler_entry_read<Width, AddrShift, Endian> *replacement = nullptr;
@@ -366,7 +365,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -379,7 +378,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -422,7 +421,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -435,7 +434,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -462,7 +461,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
for(unsigned int i=0; i != COUNT; i++) {
if(m_dispatch[i]->is_dispatch()) {
diff --git a/src/emu/emumem_hedw.h b/src/emu/emumem_hedw.h
index d0986893d6e..219b51d89f7 100644
--- a/src/emu/emumem_hedw.h
+++ b/src/emu/emumem_hedw.h
@@ -5,7 +5,7 @@
// dispatches an access among multiple handlers indexed on part of the address
-template<int HighBits, int Width, int AddrShift, int Endian> class handler_entry_write_dispatch : public handler_entry_write<Width, AddrShift, Endian>
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> class handler_entry_write_dispatch : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -15,7 +15,7 @@ public:
handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift, Endian> *handler);
~handler_entry_write_dispatch();
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const override;
@@ -35,9 +35,10 @@ public:
void enumerate_references(handler_entry::reflist &refs) const override;
- virtual void get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const override;
+ virtual const handler_entry_write<Width, AddrShift, Endian> *const *get_dispatch() const override;
protected:
+ static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_lowbits(HighBits, Width, AddrShift);
static constexpr u32 BITCOUNT = HighBits > LowBits ? HighBits - LowBits : 0;
static constexpr u32 COUNT = 1 << BITCOUNT;
diff --git a/src/emu/emumem_hedw.ipp b/src/emu/emumem_hedw.ipp
index 23b0c70572b..3e12c702864 100644
--- a/src/emu/emumem_hedw.ipp
+++ b/src/emu/emumem_hedw.ipp
@@ -10,13 +10,12 @@
#include "emumem_hedw.h"
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> const handler_entry_write<Width, AddrShift, Endian> *const *handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch() const
{
- dispatch = m_dispatch;
- shift = LowBits;
+ return m_dispatch;
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift, Endian> *handler) : handler_entry_write<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift, Endian> *handler) : handler_entry_write<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
{
if (!handler)
handler = space->get_unmap_w<Width, AddrShift, Endian>();
@@ -27,19 +26,19 @@ template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_write
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_write_dispatch()
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_write_dispatch()
{
for(unsigned int i=0; i != COUNT; i++)
m_dispatch[i]->unref();
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(unsigned int i=0; i != COUNT; i++)
refs.add(m_dispatch[i]);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
{
offs_t cur = map.empty() ? 0 : map.back().end + 1;
offs_t base = cur & UPMASK;
@@ -53,22 +52,22 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
} while(cur && !((cur ^ base) & UPMASK));
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
- dispatch_write<Width, AddrShift, Endian>(BITMASK, LowBits, offset, data, mem_mask, m_dispatch);
+ dispatch_write<Level, Width, AddrShift, Endian>(HIGHMASK, offset, data, mem_mask, m_dispatch);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void *handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void *handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
- return m_dispatch[(offset >> LowBits) & BITMASK]->get_ptr(offset);
+ return m_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset);
}
-template<int HighBits, int Width, int AddrShift, int Endian> std::string handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::name() const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::name() const
{
return "dispatch";
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
{
offs_t slot = (address >> LowBits) & BITMASK;
auto h = m_dispatch[slot];
@@ -81,7 +80,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
{
while(--start >= 0) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -94,7 +93,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
{
while(++start < COUNT) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -107,7 +106,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -120,7 +119,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -168,7 +167,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -181,7 +180,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -212,7 +211,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
{
u8 ukey = descriptor.rkey_to_ukey(rkey);
handler_entry_write<Width, AddrShift, Endian> *original = target->is_units() ? target : nullptr;
@@ -235,7 +234,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -248,7 +247,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -307,7 +306,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -320,7 +319,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -348,7 +347,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
{
handler_entry_write<Width, AddrShift, Endian> *original = target;
handler_entry_write<Width, AddrShift, Endian> *replacement = nullptr;
@@ -366,7 +365,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -379,7 +378,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -426,7 +425,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -439,7 +438,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -466,7 +465,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
for(unsigned int i=0; i != COUNT; i++) {
if(m_dispatch[i]->is_dispatch()) {
diff --git a/src/emu/emumem_hem.cpp b/src/emu/emumem_hem.cpp
index 1a2963951f1..741a2c649b4 100644
--- a/src/emu/emumem_hem.cpp
+++ b/src/emu/emumem_hem.cpp
@@ -5,44 +5,44 @@
#include "emumem_hea.h"
#include "emumem_hem.h"
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return m_base[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)];
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_read_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_read_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return m_base + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_memory<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_memory<Width, AddrShift, Endian>::name() const
{
return util::string_format("memory@%x", inh::m_address_base);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_memory<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_memory<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
offs_t off = ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift);
m_base[off] = (m_base[off] & ~mem_mask) | (data & mem_mask);
}
-template<> void handler_entry_write_memory<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask) const
{
m_base[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<> void handler_entry_write_memory<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask) const
{
m_base[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_write_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_write_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return m_base + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_memory<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_memory<Width, AddrShift, Endian>::name() const
{
return util::string_format("memory@%x", inh::m_address_base);
}
@@ -51,44 +51,44 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_m
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory_bank<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory_bank<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return static_cast<uX *>(m_bank.base())[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)];
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_read_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_read_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return static_cast<uX *>(m_bank.base()) + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_memory_bank<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_memory_bank<Width, AddrShift, Endian>::name() const
{
return m_bank.name();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_memory_bank<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_memory_bank<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
offs_t off = ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift);
static_cast<uX *>(m_bank.base())[off] = (static_cast<uX *>(m_bank.base())[off] & ~mem_mask) | (data & mem_mask);
}
-template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask) const
{
static_cast<uX *>(m_bank.base())[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask) const
{
static_cast<uX *>(m_bank.base())[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_write_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_write_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return static_cast<uX *>(m_bank.base()) + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_memory_bank<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_memory_bank<Width, AddrShift, Endian>::name() const
{
return m_bank.name();
}
diff --git a/src/emu/emumem_hem.h b/src/emu/emumem_hem.h
index 184c752625c..1d076ebc51b 100644
--- a/src/emu/emumem_hem.h
+++ b/src/emu/emumem_hem.h
@@ -5,7 +5,7 @@
// Accesses fixed memory (non-banked rom or ram)
-template<int Width, int AddrShift, int Endian> class handler_entry_read_memory : public handler_entry_read_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_memory : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,7 +14,7 @@ public:
handler_entry_read_memory(address_space *space) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_memory() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
inline void set_base(uX *base) { m_base = base; }
@@ -25,7 +25,7 @@ private:
uX *m_base;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_memory : public handler_entry_write_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_memory : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -34,7 +34,7 @@ public:
handler_entry_write_memory(address_space *space) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_memory() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
inline void set_base(uX *base) { m_base = base; }
@@ -50,7 +50,7 @@ private:
// Accesses banked memory, associated to a memory_bank
-template<int Width, int AddrShift, int Endian> class handler_entry_read_memory_bank : public handler_entry_read_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_memory_bank : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -59,7 +59,7 @@ public:
handler_entry_read_memory_bank(address_space *space, memory_bank &bank) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_bank(bank) {}
~handler_entry_read_memory_bank() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
std::string name() const override;
@@ -68,7 +68,7 @@ private:
memory_bank &m_bank;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_memory_bank : public handler_entry_write_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_memory_bank : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -77,7 +77,7 @@ public:
handler_entry_write_memory_bank(address_space *space, memory_bank &bank) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_bank(bank) {}
~handler_entry_write_memory_bank() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
std::string name() const override;
diff --git a/src/emu/emumem_hep.cpp b/src/emu/emumem_hep.cpp
index f411dcb522c..25b54142d3e 100644
--- a/src/emu/emumem_hep.cpp
+++ b/src/emu/emumem_hep.cpp
@@ -4,7 +4,7 @@
#include "emu.h"
#include "emumem_hep.h"
-template<int Width, int AddrShift, int Endian> handler_entry_read_passthrough<Width, AddrShift, Endian>::~handler_entry_read_passthrough()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_passthrough<Width, AddrShift, Endian>::~handler_entry_read_passthrough()
{
if(m_next) {
m_mph.remove_handler(this);
@@ -12,7 +12,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_read_passthrough<Wi
}
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
if(!m_next->is_passthrough())
return;
@@ -27,7 +27,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_read_passthrou
np->detach(handlers);
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_passthrough<Width, AddrShift, Endian>::~handler_entry_write_passthrough()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_passthrough<Width, AddrShift, Endian>::~handler_entry_write_passthrough()
{
if(m_next) {
m_mph.remove_handler(this);
@@ -35,7 +35,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_write_passthrough<W
}
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
if(!m_next->is_passthrough())
return;
diff --git a/src/emu/emumem_hep.h b/src/emu/emumem_hep.h
index 0b166d77698..08b453c9fb0 100644
--- a/src/emu/emumem_hep.h
+++ b/src/emu/emumem_hep.h
@@ -5,7 +5,7 @@
// parent class for handlers which want to tap the access and usually pass it on to another handler
-template<int Width, int AddrShift, int Endian> class handler_entry_read_passthrough : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_passthrough : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -26,7 +26,7 @@ protected:
handler_entry_read_passthrough(address_space *space, memory_passthrough_handler &mph, handler_entry_read<Width, AddrShift, Endian> *next) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(next) { next->ref(); mph.add_handler(this); }
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_passthrough : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_passthrough : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
diff --git a/src/emu/emumem_het.cpp b/src/emu/emumem_het.cpp
index 571b8246eac..2d2f818e770 100644
--- a/src/emu/emumem_het.cpp
+++ b/src/emu/emumem_het.cpp
@@ -5,7 +5,7 @@
#include "emumem_hep.h"
#include "emumem_het.h"
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_tap<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_tap<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
this->ref();
@@ -16,18 +16,18 @@ template<int Width, int AddrShift, int Endian> typename emu::detail::handler_ent
return data;
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_tap<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_tap<Width, AddrShift, Endian>::name() const
{
return '(' + m_name + ") " + inh::m_next->name();
}
-template<int Width, int AddrShift, int Endian> handler_entry_read_tap<Width, AddrShift, Endian> *handler_entry_read_tap<Width, AddrShift, Endian>::instantiate(handler_entry_read<Width, AddrShift, Endian> *next) const
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_tap<Width, AddrShift, Endian> *handler_entry_read_tap<Width, AddrShift, Endian>::instantiate(handler_entry_read<Width, AddrShift, Endian> *next) const
{
return new handler_entry_read_tap<Width, AddrShift, Endian>(inh::m_space, inh::m_mph, next, m_name, m_tap);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_tap<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_tap<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
this->ref();
@@ -37,13 +37,13 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_tap<Widt
this->unref();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_tap<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_tap<Width, AddrShift, Endian>::name() const
{
return '(' + m_name + ") " + inh::m_next->name();
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_tap<Width, AddrShift, Endian> *handler_entry_write_tap<Width, AddrShift, Endian>::instantiate(handler_entry_write<Width, AddrShift, Endian> *next) const
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_tap<Width, AddrShift, Endian> *handler_entry_write_tap<Width, AddrShift, Endian>::instantiate(handler_entry_write<Width, AddrShift, Endian> *next) const
{
return new handler_entry_write_tap<Width, AddrShift, Endian>(inh::m_space, inh::m_mph, next, m_name, m_tap);
}
diff --git a/src/emu/emumem_het.h b/src/emu/emumem_het.h
index 274aa138403..2e788108896 100644
--- a/src/emu/emumem_het.h
+++ b/src/emu/emumem_het.h
@@ -5,7 +5,7 @@
// handler which tap on a bus access and possibly change the data value through a std::function
-template<int Width, int AddrShift, int Endian> class handler_entry_read_tap : public handler_entry_read_passthrough<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_tap : public handler_entry_read_passthrough<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,7 +14,7 @@ public:
handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_read_passthrough<Width, AddrShift, Endian>(space, mph), m_name(name), m_tap(std::move(tap)) {}
~handler_entry_read_tap() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -27,7 +27,7 @@ protected:
handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, handler_entry_read<Width, AddrShift, Endian> *next, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_read_passthrough<Width, AddrShift, Endian>(space, mph, next), m_name(name), m_tap(tap) {}
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_tap : public handler_entry_write_passthrough<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_tap : public handler_entry_write_passthrough<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -36,7 +36,7 @@ public:
handler_entry_write_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_write_passthrough<Width, AddrShift, Endian>(space, mph), m_name(name), m_tap(std::move(tap)) {}
~handler_entry_write_tap() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
diff --git a/src/emu/emumem_heu.cpp b/src/emu/emumem_heu.cpp
index 7000f77dc25..42cc8c3f83c 100644
--- a/src/emu/emumem_heu.cpp
+++ b/src/emu/emumem_heu.cpp
@@ -7,7 +7,7 @@
#include "emumem_heu.h"
-template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
handler_entry_read<Width, AddrShift, Endian>(space, inh::F_UNITS),
m_subunits(0)
{
@@ -16,7 +16,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, A
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_read_units *src) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_read_units *src) :
handler_entry_read<Width, AddrShift, Endian>(src->m_space, inh::F_UNITS),
m_subunits(0)
{
@@ -36,19 +36,19 @@ template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, A
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, AddrShift, Endian>::~handler_entry_read_units()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_units<Width, AddrShift, Endian>::~handler_entry_read_units()
{
for(u32 i=0; i != m_subunits; i++)
m_subunit_infos[i].m_handler->unref();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(u32 i=0; i != m_subunits; i++)
refs.add(m_subunit_infos[i].m_handler);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
{
handler_entry *handler = descriptor.get_subunit_handler();
handler->ref(entries.size());
@@ -60,7 +60,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Wid
}
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_units<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_units<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
this->ref();
@@ -98,7 +98,7 @@ template<int Width, int AddrShift, int Endian> typename emu::detail::handler_ent
return result;
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{
constexpr u32 mbits = 8*sizeof(uX);
u32 start, end;
@@ -109,7 +109,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_read_un
return util::string_format("%d-%d", end, start);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::name() const
{
std::string result;
@@ -126,7 +126,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_read_un
-template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
handler_entry_write<Width, AddrShift, Endian>(space, inh::F_UNITS),
m_subunits(0)
{
@@ -135,7 +135,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width,
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_write_units<Width, AddrShift, Endian> *src) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_write_units<Width, AddrShift, Endian> *src) :
handler_entry_write<Width, AddrShift, Endian>(src->m_space, inh::F_UNITS),
m_subunits(0)
{
@@ -155,19 +155,19 @@ template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width,
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width, AddrShift, Endian>::~handler_entry_write_units()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_units<Width, AddrShift, Endian>::~handler_entry_write_units()
{
for(u32 i=0; i != m_subunits; i++)
m_subunit_infos[i].m_handler->unref();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(u32 i=0; i != m_subunits; i++)
refs.add(m_subunit_infos[i].m_handler);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
{
handler_entry *handler = descriptor.get_subunit_handler();
handler->ref(entries.size());
@@ -175,7 +175,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Wi
m_subunit_infos[m_subunits++] = subunit_info{ handler, e.m_amask, e.m_dmask, e.m_ashift, e.m_offset, e.m_dshift, descriptor.get_subunit_width(), descriptor.get_subunit_endian() };
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_units<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
this->ref();
@@ -212,7 +212,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Wi
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{
constexpr u32 mbits = 8*sizeof(uX);
u32 start, end;
@@ -223,7 +223,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_u
return util::string_format("%d-%d", end, start);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::name() const
{
std::string result;
diff --git a/src/emu/emumem_heu.h b/src/emu/emumem_heu.h
index dbc0cf064f7..d084fddfe98 100644
--- a/src/emu/emumem_heu.h
+++ b/src/emu/emumem_heu.h
@@ -5,7 +5,7 @@
// merges/splits an access among multiple handlers (unitmask support)
-template<int Width, int AddrShift, int Endian> class handler_entry_read_units : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_units : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -15,7 +15,7 @@ public:
handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_read_units *src);
~handler_entry_read_units();
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -46,7 +46,7 @@ private:
static std::string m2r(uX mask);
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_units : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_units : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -56,7 +56,7 @@ public:
handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_write_units<Width, AddrShift, Endian> *src);
~handler_entry_write_units();
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
diff --git a/src/emu/emumem_heun.cpp b/src/emu/emumem_heun.cpp
index c25d77bbd33..ff1899d686e 100644
--- a/src/emu/emumem_heun.cpp
+++ b/src/emu/emumem_heun.cpp
@@ -5,7 +5,7 @@
#include "emumem_hea.h"
#include "emumem_heun.h"
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_unmapped<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_unmapped<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
if (inh::m_space->log_unmap() && !inh::m_space->m_manager.machine().side_effects_disabled())
inh::m_space->device().logerror(inh::m_space->is_octal()
@@ -17,13 +17,13 @@ template<int Width, int AddrShift, int Endian> typename emu::detail::handler_ent
return inh::m_space->unmap();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_unmapped<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_unmapped<Width, AddrShift, Endian>::name() const
{
return "unmapped";
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_unmapped<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_unmapped<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)const
{
if (inh::m_space->log_unmap() && !inh::m_space->m_manager.machine().side_effects_disabled())
inh::m_space->device().logerror(inh::m_space->is_octal()
@@ -35,7 +35,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_unmapped
2 << Width, mem_mask);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_unmapped<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_unmapped<Width, AddrShift, Endian>::name() const
{
return "unmapped";
}
@@ -43,22 +43,22 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_u
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_nop<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_nop<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return inh::m_space->unmap();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_nop<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_nop<Width, AddrShift, Endian>::name() const
{
return "nop";
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_nop<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_nop<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_nop<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_nop<Width, AddrShift, Endian>::name() const
{
return "nop";
}
diff --git a/src/emu/emumem_heun.h b/src/emu/emumem_heun.h
index 02a79d825ab..4e76e4cb531 100644
--- a/src/emu/emumem_heun.h
+++ b/src/emu/emumem_heun.h
@@ -5,7 +5,7 @@
// Logs an unmapped access
-template<int Width, int AddrShift, int Endian> class handler_entry_read_unmapped : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_unmapped : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,12 +14,12 @@ public:
handler_entry_read_unmapped(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_unmapped() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_unmapped : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_unmapped : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -28,7 +28,7 @@ public:
handler_entry_write_unmapped(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_unmapped() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
};
@@ -39,7 +39,7 @@ public:
// Drops an unmapped access silently
-template<int Width, int AddrShift, int Endian> class handler_entry_read_nop : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_nop : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -48,12 +48,12 @@ public:
handler_entry_read_nop(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_nop() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_nop : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_nop : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -62,7 +62,7 @@ public:
handler_entry_write_nop(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_nop() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
};
diff --git a/src/emu/emumem_mud.cpp b/src/emu/emumem_mud.cpp
index 2fff5649b62..8359dd8224e 100644
--- a/src/emu/emumem_mud.cpp
+++ b/src/emu/emumem_mud.cpp
@@ -35,7 +35,7 @@ template<> u8 mask_to_ukey<u64>(u64 mask)
(mask & 0x00000000000000ff ? 0x01 : 0x00);
}
-template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, AddrShift, Endian>::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename emu::detail::handler_entry_size<Width>::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian)
+template<int Width, int AddrShift, endianness_t Endian> memory_units_descriptor<Width, AddrShift, Endian>::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename emu::detail::handler_entry_size<Width>::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian)
{
u32 bits_per_access = 8 << access_width;
constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? make_bitmask<u32>(Width + AddrShift) : 0;
@@ -86,7 +86,7 @@ template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, Ad
generate(m_keymap[i], unitmask, umasks[i], cswidth, bits_per_access, base_shift, shift, active_count);
}
-template<int Width, int AddrShift, int Endian> void memory_units_descriptor<Width, AddrShift, Endian>::generate(u8 ukey, typename emu::detail::handler_entry_size<Width>::uX gumask, typename emu::detail::handler_entry_size<Width>::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count)
+template<int Width, int AddrShift, endianness_t Endian> void memory_units_descriptor<Width, AddrShift, Endian>::generate(u8 ukey, typename emu::detail::handler_entry_size<Width>::uX gumask, typename emu::detail::handler_entry_size<Width>::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count)
{
auto &entries = m_entries_for_key[ukey];
diff --git a/src/emu/emumem_mud.h b/src/emu/emumem_mud.h
index b5347ee82e2..a25ec7051a5 100644
--- a/src/emu/emumem_mud.h
+++ b/src/emu/emumem_mud.h
@@ -3,7 +3,7 @@
// Descriptors for subunit support
-template<int Width, int AddrShift, int Endian> class memory_units_descriptor {
+template<int Width, int AddrShift, endianness_t Endian> class memory_units_descriptor {
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;