summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/emumem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/emumem.cpp')
-rw-r--r--src/emu/emumem.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index 723d705914a..432115400ed 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -1853,10 +1853,7 @@ void address_space::allocate(std::vector<std::unique_ptr<address_space>> &space_
inline void address_space::adjust_addresses(offs_t &start, offs_t &end, offs_t &mask, offs_t &mirror)
{
// adjust start/end/mask values
- if (mask == 0)
- mask = m_addrmask & ~mirror;
- else
- mask &= m_addrmask;
+ mask &= m_addrmask;
start &= ~mirror & m_addrmask;
end &= ~mirror & m_addrmask;
@@ -2027,7 +2024,7 @@ void address_space::prepare_map()
entry.m_bytestart = entry.m_addrstart;
entry.m_byteend = entry.m_addrend;
entry.m_bytemirror = entry.m_addrmirror;
- entry.m_bytemask = entry.m_addrmask;
+ entry.m_bytemask = entry.m_addrmask ? entry.m_addrmask : ~entry.m_addrmirror;
adjust_addresses(entry.m_bytestart, entry.m_byteend, entry.m_bytemask, entry.m_bytemirror);
// if we have a share entry, add it to our map
@@ -2857,7 +2854,7 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
// adjust the addresses, handling mirrors and such
offs_t bytemirror = addrmirror;
offs_t bytestart = addrstart;
- offs_t bytemask = 0;
+ offs_t bytemask = ~addrmirror;
offs_t byteend = addrend;
adjust_addresses(bytestart, byteend, bytemask, bytemirror);
@@ -4380,6 +4377,8 @@ void handler_entry::configure_subunits(u64 handlermask, int handlerbits, int &st
if ((scanmask & unitmask) != 0)
count++;
}
+ assert(count != 0);
+ assert(maxunits % count == 0);
// fill in the shifts
int cur_offset = 0;
@@ -4389,7 +4388,7 @@ void handler_entry::configure_subunits(u64 handlermask, int handlerbits, int &st
u32 shift = (unitnum^shift_xor_mask) * handlerbits;
if (((handlermask >> shift) & unitmask) != 0)
{
- m_subunit_infos[m_subunits].m_bytemask = m_bytemask;
+ m_subunit_infos[m_subunits].m_bytemask = m_bytemask / (maxunits / count);
m_subunit_infos[m_subunits].m_mask = unitmask;
m_subunit_infos[m_subunits].m_offset = cur_offset++;
m_subunit_infos[m_subunits].m_size = handlerbits;