diff --git a/src/emu/emumem_hedr.h b/src/emu/emumem_hedr.h index e1e9aa98743..e48737f31c9 100644 --- a/src/emu/emumem_hedr.h +++ b/src/emu/emumem_hedr.h @@ -17,7 +17,7 @@ public: using mapping = typename handler_entry_read::mapping; handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read *handler); - handler_entry_read_dispatch(address_space *space, memory_view &view); + handler_entry_read_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend); handler_entry_read_dispatch(handler_entry_read_dispatch *src); ~handler_entry_read_dispatch(); @@ -92,6 +92,8 @@ private: handler_entry_read **m_u_dispatch; handler_entry::range *m_u_ranges; + handler_entry::range m_global_range; + void populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read *handler); void populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read *handler); diff --git a/src/emu/emumem_hedr.ipp b/src/emu/emumem_hedr.ipp index 9994f251897..c79691e5e89 100644 --- a/src/emu/emumem_hedr.ipp +++ b/src/emu/emumem_hedr.ipp @@ -25,6 +25,7 @@ template handler_entry_read_dispatchget_unmap_r(); @@ -35,7 +36,7 @@ template handler_entry_read_dispatch handler_entry_read_dispatch::handler_entry_read_dispatch(address_space *space, memory_view &view) : handler_entry_read(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr) +template handler_entry_read_dispatch::handler_entry_read_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend) : handler_entry_read(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr) { m_ranges_array.resize(1); m_dispatch_array.resize(1); @@ -43,12 +44,15 @@ template handler_entry_read_dispatchget_unmap_r(); handler->ref(COUNT); for(unsigned int i=0; i != COUNT; i++) { m_u_dispatch[i] = handler; - m_u_ranges[i].set(0, 0); + m_u_ranges[i].start = addrstart; + m_u_ranges[i].end = addrend; } } @@ -60,6 +64,7 @@ template handler_entry_read_dispatchm_global_range; for(unsigned int i=0; i != COUNT; i++) { m_u_dispatch[i] = src->m_u_dispatch[i]->dup(); @@ -92,10 +97,12 @@ template offs_t handler_entry_read_dispa template void handler_entry_read_dispatch::dump_map(std::vector &map) const { if(m_view) { + offs_t base_cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1; for(u32 i = 0; i != m_dispatch_array.size(); i++) { u32 j = map.size(); - offs_t cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1; - offs_t end = m_view->m_addrend + 1; + offs_t cur = base_cur; + offs_t end = m_global_range.end + 1; + do { offs_t entry = (cur >> LowBits) & BITMASK; if(m_dispatch_array[i][entry]->is_dispatch() || m_dispatch_array[i][entry]->is_view()) @@ -116,6 +123,7 @@ template void handler_entry_read_dispatc } else { offs_t cur = map.empty() ? 0 : map.back().end + 1; offs_t base = cur & UPMASK; + offs_t end = m_global_range.end + 1; do { offs_t entry = (cur >> LowBits) & BITMASK; if(m_a_dispatch[entry]->is_dispatch() || m_a_dispatch[entry]->is_view()) @@ -123,7 +131,7 @@ template void handler_entry_read_dispatc else map.emplace_back(memory_entry{ m_a_ranges[entry].start, m_a_ranges[entry].end, m_a_dispatch[entry] }); cur = map.back().end + 1; - } while(cur && !((cur ^ base) & UPMASK)); + } while(cur != end && !((cur ^ base) & UPMASK)); } } @@ -343,7 +351,7 @@ template void handler_entry_read_dispatc template void handler_entry_read_dispatch::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor &descriptor, u8 rkey, std::vector &mappings) { auto cur = m_u_dispatch[entry]; - if(cur->is_dispatch()) + if(cur->is_dispatch() && !cur->is_view()) cur->populate_mismatched_nomirror(start, end, ostart, oend, descriptor, rkey, mappings); else { auto subdispatch = new handler_entry_read_dispatch(this->m_space, m_u_ranges[entry], cur); @@ -654,57 +662,29 @@ template void handler_entry_read_dispatc u32 dt = lowbits - LowBits; u32 ne = 1 << dt; u32 ee = end_entry - start_entry; - if(m_view) { - auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; }; - - for(offs_t entry = 0; entry <= ee; entry++) { - dispatch[entry]->ref(ne); - u32 e0 = (entry << dt) & BITMASK; - for(offs_t e = 0; e != ne; e++) { - offs_t e1 = e0 | e; - if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[e1]->unref(); - m_u_dispatch[e1] = dispatch[entry]; - m_u_ranges[e1] = filter(ranges[entry]); - } - } - } else { - for(offs_t entry = 0; entry <= ee; entry++) { - dispatch[entry]->ref(ne); - u32 e0 = (entry << dt) & BITMASK; - for(offs_t e = 0; e != ne; e++) { - offs_t e1 = e0 | e; - if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[e1]->unref(); - m_u_dispatch[e1] = dispatch[entry]; - m_u_ranges[e1] = ranges[entry]; - } + auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; }; + for(offs_t entry = 0; entry <= ee; entry++) { + dispatch[entry]->ref(ne); + u32 e0 = (entry << dt) & BITMASK; + for(offs_t e = 0; e != ne; e++) { + offs_t e1 = e0 | e; + if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP)) + fatalerror("Collision on multiple init_handlers calls"); + m_u_dispatch[e1]->unref(); + m_u_dispatch[e1] = dispatch[entry]; + m_u_ranges[e1] = filter(ranges[entry]); } } } else { - if(m_view) { - auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; }; - - for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) { - if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[entry]->unref(); - m_u_dispatch[entry] = dispatch[entry]; - m_u_ranges[entry] = filter(ranges[entry]); - dispatch[entry]->ref(); - } - } else { - for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) { - if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[entry]->unref(); - m_u_dispatch[entry] = dispatch[entry]; - m_u_ranges[entry] = ranges[entry]; - dispatch[entry]->ref(); - } + auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; }; + for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) { + if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP)) + fatalerror("Collision on multiple init_handlers calls"); + m_u_dispatch[entry]->unref(); + m_u_dispatch[entry] = dispatch[entry]; + m_u_ranges[entry] = filter(ranges[entry]); + dispatch[entry]->ref(); } } } diff --git a/src/emu/emumem_hedw.h b/src/emu/emumem_hedw.h index 130293a73a4..4bd3098a333 100644 --- a/src/emu/emumem_hedw.h +++ b/src/emu/emumem_hedw.h @@ -17,7 +17,7 @@ public: using mapping = typename handler_entry_write::mapping; handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write *handler); - handler_entry_write_dispatch(address_space *space, memory_view &view); + handler_entry_write_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend); handler_entry_write_dispatch(handler_entry_write_dispatch *src); ~handler_entry_write_dispatch(); @@ -92,6 +92,8 @@ private: handler_entry_write **m_u_dispatch; handler_entry::range *m_u_ranges; + handler_entry::range m_global_range; + void populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write *handler); void populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write *handler); diff --git a/src/emu/emumem_hedw.ipp b/src/emu/emumem_hedw.ipp index 37c09ccfe11..dd6001d4bb0 100644 --- a/src/emu/emumem_hedw.ipp +++ b/src/emu/emumem_hedw.ipp @@ -25,6 +25,7 @@ template handler_entry_write_dispatchget_unmap_w(); @@ -35,7 +36,7 @@ template handler_entry_write_dispatch handler_entry_write_dispatch::handler_entry_write_dispatch(address_space *space, memory_view &view) : handler_entry_write(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr) +template handler_entry_write_dispatch::handler_entry_write_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend) : handler_entry_write(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr) { m_ranges_array.resize(1); m_dispatch_array.resize(1); @@ -43,11 +44,16 @@ template handler_entry_write_dispatchget_unmap_w(); handler->ref(COUNT); - for(unsigned int i=0; i != COUNT; i++) + for(unsigned int i=0; i != COUNT; i++) { m_u_dispatch[i] = handler; + m_u_ranges[i].start = addrstart; + m_u_ranges[i].end = addrend; + } } template handler_entry_write_dispatch::handler_entry_write_dispatch(handler_entry_write_dispatch *src) : handler_entry_write(src->m_space, handler_entry::F_DISPATCH), m_view(nullptr) @@ -58,6 +64,7 @@ template handler_entry_write_dispatchm_global_range; for(unsigned int i=0; i != COUNT; i++) { m_u_dispatch[i] = src->m_u_dispatch[i]->dup(); @@ -91,10 +98,11 @@ template offs_t handler_entry_write_disp template void handler_entry_write_dispatch::dump_map(std::vector &map) const { if(m_view) { + offs_t base_cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1; for(u32 i = 0; i != m_dispatch_array.size(); i++) { u32 j = map.size(); - offs_t cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1; - offs_t end = m_view->m_addrend + 1; + offs_t cur = base_cur; + offs_t end = m_global_range.end + 1; do { offs_t entry = (cur >> LowBits) & BITMASK; if(m_dispatch_array[i][entry]->is_dispatch() || m_dispatch_array[i][entry]->is_view()) @@ -115,6 +123,7 @@ template void handler_entry_write_dispat } else { offs_t cur = map.empty() ? 0 : map.back().end + 1; offs_t base = cur & UPMASK; + offs_t end = m_global_range.end + 1; do { offs_t entry = (cur >> LowBits) & BITMASK; if(m_a_dispatch[entry]->is_dispatch() || m_a_dispatch[entry]->is_view()) @@ -122,7 +131,7 @@ template void handler_entry_write_dispat else map.emplace_back(memory_entry{ m_a_ranges[entry].start, m_a_ranges[entry].end, m_a_dispatch[entry] }); cur = map.back().end + 1; - } while(cur && !((cur ^ base) & UPMASK)); + } while(cur != end && !((cur ^ base) & UPMASK)); } } @@ -655,57 +664,29 @@ template void handler_entry_write_dispat u32 dt = lowbits - LowBits; u32 ne = 1 << dt; u32 ee = end_entry - start_entry; - if(m_view) { - auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; }; - - for(offs_t entry = 0; entry <= ee; entry++) { - dispatch[entry]->ref(ne); - u32 e0 = (entry << dt) & BITMASK; - for(offs_t e = 0; e != ne; e++) { - offs_t e1 = e0 | e; - if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[e1]->unref(); - m_u_dispatch[e1] = dispatch[entry]; - m_u_ranges[e1] = filter(ranges[entry]); - } - } - } else { - for(offs_t entry = 0; entry <= ee; entry++) { - dispatch[entry]->ref(ne); - u32 e0 = (entry << dt) & BITMASK; - for(offs_t e = 0; e != ne; e++) { - offs_t e1 = e0 | e; - if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[e1]->unref(); - m_u_dispatch[e1] = dispatch[entry]; - m_u_ranges[e1] = ranges[entry]; - } + auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; }; + for(offs_t entry = 0; entry <= ee; entry++) { + dispatch[entry]->ref(ne); + u32 e0 = (entry << dt) & BITMASK; + for(offs_t e = 0; e != ne; e++) { + offs_t e1 = e0 | e; + if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP)) + fatalerror("Collision on multiple init_handlers calls"); + m_u_dispatch[e1]->unref(); + m_u_dispatch[e1] = dispatch[entry]; + m_u_ranges[e1] = filter(ranges[entry]); } } } else { - if(m_view) { - auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; }; - - for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) { - if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[entry]->unref(); - m_u_dispatch[entry] = dispatch[entry]; - m_u_ranges[entry] = filter(ranges[entry]); - dispatch[entry]->ref(); - } - } else { - for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) { - if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP)) - fatalerror("Collision on multiple init_handlers calls"); - m_u_dispatch[entry]->unref(); - m_u_dispatch[entry] = dispatch[entry]; - m_u_ranges[entry] = ranges[entry]; - dispatch[entry]->ref(); - } + auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; }; + for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) { + if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP)) + fatalerror("Collision on multiple init_handlers calls"); + m_u_dispatch[entry]->unref(); + m_u_dispatch[entry] = dispatch[entry]; + m_u_ranges[entry] = filter(ranges[entry]); + dispatch[entry]->ref(); } } } diff --git a/src/emu/emumem_mview.cpp b/src/emu/emumem_mview.cpp index f29f5070f21..8d16f8f439a 100644 --- a/src/emu/emumem_mview.cpp +++ b/src/emu/emumem_mview.cpp @@ -556,60 +556,60 @@ void memory_view::initialize_from_address_map(offs_t addrstart, offs_t addrend, } namespace { - template void h_make_1(int HighBits, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { + template void h_make_1(int HighBits, address_space &space, memory_view &view, offs_t addrstart, offs_t addrend, handler_entry *&r, handler_entry *&w) { switch(HighBits) { - case 0: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; - case 1: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; - case 2: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; - case 3: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; - case 4: r = new handler_entry_read_dispatch< 4, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 4, Width, AddrShift>(&space, view); break; - case 5: r = new handler_entry_read_dispatch< 5, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 5, Width, AddrShift>(&space, view); break; - case 6: r = new handler_entry_read_dispatch< 6, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 6, Width, AddrShift>(&space, view); break; - case 7: r = new handler_entry_read_dispatch< 7, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 7, Width, AddrShift>(&space, view); break; - case 8: r = new handler_entry_read_dispatch< 8, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 8, Width, AddrShift>(&space, view); break; - case 9: r = new handler_entry_read_dispatch< 9, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 9, Width, AddrShift>(&space, view); break; - case 10: r = new handler_entry_read_dispatch<10, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<10, Width, AddrShift>(&space, view); break; - case 11: r = new handler_entry_read_dispatch<11, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<11, Width, AddrShift>(&space, view); break; - case 12: r = new handler_entry_read_dispatch<12, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<12, Width, AddrShift>(&space, view); break; - case 13: r = new handler_entry_read_dispatch<13, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<13, Width, AddrShift>(&space, view); break; - case 14: r = new handler_entry_read_dispatch<14, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<14, Width, AddrShift>(&space, view); break; - case 15: r = new handler_entry_read_dispatch<15, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<15, Width, AddrShift>(&space, view); break; - case 16: r = new handler_entry_read_dispatch<16, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<16, Width, AddrShift>(&space, view); break; - case 17: r = new handler_entry_read_dispatch<17, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<17, Width, AddrShift>(&space, view); break; - case 18: r = new handler_entry_read_dispatch<18, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<18, Width, AddrShift>(&space, view); break; - case 19: r = new handler_entry_read_dispatch<19, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<19, Width, AddrShift>(&space, view); break; - case 20: r = new handler_entry_read_dispatch<20, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<20, Width, AddrShift>(&space, view); break; - case 21: r = new handler_entry_read_dispatch<21, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<21, Width, AddrShift>(&space, view); break; - case 22: r = new handler_entry_read_dispatch<22, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<22, Width, AddrShift>(&space, view); break; - case 23: r = new handler_entry_read_dispatch<23, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<23, Width, AddrShift>(&space, view); break; - case 24: r = new handler_entry_read_dispatch<24, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<24, Width, AddrShift>(&space, view); break; - case 25: r = new handler_entry_read_dispatch<25, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<25, Width, AddrShift>(&space, view); break; - case 26: r = new handler_entry_read_dispatch<26, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<26, Width, AddrShift>(&space, view); break; - case 27: r = new handler_entry_read_dispatch<27, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<27, Width, AddrShift>(&space, view); break; - case 28: r = new handler_entry_read_dispatch<28, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<28, Width, AddrShift>(&space, view); break; - case 29: r = new handler_entry_read_dispatch<29, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<29, Width, AddrShift>(&space, view); break; - case 30: r = new handler_entry_read_dispatch<30, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<30, Width, AddrShift>(&space, view); break; - case 31: r = new handler_entry_read_dispatch<31, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<31, Width, AddrShift>(&space, view); break; - case 32: r = new handler_entry_read_dispatch<32, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<32, Width, AddrShift>(&space, view); break; + case 0: r = new handler_entry_read_dispatch(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch(&space, view, addrstart, addrend); break; + case 1: r = new handler_entry_read_dispatch(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch(&space, view, addrstart, addrend); break; + case 2: r = new handler_entry_read_dispatch(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch(&space, view, addrstart, addrend); break; + case 3: r = new handler_entry_read_dispatch(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch(&space, view, addrstart, addrend); break; + case 4: r = new handler_entry_read_dispatch< 4, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 4, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 5: r = new handler_entry_read_dispatch< 5, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 5, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 6: r = new handler_entry_read_dispatch< 6, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 6, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 7: r = new handler_entry_read_dispatch< 7, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 7, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 8: r = new handler_entry_read_dispatch< 8, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 8, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 9: r = new handler_entry_read_dispatch< 9, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 9, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 10: r = new handler_entry_read_dispatch<10, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<10, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 11: r = new handler_entry_read_dispatch<11, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<11, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 12: r = new handler_entry_read_dispatch<12, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<12, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 13: r = new handler_entry_read_dispatch<13, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<13, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 14: r = new handler_entry_read_dispatch<14, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<14, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 15: r = new handler_entry_read_dispatch<15, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<15, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 16: r = new handler_entry_read_dispatch<16, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<16, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 17: r = new handler_entry_read_dispatch<17, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<17, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 18: r = new handler_entry_read_dispatch<18, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<18, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 19: r = new handler_entry_read_dispatch<19, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<19, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 20: r = new handler_entry_read_dispatch<20, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<20, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 21: r = new handler_entry_read_dispatch<21, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<21, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 22: r = new handler_entry_read_dispatch<22, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<22, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 23: r = new handler_entry_read_dispatch<23, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<23, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 24: r = new handler_entry_read_dispatch<24, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<24, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 25: r = new handler_entry_read_dispatch<25, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<25, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 26: r = new handler_entry_read_dispatch<26, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<26, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 27: r = new handler_entry_read_dispatch<27, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<27, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 28: r = new handler_entry_read_dispatch<28, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<28, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 29: r = new handler_entry_read_dispatch<29, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<29, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 30: r = new handler_entry_read_dispatch<30, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<30, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 31: r = new handler_entry_read_dispatch<31, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<31, Width, AddrShift>(&space, view, addrstart, addrend); break; + case 32: r = new handler_entry_read_dispatch<32, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<32, Width, AddrShift>(&space, view, addrstart, addrend); break; default: abort(); } } - void h_make(int HighBits, int Width, int AddrShift, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { + void h_make(int HighBits, int Width, int AddrShift, address_space &space, memory_view &view, offs_t addrstart, offs_t addrend, handler_entry *&r, handler_entry *&w) { switch (Width | (AddrShift + 4)) { - case 8|(4+1): h_make_1<0, 1>(HighBits, space, view, r, w); break; - case 8|(4-0): h_make_1<0, 0>(HighBits, space, view, r, w); break; - case 16|(4+3): h_make_1<1, 3>(HighBits, space, view, r, w); break; - case 16|(4-0): h_make_1<1, 0>(HighBits, space, view, r, w); break; - case 16|(4-1): h_make_1<1, -1>(HighBits, space, view, r, w); break; - case 32|(4+3): h_make_1<2, 3>(HighBits, space, view, r, w); break; - case 32|(4-0): h_make_1<2, 0>(HighBits, space, view, r, w); break; - case 32|(4-1): h_make_1<2, -1>(HighBits, space, view, r, w); break; - case 32|(4-2): h_make_1<2, -2>(HighBits, space, view, r, w); break; - case 64|(4-0): h_make_1<3, 0>(HighBits, space, view, r, w); break; - case 64|(4-1): h_make_1<3, -1>(HighBits, space, view, r, w); break; - case 64|(4-2): h_make_1<3, -2>(HighBits, space, view, r, w); break; - case 64|(4-3): h_make_1<3, -3>(HighBits, space, view, r, w); break; + case 8|(4+1): h_make_1<0, 1>(HighBits, space, view, addrstart, addrend, r, w); break; + case 8|(4-0): h_make_1<0, 0>(HighBits, space, view, addrstart, addrend, r, w); break; + case 16|(4+3): h_make_1<1, 3>(HighBits, space, view, addrstart, addrend, r, w); break; + case 16|(4-0): h_make_1<1, 0>(HighBits, space, view, addrstart, addrend, r, w); break; + case 16|(4-1): h_make_1<1, -1>(HighBits, space, view, addrstart, addrend, r, w); break; + case 32|(4+3): h_make_1<2, 3>(HighBits, space, view, addrstart, addrend, r, w); break; + case 32|(4-0): h_make_1<2, 0>(HighBits, space, view, addrstart, addrend, r, w); break; + case 32|(4-1): h_make_1<2, -1>(HighBits, space, view, addrstart, addrend, r, w); break; + case 32|(4-2): h_make_1<2, -2>(HighBits, space, view, addrstart, addrend, r, w); break; + case 64|(4-0): h_make_1<3, 0>(HighBits, space, view, addrstart, addrend, r, w); break; + case 64|(4-1): h_make_1<3, -1>(HighBits, space, view, addrstart, addrend, r, w); break; + case 64|(4-2): h_make_1<3, -2>(HighBits, space, view, addrstart, addrend, r, w); break; + case 64|(4-3): h_make_1<3, -3>(HighBits, space, view, addrstart, addrend, r, w); break; default: abort(); } } @@ -635,7 +635,7 @@ std::pair memory_view::make_handlers(address_s offs_t span = addrstart ^ addrend; u32 awidth = 32 - count_leading_zeros_32(span); - h_make(awidth, m_config->data_width(), m_config->addr_shift(), space, *this, m_handler_read, m_handler_write); + h_make(awidth, m_config->data_width(), m_config->addr_shift(), space, *this, addrstart, addrend, m_handler_read, m_handler_write); m_handler_read->ref(); m_handler_write->ref(); }