memory: Allow simplified versions of handlers [O. Galibert]

A standard memory handler has as a prototype (where uX = u8, u16, u32 or u64):
  uX device::read(address_space &space, offs_t offset, uX mem_mask);
  void device::write(address_space &space, offs_t offset, uX data, uX mem_mask);

We now allow simplified versions which are:
  uX device::read(offs_t offset, uX mem_mask);
  void device::write(offs_t offset, uX data, uX mem_mask);

  uX device::read(offs_t offset);
  void device::write(offs_t offset, uX data);

  uX device::read();
  void device::write(uX data);

Use them at will.  Also consider
(DECLARE_)(READ|WRITE)(8|16|32|64)_MEMBER on the way out, use the
explicit prototypes.

Same for lambdas in the memory map, the parameters are now optional
following the same combinations.
This commit is contained in:
Olivier Galibert 2018-08-02 16:17:40 +02:00
parent f8a26df4ad
commit 639c9b85fc
23 changed files with 1450 additions and 324 deletions

View File

@ -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 : "<unspecified>");
@ -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 : "<unspecified>");

View File

@ -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 <typename T, typename RetR, typename... ParamsR, typename U, typename RetW, typename... ParamsW>
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<T>(m_devbase)), emu::detail::make_delegate(write, write_name, m_devbase.tag(), make_pointer<U>(m_devbase))); }
{ return r(emu::detail::make_delegate(read, read_name, m_devbase.tag(), make_pointer<T>(m_devbase))).w(emu::detail::make_delegate(write, write_name, m_devbase.tag(), make_pointer<U>(m_devbase))); }
template <typename T, typename Ret, typename... Params>
address_map_entry &m(Ret (T::*map)(Params...), const char *map_name)
@ -198,7 +201,7 @@ public:
template <typename T, typename RetR, typename... ParamsR, typename U, typename RetW, typename... ParamsW>
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 <typename T, typename Ret, typename... Params>
address_map_entry &m(const char *tag, Ret (T::*map)(Params...), const char *map_name)
@ -216,7 +219,7 @@ public:
template <typename T, typename U, typename RetR, typename... ParamsR, typename V, typename RetW, typename... ParamsW>
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<U>(obj)), emu::detail::make_delegate(write, write_name, get_tag(obj), make_pointer<V>(obj))); }
{ return r(emu::detail::make_delegate(read, read_name, get_tag(obj), make_pointer<U>(obj))).w(emu::detail::make_delegate(write, write_name, get_tag(obj), make_pointer<V>(obj))); }
template <typename T, typename U, typename Ret, typename... Params>
address_map_entry &m(T &obj, Ret (U::*map)(Params...), const char *map_name)
@ -242,11 +245,11 @@ public:
template <typename T, bool Reqd, typename U, typename RetR, typename... ParamsR, typename V, typename RetW, typename... ParamsW>
address_map_entry &rw(device_finder<T, Reqd> &finder, RetR (U::*read)(ParamsR...), const char *read_name, RetW (V::*write)(ParamsW...), const char *write_name)
{ const std::pair<device_t &, const char *> 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<U>(device)), emu::detail::make_delegate(write, write_name, device.tag(), make_pointer<V>(device))); }
{ const std::pair<device_t &, const char *> 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<U>(device))).w(emu::detail::make_delegate(write, write_name, device.tag(), make_pointer<V>(device))); }
template <typename T, bool Reqd, typename U, typename RetR, typename... ParamsR, typename V, typename RetW, typename... ParamsW>
address_map_entry &rw(const device_finder<T, Reqd> &finder, RetR (U::*read)(ParamsR...), const char *read_name, RetW (V::*write)(ParamsW...), const char *write_name)
{ const std::pair<device_t &, const char *> 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<U>(device)), emu::detail::make_delegate(write, write_name, device.tag(), make_pointer<V>(device))); }
{ const std::pair<device_t &, const char *> 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<U>(device))).w(emu::detail::make_delegate(write, write_name, device.tag(), make_pointer<V>(device))); }
template <typename T, bool Reqd, typename U, typename Ret, typename... Params>
address_map_entry &m(device_finder<T, Reqd> &finder, Ret (U::*map)(Params...), const char *map_name)
@ -259,51 +262,51 @@ public:
// lambda -> delegate converter
template<typename _lr> 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<typename _lr> 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<typename _lr> 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<typename _lr> 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<typename _lw> 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<typename _lw> 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<typename _lw> 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<typename _lw> 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<typename _lr, typename _lw> 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<typename _lr, typename _lw> 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<typename _lr, typename _lw> 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<typename _lr, typename _lw> 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

View File

@ -206,16 +206,16 @@ protected:
// Mapping method types to delegate types
template <typename T, typename Enable = void> struct delegate_type;
template <typename T> struct delegate_type<T, void_t<emu::detail::read8_device_class_t<std::remove_reference_t<T> > > > { using type = read8_delegate; using device_class = emu::detail::read8_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::read16_device_class_t<std::remove_reference_t<T> > > > { using type = read16_delegate; using device_class = emu::detail::read16_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::read32_device_class_t<std::remove_reference_t<T> > > > { using type = read32_delegate; using device_class = emu::detail::read32_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::read64_device_class_t<std::remove_reference_t<T> > > > { using type = read64_delegate; using device_class = emu::detail::read64_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::read_line_device_class_t<std::remove_reference_t<T> > > > { using type = read_line_delegate; using device_class = emu::detail::read_line_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::write8_device_class_t<std::remove_reference_t<T> > > > { using type = write8_delegate; using device_class = emu::detail::write8_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::write16_device_class_t<std::remove_reference_t<T> > > > { using type = write16_delegate; using device_class = emu::detail::write16_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::write32_device_class_t<std::remove_reference_t<T> > > > { using type = write32_delegate; using device_class = emu::detail::write32_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::write64_device_class_t<std::remove_reference_t<T> > > > { using type = write64_delegate; using device_class = emu::detail::write64_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::write_line_device_class_t<std::remove_reference_t<T> > > > { using type = write_line_delegate; using device_class = emu::detail::write_line_device_class_t<std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<read8_delegate, std::remove_reference_t<T> > > > { using type = read8_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<read16_delegate, std::remove_reference_t<T> > > > { using type = read16_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<read32_delegate, std::remove_reference_t<T> > > > { using type = read32_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<read64_delegate, std::remove_reference_t<T> > > > { using type = read64_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<read_line_delegate, std::remove_reference_t<T> > > > { using type = read_line_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<write8_delegate, std::remove_reference_t<T> > > > { using type = write8_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<write16_delegate, std::remove_reference_t<T> > > > { using type = write16_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<write32_delegate, std::remove_reference_t<T> > > > { using type = write32_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<write64_delegate, std::remove_reference_t<T> > > > { using type = write64_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> struct delegate_type<T, void_t<emu::detail::rw_device_class_t<write_line_delegate, std::remove_reference_t<T> > > > { using type = write_line_delegate; using device_class = emu::detail::rw_device_class_t<type, std::remove_reference_t<T> >; };
template <typename T> using delegate_type_t = typename delegate_type<T>::type;
template <typename T> using delegate_device_class_t = typename delegate_type<T>::device_class;
@ -330,11 +330,11 @@ protected:
// Detecting candidates for read delegates
template <typename T, typename Enable = void> struct is_read_method { static constexpr bool value = false; };
template <typename T> struct is_read_method<T, void_t<emu::detail::read8_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::read16_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::read32_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::read64_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::read_line_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::rw_device_class_t<read8_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::rw_device_class_t<read16_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::rw_device_class_t<read32_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::rw_device_class_t<read64_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_read_method<T, void_t<emu::detail::rw_device_class_t<read_line_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
// Invoking read callbacks
template <typename Result, typename T> static std::enable_if_t<is_read_form1<Result, T>::value, mask_t<read_result_t<Result, T>, Result> > invoke_read(T const &cb, address_space &space, offs_t offset, std::make_unsigned_t<Result> mem_mask) { return std::make_unsigned_t<read_result_t<Result, T> >(cb(space, offset, mem_mask)); }
@ -380,11 +380,11 @@ protected:
// Detecting candidates for write delegates
template <typename T, typename Enable = void> struct is_write_method { static constexpr bool value = false; };
template <typename T> struct is_write_method<T, void_t<emu::detail::write8_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::write16_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::write32_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::write64_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::write_line_device_class_t<std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::rw_device_class_t<write8_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::rw_device_class_t<write16_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::rw_device_class_t<write32_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::rw_device_class_t<write64_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
template <typename T> struct is_write_method<T, void_t<emu::detail::rw_device_class_t<write_line_delegate, std::remove_reference_t<T> > > > { static constexpr bool value = true; };
// Invoking write callbacks
template <typename Input, typename T> static std::enable_if_t<is_write_form1<Input, T>::value> invoke_write(T const &cb, address_space &space, offs_t &offset, Input data, std::make_unsigned_t<Input> mem_mask) { return cb(space, offset, data, mem_mask); }

View File

@ -222,7 +222,7 @@ const int MEMORY_BLOCK_CHUNK = 65536; // minimum chunk size of
template<int Width, int AddrShift, endianness_t Endian>
class address_space_specific : public address_space
{
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using NativeType = uX;
using this_type = address_space_specific<Width, AddrShift, Endian>;
@ -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<handler_entry *> m_delayed_unrefs;
private:
template<int AccessWidth> std::enable_if_t<(Width == AccessWidth)>
template<int AccessWidth, typename READ> 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<AccessWidth>::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<Width, AddrShift, Endian>(this, handler_r);
auto hand_r = new handler_entry_read_delegate<Width, AddrShift, Endian, READ>(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<int AccessWidth> std::enable_if_t<(Width > AccessWidth)>
template<int AccessWidth, typename READ> 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<AccessWidth>::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<AccessWidth, -AccessWidth, Endian>(this, handler_r);
auto hand_r = new handler_entry_read_delegate<AccessWidth, -AccessWidth, Endian, READ>(this, handler_r);
memory_units_descriptor<Width, AddrShift, Endian> 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<int AccessWidth> std::enable_if_t<(Width < AccessWidth)>
template<int AccessWidth, typename READ> 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<AccessWidth>::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<int AccessWidth> std::enable_if_t<(Width == AccessWidth)>
template<int AccessWidth, typename WRITE> 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<AccessWidth>::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<Width, AddrShift, Endian>(this, handler_w);
auto hand_w = new handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>(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<int AccessWidth> std::enable_if_t<(Width > AccessWidth)>
template<int AccessWidth, typename WRITE> 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<AccessWidth>::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<AccessWidth, -AccessWidth, Endian>(this, handler_w);
auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, Endian, WRITE>(this, handler_w);
memory_units_descriptor<Width, AddrShift, Endian> 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<int AccessWidth> std::enable_if_t<(Width < AccessWidth)>
template<int AccessWidth, typename WRITE> 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<AccessWidth>::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<int AccessWidth> std::enable_if_t<(Width == AccessWidth)>
template<int AccessWidth, typename READ, typename WRITE> 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<AccessWidth>::READ handler_r,
typename handler_entry_size<AccessWidth>::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 <Width, AddrShift, Endian>(this, handler_r);
auto hand_r = new handler_entry_read_delegate <Width, AddrShift, Endian, READ>(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<Width, AddrShift, Endian>(this, handler_w);
auto hand_w = new handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>(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<int AccessWidth> std::enable_if_t<(Width > AccessWidth)>
template<int AccessWidth, typename READ, typename WRITE> 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<AccessWidth>::READ handler_r,
typename handler_entry_size<AccessWidth>::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 <AccessWidth, -AccessWidth, Endian>(this, handler_r);
auto hand_r = new handler_entry_read_delegate <AccessWidth, -AccessWidth, Endian, READ>(this, handler_r);
memory_units_descriptor<Width, AddrShift, Endian> 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<AccessWidth, -AccessWidth, Endian>(this, handler_w);
auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, Endian, WRITE>(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<int AccessWidth> std::enable_if_t<(Width < AccessWidth)>
template<int AccessWidth, typename READ, typename WRITE> 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<AccessWidth>::READ handler_r,
typename handler_entry_size<AccessWidth>::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<int Width, int AddrShift, endianness_t Endian> void address_space_speci
install_readwrite_handler_helper<0>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler);
}
template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_speci
install_readwrite_handler_helper<1>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler);
}
template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_speci
install_readwrite_handler_helper<2>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler);
}
template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_speci
install_readwrite_handler_helper<3>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler);
}
template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::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
//**************************************************************************

View File

@ -94,149 +94,308 @@ using read16_delegate = device_delegate<u16 (address_space &, offs_t, u16)>;
using read32_delegate = device_delegate<u32 (address_space &, offs_t, u32)>;
using read64_delegate = device_delegate<u64 (address_space &, offs_t, u64)>;
using read8s_delegate = device_delegate<u8 (offs_t, u8 )>;
using read16s_delegate = device_delegate<u16 (offs_t, u16)>;
using read32s_delegate = device_delegate<u32 (offs_t, u32)>;
using read64s_delegate = device_delegate<u64 (offs_t, u64)>;
using read8sm_delegate = device_delegate<u8 (offs_t)>;
using read16sm_delegate = device_delegate<u16 (offs_t)>;
using read32sm_delegate = device_delegate<u32 (offs_t)>;
using read64sm_delegate = device_delegate<u64 (offs_t)>;
using read8smo_delegate = device_delegate<u8 ()>;
using read16smo_delegate = device_delegate<u16 ()>;
using read32smo_delegate = device_delegate<u32 ()>;
using read64smo_delegate = device_delegate<u64 ()>;
// ======================> write_delegate
// declare delegates for each width
typedef device_delegate<void (address_space &, offs_t, u8, u8 )> write8_delegate;
typedef device_delegate<void (address_space &, offs_t, u16, u16)> write16_delegate;
typedef device_delegate<void (address_space &, offs_t, u32, u32)> write32_delegate;
typedef device_delegate<void (address_space &, offs_t, u64, u64)> write64_delegate;
using write8_delegate = device_delegate<void (address_space &, offs_t, u8, u8 )>;
using write16_delegate = device_delegate<void (address_space &, offs_t, u16, u16)>;
using write32_delegate = device_delegate<void (address_space &, offs_t, u32, u32)>;
using write64_delegate = device_delegate<void (address_space &, offs_t, u64, u64)>;
using write8s_delegate = device_delegate<void (offs_t, u8, u8 )>;
using write16s_delegate = device_delegate<void (offs_t, u16, u16)>;
using write32s_delegate = device_delegate<void (offs_t, u32, u32)>;
using write64s_delegate = device_delegate<void (offs_t, u64, u64)>;
using write8sm_delegate = device_delegate<void (offs_t, u8 )>;
using write16sm_delegate = device_delegate<void (offs_t, u16)>;
using write32sm_delegate = device_delegate<void (offs_t, u32)>;
using write64sm_delegate = device_delegate<void (offs_t, u64)>;
using write8smo_delegate = device_delegate<void (u8 )>;
using write16smo_delegate = device_delegate<void (u16)>;
using write32smo_delegate = device_delegate<void (u32)>;
using write64smo_delegate = device_delegate<void (u64)>;
namespace emu { namespace detail {
template <typename T, typename Enable = void> struct read8_device_class { };
template <typename T, typename Enable = void> struct read16_device_class { };
template <typename T, typename Enable = void> struct read32_device_class { };
template <typename T, typename Enable = void> struct read64_device_class { };
template <typename D, typename T, typename Enable = void> struct rw_device_class { };
template <typename T, typename Ret, typename... Params>
struct read8_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<read8_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read8_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<read8_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read8_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<read8_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read8_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<read8_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<D, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<D, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<D, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<D, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read16_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<read16_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read16_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<read16_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read16_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<read16_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read16_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<read16_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read32_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<read32_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read32_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<read32_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read32_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<read32_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read32_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<read32_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read64_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<read64_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read64_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<read64_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read64_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<read64_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct read64_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<read64_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T> using read8_device_class_t = typename read8_device_class<T>::type;
template <typename T> using read16_device_class_t = typename read16_device_class<T>::type;
template <typename T> using read32_device_class_t = typename read32_device_class<T>::type;
template <typename T> using read64_device_class_t = typename read64_device_class<T>::type;
template <typename T, typename Enable = void> struct write8_device_class { };
template <typename T, typename Enable = void> struct write16_device_class { };
template <typename T, typename Enable = void> struct write32_device_class { };
template <typename T, typename Enable = void> struct write64_device_class { };
template <typename T, typename Ret, typename... Params>
struct write8_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<write8_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write8_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<write8_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write8_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<write8_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write8_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<write8_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write16_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<write16_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write16_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<write16_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write16_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<write16_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write16_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<write16_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write32_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<write32_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write32_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<write32_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write32_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<write32_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write32_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<write32_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write64_device_class<Ret (T::*)(Params...), std::enable_if_t<std::is_constructible<write64_delegate, Ret (T::*)(Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write64_device_class<Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<write64_delegate, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write64_device_class<Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<write64_delegate, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T, typename Ret, typename... Params>
struct write64_device_class<Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<write64_delegate, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename T> using write8_device_class_t = typename write8_device_class<T>::type;
template <typename T> using write16_device_class_t = typename write16_device_class<T>::type;
template <typename T> using write32_device_class_t = typename write32_device_class<T>::type;
template <typename T> using write64_device_class_t = typename write64_device_class<T>::type;
template <typename D, typename T> using rw_device_class_t = typename rw_device_class <D, T>::type;
template <typename T>
inline read8_delegate make_delegate(T &&func, const char *name, const char *tag, read8_device_class_t<std::remove_reference_t<T> > *obj)
inline read8_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read8_delegate, std::remove_reference_t<T> > *obj)
{ return read8_delegate(func, name, tag, obj); }
template <typename T>
inline read16_delegate make_delegate(T &&func, const char *name, const char *tag, read16_device_class_t<std::remove_reference_t<T> > *obj)
inline read16_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read16_delegate, std::remove_reference_t<T> > *obj)
{ return read16_delegate(func, name, tag, obj); }
template <typename T>
inline read32_delegate make_delegate(T &&func, const char *name, const char *tag, read32_device_class_t<std::remove_reference_t<T> > *obj)
inline read32_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read32_delegate, std::remove_reference_t<T> > *obj)
{ return read32_delegate(func, name, tag, obj); }
template <typename T>
inline read64_delegate make_delegate(T &&func, const char *name, const char *tag, read64_device_class_t<std::remove_reference_t<T> > *obj)
inline read64_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read64_delegate, std::remove_reference_t<T> > *obj)
{ return read64_delegate(func, name, tag, obj); }
template <typename T>
inline write8_delegate make_delegate(T &&func, const char *name, const char *tag, write8_device_class_t<std::remove_reference_t<T> > *obj)
inline write8_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write8_delegate, std::remove_reference_t<T> > *obj)
{ return write8_delegate(func, name, tag, obj); }
template <typename T>
inline write16_delegate make_delegate(T &&func, const char *name, const char *tag, write16_device_class_t<std::remove_reference_t<T> > *obj)
inline write16_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write16_delegate, std::remove_reference_t<T> > *obj)
{ return write16_delegate(func, name, tag, obj); }
template <typename T>
inline write32_delegate make_delegate(T &&func, const char *name, const char *tag, write32_device_class_t<std::remove_reference_t<T> > *obj)
inline write32_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write32_delegate, std::remove_reference_t<T> > *obj)
{ return write32_delegate(func, name, tag, obj); }
template <typename T>
inline write64_delegate make_delegate(T &&func, const char *name, const char *tag, write64_device_class_t<std::remove_reference_t<T> > *obj)
inline write64_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write64_delegate, std::remove_reference_t<T> > *obj)
{ return write64_delegate(func, name, tag, obj); }
} } // namespace emu::detail
template <typename T>
inline read8s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read8s_delegate, std::remove_reference_t<T> > *obj)
{ return read8s_delegate(func, name, tag, obj); }
template <typename T>
inline read16s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read16s_delegate, std::remove_reference_t<T> > *obj)
{ return read16s_delegate(func, name, tag, obj); }
template <typename T>
inline read32s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read32s_delegate, std::remove_reference_t<T> > *obj)
{ return read32s_delegate(func, name, tag, obj); }
template <typename T>
inline read64s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read64s_delegate, std::remove_reference_t<T> > *obj)
{ return read64s_delegate(func, name, tag, obj); }
template <typename T>
inline write8s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write8s_delegate, std::remove_reference_t<T> > *obj)
{ return write8s_delegate(func, name, tag, obj); }
template <typename T>
inline write16s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write16s_delegate, std::remove_reference_t<T> > *obj)
{ return write16s_delegate(func, name, tag, obj); }
template <typename T>
inline write32s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write32s_delegate, std::remove_reference_t<T> > *obj)
{ return write32s_delegate(func, name, tag, obj); }
template <typename T>
inline write64s_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write64s_delegate, std::remove_reference_t<T> > *obj)
{ return write64s_delegate(func, name, tag, obj); }
template <typename T>
inline read8sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read8sm_delegate, std::remove_reference_t<T> > *obj)
{ return read8sm_delegate(func, name, tag, obj); }
template <typename T>
inline read16sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read16sm_delegate, std::remove_reference_t<T> > *obj)
{ return read16sm_delegate(func, name, tag, obj); }
template <typename T>
inline read32sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read32sm_delegate, std::remove_reference_t<T> > *obj)
{ return read32sm_delegate(func, name, tag, obj); }
template <typename T>
inline read64sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read64sm_delegate, std::remove_reference_t<T> > *obj)
{ return read64sm_delegate(func, name, tag, obj); }
template <typename T>
inline write8sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write8sm_delegate, std::remove_reference_t<T> > *obj)
{ return write8sm_delegate(func, name, tag, obj); }
template <typename T>
inline write16sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write16sm_delegate, std::remove_reference_t<T> > *obj)
{ return write16sm_delegate(func, name, tag, obj); }
template <typename T>
inline write32sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write32sm_delegate, std::remove_reference_t<T> > *obj)
{ return write32sm_delegate(func, name, tag, obj); }
template <typename T>
inline write64sm_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write64sm_delegate, std::remove_reference_t<T> > *obj)
{ return write64sm_delegate(func, name, tag, obj); }
template <typename T>
inline read8smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read8smo_delegate, std::remove_reference_t<T> > *obj)
{ return read8smo_delegate(func, name, tag, obj); }
template <typename T>
inline read16smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read16smo_delegate, std::remove_reference_t<T> > *obj)
{ return read16smo_delegate(func, name, tag, obj); }
template <typename T>
inline read32smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read32smo_delegate, std::remove_reference_t<T> > *obj)
{ return read32smo_delegate(func, name, tag, obj); }
template <typename T>
inline read64smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<read64smo_delegate, std::remove_reference_t<T> > *obj)
{ return read64smo_delegate(func, name, tag, obj); }
template <typename T>
inline write8smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write8smo_delegate, std::remove_reference_t<T> > *obj)
{ return write8smo_delegate(func, name, tag, obj); }
template <typename T>
inline write16smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write16smo_delegate, std::remove_reference_t<T> > *obj)
{ return write16smo_delegate(func, name, tag, obj); }
template <typename T>
inline write32smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write32smo_delegate, std::remove_reference_t<T> > *obj)
{ return write32smo_delegate(func, name, tag, obj); }
template <typename T>
inline write64smo_delegate make_delegate(T &&func, const char *name, const char *tag, rw_device_class_t<write64smo_delegate, std::remove_reference_t<T> > *obj)
{ return write64smo_delegate(func, name, tag, obj); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read8_delegate, L, const char *>::value, read8_delegate> make_lr8_delegate(L l, const char *name)
{ return read8_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read8s_delegate, L, const char *>::value, read8s_delegate> make_lr8_delegate(L l, const char *name)
{ return read8s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read8sm_delegate, L, const char *>::value, read8sm_delegate> make_lr8_delegate(L l, const char *name)
{ return read8sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read8smo_delegate, L, const char *>::value, read8smo_delegate> make_lr8_delegate(L l, const char *name)
{ return read8smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read16_delegate, L, const char *>::value, read16_delegate> make_lr16_delegate(L l, const char *name)
{ return read16_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read16s_delegate, L, const char *>::value, read16s_delegate> make_lr16_delegate(L l, const char *name)
{ return read16s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read16sm_delegate, L, const char *>::value, read16sm_delegate> make_lr16_delegate(L l, const char *name)
{ return read16sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read16smo_delegate, L, const char *>::value, read16smo_delegate> make_lr16_delegate(L l, const char *name)
{ return read16smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read32_delegate, L, const char *>::value, read32_delegate> make_lr32_delegate(L l, const char *name)
{ return read32_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read32s_delegate, L, const char *>::value, read32s_delegate> make_lr32_delegate(L l, const char *name)
{ return read32s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read32sm_delegate, L, const char *>::value, read32sm_delegate> make_lr32_delegate(L l, const char *name)
{ return read32sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read32smo_delegate, L, const char *>::value, read32smo_delegate> make_lr32_delegate(L l, const char *name)
{ return read32smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read64_delegate, L, const char *>::value, read64_delegate> make_lr64_delegate(L l, const char *name)
{ return read64_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read64s_delegate, L, const char *>::value, read64s_delegate> make_lr64_delegate(L l, const char *name)
{ return read64s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read64sm_delegate, L, const char *>::value, read64sm_delegate> make_lr64_delegate(L l, const char *name)
{ return read64sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<read64smo_delegate, L, const char *>::value, read64smo_delegate> make_lr64_delegate(L l, const char *name)
{ return read64smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write8_delegate, L, const char *>::value, write8_delegate> make_lw8_delegate(L l, const char *name)
{ return write8_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write8s_delegate, L, const char *>::value, write8s_delegate> make_lw8_delegate(L l, const char *name)
{ return write8s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write8sm_delegate, L, const char *>::value, write8sm_delegate> make_lw8_delegate(L l, const char *name)
{ return write8sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write8smo_delegate, L, const char *>::value, write8smo_delegate> make_lw8_delegate(L l, const char *name)
{ return write8smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write16_delegate, L, const char *>::value, write16_delegate> make_lw16_delegate(L l, const char *name)
{ return write16_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write16s_delegate, L, const char *>::value, write16s_delegate> make_lw16_delegate(L l, const char *name)
{ return write16s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write16sm_delegate, L, const char *>::value, write16sm_delegate> make_lw16_delegate(L l, const char *name)
{ return write16sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write16smo_delegate, L, const char *>::value, write16smo_delegate> make_lw16_delegate(L l, const char *name)
{ return write16smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write32_delegate, L, const char *>::value, write32_delegate> make_lw32_delegate(L l, const char *name)
{ return write32_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write32s_delegate, L, const char *>::value, write32s_delegate> make_lw32_delegate(L l, const char *name)
{ return write32s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write32sm_delegate, L, const char *>::value, write32sm_delegate> make_lw32_delegate(L l, const char *name)
{ return write32sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write32smo_delegate, L, const char *>::value, write32smo_delegate> make_lw32_delegate(L l, const char *name)
{ return write32smo_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write64_delegate, L, const char *>::value, write64_delegate> make_lw64_delegate(L l, const char *name)
{ return write64_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write64s_delegate, L, const char *>::value, write64s_delegate> make_lw64_delegate(L l, const char *name)
{ return write64s_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write64sm_delegate, L, const char *>::value, write64sm_delegate> make_lw64_delegate(L l, const char *name)
{ return write64sm_delegate(l, name); }
template <typename L>
inline std::enable_if_t<std::is_constructible<write64smo_delegate, L, const char *>::value, write64smo_delegate> make_lw64_delegate(L l, const char *name)
{ return write64smo_delegate(l, name); }
// =====================-> Width -> types
template<int Width> 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<int Width, int AddrShift, int Endian> 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<int Width, int AddrShift, int Endian> class memory_units_descriptor;
// =====================-> The root class of all handlers
@ -334,7 +501,7 @@ template<int Width, int AddrShift, int Endian> class handler_entry_read_passthro
template<int Width, int AddrShift, int Endian> class handler_entry_read : public handler_entry
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
struct mapping {
handler_entry_read<Width, AddrShift, Endian> *original;
@ -395,7 +562,7 @@ template<int Width, int AddrShift, int Endian> class handler_entry_write_passthr
template<int Width, int AddrShift, int Endian> class handler_entry_write : public handler_entry
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
struct mapping {
handler_entry_write<Width, AddrShift, Endian> *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<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> typename handler_entry_size<TargetWidth>::uX memory_read_generic(T rop, offs_t address, typename handler_entry_size<TargetWidth>::uX mask)
template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> typename emu::detail::handler_entry_size<TargetWidth>::uX memory_read_generic(T rop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using TargetType = typename handler_entry_size<TargetWidth>::uX;
using NativeType = typename handler_entry_size<Width>::uX;
using TargetType = typename emu::detail::handler_entry_size<TargetWidth>::uX;
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
constexpr u32 TARGET_BYTES = 1 << TargetWidth;
constexpr u32 TARGET_BITS = 8 * TARGET_BYTES;
@ -611,9 +778,9 @@ template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, ty
}
// generic direct write
template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> void memory_write_generic(T wop, offs_t address, typename handler_entry_size<TargetWidth>::uX data, typename handler_entry_size<TargetWidth>::uX mask)
template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> void memory_write_generic(T wop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX data, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using NativeType = typename handler_entry_size<Width>::uX;
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
constexpr u32 TARGET_BYTES = 1 << TargetWidth;
constexpr u32 TARGET_BITS = 8 * TARGET_BYTES;
@ -740,7 +907,7 @@ template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, ty
// memory_access_cache contains state data for cached access
template<int Width, int AddrShift, int Endian> class memory_access_cache
{
using NativeType = typename handler_entry_size<Width>::uX;
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
static constexpr u32 NATIVE_BYTES = 1 << Width;
static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0;
@ -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<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX memory_access_cache<Width, AddrShift, Endian>::read_native(offs_t address, typename handler_entry_size<Width>::uX mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX memory_access_cache<Width, AddrShift, Endian>::read_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX mask)
{
check_address_r(address);
return m_cache_r->read(address, mask);
}
template<int Width, int AddrShift, int Endian> void memory_access_cache<Width, AddrShift, Endian>::write_native(offs_t address, typename handler_entry_size<Width>::uX data, typename handler_entry_size<Width>::uX mask)
template<int Width, int AddrShift, int Endian> void memory_access_cache<Width, AddrShift, Endian>::write_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mask)
{
check_address_w(address);
m_cache_w->write(address, data, mask);

View File

@ -8,7 +8,7 @@
template<int Width, int AddrShift, int Endian> class handler_entry_read_address : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_address(address_space *space, u32 flags) : handler_entry_read<Width, AddrShift, Endian>(space, flags) {}
~handler_entry_read_address() = default;
@ -25,7 +25,7 @@ protected:
template<int Width, int AddrShift, int Endian> class handler_entry_write_address : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_address(address_space *space, u32 flags) : handler_entry_write<Width, AddrShift, Endian>(space, flags) {}
~handler_entry_write_address() = default;

View File

@ -5,22 +5,102 @@
#include "emumem_hea.h"
#include "emumem_hedp.h"
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_delegate<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8_delegate>::value ||
std::is_same<R, read16_delegate>::value ||
std::is_same<R, read32_delegate>::value ||
std::is_same<R, read64_delegate>::value,
typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
{
return m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask);
}
template<int Width, int AddrShift, int Endian> std::string handler_entry_read_delegate<Width, AddrShift, Endian>::name() const
template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8s_delegate>::value ||
std::is_same<R, read16s_delegate>::value ||
std::is_same<R, read32s_delegate>::value ||
std::is_same<R, read64s_delegate>::value,
typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
{
return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask);
}
template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8sm_delegate>::value ||
std::is_same<R, read16sm_delegate>::value ||
std::is_same<R, read32sm_delegate>::value ||
std::is_same<R, read64sm_delegate>::value,
typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
{
return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8smo_delegate>::value ||
std::is_same<R, read16smo_delegate>::value ||
std::is_same<R, read32smo_delegate>::value ||
std::is_same<R, read64smo_delegate>::value,
typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
{
return m_delegate();
}
template<int Width, int AddrShift, int Endian, typename READ> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read(offs_t offset, uX mem_mask)
{
return read_impl<READ>(offset, mem_mask);
}
template<int Width, int AddrShift, int Endian, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, Endian, READ>::name() const
{
return m_delegate.name();
}
template<int Width, int AddrShift, int Endian> void handler_entry_write_delegate<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8_delegate>::value ||
std::is_same<W, write16_delegate>::value ||
std::is_same<W, write32_delegate>::value ||
std::is_same<W, write64_delegate>::value,
void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
{
m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask);
}
template<int Width, int AddrShift, int Endian> std::string handler_entry_write_delegate<Width, AddrShift, Endian>::name() const
template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8s_delegate>::value ||
std::is_same<W, write16s_delegate>::value ||
std::is_same<W, write32s_delegate>::value ||
std::is_same<W, write64s_delegate>::value,
void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
{
m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask);
}
template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8sm_delegate>::value ||
std::is_same<W, write16sm_delegate>::value ||
std::is_same<W, write32sm_delegate>::value ||
std::is_same<W, write64sm_delegate>::value,
void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
{
m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data);
}
template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8smo_delegate>::value ||
std::is_same<W, write16smo_delegate>::value ||
std::is_same<W, write32smo_delegate>::value ||
std::is_same<W, write64smo_delegate>::value,
void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
{
m_delegate(data);
}
template<int Width, int AddrShift, int Endian, typename WRITE> void handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write(offs_t offset, uX data, uX mem_mask)
{
write_impl<WRITE>(offset, data, mem_mask);
}
template<int Width, int AddrShift, int Endian, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::name() const
{
return m_delegate.name();
}
@ -28,7 +108,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_d
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_ioport<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_ioport<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
return m_port->read();
}
@ -50,51 +130,189 @@ template<int Width, int AddrShift, int Endian> 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>;

View File

@ -5,11 +5,10 @@
// Executes an access through called a delegate, usually containing a handler or a lambda
template<int Width, int AddrShift, int Endian> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian>
template<int Width, int AddrShift, int Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using READ = typename handler_entry_size<Width>::READ;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read_address<Width, AddrShift, Endian>;
handler_entry_read_delegate(address_space *space, READ delegate) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {}
@ -21,13 +20,40 @@ public:
private:
READ m_delegate;
template<typename R>
std::enable_if_t<std::is_same<R, read8_delegate>::value ||
std::is_same<R, read16_delegate>::value ||
std::is_same<R, read32_delegate>::value ||
std::is_same<R, read64_delegate>::value,
uX> read_impl(offs_t offset, uX mem_mask);
template<typename R>
std::enable_if_t<std::is_same<R, read8s_delegate>::value ||
std::is_same<R, read16s_delegate>::value ||
std::is_same<R, read32s_delegate>::value ||
std::is_same<R, read64s_delegate>::value,
uX> read_impl(offs_t offset, uX mem_mask);
template<typename R>
std::enable_if_t<std::is_same<R, read8sm_delegate>::value ||
std::is_same<R, read16sm_delegate>::value ||
std::is_same<R, read32sm_delegate>::value ||
std::is_same<R, read64sm_delegate>::value,
uX> read_impl(offs_t offset, uX mem_mask);
template<typename R>
std::enable_if_t<std::is_same<R, read8smo_delegate>::value ||
std::is_same<R, read16smo_delegate>::value ||
std::is_same<R, read32smo_delegate>::value ||
std::is_same<R, read64smo_delegate>::value,
uX> read_impl(offs_t offset, uX mem_mask);
};
template<int Width, int AddrShift, int Endian> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian>
template<int Width, int AddrShift, int Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using WRITE = typename handler_entry_size<Width>::WRITE;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write_address<Width, AddrShift, Endian>;
handler_entry_write_delegate(address_space *space, WRITE delegate) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {}
@ -39,6 +65,34 @@ public:
private:
WRITE m_delegate;
template<typename W>
std::enable_if_t<std::is_same<W, write8_delegate>::value ||
std::is_same<W, write16_delegate>::value ||
std::is_same<W, write32_delegate>::value ||
std::is_same<W, write64_delegate>::value,
void> write_impl(offs_t offset, uX data, uX mem_mask);
template<typename W>
std::enable_if_t<std::is_same<W, write8s_delegate>::value ||
std::is_same<W, write16s_delegate>::value ||
std::is_same<W, write32s_delegate>::value ||
std::is_same<W, write64s_delegate>::value,
void> write_impl(offs_t offset, uX data, uX mem_mask);
template<typename W>
std::enable_if_t<std::is_same<W, write8sm_delegate>::value ||
std::is_same<W, write16sm_delegate>::value ||
std::is_same<W, write32sm_delegate>::value ||
std::is_same<W, write64sm_delegate>::value,
void> write_impl(offs_t offset, uX data, uX mem_mask);
template<typename W>
std::enable_if_t<std::is_same<W, write8smo_delegate>::value ||
std::is_same<W, write16smo_delegate>::value ||
std::is_same<W, write32smo_delegate>::value ||
std::is_same<W, write64smo_delegate>::value,
void> write_impl(offs_t offset, uX data, uX mem_mask);
};
@ -49,7 +103,7 @@ private:
template<int Width, int AddrShift, int Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
handler_entry_read_ioport(address_space *space, ioport_port *port) : handler_entry_read<Width, AddrShift, Endian>(space, 0), m_port(port) {}
@ -66,7 +120,7 @@ private:
template<int Width, int AddrShift, int Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
handler_entry_write_ioport(address_space *space, ioport_port *port) : handler_entry_write<Width, AddrShift, Endian>(space, 0), m_port(port) {}

View File

@ -8,7 +8,7 @@
template<int HighBits, int Width, int AddrShift, int Endian> class handler_entry_read_dispatch : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
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<offs_t>(BITCOUNT);

View File

@ -47,7 +47,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
template<int HighBits, int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int HighBits, int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
return m_dispatch[(offset >> LowBits) & BITMASK]->read(offset, mem_mask);
}

View File

@ -8,7 +8,7 @@
template<int HighBits, int Width, int AddrShift, int Endian> class handler_entry_write_dispatch : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
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<offs_t>(BITCOUNT);

View File

@ -5,7 +5,7 @@
#include "emumem_hea.h"
#include "emumem_hem.h"
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_memory<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
return m_base[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)];
}
@ -51,7 +51,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_m
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_memory_bank<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory_bank<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
return static_cast<uX *>(m_bank.base())[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)];
}

View File

@ -8,7 +8,7 @@
template<int Width, int AddrShift, int Endian> class handler_entry_read_memory : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read_address<Width, AddrShift, Endian>;
handler_entry_read_memory(address_space *space) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0) {}
@ -28,7 +28,7 @@ private:
template<int Width, int AddrShift, int Endian> class handler_entry_write_memory : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write_address<Width, AddrShift, Endian>;
handler_entry_write_memory(address_space *space) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0) {}
@ -53,7 +53,7 @@ private:
template<int Width, int AddrShift, int Endian> class handler_entry_read_memory_bank : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read_address<Width, AddrShift, Endian>;
handler_entry_read_memory_bank(address_space *space, memory_bank &bank) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_bank(bank) {}
@ -71,7 +71,7 @@ private:
template<int Width, int AddrShift, int Endian> class handler_entry_write_memory_bank : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write_address<Width, AddrShift, Endian>;
handler_entry_write_memory_bank(address_space *space, memory_bank &bank) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_bank(bank) {}

View File

@ -8,7 +8,7 @@
template<int Width, int AddrShift, int Endian> class handler_entry_read_passthrough : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_passthrough(address_space *space, memory_passthrough_handler &mph) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(nullptr) {}
~handler_entry_read_passthrough();
@ -29,7 +29,7 @@ protected:
template<int Width, int AddrShift, int Endian> class handler_entry_write_passthrough : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_passthrough(address_space *space, memory_passthrough_handler &mph) : handler_entry_write<Width, AddrShift, Endian>(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(nullptr) {}
~handler_entry_write_passthrough();

View File

@ -5,7 +5,7 @@
#include "emumem_hep.h"
#include "emumem_het.h"
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_tap<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_tap<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
uX data = inh::m_next->read(offset, mem_mask);
m_tap(offset, data, mem_mask);

View File

@ -8,7 +8,7 @@
template<int Width, int AddrShift, int Endian> class handler_entry_read_tap : public handler_entry_read_passthrough<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read_passthrough<Width, AddrShift, Endian>;
handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_read_passthrough<Width, AddrShift, Endian>(space, mph), m_name(name), m_tap(std::move(tap)) {}
@ -30,7 +30,7 @@ protected:
template<int Width, int AddrShift, int Endian> class handler_entry_write_tap : public handler_entry_write_passthrough<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write_passthrough<Width, AddrShift, Endian>;
handler_entry_write_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_write_passthrough<Width, AddrShift, Endian>(space, mph), m_name(name), m_tap(std::move(tap)) {}

View File

@ -60,7 +60,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Wid
}
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_units<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_units<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
uX result = m_unmap;
for (int index = 0; index < m_subunits; index++) {
@ -94,7 +94,7 @@ template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width
return result;
}
template<int Width, int AddrShift, int Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::m2r(typename handler_entry_size<Width>::uX mask)
template<int Width, int AddrShift, int Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{
constexpr u32 mbits = 8*sizeof(uX);
u32 start, end;
@ -204,7 +204,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Wi
}
template<int Width, int AddrShift, int Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::m2r(typename handler_entry_size<Width>::uX mask)
template<int Width, int AddrShift, int Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{
constexpr u32 mbits = 8*sizeof(uX);
u32 start, end;

View File

@ -8,8 +8,7 @@
template<int Width, int AddrShift, int Endian> class handler_entry_read_units : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using READ = typename handler_entry_size<Width>::READ;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space);
@ -50,8 +49,7 @@ private:
template<int Width, int AddrShift, int Endian> class handler_entry_write_units : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using WRITE = typename handler_entry_size<Width>::WRITE;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space);

View File

@ -5,7 +5,7 @@
#include "emumem_hea.h"
#include "emumem_heun.h"
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_unmapped<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_unmapped<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
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<int Width, int AddrShift, int Endian> std::string handler_entry_write_u
template<int Width, int AddrShift, int Endian> typename handler_entry_size<Width>::uX handler_entry_read_nop<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_nop<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
{
return inh::m_space->unmap();
}

View File

@ -8,7 +8,7 @@
template<int Width, int AddrShift, int Endian> class handler_entry_read_unmapped : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
handler_entry_read_unmapped(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
@ -22,7 +22,7 @@ public:
template<int Width, int AddrShift, int Endian> class handler_entry_write_unmapped : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
handler_entry_write_unmapped(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
@ -42,7 +42,7 @@ public:
template<int Width, int AddrShift, int Endian> class handler_entry_read_nop : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
handler_entry_read_nop(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
@ -56,7 +56,7 @@ public:
template<int Width, int AddrShift, int Endian> class handler_entry_write_nop : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
handler_entry_write_nop(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}

View File

@ -35,7 +35,7 @@ template<> u8 mask_to_ukey<u64>(u64 mask)
(mask & 0x00000000000000ff ? 0x01 : 0x00);
}
template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, AddrShift, Endian>::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename handler_entry_size<Width>::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian)
template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, AddrShift, Endian>::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename emu::detail::handler_entry_size<Width>::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian)
{
constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? make_bitmask<u32>(Width + AddrShift) : 0;
u32 bits_per_access = 8 << access_width;
@ -82,7 +82,7 @@ template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, Ad
generate(m_keymap[i], umasks[i], cswidth, bits_per_access, base_shift, shift, active_count);
}
template<int Width, int AddrShift, int Endian> void memory_units_descriptor<Width, AddrShift, Endian>::generate(u8 ukey, typename handler_entry_size<Width>::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count)
template<int Width, int AddrShift, int Endian> void memory_units_descriptor<Width, AddrShift, Endian>::generate(u8 ukey, typename emu::detail::handler_entry_size<Width>::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count)
{
auto &entries = m_entries_for_key[ukey];

View File

@ -5,7 +5,7 @@
template<int Width, int AddrShift, int Endian> class memory_units_descriptor {
public:
using uX = typename handler_entry_size<Width>::uX;
using uX = typename emu::detail::handler_entry_size<Width>::uX;
struct entry {
uX m_amask;

View File

@ -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: