diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp index 3a3fb07c899..f70fdce5e09 100644 --- a/src/emu/addrmap.cpp +++ b/src/emu/addrmap.cpp @@ -162,29 +162,80 @@ address_map_entry &address_map_entry::m(device_t *device, address_map_constructo address_map_entry &address_map_entry::r(read8_delegate func) { assert(!func.isnull()); - m_read.m_type = AMH_DEVICE_DELEGATE; + m_read.m_type = AMH_DEVICE_DELEGATE_F; m_read.m_bits = 8; m_read.m_name = func.name(); m_rproto8 = func; return *this; } - address_map_entry &address_map_entry::w(write8_delegate func) { assert(!func.isnull()); - m_write.m_type = AMH_DEVICE_DELEGATE; + m_write.m_type = AMH_DEVICE_DELEGATE_F; m_write.m_bits = 8; m_write.m_name = func.name(); m_wproto8 = func; return *this; } - -address_map_entry &address_map_entry::rw(read8_delegate rfunc, write8_delegate wfunc) +address_map_entry &address_map_entry::r(read8s_delegate func) { - r(rfunc); - w(wfunc); + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_S; + m_read.m_bits = 8; + m_read.m_name = func.name(); + m_rproto8s = func; + return *this; +} + +address_map_entry &address_map_entry::w(write8s_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_S; + m_write.m_bits = 8; + m_write.m_name = func.name(); + m_wproto8s = func; + return *this; +} + +address_map_entry &address_map_entry::r(read8sm_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SM; + m_read.m_bits = 8; + m_read.m_name = func.name(); + m_rproto8sm = func; + return *this; +} + +address_map_entry &address_map_entry::w(write8sm_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SM; + m_write.m_bits = 8; + m_write.m_name = func.name(); + m_wproto8sm = func; + return *this; +} + +address_map_entry &address_map_entry::r(read8smo_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_F; + m_read.m_bits = 8; + m_read.m_name = func.name(); + m_rproto8smo = func; + return *this; +} + +address_map_entry &address_map_entry::w(write8smo_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SMO; + m_write.m_bits = 8; + m_write.m_name = func.name(); + m_wproto8smo = func; return *this; } @@ -197,29 +248,80 @@ address_map_entry &address_map_entry::rw(read8_delegate rfunc, write8_delegate w address_map_entry &address_map_entry::r(read16_delegate func) { assert(!func.isnull()); - m_read.m_type = AMH_DEVICE_DELEGATE; + m_read.m_type = AMH_DEVICE_DELEGATE_F; m_read.m_bits = 16; m_read.m_name = func.name(); m_rproto16 = func; return *this; } - address_map_entry &address_map_entry::w(write16_delegate func) { assert(!func.isnull()); - m_write.m_type = AMH_DEVICE_DELEGATE; + m_write.m_type = AMH_DEVICE_DELEGATE_F; m_write.m_bits = 16; m_write.m_name = func.name(); m_wproto16 = func; return *this; } - -address_map_entry &address_map_entry::rw(read16_delegate rfunc, write16_delegate wfunc) +address_map_entry &address_map_entry::r(read16s_delegate func) { - r(rfunc); - w(wfunc); + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_S; + m_read.m_bits = 16; + m_read.m_name = func.name(); + m_rproto16s = func; + return *this; +} + +address_map_entry &address_map_entry::w(write16s_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_S; + m_write.m_bits = 16; + m_write.m_name = func.name(); + m_wproto16s = func; + return *this; +} + +address_map_entry &address_map_entry::r(read16sm_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SM; + m_read.m_bits = 16; + m_read.m_name = func.name(); + m_rproto16sm = func; + return *this; +} + +address_map_entry &address_map_entry::w(write16sm_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SM; + m_write.m_bits = 16; + m_write.m_name = func.name(); + m_wproto16sm = func; + return *this; +} + +address_map_entry &address_map_entry::r(read16smo_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SM; + m_read.m_bits = 16; + m_read.m_name = func.name(); + m_rproto16smo = func; + return *this; +} + +address_map_entry &address_map_entry::w(write16smo_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SM; + m_write.m_bits = 16; + m_write.m_name = func.name(); + m_wproto16smo = func; return *this; } @@ -232,32 +334,82 @@ address_map_entry &address_map_entry::rw(read16_delegate rfunc, write16_delegate address_map_entry &address_map_entry::r(read32_delegate func) { assert(!func.isnull()); - m_read.m_type = AMH_DEVICE_DELEGATE; + m_read.m_type = AMH_DEVICE_DELEGATE_F; m_read.m_bits = 32; m_read.m_name = func.name(); m_rproto32 = func; return *this; } - address_map_entry &address_map_entry::w(write32_delegate func) { assert(!func.isnull()); - m_write.m_type = AMH_DEVICE_DELEGATE; + m_write.m_type = AMH_DEVICE_DELEGATE_F; m_write.m_bits = 32; m_write.m_name = func.name(); m_wproto32 = func; return *this; } - -address_map_entry &address_map_entry::rw(read32_delegate rfunc, write32_delegate wfunc) +address_map_entry &address_map_entry::r(read32s_delegate func) { - r(rfunc); - w(wfunc); + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_S; + m_read.m_bits = 32; + m_read.m_name = func.name(); + m_rproto32s = func; return *this; } +address_map_entry &address_map_entry::w(write32s_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_S; + m_write.m_bits = 32; + m_write.m_name = func.name(); + m_wproto32s = func; + return *this; +} + +address_map_entry &address_map_entry::r(read32sm_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SM; + m_read.m_bits = 32; + m_read.m_name = func.name(); + m_rproto32sm = func; + return *this; +} + +address_map_entry &address_map_entry::w(write32sm_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SM; + m_write.m_bits = 32; + m_write.m_name = func.name(); + m_wproto32sm = func; + return *this; +} + +address_map_entry &address_map_entry::r(read32smo_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SMO; + m_read.m_bits = 32; + m_read.m_name = func.name(); + m_rproto32smo = func; + return *this; +} + +address_map_entry &address_map_entry::w(write32smo_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SMO; + m_write.m_bits = 32; + m_write.m_name = func.name(); + m_wproto32smo = func; + return *this; +} //------------------------------------------------- // r/w/rw - handler setters for @@ -267,29 +419,80 @@ address_map_entry &address_map_entry::rw(read32_delegate rfunc, write32_delegate address_map_entry &address_map_entry::r(read64_delegate func) { assert(!func.isnull()); - m_read.m_type = AMH_DEVICE_DELEGATE; + m_read.m_type = AMH_DEVICE_DELEGATE_F; m_read.m_bits = 64; m_read.m_name = func.name(); m_rproto64 = func; return *this; } - address_map_entry &address_map_entry::w(write64_delegate func) { assert(!func.isnull()); - m_write.m_type = AMH_DEVICE_DELEGATE; + m_write.m_type = AMH_DEVICE_DELEGATE_F; m_write.m_bits = 64; m_write.m_name = func.name(); m_wproto64 = func; return *this; } - -address_map_entry &address_map_entry::rw(read64_delegate rfunc, write64_delegate wfunc) +address_map_entry &address_map_entry::r(read64s_delegate func) { - r(rfunc); - w(wfunc); + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_S; + m_read.m_bits = 64; + m_read.m_name = func.name(); + m_rproto64s = func; + return *this; +} + +address_map_entry &address_map_entry::w(write64s_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_S; + m_write.m_bits = 64; + m_write.m_name = func.name(); + m_wproto64s = func; + return *this; +} + +address_map_entry &address_map_entry::r(read64sm_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SM; + m_read.m_bits = 64; + m_read.m_name = func.name(); + m_rproto64sm = func; + return *this; +} + +address_map_entry &address_map_entry::w(write64sm_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SM; + m_write.m_bits = 64; + m_write.m_name = func.name(); + m_wproto64sm = func; + return *this; +} + +address_map_entry &address_map_entry::r(read64smo_delegate func) +{ + assert(!func.isnull()); + m_read.m_type = AMH_DEVICE_DELEGATE_SMO; + m_read.m_bits = 64; + m_read.m_name = func.name(); + m_rproto64smo = func; + return *this; +} + +address_map_entry &address_map_entry::w(write64smo_delegate func) +{ + assert(!func.isnull()); + m_write.m_type = AMH_DEVICE_DELEGATE_SMO; + m_write.m_bits = 64; + m_write.m_name = func.name(); + m_wproto64smo = func; return *this; } @@ -749,16 +952,55 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons } // make sure all devices exist - if (entry.m_read.m_type == AMH_DEVICE_DELEGATE) + if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_F || entry.m_read.m_type == AMH_DEVICE_DELEGATE_S || entry.m_read.m_type == AMH_DEVICE_DELEGATE_SM || entry.m_read.m_type == AMH_DEVICE_DELEGATE_SMO) { // extract the device tag from the proto-delegate const char *devtag = nullptr; switch (entry.m_read.m_bits) { - case 8: devtag = entry.m_rproto8.device_name(); break; - case 16: devtag = entry.m_rproto16.device_name(); break; - case 32: devtag = entry.m_rproto32.device_name(); break; - case 64: devtag = entry.m_rproto64.device_name(); break; + case 8: + if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_rproto8.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto8s.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto8sm.device_name(); + else + devtag = entry.m_rproto8smo.device_name(); + break; + + case 16: + if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_rproto16.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto16s.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto16sm.device_name(); + else + devtag = entry.m_rproto16smo.device_name(); + break; + + case 32: + if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_rproto32.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto32s.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto32sm.device_name(); + else + devtag = entry.m_rproto32smo.device_name(); + break; + + case 64: + if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_rproto64.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto64s.device_name(); + else if (entry.m_read.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_rproto64sm.device_name(); + else + devtag = entry.m_rproto64smo.device_name(); + break; } if (entry.m_devbase.subdevice(devtag) == nullptr) osd_printf_error("%s space memory map entry reads from nonexistent device '%s'\n", spaceconfig.m_name, devtag ? devtag : ""); @@ -766,16 +1008,55 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons (void)entry.unitmask_is_appropriate(entry.m_read.m_bits, entry.m_mask, entry.m_read.m_name); #endif } - if (entry.m_write.m_type == AMH_DEVICE_DELEGATE) + if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_F || entry.m_write.m_type == AMH_DEVICE_DELEGATE_S || entry.m_write.m_type == AMH_DEVICE_DELEGATE_SM || entry.m_write.m_type == AMH_DEVICE_DELEGATE_SMO) { // extract the device tag from the proto-delegate const char *devtag = nullptr; switch (entry.m_write.m_bits) { - case 8: devtag = entry.m_wproto8.device_name(); break; - case 16: devtag = entry.m_wproto16.device_name(); break; - case 32: devtag = entry.m_wproto32.device_name(); break; - case 64: devtag = entry.m_wproto64.device_name(); break; + case 8: + if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_wproto8.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto8s.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto8sm.device_name(); + else + devtag = entry.m_wproto8smo.device_name(); + break; + + case 16: + if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_wproto16.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto16s.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto16sm.device_name(); + else + devtag = entry.m_wproto16smo.device_name(); + break; + + case 32: + if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_wproto32.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto32s.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto32sm.device_name(); + else + devtag = entry.m_wproto32smo.device_name(); + break; + + case 64: + if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_F) + devtag = entry.m_wproto64.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto64s.device_name(); + else if (entry.m_write.m_type == AMH_DEVICE_DELEGATE_S) + devtag = entry.m_wproto64sm.device_name(); + else + devtag = entry.m_wproto64smo.device_name(); + break; } if (entry.m_devbase.subdevice(devtag) == nullptr) osd_printf_error("%s space memory map entry writes to nonexistent device '%s'\n", spaceconfig.m_name, devtag ? devtag : ""); diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h index 90dd8898533..56d50ef4f7e 100644 --- a/src/emu/addrmap.h +++ b/src/emu/addrmap.h @@ -32,7 +32,10 @@ enum map_handler_type AMH_ROM, AMH_NOP, AMH_UNMAP, - AMH_DEVICE_DELEGATE, + AMH_DEVICE_DELEGATE_F, + AMH_DEVICE_DELEGATE_S, + AMH_DEVICE_DELEGATE_SM, + AMH_DEVICE_DELEGATE_SMO, AMH_PORT, AMH_BANK, AMH_DEVICE_SUBMAP @@ -180,7 +183,7 @@ public: template address_map_entry &rw(RetR (T::*read)(ParamsR...), const char *read_name, RetW (U::*write)(ParamsW...), const char *write_name) - { return rw(emu::detail::make_delegate(read, read_name, m_devbase.tag(), make_pointer(m_devbase)), emu::detail::make_delegate(write, write_name, m_devbase.tag(), make_pointer(m_devbase))); } + { return r(emu::detail::make_delegate(read, read_name, m_devbase.tag(), make_pointer(m_devbase))).w(emu::detail::make_delegate(write, write_name, m_devbase.tag(), make_pointer(m_devbase))); } template address_map_entry &m(Ret (T::*map)(Params...), const char *map_name) @@ -198,7 +201,7 @@ public: template address_map_entry &rw(const char *tag, RetR (T::*read)(ParamsR...), const char *read_name, RetW (U::*write)(ParamsW...), const char *write_name) - { return rw(emu::detail::make_delegate(read, read_name, tag, nullptr), emu::detail::make_delegate(write, write_name, tag, nullptr)); } + { return r(emu::detail::make_delegate(read, read_name, tag, nullptr)).w(emu::detail::make_delegate(write, write_name, tag, nullptr)); } template address_map_entry &m(const char *tag, Ret (T::*map)(Params...), const char *map_name) @@ -216,7 +219,7 @@ public: template address_map_entry &rw(T &obj, RetR (U::*read)(ParamsR...), const char *read_name, RetW (V::*write)(ParamsW...), const char *write_name) - { return rw(emu::detail::make_delegate(read, read_name, get_tag(obj), make_pointer(obj)), emu::detail::make_delegate(write, write_name, get_tag(obj), make_pointer(obj))); } + { return r(emu::detail::make_delegate(read, read_name, get_tag(obj), make_pointer(obj))).w(emu::detail::make_delegate(write, write_name, get_tag(obj), make_pointer(obj))); } template address_map_entry &m(T &obj, Ret (U::*map)(Params...), const char *map_name) @@ -242,11 +245,11 @@ public: template address_map_entry &rw(device_finder &finder, RetR (U::*read)(ParamsR...), const char *read_name, RetW (V::*write)(ParamsW...), const char *write_name) - { const std::pair target(finder.finder_target()); device_t &device(*target.first.subdevice(target.second)); return rw(emu::detail::make_delegate(read, read_name, device.tag(), make_pointer(device)), emu::detail::make_delegate(write, write_name, device.tag(), make_pointer(device))); } + { const std::pair target(finder.finder_target()); device_t &device(*target.first.subdevice(target.second)); return r(emu::detail::make_delegate(read, read_name, device.tag(), make_pointer(device))).w(emu::detail::make_delegate(write, write_name, device.tag(), make_pointer(device))); } template address_map_entry &rw(const device_finder &finder, RetR (U::*read)(ParamsR...), const char *read_name, RetW (V::*write)(ParamsW...), const char *write_name) - { const std::pair target(finder.finder_target()); device_t &device(*target.first.subdevice(target.second)); return rw(emu::detail::make_delegate(read, read_name, device.tag(), make_pointer(device)), emu::detail::make_delegate(write, write_name, device.tag(), make_pointer(device))); } + { const std::pair target(finder.finder_target()); device_t &device(*target.first.subdevice(target.second)); return r(emu::detail::make_delegate(read, read_name, device.tag(), make_pointer(device))).w(emu::detail::make_delegate(write, write_name, device.tag(), make_pointer(device))); } template address_map_entry &m(device_finder &finder, Ret (U::*map)(Params...), const char *map_name) @@ -259,51 +262,51 @@ public: // lambda -> delegate converter template address_map_entry &lr8(const char *name, _lr &&read) { - return r(read8_delegate(read, name)); + return r(emu::detail::make_lr8_delegate(read, name)); } template address_map_entry &lr16(const char *name, _lr &&read) { - return r(read16_delegate(read, name)); + return r(emu::detail::make_lr16_delegate(read, name)); } template address_map_entry &lr32(const char *name, _lr &&read) { - return r(read32_delegate(read, name)); + return r(emu::detail::make_lr32_delegate(read, name)); } template address_map_entry &lr64(const char *name, _lr &&read) { - return r(read64_delegate(read, name)); + return r(emu::detail::make_lr64_delegate(read, name)); } template address_map_entry &lw8(const char *name, _lw &&write) { - return w(write8_delegate(write, name)); + return w(emu::detail::make_lw8_delegate(write, name)); } template address_map_entry &lw16(const char *name, _lw &&write) { - return w(write16_delegate(write, name)); + return w(emu::detail::make_lw16_delegate(write, name)); } template address_map_entry &lw32(const char *name, _lw &&write) { - return w(write32_delegate(write, name)); + return w(emu::detail::make_lw32_delegate(write, name)); } template address_map_entry &lw64(const char *name, _lw &&write) { - return w(write64_delegate(write, name)); + return w(emu::detail::make_lw64_delegate(write, name)); } template address_map_entry &lrw8(const char *name, _lr &&read, _lw &&write) { - return rw(read8_delegate(read, name), write8_delegate(write, name)); + return r(emu::detail::make_lr8_delegate(read, name)).w(emu::detail::make_lw8_delegate(write, name)); } template address_map_entry &lrw16(const char *name, _lr &&read, _lw &&write) { - return rw(read16_delegate(read, name), write16_delegate(write, name)); + return r(emu::detail::make_lr16_delegate(read, name)).w(emu::detail::make_lw16_delegate(write, name)); } template address_map_entry &lrw32(const char *name, _lr &&read, _lw &&write) { - return rw(read32_delegate(read, name), write32_delegate(write, name)); + return r(emu::detail::make_lr32_delegate(read, name)).w(emu::detail::make_lw32_delegate(write, name)); } template address_map_entry &lrw64(const char *name, _lr &&read, _lw &&write) { - return rw(read64_delegate(read, name), write64_delegate(write, name)); + return r(emu::detail::make_lr64_delegate(read, name)).w(emu::detail::make_lw64_delegate(write, name)); } // public state @@ -335,6 +338,33 @@ public: write32_delegate m_wproto32; // 32-bit write proto-delegate write64_delegate m_wproto64; // 64-bit write proto-delegate + read8s_delegate m_rproto8s; // 8-bit read proto-delegate + read16s_delegate m_rproto16s; // 16-bit read proto-delegate + read32s_delegate m_rproto32s; // 32-bit read proto-delegate + read64s_delegate m_rproto64s; // 64-bit read proto-delegate + write8s_delegate m_wproto8s; // 8-bit write proto-delegate + write16s_delegate m_wproto16s; // 16-bit write proto-delegate + write32s_delegate m_wproto32s; // 32-bit write proto-delegate + write64s_delegate m_wproto64s; // 64-bit write proto-delegate + + read8sm_delegate m_rproto8sm; // 8-bit read proto-delegate + read16sm_delegate m_rproto16sm; // 16-bit read proto-delegate + read32sm_delegate m_rproto32sm; // 32-bit read proto-delegate + read64sm_delegate m_rproto64sm; // 64-bit read proto-delegate + write8sm_delegate m_wproto8sm; // 8-bit write proto-delegate + write16sm_delegate m_wproto16sm; // 16-bit write proto-delegate + write32sm_delegate m_wproto32sm; // 32-bit write proto-delegate + write64sm_delegate m_wproto64sm; // 64-bit write proto-delegate + + read8smo_delegate m_rproto8smo; // 8-bit read proto-delegate + read16smo_delegate m_rproto16smo; // 16-bit read proto-delegate + read32smo_delegate m_rproto32smo; // 32-bit read proto-delegate + read64smo_delegate m_rproto64smo; // 64-bit read proto-delegate + write8smo_delegate m_wproto8smo; // 8-bit write proto-delegate + write16smo_delegate m_wproto16smo; // 16-bit write proto-delegate + write32smo_delegate m_wproto32smo; // 32-bit write proto-delegate + write64smo_delegate m_wproto64smo; // 64-bit write proto-delegate + device_t *m_submap_device; address_map_constructor m_submap_delegate; @@ -344,22 +374,42 @@ public: // handler setters for 8-bit delegates address_map_entry &r(read8_delegate func); address_map_entry &w(write8_delegate func); - address_map_entry &rw(read8_delegate rfunc, write8_delegate wfunc); + address_map_entry &r(read8s_delegate func); + address_map_entry &w(write8s_delegate func); + address_map_entry &r(read8sm_delegate func); + address_map_entry &w(write8sm_delegate func); + address_map_entry &r(read8smo_delegate func); + address_map_entry &w(write8smo_delegate func); // handler setters for 16-bit delegates address_map_entry &r(read16_delegate func); address_map_entry &w(write16_delegate func); - address_map_entry &rw(read16_delegate rfunc, write16_delegate wfunc); + address_map_entry &r(read16s_delegate func); + address_map_entry &w(write16s_delegate func); + address_map_entry &r(read16sm_delegate func); + address_map_entry &w(write16sm_delegate func); + address_map_entry &r(read16smo_delegate func); + address_map_entry &w(write16smo_delegate func); // handler setters for 32-bit delegates address_map_entry &r(read32_delegate func); address_map_entry &w(write32_delegate func); - address_map_entry &rw(read32_delegate rfunc, write32_delegate wfunc); + address_map_entry &r(read32s_delegate func); + address_map_entry &w(write32s_delegate func); + address_map_entry &r(read32sm_delegate func); + address_map_entry &w(write32sm_delegate func); + address_map_entry &r(read32smo_delegate func); + address_map_entry &w(write32smo_delegate func); // handler setters for 64-bit delegates address_map_entry &r(read64_delegate func); address_map_entry &w(write64_delegate func); - address_map_entry &rw(read64_delegate rfunc, write64_delegate wfunc); + address_map_entry &r(read64s_delegate func); + address_map_entry &w(write64s_delegate func); + address_map_entry &r(read64sm_delegate func); + address_map_entry &w(write64sm_delegate func); + address_map_entry &r(read64smo_delegate func); + address_map_entry &w(write64smo_delegate func); private: // helper functions diff --git a/src/emu/devcb.h b/src/emu/devcb.h index beaba738592..4d858f8b82a 100644 --- a/src/emu/devcb.h +++ b/src/emu/devcb.h @@ -206,16 +206,16 @@ protected: // Mapping method types to delegate types template struct delegate_type; - template struct delegate_type > > > { using type = read8_delegate; using device_class = emu::detail::read8_device_class_t >; }; - template struct delegate_type > > > { using type = read16_delegate; using device_class = emu::detail::read16_device_class_t >; }; - template struct delegate_type > > > { using type = read32_delegate; using device_class = emu::detail::read32_device_class_t >; }; - template struct delegate_type > > > { using type = read64_delegate; using device_class = emu::detail::read64_device_class_t >; }; - template struct delegate_type > > > { using type = read_line_delegate; using device_class = emu::detail::read_line_device_class_t >; }; - template struct delegate_type > > > { using type = write8_delegate; using device_class = emu::detail::write8_device_class_t >; }; - template struct delegate_type > > > { using type = write16_delegate; using device_class = emu::detail::write16_device_class_t >; }; - template struct delegate_type > > > { using type = write32_delegate; using device_class = emu::detail::write32_device_class_t >; }; - template struct delegate_type > > > { using type = write64_delegate; using device_class = emu::detail::write64_device_class_t >; }; - template struct delegate_type > > > { using type = write_line_delegate; using device_class = emu::detail::write_line_device_class_t >; }; + template struct delegate_type > > > { using type = read8_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = read16_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = read32_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = read64_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = read_line_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = write8_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = write16_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = write32_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = write64_delegate; using device_class = emu::detail::rw_device_class_t >; }; + template struct delegate_type > > > { using type = write_line_delegate; using device_class = emu::detail::rw_device_class_t >; }; template using delegate_type_t = typename delegate_type::type; template using delegate_device_class_t = typename delegate_type::device_class; @@ -330,11 +330,11 @@ protected: // Detecting candidates for read delegates template struct is_read_method { static constexpr bool value = false; }; - template struct is_read_method > > > { static constexpr bool value = true; }; - template struct is_read_method > > > { static constexpr bool value = true; }; - template struct is_read_method > > > { static constexpr bool value = true; }; - template struct is_read_method > > > { static constexpr bool value = true; }; - template struct is_read_method > > > { static constexpr bool value = true; }; + template struct is_read_method > > > { static constexpr bool value = true; }; + template struct is_read_method > > > { static constexpr bool value = true; }; + template struct is_read_method > > > { static constexpr bool value = true; }; + template struct is_read_method > > > { static constexpr bool value = true; }; + template struct is_read_method > > > { static constexpr bool value = true; }; // Invoking read callbacks template static std::enable_if_t::value, mask_t, Result> > invoke_read(T const &cb, address_space &space, offs_t offset, std::make_unsigned_t mem_mask) { return std::make_unsigned_t >(cb(space, offset, mem_mask)); } @@ -380,11 +380,11 @@ protected: // Detecting candidates for write delegates template struct is_write_method { static constexpr bool value = false; }; - template struct is_write_method > > > { static constexpr bool value = true; }; - template struct is_write_method > > > { static constexpr bool value = true; }; - template struct is_write_method > > > { static constexpr bool value = true; }; - template struct is_write_method > > > { static constexpr bool value = true; }; - template struct is_write_method > > > { static constexpr bool value = true; }; + template struct is_write_method > > > { static constexpr bool value = true; }; + template struct is_write_method > > > { static constexpr bool value = true; }; + template struct is_write_method > > > { static constexpr bool value = true; }; + template struct is_write_method > > > { static constexpr bool value = true; }; + template struct is_write_method > > > { static constexpr bool value = true; }; // Invoking write callbacks template static std::enable_if_t::value> invoke_write(T const &cb, address_space &space, offs_t &offset, Input data, std::make_unsigned_t mem_mask) { return cb(space, offset, data, mem_mask); } diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index 0cfb6f07d93..0ba90cb45ab 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -222,7 +222,7 @@ const int MEMORY_BLOCK_CHUNK = 65536; // minimum chunk size of template class address_space_specific : public address_space { - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using NativeType = uX; using this_type = address_space_specific; @@ -244,6 +244,7 @@ public: void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank) override; void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, const char *rtag, const char *wtag) override; void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; @@ -257,6 +258,45 @@ public: void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override; + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override; + using address_space::install_read_tap; using address_space::install_write_tap; using address_space::install_readwrite_tap; @@ -470,9 +510,9 @@ public: std::unordered_set m_delayed_unrefs; private: - template std::enable_if_t<(Width == AccessWidth)> + template std::enable_if_t<(Width == AccessWidth)> install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::READ handler_r) + READ handler_r) { VPRINTF(("address_space::install_read_handler(%s-%s mask=%s mirror=%s, space width=%d, handler width=%d, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -485,15 +525,15 @@ private: int ncswidth; check_optimize_all("install_read_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); - auto hand_r = new handler_entry_read_delegate(this, handler_r); + auto hand_r = new handler_entry_read_delegate(this, handler_r); hand_r->set_address_info(nstart, nmask); m_root_read->populate(nstart, nend, nmirror, hand_r); invalidate_caches(read_or_write::READ); } - template std::enable_if_t<(Width > AccessWidth)> + template std::enable_if_t<(Width > AccessWidth)> install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::READ handler_r) + READ handler_r) { VPRINTF(("address_space::install_read_handler(%s-%s mask=%s mirror=%s, space width=%d, handler width=%d, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -506,7 +546,7 @@ private: int ncswidth; check_optimize_all("install_read_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); - auto hand_r = new handler_entry_read_delegate(this, handler_r); + auto hand_r = new handler_entry_read_delegate(this, handler_r); memory_units_descriptor descriptor(AccessWidth, Endian, hand_r, nstart, nend, nmask, nunitmask, ncswidth); hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); m_root_read->populate_mismatched(nstart, nend, nmirror, descriptor); @@ -515,16 +555,16 @@ private: } - template std::enable_if_t<(Width < AccessWidth)> + template std::enable_if_t<(Width < AccessWidth)> install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::READ handler_r) + READ handler_r) { fatalerror("install_read_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width); } - template std::enable_if_t<(Width == AccessWidth)> + template std::enable_if_t<(Width == AccessWidth)> install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::WRITE handler_w) + WRITE handler_w) { VPRINTF(("address_space::install_write_handler(%s-%s mask=%s mirror=%s, space width=%d, handler width=%d, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -537,15 +577,15 @@ private: int ncswidth; check_optimize_all("install_write_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); - auto hand_w = new handler_entry_write_delegate(this, handler_w); + auto hand_w = new handler_entry_write_delegate(this, handler_w); hand_w->set_address_info(nstart, nmask); m_root_write->populate(nstart, nend, nmirror, hand_w); invalidate_caches(read_or_write::WRITE); } - template std::enable_if_t<(Width > AccessWidth)> + template std::enable_if_t<(Width > AccessWidth)> install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::WRITE handler_w) + WRITE handler_w) { VPRINTF(("address_space::install_write_handler(%s-%s mask=%s mirror=%s, space width=%d, handler width=%d, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -558,7 +598,7 @@ private: int ncswidth; check_optimize_all("install_write_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); - auto hand_w = new handler_entry_write_delegate(this, handler_w); + auto hand_w = new handler_entry_write_delegate(this, handler_w); memory_units_descriptor descriptor(AccessWidth, Endian, hand_w, nstart, nend, nmask, nunitmask, ncswidth); hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); m_root_write->populate_mismatched(nstart, nend, nmirror, descriptor); @@ -567,19 +607,19 @@ private: } - template std::enable_if_t<(Width < AccessWidth)> + template std::enable_if_t<(Width < AccessWidth)> install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::WRITE handler_w) + WRITE handler_w) { fatalerror("install_write_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width); } - template std::enable_if_t<(Width == AccessWidth)> + template std::enable_if_t<(Width == AccessWidth)> install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::READ handler_r, - typename handler_entry_size::WRITE handler_w) + READ handler_r, + WRITE handler_w) { VPRINTF(("address_space::install_readwrite_handler(%s-%s mask=%s mirror=%s, space width=%d, handler width=%d, %s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -592,21 +632,21 @@ private: int ncswidth; check_optimize_all("install_readwrite_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); - auto hand_r = new handler_entry_read_delegate (this, handler_r); + auto hand_r = new handler_entry_read_delegate (this, handler_r); hand_r->set_address_info(nstart, nmask); m_root_read ->populate(nstart, nend, nmirror, hand_r); - auto hand_w = new handler_entry_write_delegate(this, handler_w); + auto hand_w = new handler_entry_write_delegate(this, handler_w); hand_w->set_address_info(nstart, nmask); m_root_write->populate(nstart, nend, nmirror, hand_w); invalidate_caches(read_or_write::READWRITE); } - template std::enable_if_t<(Width > AccessWidth)> + template std::enable_if_t<(Width > AccessWidth)> install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::READ handler_r, - typename handler_entry_size::WRITE handler_w) + READ handler_r, + WRITE handler_w) { VPRINTF(("address_space::install_readwrite_handler(%s-%s mask=%s mirror=%s, space width=%d, handler width=%d, %s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -619,13 +659,13 @@ private: int ncswidth; check_optimize_all("install_readwrite_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); - auto hand_r = new handler_entry_read_delegate (this, handler_r); + auto hand_r = new handler_entry_read_delegate (this, handler_r); memory_units_descriptor descriptor(AccessWidth, Endian, hand_r, nstart, nend, nmask, nunitmask, ncswidth); hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); m_root_read ->populate_mismatched(nstart, nend, nmirror, descriptor); hand_r->unref(); - auto hand_w = new handler_entry_write_delegate(this, handler_w); + auto hand_w = new handler_entry_write_delegate(this, handler_w); descriptor.set_subunit_handler(hand_w); hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); m_root_write->populate_mismatched(nstart, nend, nmirror, descriptor); @@ -635,10 +675,10 @@ private: } - template std::enable_if_t<(Width < AccessWidth)> + template std::enable_if_t<(Width < AccessWidth)> install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, - typename handler_entry_size::READ handler_r, - typename handler_entry_size::WRITE handler_w) + READ handler_r, + WRITE handler_w) { fatalerror("install_readwrite_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width); } @@ -1255,7 +1295,7 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w unmap_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, readorwrite, false); break; - case AMH_DEVICE_DELEGATE: + case AMH_DEVICE_DELEGATE_F: if (readorwrite == read_or_write::READ) switch (data.m_bits) { @@ -1274,6 +1314,63 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w } break; + case AMH_DEVICE_DELEGATE_S: + if (readorwrite == read_or_write::READ) + switch (data.m_bits) + { + case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read8s_delegate(entry.m_rproto8s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read16s_delegate(entry.m_rproto16s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read32s_delegate(entry.m_rproto32s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read64s_delegate(entry.m_rproto64s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + } + else + switch (data.m_bits) + { + case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write8s_delegate(entry.m_wproto8s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write16s_delegate(entry.m_wproto16s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write32s_delegate(entry.m_wproto32s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write64s_delegate(entry.m_wproto64s, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + } + break; + + case AMH_DEVICE_DELEGATE_SM: + if (readorwrite == read_or_write::READ) + switch (data.m_bits) + { + case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read8sm_delegate(entry.m_rproto8sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read16sm_delegate(entry.m_rproto16sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read32sm_delegate(entry.m_rproto32sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read64sm_delegate(entry.m_rproto64sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + } + else + switch (data.m_bits) + { + case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write8sm_delegate(entry.m_wproto8sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write16sm_delegate(entry.m_wproto16sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write32sm_delegate(entry.m_wproto32sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write64sm_delegate(entry.m_wproto64sm, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + } + break; + + case AMH_DEVICE_DELEGATE_SMO: + if (readorwrite == read_or_write::READ) + switch (data.m_bits) + { + case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read8smo_delegate(entry.m_rproto8smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read16smo_delegate(entry.m_rproto16smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read32smo_delegate(entry.m_rproto32smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, read64smo_delegate(entry.m_rproto64smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + } + else + switch (data.m_bits) + { + case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write8smo_delegate(entry.m_wproto8smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write16smo_delegate(entry.m_wproto16smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write32smo_delegate(entry.m_wproto32smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, write64smo_delegate(entry.m_wproto64smo, entry.m_devbase), entry.m_mask, entry.m_cswidth); break; + } + break; + case AMH_PORT: install_readwrite_port(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, (readorwrite == read_or_write::READ) ? data.m_tag : nullptr, @@ -1894,6 +1991,51 @@ template void address_space_speci install_readwrite_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); } +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + //------------------------------------------------- // install_handler - install 16-bit read/write @@ -1915,6 +2057,51 @@ template void address_space_speci install_readwrite_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); } +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + //------------------------------------------------- // install_handler - install 32-bit read/write @@ -1936,6 +2123,51 @@ template void address_space_speci install_readwrite_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); } +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + //------------------------------------------------- // install_handler64 - install 64-bit read/write @@ -1957,6 +2189,51 @@ template void address_space_speci install_readwrite_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); } +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + +template void address_space_specific::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate handler, u64 unitmask, int cswidth) +{ + install_read_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate handler, u64 unitmask, int cswidth) +{ + install_write_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler); +} + +template void address_space_specific::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask, int cswidth) +{ + install_readwrite_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); +} + //************************************************************************** // MEMORY MAPPING HELPERS //************************************************************************** diff --git a/src/emu/emumem.h b/src/emu/emumem.h index d631fd29985..ec7fae2b258 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -94,149 +94,308 @@ using read16_delegate = device_delegate; using read32_delegate = device_delegate; using read64_delegate = device_delegate; +using read8s_delegate = device_delegate; +using read16s_delegate = device_delegate; +using read32s_delegate = device_delegate; +using read64s_delegate = device_delegate; + +using read8sm_delegate = device_delegate; +using read16sm_delegate = device_delegate; +using read32sm_delegate = device_delegate; +using read64sm_delegate = device_delegate; + +using read8smo_delegate = device_delegate; +using read16smo_delegate = device_delegate; +using read32smo_delegate = device_delegate; +using read64smo_delegate = device_delegate; + // ======================> write_delegate // declare delegates for each width -typedef device_delegate write8_delegate; -typedef device_delegate write16_delegate; -typedef device_delegate write32_delegate; -typedef device_delegate write64_delegate; +using write8_delegate = device_delegate; +using write16_delegate = device_delegate; +using write32_delegate = device_delegate; +using write64_delegate = device_delegate; + +using write8s_delegate = device_delegate; +using write16s_delegate = device_delegate; +using write32s_delegate = device_delegate; +using write64s_delegate = device_delegate; + +using write8sm_delegate = device_delegate; +using write16sm_delegate = device_delegate; +using write32sm_delegate = device_delegate; +using write64sm_delegate = device_delegate; + +using write8smo_delegate = device_delegate; +using write16smo_delegate = device_delegate; +using write32smo_delegate = device_delegate; +using write64smo_delegate = device_delegate; + namespace emu { namespace detail { -template struct read8_device_class { }; -template struct read16_device_class { }; -template struct read32_device_class { }; -template struct read64_device_class { }; +template struct rw_device_class { }; -template -struct read8_device_class::value> > { using type = T; }; -template -struct read8_device_class::value> > { using type = T; }; -template -struct read8_device_class::value> > { using type = T; }; -template -struct read8_device_class::value> > { using type = T; }; +template +struct rw_device_class::value> > { using type = T; }; +template +struct rw_device_class::value> > { using type = T; }; +template +struct rw_device_class::value> > { using type = T; }; +template +struct rw_device_class::value> > { using type = T; }; -template -struct read16_device_class::value> > { using type = T; }; -template -struct read16_device_class::value> > { using type = T; }; -template -struct read16_device_class::value> > { using type = T; }; -template -struct read16_device_class::value> > { using type = T; }; - -template -struct read32_device_class::value> > { using type = T; }; -template -struct read32_device_class::value> > { using type = T; }; -template -struct read32_device_class::value> > { using type = T; }; -template -struct read32_device_class::value> > { using type = T; }; - -template -struct read64_device_class::value> > { using type = T; }; -template -struct read64_device_class::value> > { using type = T; }; -template -struct read64_device_class::value> > { using type = T; }; -template -struct read64_device_class::value> > { using type = T; }; - -template using read8_device_class_t = typename read8_device_class::type; -template using read16_device_class_t = typename read16_device_class::type; -template using read32_device_class_t = typename read32_device_class::type; -template using read64_device_class_t = typename read64_device_class::type; - -template struct write8_device_class { }; -template struct write16_device_class { }; -template struct write32_device_class { }; -template struct write64_device_class { }; - -template -struct write8_device_class::value> > { using type = T; }; -template -struct write8_device_class::value> > { using type = T; }; -template -struct write8_device_class::value> > { using type = T; }; -template -struct write8_device_class::value> > { using type = T; }; - -template -struct write16_device_class::value> > { using type = T; }; -template -struct write16_device_class::value> > { using type = T; }; -template -struct write16_device_class::value> > { using type = T; }; -template -struct write16_device_class::value> > { using type = T; }; - -template -struct write32_device_class::value> > { using type = T; }; -template -struct write32_device_class::value> > { using type = T; }; -template -struct write32_device_class::value> > { using type = T; }; -template -struct write32_device_class::value> > { using type = T; }; - -template -struct write64_device_class::value> > { using type = T; }; -template -struct write64_device_class::value> > { using type = T; }; -template -struct write64_device_class::value> > { using type = T; }; -template -struct write64_device_class::value> > { using type = T; }; - -template using write8_device_class_t = typename write8_device_class::type; -template using write16_device_class_t = typename write16_device_class::type; -template using write32_device_class_t = typename write32_device_class::type; -template using write64_device_class_t = typename write64_device_class::type; +template using rw_device_class_t = typename rw_device_class ::type; template -inline read8_delegate make_delegate(T &&func, const char *name, const char *tag, read8_device_class_t > *obj) +inline read8_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return read8_delegate(func, name, tag, obj); } template -inline read16_delegate make_delegate(T &&func, const char *name, const char *tag, read16_device_class_t > *obj) +inline read16_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return read16_delegate(func, name, tag, obj); } template -inline read32_delegate make_delegate(T &&func, const char *name, const char *tag, read32_device_class_t > *obj) +inline read32_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return read32_delegate(func, name, tag, obj); } template -inline read64_delegate make_delegate(T &&func, const char *name, const char *tag, read64_device_class_t > *obj) +inline read64_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return read64_delegate(func, name, tag, obj); } template -inline write8_delegate make_delegate(T &&func, const char *name, const char *tag, write8_device_class_t > *obj) +inline write8_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return write8_delegate(func, name, tag, obj); } template -inline write16_delegate make_delegate(T &&func, const char *name, const char *tag, write16_device_class_t > *obj) +inline write16_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return write16_delegate(func, name, tag, obj); } template -inline write32_delegate make_delegate(T &&func, const char *name, const char *tag, write32_device_class_t > *obj) +inline write32_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return write32_delegate(func, name, tag, obj); } template -inline write64_delegate make_delegate(T &&func, const char *name, const char *tag, write64_device_class_t > *obj) +inline write64_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) { return write64_delegate(func, name, tag, obj); } -} } // namespace emu::detail + +template +inline read8s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read8s_delegate(func, name, tag, obj); } +template +inline read16s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read16s_delegate(func, name, tag, obj); } +template +inline read32s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read32s_delegate(func, name, tag, obj); } +template +inline read64s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read64s_delegate(func, name, tag, obj); } + +template +inline write8s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write8s_delegate(func, name, tag, obj); } +template +inline write16s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write16s_delegate(func, name, tag, obj); } +template +inline write32s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write32s_delegate(func, name, tag, obj); } +template +inline write64s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write64s_delegate(func, name, tag, obj); } + + +template +inline read8sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read8sm_delegate(func, name, tag, obj); } +template +inline read16sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read16sm_delegate(func, name, tag, obj); } +template +inline read32sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read32sm_delegate(func, name, tag, obj); } +template +inline read64sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read64sm_delegate(func, name, tag, obj); } + +template +inline write8sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write8sm_delegate(func, name, tag, obj); } +template +inline write16sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write16sm_delegate(func, name, tag, obj); } +template +inline write32sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write32sm_delegate(func, name, tag, obj); } +template +inline write64sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write64sm_delegate(func, name, tag, obj); } + + +template +inline read8smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read8smo_delegate(func, name, tag, obj); } +template +inline read16smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read16smo_delegate(func, name, tag, obj); } +template +inline read32smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read32smo_delegate(func, name, tag, obj); } +template +inline read64smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return read64smo_delegate(func, name, tag, obj); } + +template +inline write8smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write8smo_delegate(func, name, tag, obj); } +template +inline write16smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write16smo_delegate(func, name, tag, obj); } +template +inline write32smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write32smo_delegate(func, name, tag, obj); } +template +inline write64smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t > *obj) +{ return write64smo_delegate(func, name, tag, obj); } + + + +template +inline std::enable_if_t::value, read8_delegate> make_lr8_delegate(L l, const char *name) +{ return read8_delegate(l, name); } + +template +inline std::enable_if_t::value, read8s_delegate> make_lr8_delegate(L l, const char *name) +{ return read8s_delegate(l, name); } + +template +inline std::enable_if_t::value, read8sm_delegate> make_lr8_delegate(L l, const char *name) +{ return read8sm_delegate(l, name); } + +template +inline std::enable_if_t::value, read8smo_delegate> make_lr8_delegate(L l, const char *name) +{ return read8smo_delegate(l, name); } + +template +inline std::enable_if_t::value, read16_delegate> make_lr16_delegate(L l, const char *name) +{ return read16_delegate(l, name); } + +template +inline std::enable_if_t::value, read16s_delegate> make_lr16_delegate(L l, const char *name) +{ return read16s_delegate(l, name); } + +template +inline std::enable_if_t::value, read16sm_delegate> make_lr16_delegate(L l, const char *name) +{ return read16sm_delegate(l, name); } + +template +inline std::enable_if_t::value, read16smo_delegate> make_lr16_delegate(L l, const char *name) +{ return read16smo_delegate(l, name); } + +template +inline std::enable_if_t::value, read32_delegate> make_lr32_delegate(L l, const char *name) +{ return read32_delegate(l, name); } + +template +inline std::enable_if_t::value, read32s_delegate> make_lr32_delegate(L l, const char *name) +{ return read32s_delegate(l, name); } + +template +inline std::enable_if_t::value, read32sm_delegate> make_lr32_delegate(L l, const char *name) +{ return read32sm_delegate(l, name); } + +template +inline std::enable_if_t::value, read32smo_delegate> make_lr32_delegate(L l, const char *name) +{ return read32smo_delegate(l, name); } + +template +inline std::enable_if_t::value, read64_delegate> make_lr64_delegate(L l, const char *name) +{ return read64_delegate(l, name); } + +template +inline std::enable_if_t::value, read64s_delegate> make_lr64_delegate(L l, const char *name) +{ return read64s_delegate(l, name); } + +template +inline std::enable_if_t::value, read64sm_delegate> make_lr64_delegate(L l, const char *name) +{ return read64sm_delegate(l, name); } + +template +inline std::enable_if_t::value, read64smo_delegate> make_lr64_delegate(L l, const char *name) +{ return read64smo_delegate(l, name); } + + +template +inline std::enable_if_t::value, write8_delegate> make_lw8_delegate(L l, const char *name) +{ return write8_delegate(l, name); } + +template +inline std::enable_if_t::value, write8s_delegate> make_lw8_delegate(L l, const char *name) +{ return write8s_delegate(l, name); } + +template +inline std::enable_if_t::value, write8sm_delegate> make_lw8_delegate(L l, const char *name) +{ return write8sm_delegate(l, name); } + +template +inline std::enable_if_t::value, write8smo_delegate> make_lw8_delegate(L l, const char *name) +{ return write8smo_delegate(l, name); } + +template +inline std::enable_if_t::value, write16_delegate> make_lw16_delegate(L l, const char *name) +{ return write16_delegate(l, name); } + +template +inline std::enable_if_t::value, write16s_delegate> make_lw16_delegate(L l, const char *name) +{ return write16s_delegate(l, name); } + +template +inline std::enable_if_t::value, write16sm_delegate> make_lw16_delegate(L l, const char *name) +{ return write16sm_delegate(l, name); } + +template +inline std::enable_if_t::value, write16smo_delegate> make_lw16_delegate(L l, const char *name) +{ return write16smo_delegate(l, name); } + +template +inline std::enable_if_t::value, write32_delegate> make_lw32_delegate(L l, const char *name) +{ return write32_delegate(l, name); } + +template +inline std::enable_if_t::value, write32s_delegate> make_lw32_delegate(L l, const char *name) +{ return write32s_delegate(l, name); } + +template +inline std::enable_if_t::value, write32sm_delegate> make_lw32_delegate(L l, const char *name) +{ return write32sm_delegate(l, name); } + +template +inline std::enable_if_t::value, write32smo_delegate> make_lw32_delegate(L l, const char *name) +{ return write32smo_delegate(l, name); } + +template +inline std::enable_if_t::value, write64_delegate> make_lw64_delegate(L l, const char *name) +{ return write64_delegate(l, name); } + +template +inline std::enable_if_t::value, write64s_delegate> make_lw64_delegate(L l, const char *name) +{ return write64s_delegate(l, name); } + +template +inline std::enable_if_t::value, write64sm_delegate> make_lw64_delegate(L l, const char *name) +{ return write64sm_delegate(l, name); } + +template +inline std::enable_if_t::value, write64smo_delegate> make_lw64_delegate(L l, const char *name) +{ return write64smo_delegate(l, name); } + + // =====================-> Width -> types template struct handler_entry_size {}; -template<> struct handler_entry_size<0> { using uX = u8; using READ = read8_delegate; using WRITE = write8_delegate; }; -template<> struct handler_entry_size<1> { using uX = u16; using READ = read16_delegate; using WRITE = write16_delegate; }; -template<> struct handler_entry_size<2> { using uX = u32; using READ = read32_delegate; using WRITE = write32_delegate; }; -template<> struct handler_entry_size<3> { using uX = u64; using READ = read64_delegate; using WRITE = write64_delegate; }; - - -// ======================> memopry_units_descritor forwards declaration - -template class memory_units_descriptor; +template<> struct handler_entry_size<0> { using uX = u8; }; +template<> struct handler_entry_size<1> { using uX = u16; }; +template<> struct handler_entry_size<2> { using uX = u32; }; +template<> struct handler_entry_size<3> { using uX = u64; }; // =====================-> Address segmentation for the search tree @@ -248,6 +407,14 @@ constexpr int handler_entry_dispatch_lowbits(int highbits, int width, int ashift width + ashift; } +} } // namespace emu::detail + + +// ======================> memory_units_descritor forwards declaration + +template class memory_units_descriptor; + + // =====================-> The root class of all handlers @@ -334,7 +501,7 @@ template class handler_entry_read_passthro template class handler_entry_read : public handler_entry { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; struct mapping { handler_entry_read *original; @@ -395,7 +562,7 @@ template class handler_entry_write_passthr template class handler_entry_write : public handler_entry { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; struct mapping { handler_entry_write *original; @@ -477,10 +644,10 @@ constexpr offs_t memory_offset_to_byte(offs_t offset, int AddrShift) { return Ad // ======================> generic read/write decomposition routines // generic direct read -template typename handler_entry_size::uX memory_read_generic(T rop, offs_t address, typename handler_entry_size::uX mask) +template typename emu::detail::handler_entry_size::uX memory_read_generic(T rop, offs_t address, typename emu::detail::handler_entry_size::uX mask) { - using TargetType = typename handler_entry_size::uX; - using NativeType = typename handler_entry_size::uX; + using TargetType = typename emu::detail::handler_entry_size::uX; + using NativeType = typename emu::detail::handler_entry_size::uX; constexpr u32 TARGET_BYTES = 1 << TargetWidth; constexpr u32 TARGET_BITS = 8 * TARGET_BYTES; @@ -611,9 +778,9 @@ template void memory_write_generic(T wop, offs_t address, typename handler_entry_size::uX data, typename handler_entry_size::uX mask) +template void memory_write_generic(T wop, offs_t address, typename emu::detail::handler_entry_size::uX data, typename emu::detail::handler_entry_size::uX mask) { - using NativeType = typename handler_entry_size::uX; + using NativeType = typename emu::detail::handler_entry_size::uX; constexpr u32 TARGET_BYTES = 1 << TargetWidth; constexpr u32 TARGET_BITS = 8 * TARGET_BYTES; @@ -740,7 +907,7 @@ template class memory_access_cache { - using NativeType = typename handler_entry_size::uX; + using NativeType = typename emu::detail::handler_entry_size::uX; static constexpr u32 NATIVE_BYTES = 1 << Width; static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0; @@ -1073,6 +1240,45 @@ public: void install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + + void install_read_handler(offs_t addrstart, offs_t addrend, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + + void install_read_handler(offs_t addrstart, offs_t addrend, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + void install_read_handler(offs_t addrstart, offs_t addrend, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); } + void install_write_handler(offs_t addrstart, offs_t addrend, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); } + // install new-style delegate handlers (with mirror/mask) virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; @@ -1087,6 +1293,45 @@ public: virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0; + // setup void prepare_map(); void populate_from_map(address_map *map = nullptr); @@ -1474,13 +1719,13 @@ private: #define QWORD_ALIGNED(a) (((a) & 7) == 0) -template typename handler_entry_size::uX memory_access_cache::read_native(offs_t address, typename handler_entry_size::uX mask) +template typename emu::detail::handler_entry_size::uX memory_access_cache::read_native(offs_t address, typename emu::detail::handler_entry_size::uX mask) { check_address_r(address); return m_cache_r->read(address, mask); } -template void memory_access_cache::write_native(offs_t address, typename handler_entry_size::uX data, typename handler_entry_size::uX mask) +template void memory_access_cache::write_native(offs_t address, typename emu::detail::handler_entry_size::uX data, typename emu::detail::handler_entry_size::uX mask) { check_address_w(address); m_cache_w->write(address, data, mask); diff --git a/src/emu/emumem_hea.h b/src/emu/emumem_hea.h index 7de0d7913a0..e19a04b4613 100644 --- a/src/emu/emumem_hea.h +++ b/src/emu/emumem_hea.h @@ -8,7 +8,7 @@ template class handler_entry_read_address : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; handler_entry_read_address(address_space *space, u32 flags) : handler_entry_read(space, flags) {} ~handler_entry_read_address() = default; @@ -25,7 +25,7 @@ protected: template class handler_entry_write_address : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; handler_entry_write_address(address_space *space, u32 flags) : handler_entry_write(space, flags) {} ~handler_entry_write_address() = default; diff --git a/src/emu/emumem_hedp.cpp b/src/emu/emumem_hedp.cpp index 330117f2637..c0215493193 100644 --- a/src/emu/emumem_hedp.cpp +++ b/src/emu/emumem_hedp.cpp @@ -5,22 +5,102 @@ #include "emumem_hea.h" #include "emumem_hedp.h" -template typename handler_entry_size::uX handler_entry_read_delegate::read(offs_t offset, uX mem_mask) +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + typename emu::detail::handler_entry_size::uX> handler_entry_read_delegate::read_impl(offs_t offset, uX mem_mask) { return m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask); } -template std::string handler_entry_read_delegate::name() const +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + typename emu::detail::handler_entry_size::uX> handler_entry_read_delegate::read_impl(offs_t offset, uX mem_mask) +{ + return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask); +} + +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + typename emu::detail::handler_entry_size::uX> handler_entry_read_delegate::read_impl(offs_t offset, uX mem_mask) +{ + return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)); +} + +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + typename emu::detail::handler_entry_size::uX> handler_entry_read_delegate::read_impl(offs_t offset, uX mem_mask) +{ + return m_delegate(); +} + +template typename emu::detail::handler_entry_size::uX handler_entry_read_delegate::read(offs_t offset, uX mem_mask) +{ + return read_impl(offset, mem_mask); +} + +template std::string handler_entry_read_delegate::name() const { return m_delegate.name(); } -template void handler_entry_write_delegate::write(offs_t offset, uX data, uX mem_mask) +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> handler_entry_write_delegate::write_impl(offs_t offset, uX data, uX mem_mask) { m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask); } -template std::string handler_entry_write_delegate::name() const +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> handler_entry_write_delegate::write_impl(offs_t offset, uX data, uX mem_mask) +{ + m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask); +} + +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> handler_entry_write_delegate::write_impl(offs_t offset, uX data, uX mem_mask) +{ + m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data); +} + +template template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> handler_entry_write_delegate::write_impl(offs_t offset, uX data, uX mem_mask) +{ + m_delegate(data); +} + +template void handler_entry_write_delegate::write(offs_t offset, uX data, uX mem_mask) +{ + write_impl(offset, data, mem_mask); +} + +template std::string handler_entry_write_delegate::name() const { return m_delegate.name(); } @@ -28,7 +108,7 @@ template std::string handler_entry_write_d -template typename handler_entry_size::uX handler_entry_read_ioport::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_ioport::read(offs_t offset, uX mem_mask) { return m_port->read(); } @@ -50,51 +130,189 @@ template std::string handler_entry_write_i -template class handler_entry_read_delegate<0, 0, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<0, 0, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<1, 3, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<1, 3, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<1, 0, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<1, 0, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<1, -1, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<1, -1, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<2, 0, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<2, 0, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<2, -1, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<2, -1, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<2, -2, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<2, -2, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<3, 0, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<3, 0, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<3, -1, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<3, -1, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<3, -2, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<3, -2, ENDIANNESS_BIG>; -template class handler_entry_read_delegate<3, -3, ENDIANNESS_LITTLE>; -template class handler_entry_read_delegate<3, -3, ENDIANNESS_BIG>; +template class handler_entry_read_delegate<0, 0, ENDIANNESS_LITTLE, read8_delegate>; +template class handler_entry_read_delegate<0, 0, ENDIANNESS_BIG, read8_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_LITTLE, read16_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_BIG, read16_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_LITTLE, read16_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_BIG, read16_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_LITTLE, read16_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_BIG, read16_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_LITTLE, read32_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_BIG, read32_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_LITTLE, read32_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_BIG, read32_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_LITTLE, read32_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_BIG, read32_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_LITTLE, read64_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_BIG, read64_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_LITTLE, read64_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_BIG, read64_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_LITTLE, read64_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_BIG, read64_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_LITTLE, read64_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_BIG, read64_delegate>; -template class handler_entry_write_delegate<0, 0, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<0, 0, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<1, 3, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<1, 3, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<1, 0, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<1, 0, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<1, -1, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<1, -1, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<2, 0, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<2, 0, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<2, -1, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<2, -1, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<2, -2, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<2, -2, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<3, 0, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<3, 0, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<3, -1, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<3, -1, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<3, -2, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<3, -2, ENDIANNESS_BIG>; -template class handler_entry_write_delegate<3, -3, ENDIANNESS_LITTLE>; -template class handler_entry_write_delegate<3, -3, ENDIANNESS_BIG>; +template class handler_entry_read_delegate<0, 0, ENDIANNESS_LITTLE, read8s_delegate>; +template class handler_entry_read_delegate<0, 0, ENDIANNESS_BIG, read8s_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_LITTLE, read16s_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_BIG, read16s_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_LITTLE, read16s_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_BIG, read16s_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_LITTLE, read16s_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_BIG, read16s_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_LITTLE, read32s_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_BIG, read32s_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_LITTLE, read32s_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_BIG, read32s_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_LITTLE, read32s_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_BIG, read32s_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_LITTLE, read64s_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_BIG, read64s_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_LITTLE, read64s_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_BIG, read64s_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_LITTLE, read64s_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_BIG, read64s_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_LITTLE, read64s_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_BIG, read64s_delegate>; + +template class handler_entry_read_delegate<0, 0, ENDIANNESS_LITTLE, read8sm_delegate>; +template class handler_entry_read_delegate<0, 0, ENDIANNESS_BIG, read8sm_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_LITTLE, read16sm_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_BIG, read16sm_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_LITTLE, read16sm_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_BIG, read16sm_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_LITTLE, read16sm_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_BIG, read16sm_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_LITTLE, read32sm_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_BIG, read32sm_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_LITTLE, read32sm_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_BIG, read32sm_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_LITTLE, read32sm_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_BIG, read32sm_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_LITTLE, read64sm_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_BIG, read64sm_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_LITTLE, read64sm_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_BIG, read64sm_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_LITTLE, read64sm_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_BIG, read64sm_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_LITTLE, read64sm_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_BIG, read64sm_delegate>; + +template class handler_entry_read_delegate<0, 0, ENDIANNESS_LITTLE, read8smo_delegate>; +template class handler_entry_read_delegate<0, 0, ENDIANNESS_BIG, read8smo_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_LITTLE, read16smo_delegate>; +template class handler_entry_read_delegate<1, 3, ENDIANNESS_BIG, read16smo_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_LITTLE, read16smo_delegate>; +template class handler_entry_read_delegate<1, 0, ENDIANNESS_BIG, read16smo_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_LITTLE, read16smo_delegate>; +template class handler_entry_read_delegate<1, -1, ENDIANNESS_BIG, read16smo_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_LITTLE, read32smo_delegate>; +template class handler_entry_read_delegate<2, 0, ENDIANNESS_BIG, read32smo_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_LITTLE, read32smo_delegate>; +template class handler_entry_read_delegate<2, -1, ENDIANNESS_BIG, read32smo_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_LITTLE, read32smo_delegate>; +template class handler_entry_read_delegate<2, -2, ENDIANNESS_BIG, read32smo_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_LITTLE, read64smo_delegate>; +template class handler_entry_read_delegate<3, 0, ENDIANNESS_BIG, read64smo_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_LITTLE, read64smo_delegate>; +template class handler_entry_read_delegate<3, -1, ENDIANNESS_BIG, read64smo_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_LITTLE, read64smo_delegate>; +template class handler_entry_read_delegate<3, -2, ENDIANNESS_BIG, read64smo_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_LITTLE, read64smo_delegate>; +template class handler_entry_read_delegate<3, -3, ENDIANNESS_BIG, read64smo_delegate>; + +template class handler_entry_write_delegate<0, 0, ENDIANNESS_LITTLE, write8_delegate>; +template class handler_entry_write_delegate<0, 0, ENDIANNESS_BIG, write8_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_LITTLE, write16_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_BIG, write16_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_LITTLE, write16_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_BIG, write16_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_LITTLE, write16_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_BIG, write16_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_LITTLE, write32_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_BIG, write32_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_LITTLE, write32_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_BIG, write32_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_LITTLE, write32_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_BIG, write32_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_LITTLE, write64_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_BIG, write64_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_LITTLE, write64_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_BIG, write64_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_LITTLE, write64_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_BIG, write64_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_LITTLE, write64_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_BIG, write64_delegate>; + +template class handler_entry_write_delegate<0, 0, ENDIANNESS_LITTLE, write8s_delegate>; +template class handler_entry_write_delegate<0, 0, ENDIANNESS_BIG, write8s_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_LITTLE, write16s_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_BIG, write16s_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_LITTLE, write16s_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_BIG, write16s_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_LITTLE, write16s_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_BIG, write16s_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_LITTLE, write32s_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_BIG, write32s_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_LITTLE, write32s_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_BIG, write32s_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_LITTLE, write32s_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_BIG, write32s_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_LITTLE, write64s_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_BIG, write64s_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_LITTLE, write64s_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_BIG, write64s_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_LITTLE, write64s_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_BIG, write64s_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_LITTLE, write64s_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_BIG, write64s_delegate>; + +template class handler_entry_write_delegate<0, 0, ENDIANNESS_LITTLE, write8sm_delegate>; +template class handler_entry_write_delegate<0, 0, ENDIANNESS_BIG, write8sm_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_LITTLE, write16sm_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_BIG, write16sm_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_LITTLE, write16sm_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_BIG, write16sm_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_LITTLE, write16sm_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_BIG, write16sm_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_LITTLE, write32sm_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_BIG, write32sm_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_LITTLE, write32sm_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_BIG, write32sm_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_LITTLE, write32sm_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_BIG, write32sm_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_LITTLE, write64sm_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_BIG, write64sm_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_LITTLE, write64sm_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_BIG, write64sm_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_LITTLE, write64sm_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_BIG, write64sm_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_LITTLE, write64sm_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_BIG, write64sm_delegate>; + +template class handler_entry_write_delegate<0, 0, ENDIANNESS_LITTLE, write8smo_delegate>; +template class handler_entry_write_delegate<0, 0, ENDIANNESS_BIG, write8smo_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_LITTLE, write16smo_delegate>; +template class handler_entry_write_delegate<1, 3, ENDIANNESS_BIG, write16smo_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_LITTLE, write16smo_delegate>; +template class handler_entry_write_delegate<1, 0, ENDIANNESS_BIG, write16smo_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_LITTLE, write16smo_delegate>; +template class handler_entry_write_delegate<1, -1, ENDIANNESS_BIG, write16smo_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_LITTLE, write32smo_delegate>; +template class handler_entry_write_delegate<2, 0, ENDIANNESS_BIG, write32smo_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_LITTLE, write32smo_delegate>; +template class handler_entry_write_delegate<2, -1, ENDIANNESS_BIG, write32smo_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_LITTLE, write32smo_delegate>; +template class handler_entry_write_delegate<2, -2, ENDIANNESS_BIG, write32smo_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_LITTLE, write64smo_delegate>; +template class handler_entry_write_delegate<3, 0, ENDIANNESS_BIG, write64smo_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_LITTLE, write64smo_delegate>; +template class handler_entry_write_delegate<3, -1, ENDIANNESS_BIG, write64smo_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_LITTLE, write64smo_delegate>; +template class handler_entry_write_delegate<3, -2, ENDIANNESS_BIG, write64smo_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_LITTLE, write64smo_delegate>; +template class handler_entry_write_delegate<3, -3, ENDIANNESS_BIG, write64smo_delegate>; template class handler_entry_read_ioport<0, 0, ENDIANNESS_LITTLE>; diff --git a/src/emu/emumem_hedp.h b/src/emu/emumem_hedp.h index e9539bd21d9..af16088f21e 100644 --- a/src/emu/emumem_hedp.h +++ b/src/emu/emumem_hedp.h @@ -5,11 +5,10 @@ // Executes an access through called a delegate, usually containing a handler or a lambda -template class handler_entry_read_delegate : public handler_entry_read_address +template class handler_entry_read_delegate : public handler_entry_read_address { public: - using uX = typename handler_entry_size::uX; - using READ = typename handler_entry_size::READ; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read_address; handler_entry_read_delegate(address_space *space, READ delegate) : handler_entry_read_address(space, 0), m_delegate(delegate) {} @@ -21,13 +20,40 @@ public: private: READ m_delegate; + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + uX> read_impl(offs_t offset, uX mem_mask); + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + uX> read_impl(offs_t offset, uX mem_mask); + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + uX> read_impl(offs_t offset, uX mem_mask); + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + uX> read_impl(offs_t offset, uX mem_mask); }; -template class handler_entry_write_delegate : public handler_entry_write_address +template class handler_entry_write_delegate : public handler_entry_write_address { public: - using uX = typename handler_entry_size::uX; - using WRITE = typename handler_entry_size::WRITE; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write_address; handler_entry_write_delegate(address_space *space, WRITE delegate) : handler_entry_write_address(space, 0), m_delegate(delegate) {} @@ -39,6 +65,34 @@ public: private: WRITE m_delegate; + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> write_impl(offs_t offset, uX data, uX mem_mask); + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> write_impl(offs_t offset, uX data, uX mem_mask); + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> write_impl(offs_t offset, uX data, uX mem_mask); + + template + std::enable_if_t::value || + std::is_same::value || + std::is_same::value || + std::is_same::value, + void> write_impl(offs_t offset, uX data, uX mem_mask); }; @@ -49,7 +103,7 @@ private: template class handler_entry_read_ioport : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read; handler_entry_read_ioport(address_space *space, ioport_port *port) : handler_entry_read(space, 0), m_port(port) {} @@ -66,7 +120,7 @@ private: template class handler_entry_write_ioport : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write; handler_entry_write_ioport(address_space *space, ioport_port *port) : handler_entry_write(space, 0), m_port(port) {} diff --git a/src/emu/emumem_hedr.h b/src/emu/emumem_hedr.h index 87fff01635e..b30dfb95637 100644 --- a/src/emu/emumem_hedr.h +++ b/src/emu/emumem_hedr.h @@ -8,7 +8,7 @@ template class handler_entry_read_dispatch : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read; using mapping = typename inh::mapping; @@ -36,7 +36,7 @@ public: void enumerate_references(handler_entry::reflist &refs) const override; protected: - static constexpr u32 LowBits = handler_entry_dispatch_lowbits(HighBits, Width, AddrShift); + 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; static constexpr offs_t BITMASK = make_bitmask(BITCOUNT); diff --git a/src/emu/emumem_hedr.ipp b/src/emu/emumem_hedr.ipp index 626f43a6d3f..af259b33b01 100644 --- a/src/emu/emumem_hedr.ipp +++ b/src/emu/emumem_hedr.ipp @@ -47,7 +47,7 @@ template void handler_entry_ } -template typename handler_entry_size::uX handler_entry_read_dispatch::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_dispatch::read(offs_t offset, uX mem_mask) { return m_dispatch[(offset >> LowBits) & BITMASK]->read(offset, mem_mask); } diff --git a/src/emu/emumem_hedw.h b/src/emu/emumem_hedw.h index ed51d826f97..72143402c6f 100644 --- a/src/emu/emumem_hedw.h +++ b/src/emu/emumem_hedw.h @@ -8,7 +8,7 @@ template class handler_entry_write_dispatch : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write; using mapping = typename inh::mapping; @@ -36,7 +36,7 @@ public: void enumerate_references(handler_entry::reflist &refs) const override; protected: - static constexpr u32 LowBits = handler_entry_dispatch_lowbits(HighBits, Width, AddrShift); + 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; static constexpr offs_t BITMASK = make_bitmask(BITCOUNT); diff --git a/src/emu/emumem_hem.cpp b/src/emu/emumem_hem.cpp index 6a897b2c07c..45f83d75d12 100644 --- a/src/emu/emumem_hem.cpp +++ b/src/emu/emumem_hem.cpp @@ -5,7 +5,7 @@ #include "emumem_hea.h" #include "emumem_hem.h" -template typename handler_entry_size::uX handler_entry_read_memory::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_memory::read(offs_t offset, uX mem_mask) { return m_base[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)]; } @@ -51,7 +51,7 @@ template std::string handler_entry_write_m -template typename handler_entry_size::uX handler_entry_read_memory_bank::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_memory_bank::read(offs_t offset, uX mem_mask) { return static_cast(m_bank.base())[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)]; } diff --git a/src/emu/emumem_hem.h b/src/emu/emumem_hem.h index 554f6957a18..184c752625c 100644 --- a/src/emu/emumem_hem.h +++ b/src/emu/emumem_hem.h @@ -8,7 +8,7 @@ template class handler_entry_read_memory : public handler_entry_read_address { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read_address; handler_entry_read_memory(address_space *space) : handler_entry_read_address(space, 0) {} @@ -28,7 +28,7 @@ private: template class handler_entry_write_memory : public handler_entry_write_address { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write_address; handler_entry_write_memory(address_space *space) : handler_entry_write_address(space, 0) {} @@ -53,7 +53,7 @@ private: template class handler_entry_read_memory_bank : public handler_entry_read_address { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read_address; handler_entry_read_memory_bank(address_space *space, memory_bank &bank) : handler_entry_read_address(space, 0), m_bank(bank) {} @@ -71,7 +71,7 @@ private: template class handler_entry_write_memory_bank : public handler_entry_write_address { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write_address; handler_entry_write_memory_bank(address_space *space, memory_bank &bank) : handler_entry_write_address(space, 0), m_bank(bank) {} diff --git a/src/emu/emumem_hep.h b/src/emu/emumem_hep.h index 11da1dc2bca..0b166d77698 100644 --- a/src/emu/emumem_hep.h +++ b/src/emu/emumem_hep.h @@ -8,7 +8,7 @@ template class handler_entry_read_passthrough : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; handler_entry_read_passthrough(address_space *space, memory_passthrough_handler &mph) : handler_entry_read(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(nullptr) {} ~handler_entry_read_passthrough(); @@ -29,7 +29,7 @@ protected: template class handler_entry_write_passthrough : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; handler_entry_write_passthrough(address_space *space, memory_passthrough_handler &mph) : handler_entry_write(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(nullptr) {} ~handler_entry_write_passthrough(); diff --git a/src/emu/emumem_het.cpp b/src/emu/emumem_het.cpp index 6870284d61d..5d948eccfeb 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 typename handler_entry_size::uX handler_entry_read_tap::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_tap::read(offs_t offset, uX mem_mask) { uX data = inh::m_next->read(offset, mem_mask); m_tap(offset, data, mem_mask); diff --git a/src/emu/emumem_het.h b/src/emu/emumem_het.h index 785c840d75d..274aa138403 100644 --- a/src/emu/emumem_het.h +++ b/src/emu/emumem_het.h @@ -8,7 +8,7 @@ template class handler_entry_read_tap : public handler_entry_read_passthrough { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read_passthrough; handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function tap) : handler_entry_read_passthrough(space, mph), m_name(name), m_tap(std::move(tap)) {} @@ -30,7 +30,7 @@ protected: template class handler_entry_write_tap : public handler_entry_write_passthrough { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write_passthrough; handler_entry_write_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function tap) : handler_entry_write_passthrough(space, mph), m_name(name), m_tap(std::move(tap)) {} diff --git a/src/emu/emumem_heu.cpp b/src/emu/emumem_heu.cpp index d56c62498d8..3806e0916ac 100644 --- a/src/emu/emumem_heu.cpp +++ b/src/emu/emumem_heu.cpp @@ -60,7 +60,7 @@ template void handler_entry_read_units typename handler_entry_size::uX handler_entry_read_units::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_units::read(offs_t offset, uX mem_mask) { uX result = m_unmap; for (int index = 0; index < m_subunits; index++) { @@ -94,7 +94,7 @@ template typename handler_entry_size std::string handler_entry_read_units::m2r(typename handler_entry_size::uX mask) +template std::string handler_entry_read_units::m2r(typename emu::detail::handler_entry_size::uX mask) { constexpr u32 mbits = 8*sizeof(uX); u32 start, end; @@ -204,7 +204,7 @@ template void handler_entry_write_units std::string handler_entry_write_units::m2r(typename handler_entry_size::uX mask) +template std::string handler_entry_write_units::m2r(typename emu::detail::handler_entry_size::uX mask) { constexpr u32 mbits = 8*sizeof(uX); u32 start, end; diff --git a/src/emu/emumem_heu.h b/src/emu/emumem_heu.h index 4b1857f0c6c..dbc0cf064f7 100644 --- a/src/emu/emumem_heu.h +++ b/src/emu/emumem_heu.h @@ -8,8 +8,7 @@ template class handler_entry_read_units : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; - using READ = typename handler_entry_size::READ; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read; handler_entry_read_units(const memory_units_descriptor &descriptor, u8 ukey, address_space *space); @@ -50,8 +49,7 @@ private: template class handler_entry_write_units : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; - using WRITE = typename handler_entry_size::WRITE; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write; handler_entry_write_units(const memory_units_descriptor &descriptor, u8 ukey, address_space *space); diff --git a/src/emu/emumem_heun.cpp b/src/emu/emumem_heun.cpp index 1ab59b17c2f..e76ddfe7078 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 typename handler_entry_size::uX handler_entry_read_unmapped::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_unmapped::read(offs_t offset, uX mem_mask) { 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() @@ -43,7 +43,7 @@ template std::string handler_entry_write_u -template typename handler_entry_size::uX handler_entry_read_nop::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_nop::read(offs_t offset, uX mem_mask) { return inh::m_space->unmap(); } diff --git a/src/emu/emumem_heun.h b/src/emu/emumem_heun.h index 2bc4a02a2dc..02a79d825ab 100644 --- a/src/emu/emumem_heun.h +++ b/src/emu/emumem_heun.h @@ -8,7 +8,7 @@ template class handler_entry_read_unmapped : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read; handler_entry_read_unmapped(address_space *space) : handler_entry_read(space, 0) {} @@ -22,7 +22,7 @@ public: template class handler_entry_write_unmapped : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write; handler_entry_write_unmapped(address_space *space) : handler_entry_write(space, 0) {} @@ -42,7 +42,7 @@ public: template class handler_entry_read_nop : public handler_entry_read { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read; handler_entry_read_nop(address_space *space) : handler_entry_read(space, 0) {} @@ -56,7 +56,7 @@ public: template class handler_entry_write_nop : public handler_entry_write { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write; handler_entry_write_nop(address_space *space) : handler_entry_write(space, 0) {} diff --git a/src/emu/emumem_mud.cpp b/src/emu/emumem_mud.cpp index 98e83c7055f..01e9916b9a0 100644 --- a/src/emu/emumem_mud.cpp +++ b/src/emu/emumem_mud.cpp @@ -35,7 +35,7 @@ template<> u8 mask_to_ukey(u64 mask) (mask & 0x00000000000000ff ? 0x01 : 0x00); } -template memory_units_descriptor::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename handler_entry_size::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian) +template memory_units_descriptor::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::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian) { constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? make_bitmask(Width + AddrShift) : 0; u32 bits_per_access = 8 << access_width; @@ -82,7 +82,7 @@ template memory_units_descriptor void memory_units_descriptor::generate(u8 ukey, typename handler_entry_size::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count) +template void memory_units_descriptor::generate(u8 ukey, typename emu::detail::handler_entry_size::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 e1299ed7fcc..eff76575c72 100644 --- a/src/emu/emumem_mud.h +++ b/src/emu/emumem_mud.h @@ -5,7 +5,7 @@ template class memory_units_descriptor { public: - using uX = typename handler_entry_size::uX; + using uX = typename emu::detail::handler_entry_size::uX; struct entry { uX m_amask; diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 894767e0838..c8d9b81b2f1 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -201,7 +201,10 @@ namespace sol case AMH_UNMAP: typestr = "unmap"; break; - case AMH_DEVICE_DELEGATE: + case AMH_DEVICE_DELEGATE_F: + case AMH_DEVICE_DELEGATE_S: + case AMH_DEVICE_DELEGATE_SM: + case AMH_DEVICE_DELEGATE_SMO: typestr = "delegate"; break; case AMH_PORT: