diff --git a/src/emu/addrmap.c b/src/emu/addrmap.c index 75c39c2b3a3..a989d1e548a 100644 --- a/src/emu/addrmap.c +++ b/src/emu/addrmap.c @@ -271,7 +271,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(8, unitmask, func.name())); @@ -284,7 +284,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(8, unitmask, func.name())); @@ -297,7 +297,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 unitmask) { internal_set_handler(devconfig, tag, rfunc, unitmask); internal_set_handler(devconfig, tag, wfunc, unitmask); @@ -373,7 +373,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(16, unitmask, func.name())); @@ -386,7 +386,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(16, unitmask, func.name())); @@ -399,7 +399,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 unitmask) { internal_set_handler(devconfig, tag, rfunc, unitmask); internal_set_handler(devconfig, tag, wfunc, unitmask); @@ -475,7 +475,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(32, unitmask, func.name())); @@ -488,7 +488,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(32, unitmask, func.name())); @@ -501,7 +501,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 unitmask) { internal_set_handler(devconfig, tag, rfunc, unitmask); internal_set_handler(devconfig, tag, wfunc, unitmask); @@ -577,7 +577,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(64, unitmask, func.name())); @@ -590,7 +590,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_delegate func, UINT64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(64, unitmask, func.name())); @@ -603,7 +603,7 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con } -void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc, UINT64 unitmask) +void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 unitmask) { internal_set_handler(devconfig, tag, rfunc, unitmask); internal_set_handler(devconfig, tag, wfunc, unitmask); diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h index b45c38a90f8..9593b66ab05 100644 --- a/src/emu/addrmap.h +++ b/src/emu/addrmap.h @@ -157,10 +157,10 @@ public: offs_t m_rgnoffs; // offset within the region // handlers - read8_proto_delegate m_rproto8; // 8-bit read proto-delegate - read16_proto_delegate m_rproto16; // 16-bit read proto-delegate - read32_proto_delegate m_rproto32; // 32-bit read proto-delegate - read64_proto_delegate m_rproto64; // 64-bit read proto-delegate + read8_delegate m_rproto8; // 8-bit read proto-delegate + read16_delegate m_rproto16; // 16-bit read proto-delegate + read32_delegate m_rproto32; // 32-bit read proto-delegate + read64_delegate m_rproto64; // 64-bit read proto-delegate read8_space_func m_rspace8; // 8-bit legacy address space handler read16_space_func m_rspace16; // 16-bit legacy address space handler read32_space_func m_rspace32; // 32-bit legacy address space handler @@ -169,10 +169,10 @@ public: read16_device_func m_rdevice16; // 16-bit legacy device handler read32_device_func m_rdevice32; // 32-bit legacy device handler read64_device_func m_rdevice64; // 64-bit legacy device handler - write8_proto_delegate m_wproto8; // 8-bit write proto-delegate - write16_proto_delegate m_wproto16; // 16-bit write proto-delegate - write32_proto_delegate m_wproto32; // 32-bit write proto-delegate - write64_proto_delegate m_wproto64; // 64-bit write proto-delegate + write8_delegate m_wproto8; // 8-bit write proto-delegate + write16_delegate m_wproto16; // 16-bit write proto-delegate + write32_delegate m_wproto32; // 32-bit write proto-delegate + write64_delegate m_wproto64; // 64-bit write proto-delegate write8_space_func m_wspace8; // 8-bit legacy address space handler write16_space_func m_wspace16; // 16-bit legacy address space handler write32_space_func m_wspace32; // 32-bit legacy address space handler @@ -200,9 +200,9 @@ protected: void internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask); // internal handler setters for 16-bit functions void internal_set_handler(read16_space_func func, const char *string, UINT64 mask); @@ -211,9 +211,9 @@ protected: void internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask); // internal handler setters for 32-bit functions void internal_set_handler(read32_space_func func, const char *string, UINT64 mask); @@ -222,9 +222,9 @@ protected: void internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask); // internal handler setters for 64-bit functions void internal_set_handler(read64_space_func func, const char *string, UINT64 mask); @@ -233,9 +233,9 @@ protected: void internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string, UINT64 mask); void internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func, UINT64 mask); - void internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, write64_delegate func, UINT64 mask); + void internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 mask); private: // helper functions @@ -260,9 +260,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, write8_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } }; @@ -283,9 +283,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); } - void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } + void set_handler(const device_config &devconfig, const char *tag, read16_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, write16_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } // 8-bit handlers void set_handler(read8_space_func func, const char *string, UINT16 mask) { internal_set_handler(func, string, mask); } @@ -294,9 +294,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT16 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT16 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } }; @@ -317,9 +317,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); } - void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } + void set_handler(const device_config &devconfig, const char *tag, read32_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, write32_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } // 16-bit handlers void set_handler(read16_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); } @@ -328,9 +328,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); } - void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } + void set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } // 8-bit handlers void set_handler(read8_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); } @@ -339,9 +339,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } }; @@ -362,9 +362,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); } void set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); } - void set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); } - void set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } + void set_handler(const device_config &devconfig, const char *tag, read64_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, write64_delegate func) { internal_set_handler(devconfig, tag, func, 0); } + void set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); } // 32-bit handlers void set_handler(read32_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } @@ -373,9 +373,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); } - void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } + void set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } // 16-bit handlers void set_handler(read16_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } @@ -384,9 +384,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); } - void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } + void set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } // 8-bit handlers void set_handler(read8_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } @@ -395,9 +395,9 @@ public: void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); } void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } - void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); } + void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); } }; @@ -461,8 +461,8 @@ public: #define ADDRESS_MAP_START(_name, _space, _bits) \ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \ { \ - typedef read##_bits##_proto_delegate read_proto_delegate; \ - typedef write##_bits##_proto_delegate write_proto_delegate; \ + typedef read##_bits##_delegate read_delegate; \ + typedef write##_bits##_delegate write_delegate; \ address_map_entry##_bits *curentry = NULL; \ (void)curentry; \ map.configure(_space, _bits); \ @@ -588,44 +588,44 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \ // device reads #define AM_DEVREAD_MODERN(_tag, _class, _handler) \ - curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ + curentry->set_handler(devconfig, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \ #define AM_DEVREAD8_MODERN(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVREAD16_MODERN(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVREAD32_MODERN(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ // device writes #define AM_DEVWRITE_MODERN(_tag, _class, _handler) \ - curentry->set_handler(devconfig, _tag, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ + curentry->set_handler(devconfig, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \ #define AM_DEVWRITE8_MODERN(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVWRITE16_MODERN(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVWRITE32_MODERN(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ // device reads/writes #define AM_DEVREADWRITE_MODERN(_tag, _class, _rhandler, _whandler) \ - curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \ + curentry->set_handler(devconfig, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \ #define AM_DEVREADWRITE8_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ #define AM_DEVREADWRITE16_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ #define AM_DEVREADWRITE32_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ // special-case accesses @@ -730,8 +730,8 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \ #define ADDRESS_MAP_START(_name, _space, _bits, _class) \ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \ { \ - typedef read##_bits##_proto_delegate read_proto_delegate; \ - typedef write##_bits##_proto_delegate write_proto_delegate; \ + typedef read##_bits##_delegate read_delegate; \ + typedef write##_bits##_delegate write_delegate; \ address_map_entry##_bits *curentry = NULL; \ (void)curentry; \ map.configure(_space, _bits); \ @@ -858,128 +858,128 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \ // driver data base reads #define AM_READ_BASE(_class, _handler) \ - curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler)); \ + curentry->set_handler(devconfig, NULL, read_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \ #define AM_READ8_BASE(_class, _handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \ #define AM_READ16_BASE(_class, _handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \ #define AM_READ32_BASE(_class, _handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \ // driver data base writes #define AM_WRITE_BASE(_class, _handler) \ - curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler)); \ + curentry->set_handler(devconfig, NULL, write_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \ #define AM_WRITE8_BASE(_class, _handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, write8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \ #define AM_WRITE16_BASE(_class, _handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, write16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \ #define AM_WRITE32_BASE(_class, _handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, write32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \ // driver data base reads/writes #define AM_READWRITE_BASE(_class, _rhandler, _whandler) \ - curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler)); \ + curentry->set_handler(devconfig, NULL, read_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0)); \ #define AM_READWRITE8_BASE(_class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read8_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \ #define AM_READWRITE16_BASE(_class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read16_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \ #define AM_READWRITE32_BASE(_class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read32_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \ // driver data reads #define AM_READ(_handler) \ - curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member("driver_data::" #_handler)); \ + curentry->set_handler(devconfig, NULL, read_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \ #define AM_READ8(_handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ #define AM_READ16(_handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ #define AM_READ32(_handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ // driver data writes #define AM_WRITE(_handler) \ - curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member("driver_data::" #_handler)); \ + curentry->set_handler(devconfig, NULL, write_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \ #define AM_WRITE8(_handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, write8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ #define AM_WRITE16(_handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, write16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ #define AM_WRITE32(_handler, _unitmask) \ - curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member("driver_data::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, NULL, write32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ // driver data reads/writes #define AM_READWRITE(_rhandler, _whandler) \ - curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member("driver_data::" #_rhandler), write_proto_delegate::_create_member("driver_data::" #_whandler)); \ + curentry->set_handler(devconfig, NULL, read_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0)); \ #define AM_READWRITE8(_rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member("driver_data::" #_rhandler), write8_proto_delegate::_create_member("driver_data::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read8_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write8_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \ #define AM_READWRITE16(_rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member("driver_data::" #_rhandler), write16_proto_delegate::_create_member("driver_data::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read16_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write16_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \ #define AM_READWRITE32(_rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member("driver_data::" #_rhandler), write32_proto_delegate::_create_member("driver_data::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, NULL, read32_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write32_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \ // device reads #define AM_DEVREAD(_tag, _class, _handler) \ - curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ + curentry->set_handler(devconfig, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \ #define AM_DEVREAD8(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVREAD16(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVREAD32(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ // device writes #define AM_DEVWRITE(_tag, _class, _handler) \ - curentry->set_handler(devconfig, _tag, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \ + curentry->set_handler(devconfig, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \ #define AM_DEVWRITE8(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVWRITE16(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ #define AM_DEVWRITE32(_tag, _class, _handler, _unitmask) \ - curentry->set_handler(devconfig, _tag, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \ + curentry->set_handler(devconfig, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ // device reads/writes #define AM_DEVREADWRITE(_tag, _class, _rhandler, _whandler) \ - curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \ + curentry->set_handler(devconfig, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \ #define AM_DEVREADWRITE8(_tag, _class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ #define AM_DEVREADWRITE16(_tag, _class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ #define AM_DEVREADWRITE32(_tag, _class, _rhandler, _whandler, _unitmask) \ - curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \ + curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ // special-case accesses diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index dde86985f91..589493d35fe 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -238,7 +238,7 @@ static CPU_INIT( dsp56k ) /* Setup the direct memory handler for this CPU */ /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */ - const_cast(cpustate->program)->set_direct_update_handler(direct_update_delegate_create_static(dsp56k_direct_handler, device->machine())); + cpustate->program->set_direct_update_handler(direct_update_delegate(FUNC(dsp56k_direct_handler), &device->machine())); } diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index e09796556ba..b906109c205 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -1084,13 +1084,13 @@ void m68k_memory_interface::init8(address_space &space) m_cpustate = get_safe_token(&space.device()); opcode_xor = 0; - readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, m68008_read_immediate_16), *this); - read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(address_space, read_byte), space); - read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(address_space, read_word), space); - read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(address_space, read_dword), space); - write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(address_space, write_byte), space); - write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(address_space, write_word), space); - write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(address_space, write_dword), space); + readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::m68008_read_immediate_16), this); + read8 = m68k_read8_delegate(FUNC(address_space::read_byte), &space); + read16 = m68k_read16_delegate(FUNC(address_space::read_word), &space); + read32 = m68k_read32_delegate(FUNC(address_space::read_dword), &space); + write8 = m68k_write8_delegate(FUNC(address_space::write_byte), &space); + write16 = m68k_write16_delegate(FUNC(address_space::write_word), &space); + write32 = m68k_write32_delegate(FUNC(address_space::write_dword), &space); } /**************************************************************************** @@ -1114,13 +1114,13 @@ void m68k_memory_interface::init16(address_space &space) m_cpustate = get_safe_token(&space.device()); opcode_xor = 0; - readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, simple_read_immediate_16), *this); - read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(address_space, read_byte), space); - read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(address_space, read_word), space); - read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(address_space, read_dword), space); - write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(address_space, write_byte), space); - write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(address_space, write_word), space); - write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(address_space, write_dword), space); + readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::simple_read_immediate_16), this); + read8 = m68k_read8_delegate(FUNC(address_space::read_byte), &space); + read16 = m68k_read16_delegate(FUNC(address_space::read_word), &space); + read32 = m68k_read32_delegate(FUNC(address_space::read_dword), &space); + write8 = m68k_write8_delegate(FUNC(address_space::write_byte), &space); + write16 = m68k_write16_delegate(FUNC(address_space::write_word), &space); + write32 = m68k_write32_delegate(FUNC(address_space::write_dword), &space); } /**************************************************************************** @@ -1135,13 +1135,13 @@ void m68k_memory_interface::init32(address_space &space) m_cpustate = get_safe_token(&space.device()); opcode_xor = WORD_XOR_BE(0); - readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, read_immediate_16), *this); - read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(address_space, read_byte), space); - read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(address_space, read_word_unaligned), space); - read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(address_space, read_dword_unaligned), space); - write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(address_space, write_byte), space); - write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(address_space, write_word_unaligned), space); - write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(address_space, write_dword_unaligned), space); + readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16), this); + read8 = m68k_read8_delegate(FUNC(address_space::read_byte), &space); + read16 = m68k_read16_delegate(FUNC(address_space::read_word_unaligned), &space); + read32 = m68k_read32_delegate(FUNC(address_space::read_dword_unaligned), &space); + write8 = m68k_write8_delegate(FUNC(address_space::write_byte), &space); + write16 = m68k_write16_delegate(FUNC(address_space::write_word_unaligned), &space); + write32 = m68k_write32_delegate(FUNC(address_space::write_dword_unaligned), &space); } /* interface for 32-bit data bus with PMMU (68EC020, 68020) */ @@ -1353,13 +1353,13 @@ void m68k_memory_interface::init32mmu(address_space &space) m_cpustate = get_safe_token(&space.device()); opcode_xor = WORD_XOR_BE(0); - readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, read_immediate_16_mmu), *this); - read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(m68k_memory_interface, read_byte_32_mmu), *this); - read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(m68k_memory_interface, readword_d32_mmu), *this); - read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(m68k_memory_interface, readlong_d32_mmu), *this); - write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(m68k_memory_interface, write_byte_32_mmu), *this); - write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(m68k_memory_interface, writeword_d32_mmu), *this); - write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(m68k_memory_interface, writelong_d32_mmu), *this); + readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16_mmu), this); + read8 = m68k_read8_delegate(FUNC(m68k_memory_interface::read_byte_32_mmu), this); + read16 = m68k_read16_delegate(FUNC(m68k_memory_interface::readword_d32_mmu), this); + read32 = m68k_read32_delegate(FUNC(m68k_memory_interface::readlong_d32_mmu), this); + write8 = m68k_write8_delegate(FUNC(m68k_memory_interface::write_byte_32_mmu), this); + write16 = m68k_write16_delegate(FUNC(m68k_memory_interface::writeword_d32_mmu), this); + write32 = m68k_write32_delegate(FUNC(m68k_memory_interface::writelong_d32_mmu), this); } @@ -1480,13 +1480,13 @@ void m68k_memory_interface::init32hmmu(address_space &space) m_cpustate = get_safe_token(&space.device()); opcode_xor = WORD_XOR_BE(0); - readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, read_immediate_16_hmmu), *this); - read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(m68k_memory_interface, read_byte_32_hmmu), *this); - read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(m68k_memory_interface, readword_d32_hmmu), *this); - read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(m68k_memory_interface, readlong_d32_hmmu), *this); - write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(m68k_memory_interface, write_byte_32_hmmu), *this); - write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(m68k_memory_interface, writeword_d32_hmmu), *this); - write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(m68k_memory_interface, writelong_d32_hmmu), *this); + readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16_hmmu), this); + read8 = m68k_read8_delegate(FUNC(m68k_memory_interface::read_byte_32_hmmu), this); + read16 = m68k_read16_delegate(FUNC(m68k_memory_interface::readword_d32_hmmu), this); + read32 = m68k_read32_delegate(FUNC(m68k_memory_interface::readlong_d32_hmmu), this); + write8 = m68k_write8_delegate(FUNC(m68k_memory_interface::write_byte_32_hmmu), this); + write16 = m68k_write16_delegate(FUNC(m68k_memory_interface::writeword_d32_hmmu), this); + write32 = m68k_write32_delegate(FUNC(m68k_memory_interface::writelong_d32_hmmu), this); } void m68k_set_reset_callback(device_t *device, m68k_reset_func callback) diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h index 6b2bb71a307..a447c224485 100644 --- a/src/emu/cpu/m68000/m68kcpu.h +++ b/src/emu/cpu/m68000/m68kcpu.h @@ -546,21 +546,13 @@ union _fp_reg /* Redirect memory calls */ -typedef proto_delegate_1param m68k_read8_proto_delegate; -typedef proto_delegate_1param m68k_readimm16_proto_delegate; -typedef proto_delegate_1param m68k_read16_proto_delegate; -typedef proto_delegate_1param m68k_read32_proto_delegate; -typedef proto_delegate_2param m68k_write8_proto_delegate; -typedef proto_delegate_2param m68k_write16_proto_delegate; -typedef proto_delegate_2param m68k_write32_proto_delegate; - -typedef delegate_1param m68k_read8_delegate; -typedef delegate_1param m68k_readimm16_delegate; -typedef delegate_1param m68k_read16_delegate; -typedef delegate_1param m68k_read32_delegate; -typedef delegate_2param m68k_write8_delegate; -typedef delegate_2param m68k_write16_delegate; -typedef delegate_2param m68k_write32_delegate; +typedef delegate m68k_read8_delegate; +typedef delegate m68k_readimm16_delegate; +typedef delegate m68k_read16_delegate; +typedef delegate m68k_read32_delegate; +typedef delegate m68k_write8_delegate; +typedef delegate m68k_write16_delegate; +typedef delegate m68k_write32_delegate; class m68k_memory_interface : public bindable_object { diff --git a/src/emu/delegate.c b/src/emu/delegate.c index 14f8451f908..d6922243029 100644 --- a/src/emu/delegate.c +++ b/src/emu/delegate.c @@ -70,28 +70,24 @@ bindable_object::~bindable_object() #if (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL) -// NULL structure used in dummy constructor -delegate_gcc_mfp_internal delegate_gcc_mfp_null; - - //------------------------------------------------- // delegate_convert_raw - given an object and // an raw function, adjust the object base and // return the actual final code pointer //------------------------------------------------- -delegate_generic_function delegate_convert_raw(delegate_generic_class *&object, delegate_gcc_mfp_internal &mfp) +delegate_generic_function delegate_internal_mfp::convert_to_generic(delegate_generic_class *&object) const { // apply the "this" delta to the object first - object = reinterpret_cast(reinterpret_cast(object) + mfp.this_delta); + object = reinterpret_cast(reinterpret_cast(object) + m_this_delta); // if the low bit of the vtable index is clear, then it is just a raw function pointer - if (!(mfp.u.vtable_index & 1)) - return mfp.u.funcptr; + if (!(m_function & 1)) + return reinterpret_cast(m_function); // otherwise, it is the byte index into the vtable where the actual function lives UINT8 *vtable_base = *reinterpret_cast(object); - return *reinterpret_cast(vtable_base + mfp.u.vtable_index - 1); + return *reinterpret_cast(vtable_base + m_function - 1); } #endif diff --git a/src/emu/delegate.h b/src/emu/delegate.h index da7f866be5b..5570845fbb8 100644 --- a/src/emu/delegate.h +++ b/src/emu/delegate.h @@ -123,11 +123,6 @@ #define USE_DELEGATE_TYPE DELEGATE_TYPE_COMPATIBLE #endif -// nicer macros to hide the template gobblety-gook and to pass the names -#define create_member_name(_class, _member, _name) _create_member<_class, &_class::_member>(_name) -#define create_member(_class, _member) _create_member<_class, &_class::_member>(#_class "::" #_member) -#define create_static(_class, _func) _crate_static<_class, &_func>(#_func) - //************************************************************************** @@ -169,29 +164,57 @@ static delegate_generic_class *deferred_cast(bindable_object &object) typedef delegate_generic_class *(*deferred_cast_func)(bindable_object &object); -// ======================> delegate_base +// ======================> delegate_traits -// simple base class for all delegates to derive from; it is explicitly -// polymorphic so that a delegate_base * can be used as a lowest-common -// denominator, and then downcast to the appropriate type with proper -// type checking -class delegate_base +// delegate_traits is a meta-template that is used to provide a static function pointer +// and member function pointer of the appropriate type and number of parameters; we use +// partial template specialization to support fewer parameters by defaulting the later +// parameters to the special type delegate_param_none +template +struct delegate_traits { -public: - delegate_base(deferred_cast_func caster, const char *name) - : m_caster(caster), - m_name(name) { } + typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type); + typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type); + typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type, _P4Type); +}; - virtual ~delegate_base() { } +// dummy class used to indicate a non-existant parameter +class delegate_param_none { }; - // getters - bool isnull() const { return (m_caster == NULL); } - bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); } - const char *name() const { return m_name; } +// specialization for 3 parameters +template +struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none> +{ + typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type); + typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type); + typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type); +}; -protected: - deferred_cast_func m_caster; // pointer to helper function that does the cast - const char * m_name; // name string +// specialization for 2 parameters +template +struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none> +{ + typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type); + typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type); + typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type); +}; + +// specialization for 1 parameter +template +struct delegate_traits<_ClassType, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none> +{ + typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type); + typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type); + typedef _ReturnType (_ClassType::*member_func_type)(_P1Type); +}; + +// specialization for no parameters +template +struct delegate_traits<_ClassType, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none> +{ + typedef _ReturnType (*static_func_type)(_ClassType *); + typedef _ReturnType (*static_ref_func_type)(_ClassType &); + typedef _ReturnType (_ClassType::*member_func_type)(); }; @@ -202,466 +225,218 @@ protected: #if (USE_DELEGATE_TYPE == DELEGATE_TYPE_COMPATIBLE) -// ======================> proto_delegate_0param +// ======================> delegate_raw_mfp -template -class proto_delegate_0param : public delegate_base +// delegate_raw_mfp is a class that wraps a generic member function pointer +// in a static buffer, and can effectively recast itself back for later use; +// it hides some of the gross details involved in copying artibtrary member +// function pointers around +struct delegate_raw_mfp { -protected: - // pointer to a static version of the function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *); + // for MSVC maximum size is one pointer, plus 3 ints + static const int MAX_MFP_SIZE = sizeof(void *) + 3 * sizeof(int); + + // default and copy constructors + delegate_raw_mfp() { memset(&m_rawdata, 0, sizeof(m_rawdata)); } + delegate_raw_mfp(const delegate_raw_mfp &src) : m_rawdata(src.m_rawdata) { } + + // construct from any member function pointer + template + delegate_raw_mfp(_FunctionType mfp) + { + assert(sizeof(mfp) <= sizeof(m_rawdata)); + memset(&m_rawdata, 0, sizeof(m_rawdata)); + *reinterpret_cast<_FunctionType *>(&m_rawdata) = mfp; + } + + // assignment operator + delegate_raw_mfp &operator=(const delegate_raw_mfp &src) + { + if (this != &src) + m_rawdata = src.m_rawdata; + return *this; + } + + // comparison operator + bool operator==(const delegate_raw_mfp &rhs) const + { + return (memcmp(&m_rawdata, &rhs.m_rawdata, sizeof(m_rawdata)) == 0); + } + + // convert back to a member function pointer + template + _FunctionType &mfp() const { return *reinterpret_cast<_FunctionType *>(&m_rawdata); } + + // raw buffer to hold the copy of the function pointer + mutable struct { UINT8 bytes[MAX_MFP_SIZE]; } m_rawdata; +}; + + +// ======================> delegate + +// general delegate class template supporting up to 4 parameters +template +class delegate_base +{ + typedef typename delegate_traits::static_func_type generic_static_func; public: - // constructors - proto_delegate_0param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function) { } + // generic constructor + delegate_base() + : m_caster(NULL), + m_name(NULL), + m_function(NULL), + m_object(NULL), + m_callobject(NULL) { } - proto_delegate_0param(const proto_delegate_0param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function) { } + // copy constructor + delegate_base(const delegate_base &src) + : m_caster(src.m_caster), + m_name(src.m_name), + m_object(src.m_object), + m_callobject(src.is_mfp() ? reinterpret_cast(this) : src.m_object), + m_function(src.m_function), + m_rawfunction(src.m_rawfunction) { } - // create a member function proto-delegate - template - static proto_delegate_0param _create_member(const char *name = NULL) + // copy constructor with re-bind + template + delegate_base(const delegate_base &src, _FunctionClass *object) + : m_caster(src.m_caster), + m_name(src.m_name), + m_object(src.m_object), + m_callobject(src.is_mfp() ? reinterpret_cast(this) : src.m_object), + m_function(src.m_function), + m_rawfunction(src.m_rawfunction) { bind(object); } + + // construct from member function with object pointer + template + delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object) + : m_caster(&deferred_cast<_FunctionClass>), + m_name(name), + m_function(&delegate_base::method_stub<_FunctionClass>), + m_object(NULL), + m_callobject(reinterpret_cast(this)), + m_rawfunction(funcptr) { bind(object); } + + // construct from static function with object pointer + template + delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object) + : m_caster(&deferred_cast<_FunctionClass>), + m_name(name), + m_object(NULL), + m_callobject(NULL), + m_function(reinterpret_cast(funcptr)) { bind(object); } + + // construct from static reference function with object pointer + template + delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) + : m_caster(&deferred_cast<_FunctionClass>), + m_name(name), + m_object(NULL), + m_callobject(NULL), + m_function(reinterpret_cast(funcptr)) { bind(object); } + + // copy operator + delegate_base &operator=(const delegate_base &src) { - return proto_delegate_0param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name); + if (this != &src) + { + m_caster = src.m_caster; + m_name = src.m_name; + m_object = src.m_object; + m_callobject = src.is_mfp() ? reinterpret_cast(this) : src.m_object; + m_function = src.m_function; + m_rawfunction = src.m_rawfunction; + } + return *this; } - - // create a static function proto-delegate - template - static proto_delegate_0param _create_static(const char *name = NULL) + + // comparison operator + bool operator==(const delegate_base &rhs) const { - return proto_delegate_0param(reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_0param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster); + return (m_caster == rhs.m_caster && m_object == rhs.m_object && + m_function == m_function && m_rawfunction == m_rawfunction); } + + // getters + bool isnull() const { return (m_caster == NULL); } + bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); } + bool has_object() const { return (m_object != NULL); } + const char *name() const { return m_name; } + + // call the function + _ReturnType operator()() const { return (*m_function)(m_callobject); } + _ReturnType operator()(_P1Type p1) const { return (*m_function)(m_callobject, p1); } + _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_callobject, p1, p2); } + _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_callobject, p1, p2, p3); } + _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_callobject, p1, p2, p3, p4); } protected: - // helper stub that calls the member function - template - static _ReturnType method_stub(delegate_generic_class *object_ptr) + // bind the actual object + void bind(bindable_object *object) + { + m_object = (object != NULL) ? (*this->m_caster)(*object) : NULL; + if (!is_mfp()) m_callobject = m_object; + } + + // internal helpers + bool is_mfp() const { return m_callobject == reinterpret_cast(this); } + + // helper stub that calls the member function; we need one for each parameter count + template + static _ReturnType method_stub(delegate_generic_class *object) { - _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr); - return (p->*_FunctionPtr)(); + typedef _ReturnType (_FunctionClass::*mfptype)(); + delegate_base *_this = reinterpret_cast(object); + mfptype &mfp = _this->m_rawfunction.mfp(); + return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(); + } + + template + static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1) + { + typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1); + delegate_base *_this = reinterpret_cast(object); + mfptype &mfp = _this->m_rawfunction.mfp(); + return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1); + } + + template + static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2) + { + typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2); + delegate_base *_this = reinterpret_cast(object); + mfptype &mfp = _this->m_rawfunction.mfp(); + return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1, p2); + } + + template + static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3) + { + typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3); + delegate_base *_this = reinterpret_cast(object); + mfptype &mfp = _this->m_rawfunction.mfp(); + return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1, p2, p3); + } + + template + static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) + { + typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4); + delegate_base *_this = reinterpret_cast(object); + mfptype &mfp = _this->m_rawfunction.mfp(); + return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1, p2, p3, p4); } // internal state - static_func m_function; // pointer to the stub or static function + deferred_cast_func m_caster; // pointer to helper function that does the cast + const char * m_name; // name string + generic_static_func m_function; // generic static function pointer + delegate_raw_mfp m_rawfunction; // copy of raw MFP + delegate_generic_class * m_object; // pointer to the post-cast object + delegate_generic_class * m_callobject; // pointer to the object used for calling }; - -// ======================> delegate_0param - -template -class delegate_0param : public proto_delegate_0param<_ReturnType> -{ - typedef proto_delegate_0param<_ReturnType> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - -public: - // constructors - delegate_0param() - : m_object(NULL) { } - - delegate_0param(proto_base proto) - : proto_delegate_0param<_ReturnType>(proto), - m_object(NULL) { } - - delegate_0param(proto_base proto, bindable_object &object) - : proto_delegate_0param<_ReturnType>(proto), - m_object((*m_caster)(object)) { } - - // bind the actual object - void bind(bindable_object &object) { m_object = (*m_caster)(object); } - - // call the function - _ReturnType operator()() const { return (*m_function)(m_object); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_0param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_1param - -template -class proto_delegate_1param : public delegate_base -{ -protected: - // pointer to a static version of the function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type); - -public: - // constructors - proto_delegate_1param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function) { } - - proto_delegate_1param(const proto_delegate_1param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function) { } - - // create a member function proto-delegate - template - static proto_delegate_1param _create_member(const char *name = NULL) - { - return proto_delegate_1param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_1param _create_static(const char *name = NULL) - { - return proto_delegate_1param(reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_1param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster); - } - -protected: - // helper stub that calls the member function - template - static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1) - { - _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr); - return (p->*_FunctionPtr)(p1); - } - - // internal state - static_func m_function; // pointer to the stub or static function -}; - - -// ======================> delegate_1param - -template -class delegate_1param : public proto_delegate_1param<_ReturnType, _P1Type> -{ - typedef proto_delegate_1param<_ReturnType, _P1Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - -public: - // constructors - delegate_1param() - : m_object(NULL) { } - - delegate_1param(proto_delegate_1param<_ReturnType, _P1Type> proto) - : proto_delegate_1param<_ReturnType, _P1Type>(proto), - m_object(NULL) { } - - delegate_1param(proto_delegate_1param<_ReturnType, _P1Type> proto, bindable_object &object) - : proto_delegate_1param<_ReturnType, _P1Type>(proto), - m_object((*m_caster)(object)) { } - - // bind the actual object - void bind(bindable_object &object) { m_object = (*m_caster)(object); } - - // call the function - _ReturnType operator()(_P1Type p1) const { return (*m_function)(m_object, p1); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_1param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_2param - -template -class proto_delegate_2param : public delegate_base -{ -protected: - // pointer to a static version of the function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type); - -public: - // constructors - proto_delegate_2param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function) { } - - proto_delegate_2param(const proto_delegate_2param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function) { } - - // create a member function proto-delegate - template - static proto_delegate_2param _create_member(const char *name = NULL) - { - return proto_delegate_2param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_2param _create_static(const char *name = NULL) - { - return proto_delegate_2param(reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_2param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster); - } - -protected: - // helper stub that calls the member function - template - static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1, _P2Type p2) - { - _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr); - return (p->*_FunctionPtr)(p1, p2); - } - - // internal state - static_func m_function; // pointer to the stub or static function -}; - - -// ======================> delegate_2param - -template -class delegate_2param : public proto_delegate_2param<_ReturnType, _P1Type, _P2Type> -{ - typedef proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - -public: - // constructors - delegate_2param() - : m_object(NULL) { } - - delegate_2param(proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto) - : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto), - m_object(NULL) { } - - delegate_2param(proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto, bindable_object &object) - : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto), - m_object((*m_caster)(object)) { } - - // bind the actual object - void bind(bindable_object &object) { m_object = (*m_caster)(object); } - - // call the function - _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_object, p1, p2); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_2param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_3param - -template -class proto_delegate_3param : public delegate_base -{ -protected: - // pointer to a static version of the function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type); - -public: - // constructors - proto_delegate_3param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function) { } - - proto_delegate_3param(const proto_delegate_3param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function) { } - - // create a member function proto-delegate - template - static proto_delegate_3param _create_member(const char *name = NULL) - { - return proto_delegate_3param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_3param _create_static(const char *name = NULL) - { - return proto_delegate_3param(reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_3param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster); - } - -protected: - // helper stub that calls the member function - template - static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1, _P2Type p2, _P3Type p3) - { - _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr); - return (p->*_FunctionPtr)(p1, p2, p3); - } - - // internal state - static_func m_function; // pointer to the stub or static function -}; - - -// ======================> delegate_3param - -template -class delegate_3param : public proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> -{ - typedef proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - -public: - // constructors - delegate_3param() - : m_object(NULL) { } - - delegate_3param(proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto) - : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto), - m_object(NULL) { } - - delegate_3param(proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto, bindable_object &object) - : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto), - m_object((*m_caster)(object)) { } - - // bind the actual object - void bind(bindable_object &object) { m_object = (*m_caster)(object); } - - // call the function - _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_object, p1, p2, p3); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_3param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_4param - -template -class proto_delegate_4param : public delegate_base -{ -protected: - // pointer to a static version of the function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type, _P4Type); - -public: - // constructors - proto_delegate_4param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function) { } - - proto_delegate_4param(const proto_delegate_4param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function) { } - - // create a member function proto-delegate - template - static proto_delegate_4param _create_member(const char *name = NULL) - { - return proto_delegate_4param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_4param _create_static(const char *name = NULL) - { - return proto_delegate_4param(reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_4param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster); - } - -protected: - // helper stub that calls the member function - template - static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) - { - _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr); - return (p->*_FunctionPtr)(p1, p2, p3, p4); - } - - // internal state - static_func m_function; // pointer to the stub or static function -}; - - -// ======================> delegate_4param - -template -class delegate_4param : public proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> -{ - typedef proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - -public: - // constructors - delegate_4param() - : m_object(NULL) { } - - delegate_4param(proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto) - : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto), - m_object(NULL) { } - - delegate_4param(proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto, bindable_object &object) - : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto), - m_object((*m_caster)(object)) { } - - // bind the actual object - void bind(bindable_object &object) { m_object = (*m_caster)(object); } - - // call the function - _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_object, p1, p2, p3, p4); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_4param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - #endif @@ -675,535 +450,248 @@ protected: typedef void (*delegate_generic_function)(); // struct describing the contents of a member function pointer -struct delegate_gcc_mfp_internal +struct delegate_internal_mfp { - union // first item can be one of two things: + // default constructor + delegate_internal_mfp() + : m_function(0), + m_this_delta(0) { } + + // copy constructor + delegate_internal_mfp(const delegate_internal_mfp &src) + : m_function(src.m_function), + m_this_delta(src.m_this_delta) { } + + // construct from any member function pointer + template + delegate_internal_mfp(_FunctionPtr funcptr) { - delegate_generic_function funcptr; // if even, it's a pointer to the function - FPTR vtable_index; // if odd, it's the byte offset into the vtable - } u; - int this_delta; // delta to apply to the 'this' pointer -}; + assert(sizeof(funcptr) == sizeof(*this)); + *reinterpret_cast<_FunctionPtr *>(this) = funcptr; + } -// helper function -delegate_generic_function delegate_convert_raw(delegate_generic_class *&object, delegate_gcc_mfp_internal &mfp); - -// global dummy extern -extern delegate_gcc_mfp_internal delegate_gcc_mfp_null; - - -// ======================> proto_delegate_0param - -template -class proto_delegate_0param : public delegate_base -{ -protected: - // pointer to a static function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *); - -public: - // constructors - proto_delegate_0param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function), - m_rawfunction(mfp) { } - - proto_delegate_0param(const proto_delegate_0param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function), - m_rawfunction(proto.m_rawfunction) { } - - // create a member function proto-delegate - template - static proto_delegate_0param _create_member(const char *name = NULL) + // assignment operator + delegate_internal_mfp &operator=(const delegate_internal_mfp &src) { - union + if (this != &src) { - _ReturnType (_FunctionClass::*mfp)(); - delegate_gcc_mfp_internal internal; - } tempunion; - tempunion.mfp = _FunctionPtr; - return proto_delegate_0param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name); + m_function = src.m_function; + m_this_delta = src.m_this_delta; + } + return *this; } - // create a static function proto-delegate - template - static proto_delegate_0param _create_static(const char *name = NULL) + // comparison operator + bool operator==(const delegate_internal_mfp &rhs) const { - return proto_delegate_0param(delegate_gcc_mfp_null, reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); + return (m_function == rhs.m_function && m_this_delta == rhs.m_this_delta); } - // equality testing - bool operator==(const proto_delegate_0param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster && - m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr && - m_rawfunction.this_delta == rhs.m_rawfunction.this_delta); - } + // extract the generic function and adjust the object pointer + delegate_generic_function convert_to_generic(delegate_generic_class *&object) const; -protected: - // internal state - static_func m_function; // generic static function pointer - delegate_gcc_mfp_internal m_rawfunction; // raw member function definition + // actual state + FPTR m_function; // first item can be one of two things: + // if even, it's a pointer to the function + // if odd, it's the byte offset into the vtable + int m_this_delta; // delta to apply to the 'this' pointer }; -// ======================> delegate_0param +// ======================> delegate -template -class delegate_0param : public proto_delegate_0param<_ReturnType> +template +class delegate_base { - typedef _ReturnType (*static_func)(delegate_generic_class *); - typedef proto_delegate_0param<_ReturnType> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - using proto_base::m_rawfunction; + typedef typename delegate_traits::static_func_type generic_static_func; public: - // constructors - delegate_0param() - : m_object(NULL) { } + // generic constructor + delegate_base() + : m_caster(NULL), + m_name(NULL), + m_object(NULL), + m_function(NULL) { } - delegate_0param(proto_base proto) - : proto_delegate_0param<_ReturnType>(proto), - m_object(NULL) { } + // copy constructor + delegate_base(const delegate_base &src) + : m_caster(src.m_caster), + m_name(src.m_name), + m_object(src.m_object), + m_function(src.m_function), + m_rawfunction(src.m_rawfunction) { } - delegate_0param(proto_base proto, bindable_object &object) - : proto_delegate_0param<_ReturnType>(proto), - m_object(NULL) { bind(object); } + // copy constructor with re-bind + template + delegate_base(const delegate_base &src, _FunctionClass *object) + : m_caster(src.m_caster), + m_name(src.m_name), + m_object(src.m_object), + m_function(src.m_function), + m_rawfunction(src.m_rawfunction) { bind(object); } - // bind the actual object - void bind(bindable_object &object) + // construct from member function with object pointer + template + delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object) + : m_caster(&deferred_cast<_FunctionClass>), + m_name(name), + m_object(NULL), + m_function(NULL), + m_rawfunction(funcptr) { bind(object); } + + // construct from static function with object pointer + template + delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object) + : m_caster(&deferred_cast<_FunctionClass>), + m_name(name), + m_object(NULL), + m_function(reinterpret_cast(funcptr)) { bind(object); } + + // construct from static reference function with object pointer + template + delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) + : m_caster(&deferred_cast<_FunctionClass>), + m_name(name), + m_object(NULL), + m_function(reinterpret_cast(funcptr)) { bind(object); } + + // copy operator + delegate_base &operator=(const delegate_base &src) { - m_object = (*this->m_caster)(object); - if (m_rawfunction.u.funcptr != NULL) - m_function = reinterpret_cast(delegate_convert_raw(m_object, m_rawfunction)); + if (this != &src) + { + m_caster = src.m_caster; + m_name = src.m_name; + m_object = src.m_object; + m_function = src.m_function; + m_rawfunction = src.m_rawfunction; + } + return *this; } - + + // comparison operator + bool operator==(const delegate_base &rhs) const + { + return (m_caster == rhs.m_caster && m_object == rhs.m_object && + m_function == m_function && m_rawfunction == m_rawfunction); + } + + // getters + bool isnull() const { return (m_caster == NULL); } + bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); } + bool has_object() const { return (m_object != NULL); } + const char *name() const { return m_name; } + // call the function _ReturnType operator()() const { return (*m_function)(m_object); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_0param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_1param - -template -class proto_delegate_1param : public delegate_base -{ -protected: - // pointer to a static function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type); - -public: - // constructors - proto_delegate_1param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function), - m_rawfunction(mfp) { } - - proto_delegate_1param(const proto_delegate_1param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function), - m_rawfunction(proto.m_rawfunction) { } - - // create a member function proto-delegate - template - static proto_delegate_1param _create_member(const char *name = NULL) - { - union - { - _ReturnType (_FunctionClass::*mfp)(_P1Type); - delegate_gcc_mfp_internal internal; - } tempunion; - tempunion.mfp = _FunctionPtr; - return proto_delegate_1param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_1param _create_static(const char *name = NULL) - { - return proto_delegate_1param(delegate_gcc_mfp_null, reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_1param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster && - m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr && - m_rawfunction.this_delta == rhs.m_rawfunction.this_delta); - } - -protected: - // internal state - static_func m_function; // generic static function pointer - delegate_gcc_mfp_internal m_rawfunction; // raw member function definition -}; - - -// ======================> delegate_1param - -template -class delegate_1param : public proto_delegate_1param<_ReturnType, _P1Type> -{ - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type); - typedef proto_delegate_1param<_ReturnType, _P1Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - using proto_base::m_rawfunction; - -public: - // constructors - delegate_1param() - : m_object(NULL) { } - - delegate_1param(proto_base proto) - : proto_delegate_1param<_ReturnType, _P1Type>(proto), - m_object(NULL) { } - - delegate_1param(proto_base proto, bindable_object &object) - : proto_delegate_1param<_ReturnType, _P1Type>(proto), - m_object(NULL) { bind(object); } - - // bind the actual object - void bind(bindable_object &object) - { - m_object = (*this->m_caster)(object); - if (m_rawfunction.u.funcptr != NULL) - m_function = reinterpret_cast(delegate_convert_raw(m_object, m_rawfunction)); - } - - // call the function _ReturnType operator()(_P1Type p1) const { return (*m_function)(m_object, p1); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_1param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_2param - -template -class proto_delegate_2param : public delegate_base -{ -protected: - // pointer to a static function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type); - -public: - // constructors - proto_delegate_2param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function), - m_rawfunction(mfp) { } - - proto_delegate_2param(const proto_delegate_2param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function), - m_rawfunction(proto.m_rawfunction) { } - - // create a member function proto-delegate - template - static proto_delegate_2param _create_member(const char *name = NULL) - { - union - { - _ReturnType (_FunctionClass::*mfp)(_P1Type, _P2Type); - delegate_gcc_mfp_internal internal; - } tempunion; - tempunion.mfp = _FunctionPtr; - return proto_delegate_2param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_2param _create_static(const char *name = NULL) - { - return proto_delegate_2param(delegate_gcc_mfp_null, reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_2param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster && - m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr && - m_rawfunction.this_delta == rhs.m_rawfunction.this_delta); - } - -protected: - // internal state - static_func m_function; // generic static function pointer - delegate_gcc_mfp_internal m_rawfunction; // raw member function definition -}; - - -// ======================> delegate_2param - -template -class delegate_2param : public proto_delegate_2param<_ReturnType, _P1Type, _P2Type> -{ - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type); - typedef proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - using proto_base::m_rawfunction; - -public: - // constructors - delegate_2param() - : m_object(NULL) { } - - delegate_2param(proto_base proto) - : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto), - m_object(NULL) { } - - delegate_2param(proto_base proto, bindable_object &object) - : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto), - m_object(NULL) { bind(object); } - - // bind the actual object - void bind(bindable_object &object) - { - m_object = (*this->m_caster)(object); - if (m_rawfunction.u.funcptr != NULL) - m_function = reinterpret_cast(delegate_convert_raw(m_object, m_rawfunction)); - } - - // call the function _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_object, p1, p2); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_2param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_3param - -template -class proto_delegate_3param : public delegate_base -{ -protected: - // pointer to a static function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type); - -public: - // constructors - proto_delegate_3param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function), - m_rawfunction(mfp) { } - - proto_delegate_3param(const proto_delegate_3param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function), - m_rawfunction(proto.m_rawfunction) { } - - // create a member function proto-delegate - template - static proto_delegate_3param _create_member(const char *name = NULL) - { - union - { - _ReturnType (_FunctionClass::*mfp)(_P1Type, _P2Type, _P3Type); - delegate_gcc_mfp_internal internal; - } tempunion; - tempunion.mfp = _FunctionPtr; - return proto_delegate_3param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_3param _create_static(const char *name = NULL) - { - return proto_delegate_3param(delegate_gcc_mfp_null, reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_3param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster && - m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr && - m_rawfunction.this_delta == rhs.m_rawfunction.this_delta); - } - -protected: - // internal state - static_func m_function; // generic static function pointer - delegate_gcc_mfp_internal m_rawfunction; // raw member function definition -}; - - -// ======================> delegate_3param - -template -class delegate_3param : public proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> -{ - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type); - typedef proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - using proto_base::m_rawfunction; - -public: - // constructors - delegate_3param() - : m_object(NULL) { } - - delegate_3param(proto_base proto) - : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto), - m_object(NULL) { } - - delegate_3param(proto_base proto, bindable_object &object) - : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto), - m_object(NULL) { bind(object); } - - // bind the actual object - void bind(bindable_object &object) - { - m_object = (*this->m_caster)(object); - if (m_rawfunction.u.funcptr != NULL) - m_function = reinterpret_cast(delegate_convert_raw(m_object, m_rawfunction)); - } - - // call the function _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_object, p1, p2, p3); } - - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_3param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - -protected: - // internal state - delegate_generic_class *m_object; // pointer to the post-cast object -}; - - -// ======================> proto_delegate_4param - -template -class proto_delegate_4param : public delegate_base -{ -protected: - // pointer to a static function which takes the object as a first parameter - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type, _P4Type); - -public: - // constructors - proto_delegate_4param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL) - : delegate_base(caster, name), - m_function(function), - m_rawfunction(mfp) { } - - proto_delegate_4param(const proto_delegate_4param &proto) - : delegate_base(proto.m_caster, proto.m_name), - m_function(proto.m_function), - m_rawfunction(proto.m_rawfunction) { } - - // create a member function proto-delegate - template - static proto_delegate_4param _create_member(const char *name = NULL) - { - union - { - _ReturnType (_FunctionClass::*mfp)(_P1Type, _P2Type, _P3Type, _P4Type); - delegate_gcc_mfp_internal internal; - } tempunion; - tempunion.mfp = _FunctionPtr; - return proto_delegate_4param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name); - } - - // create a static function proto-delegate - template - static proto_delegate_4param _create_static(const char *name = NULL) - { - return proto_delegate_4param(delegate_gcc_mfp_null, reinterpret_cast(_FunctionPtr), &deferred_cast<_FunctionClass>, name); - } - - // equality testing - bool operator==(const proto_delegate_4param &rhs) const - { - return (m_function == rhs.m_function && m_caster == rhs.m_caster && - m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr && - m_rawfunction.this_delta == rhs.m_rawfunction.this_delta); - } - -protected: - // internal state - static_func m_function; // generic static function pointer - delegate_gcc_mfp_internal m_rawfunction; // raw member function definition -}; - - -// ======================> delegate_4param - -template -class delegate_4param : public proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> -{ - typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type, _P4Type); - typedef proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto_base; - - using delegate_base::m_caster; - using proto_base::m_function; - using proto_base::m_rawfunction; - -public: - // constructors - delegate_4param() - : m_object(NULL) { } - - delegate_4param(proto_base proto) - : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto), - m_object(NULL) { } - - delegate_4param(proto_base proto, bindable_object &object) - : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto), - m_object(NULL) { bind(object); } - - // bind the actual object - void bind(bindable_object &object) - { - m_object = (*this->m_caster)(object); - if (m_rawfunction.u.funcptr != NULL) - m_function = reinterpret_cast(delegate_convert_raw(m_object, m_rawfunction)); - } - - // call the function _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_object, p1, p2, p3, p4); } - // testing - bool has_object() const { return (m_object != NULL); } - bool operator==(const delegate_4param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); } - protected: + // bind the actual object + void bind(bindable_object *object) + { + m_object = (object != NULL) ? (*this->m_caster)(*object) : NULL; + if (m_object != NULL && m_rawfunction.m_function != 0) + m_function = reinterpret_cast(m_rawfunction.convert_to_generic(m_object)); + } + // internal state - delegate_generic_class *m_object; // pointer to the post-cast object + deferred_cast_func m_caster; // pointer to helper function that does the cast + const char * m_name; // name string + delegate_generic_class * m_object; // pointer to the post-cast object + generic_static_func m_function; // generic static function pointer + delegate_internal_mfp m_rawfunction; // raw member function definition }; - - #endif +//************************************************************************** +// NATURAL SYNTAX +//************************************************************************** + +// declare the base template +template +class delegate; + +// specialize for 0 parameters; we derive from the base class and provide equivalent +// pass-through constructors for each type, as well as an assignment operator +template +class delegate<_ReturnType ()> : public delegate_base<_ReturnType> +{ + typedef delegate_base<_ReturnType> basetype; +public: + delegate() : basetype() { } + delegate(const basetype &src) : basetype(src) { } + template delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + delegate &operator=(const basetype &src) { *static_cast(this) = src; return *this; } +}; + +// specialize for 1 parameter +template +class delegate<_ReturnType (_P1Type)> : public delegate_base<_ReturnType, _P1Type> +{ + typedef delegate_base<_ReturnType, _P1Type> basetype; +public: + delegate() : basetype() { } + delegate(const basetype &src) : basetype(src) { } + template delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + delegate &operator=(const basetype &src) { *static_cast(this) = src; return *this; } +}; + +// specialize for 2 parameters +template +class delegate<_ReturnType (_P1Type, _P2Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type> +{ + typedef delegate_base<_ReturnType, _P1Type, _P2Type> basetype; +public: + delegate() : basetype() { } + delegate(const basetype &src) : basetype(src) { } + template delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + delegate &operator=(const basetype &src) { *static_cast(this) = src; return *this; } +}; + +// specialize for 3 parameters +template +class delegate<_ReturnType (_P1Type, _P2Type, _P3Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type> +{ + typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type> basetype; +public: + delegate() : basetype() { } + delegate(const basetype &src) : basetype(src) { } + template delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + delegate &operator=(const basetype &src) { *static_cast(this) = src; return *this; } +}; + +// specialize for 4 parameters +template +class delegate<_ReturnType (_P1Type, _P2Type, _P3Type, _P4Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> +{ + typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> basetype; +public: + delegate() : basetype() { } + delegate(const basetype &src) : basetype(src) { } + template delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + template delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { } + delegate &operator=(const basetype &src) { *static_cast(this) = src; return *this; } +}; + + #endif /* __DELEGATE_H__ */ diff --git a/src/emu/emucore.h b/src/emu/emucore.h index 68503d30887..38e042900c4 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -202,7 +202,8 @@ inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); } #define NAME(x) x, #x // this macro wraps a function 'x' and can be used to pass a function followed by its name -#define FUNC(x) x, #x +#define FUNC(x) &x, #x +#define FUNC_NULL NULL, "(null)" // this macro wraps a member function 'x' from class 'c' #define MFUNC(c,x) &c::x, #c "::" #x diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index c27312f5bb6..433badd8821 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -1851,7 +1851,7 @@ static DEVICE_START( ide_controller ) } /* create a timer for timing status */ - ide->last_status_timer = device->machine().scheduler().timer_alloc(FUNC(NULL)); + ide->last_status_timer = device->machine().scheduler().timer_alloc(FUNC_NULL); ide->reset_timer = device->machine().scheduler().timer_alloc(FUNC(reset_callback), (void *)device); /* register ide states */ diff --git a/src/emu/machine/nvram.c b/src/emu/machine/nvram.c index 58e174a0d92..c7a3fc7152d 100644 --- a/src/emu/machine/nvram.c +++ b/src/emu/machine/nvram.c @@ -104,7 +104,7 @@ void nvram_device_config::static_set_default_value(device_config *device, defaul // helper to set a custom callback //------------------------------------------------- -void nvram_device_config::static_set_custom_handler(device_config *device, nvram_init_proto_delegate handler) +void nvram_device_config::static_set_custom_handler(device_config *device, nvram_init_delegate handler) { nvram_device_config *nvram = downcast(device); nvram->m_default_value = DEFAULT_CUSTOM; @@ -139,7 +139,7 @@ void nvram_device::device_start() { // bind our handler if (!m_config.m_custom_handler.isnull()) - m_custom_handler = nvram_init_delegate(m_config.m_custom_handler, *m_owner); + m_custom_handler = nvram_init_delegate(m_config.m_custom_handler, m_owner); } diff --git a/src/emu/machine/nvram.h b/src/emu/machine/nvram.h index 3d1add8fc72..736a6bbac19 100644 --- a/src/emu/machine/nvram.h +++ b/src/emu/machine/nvram.h @@ -66,7 +66,7 @@ #define MCFG_NVRAM_ADD_CUSTOM(_tag, _class, _method) \ MCFG_DEVICE_ADD(_tag, NVRAM, 0) \ - nvram_device_config::static_set_custom_handler(device, nvram_init_proto_delegate::_create_member<_class, &_class::_method>(#_class "::" #_method)); \ + nvram_device_config::static_set_custom_handler(device, nvram_init_delegate(&_class::_method, #_class "::" #_method, (_class *)0)); \ #define MCFG_NVRAM_REPLACE_0FILL(_tag) \ @@ -83,7 +83,7 @@ #define MCFG_NVRAM_REPLACE_CUSTOM(_tag, _class, _method) \ MCFG_DEVICE_REPLACE(_tag, NVRAM, 0) \ - nvram_device_config::static_set_custom_handler(device, nvram_init_proto_delegate::_create_member<_class, &_class::_method>(#_class "::" #_method)); \ + nvram_device_config::static_set_custom_handler(device, nvram_init_delegate(&_class::_method, #_class "::" #_method, (_class *)0)); \ @@ -95,8 +95,7 @@ class nvram_device; // custom initialization for default state -typedef proto_delegate_3param nvram_init_proto_delegate; -typedef delegate_3param nvram_init_delegate; +typedef delegate nvram_init_delegate; // ======================> nvram_device_config @@ -126,12 +125,12 @@ public: // inline configuration helpers static void static_set_default_value(device_config *device, default_value value); - static void static_set_custom_handler(device_config *device, nvram_init_proto_delegate callback); + static void static_set_custom_handler(device_config *device, nvram_init_delegate callback); protected: // internal state default_value m_default_value; - nvram_init_proto_delegate m_custom_handler; + nvram_init_delegate m_custom_handler; }; diff --git a/src/emu/memory.c b/src/emu/memory.c index 9b496334176..252353bcae1 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -2082,18 +2082,18 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w if (readorwrite == ROW_READ) switch (data.m_bits) { - case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read8_delegate(entry.m_rproto8, *object), data.m_mask); break; - case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read16_delegate(entry.m_rproto16, *object), data.m_mask); break; - case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read32_delegate(entry.m_rproto32, *object), data.m_mask); break; - case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read64_delegate(entry.m_rproto64, *object), data.m_mask); break; + case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read8_delegate(entry.m_rproto8, object), data.m_mask); break; + case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read16_delegate(entry.m_rproto16, object), data.m_mask); break; + case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read32_delegate(entry.m_rproto32, object), data.m_mask); break; + case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read64_delegate(entry.m_rproto64, object), data.m_mask); break; } else switch (data.m_bits) { - case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write8_delegate(entry.m_wproto8, *object), data.m_mask); break; - case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write16_delegate(entry.m_wproto16, *object), data.m_mask); break; - case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write32_delegate(entry.m_wproto32, *object), data.m_mask); break; - case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write64_delegate(entry.m_wproto64, *object), data.m_mask); break; + case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write8_delegate(entry.m_wproto8, object), data.m_mask); break; + case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write16_delegate(entry.m_wproto16, object), data.m_mask); break; + case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write32_delegate(entry.m_wproto32, object), data.m_mask); break; + case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write64_delegate(entry.m_wproto64, object), data.m_mask); break; } break; @@ -3743,30 +3743,30 @@ address_table_read::address_table_read(address_space &space, bool large) { // 8-bit case case 8: - m_handlers[STATIC_UNMAP]->set_delegate(read8_delegate_create(address_table_read, unmap_r, *this)); - m_handlers[STATIC_NOP]->set_delegate(read8_delegate_create(address_table_read, nop_r, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read8_delegate_create(address_table_read, watchpoint_r, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(read8_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read8_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read8_delegate(FUNC(address_table_read::watchpoint_r), this)); break; // 16-bit case case 16: - m_handlers[STATIC_UNMAP]->set_delegate(read16_delegate_create(address_table_read, unmap_r, *this)); - m_handlers[STATIC_NOP]->set_delegate(read16_delegate_create(address_table_read, nop_r, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read16_delegate_create(address_table_read, watchpoint_r, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(read16_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read16_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read16_delegate(FUNC(address_table_read::watchpoint_r), this)); break; // 32-bit case case 32: - m_handlers[STATIC_UNMAP]->set_delegate(read32_delegate_create(address_table_read, unmap_r, *this)); - m_handlers[STATIC_NOP]->set_delegate(read32_delegate_create(address_table_read, nop_r, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read32_delegate_create(address_table_read, watchpoint_r, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(read32_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read32_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read32_delegate(FUNC(address_table_read::watchpoint_r), this)); break; // 64-bit case case 64: - m_handlers[STATIC_UNMAP]->set_delegate(read64_delegate_create(address_table_read, unmap_r, *this)); - m_handlers[STATIC_NOP]->set_delegate(read64_delegate_create(address_table_read, nop_r, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read64_delegate_create(address_table_read, watchpoint_r, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(read64_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read64_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read64_delegate(FUNC(address_table_read::watchpoint_r), this)); break; } @@ -3819,30 +3819,30 @@ address_table_write::address_table_write(address_space &space, bool large) { // 8-bit case case 8: - m_handlers[STATIC_UNMAP]->set_delegate(write8_delegate_create(address_table_write, unmap_w, *this)); - m_handlers[STATIC_NOP]->set_delegate(write8_delegate_create(address_table_write, nop_w, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write8_delegate_create(address_table_write, watchpoint_w, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(write8_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write8_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write8_delegate(FUNC(address_table_write::watchpoint_w), this)); break; // 16-bit case case 16: - m_handlers[STATIC_UNMAP]->set_delegate(write16_delegate_create(address_table_write, unmap_w, *this)); - m_handlers[STATIC_NOP]->set_delegate(write16_delegate_create(address_table_write, nop_w, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write16_delegate_create(address_table_write, watchpoint_w, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(write16_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write16_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write16_delegate(FUNC(address_table_write::watchpoint_w), this)); break; // 32-bit case case 32: - m_handlers[STATIC_UNMAP]->set_delegate(write32_delegate_create(address_table_write, unmap_w, *this)); - m_handlers[STATIC_NOP]->set_delegate(write32_delegate_create(address_table_write, nop_w, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write32_delegate_create(address_table_write, watchpoint_w, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(write32_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write32_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write32_delegate(FUNC(address_table_write::watchpoint_w), this)); break; // 64-bit case case 64: - m_handlers[STATIC_UNMAP]->set_delegate(write64_delegate_create(address_table_write, unmap_w, *this)); - m_handlers[STATIC_NOP]->set_delegate(write64_delegate_create(address_table_write, nop_w, *this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write64_delegate_create(address_table_write, watchpoint_w, *this)); + m_handlers[STATIC_UNMAP]->set_delegate(write64_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write64_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write64_delegate(FUNC(address_table_write::watchpoint_w), this)); break; } @@ -4446,11 +4446,11 @@ void handler_entry_read::set_delegate(read8_delegate delegate, UINT64 mask) { configure_subunits(mask, 8); if (m_datawidth == 16) - set_delegate(read16_delegate(read16_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(read16_delegate(&handler_entry_read::read_stub_16_from_8, delegate.name(), this)); else if (m_datawidth == 32) - set_delegate(read32_delegate(read32_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(read32_delegate(&handler_entry_read::read_stub_32_from_8, delegate.name(), this)); else if (m_datawidth == 64) - set_delegate(read64_delegate(read64_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(read64_delegate(&handler_entry_read::read_stub_64_from_8, delegate.name(), this)); } } @@ -4475,9 +4475,9 @@ void handler_entry_read::set_delegate(read16_delegate delegate, UINT64 mask) { configure_subunits(mask, 16); if (m_datawidth == 32) - set_delegate(read32_delegate(read32_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(read32_delegate(&handler_entry_read::read_stub_32_from_16, delegate.name(), this)); else if (m_datawidth == 64) - set_delegate(read64_delegate(read64_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(read64_delegate(&handler_entry_read::read_stub_64_from_16, delegate.name(), this)); } } @@ -4502,7 +4502,7 @@ void handler_entry_read::set_delegate(read32_delegate delegate, UINT64 mask) { configure_subunits(mask, 32); if (m_datawidth == 64) - set_delegate(read64_delegate(read64_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(read64_delegate(&handler_entry_read::read_stub_64_from_32, delegate.name(), this)); } } @@ -4532,28 +4532,28 @@ void handler_entry_read::set_legacy_func(address_space &space, read8_space_func { m_legacy_handler.space8 = func; m_legacy_object.space = &space; - set_delegate(read8_delegate(read8_proto_delegate::_create_member(name), *this), mask); + set_delegate(read8_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } void handler_entry_read::set_legacy_func(address_space &space, read16_space_func func, const char *name, UINT64 mask) { m_legacy_handler.space16 = func; m_legacy_object.space = &space; - set_delegate(read16_delegate(read16_proto_delegate::_create_member(name), *this), mask); + set_delegate(read16_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } void handler_entry_read::set_legacy_func(address_space &space, read32_space_func func, const char *name, UINT64 mask) { m_legacy_handler.space32 = func; m_legacy_object.space = &space; - set_delegate(read32_delegate(read32_proto_delegate::_create_member(name), *this), mask); + set_delegate(read32_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } void handler_entry_read::set_legacy_func(address_space &space, read64_space_func func, const char *name, UINT64 mask) { m_legacy_handler.space64 = func; m_legacy_object.space = &space; - set_delegate(read64_delegate(read64_proto_delegate::_create_member(name), *this), mask); + set_delegate(read64_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } @@ -4566,28 +4566,28 @@ void handler_entry_read::set_legacy_func(device_t &device, read8_device_func fun { m_legacy_handler.device8 = func; m_legacy_object.device = &device; - set_delegate(read8_delegate(read8_proto_delegate::_create_member(name), *this), mask); + set_delegate(read8_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } void handler_entry_read::set_legacy_func(device_t &device, read16_device_func func, const char *name, UINT64 mask) { m_legacy_handler.device16 = func; m_legacy_object.device = &device; - set_delegate(read16_delegate(read16_proto_delegate::_create_member(name), *this), mask); + set_delegate(read16_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } void handler_entry_read::set_legacy_func(device_t &device, read32_device_func func, const char *name, UINT64 mask) { m_legacy_handler.device32 = func; m_legacy_object.device = &device; - set_delegate(read32_delegate(read32_proto_delegate::_create_member(name), *this), mask); + set_delegate(read32_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } void handler_entry_read::set_legacy_func(device_t &device, read64_device_func func, const char *name, UINT64 mask) { m_legacy_handler.device64 = func; m_legacy_object.device = &device; - set_delegate(read64_delegate(read64_proto_delegate::_create_member(name), *this), mask); + set_delegate(read64_delegate(&handler_entry_read::read_stub_legacy, name, this), mask); } @@ -4600,13 +4600,13 @@ void handler_entry_read::set_ioport(const input_port_config &ioport) { m_ioport = &ioport; if (m_datawidth == 8) - set_delegate(read8_delegate(read8_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport, ioport.tag, this)); else if (m_datawidth == 16) - set_delegate(read16_delegate(read16_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport, ioport.tag, this)); else if (m_datawidth == 32) - set_delegate(read32_delegate(read32_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport, ioport.tag, this)); else if (m_datawidth == 64) - set_delegate(read64_delegate(read64_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport, ioport.tag, this)); } @@ -4788,11 +4788,11 @@ void handler_entry_write::set_delegate(write8_delegate delegate, UINT64 mask) { configure_subunits(mask, 8); if (m_datawidth == 16) - set_delegate(write16_delegate(write16_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(write16_delegate(&handler_entry_write::write_stub_16_from_8, delegate.name(), this)); else if (m_datawidth == 32) - set_delegate(write32_delegate(write32_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(write32_delegate(&handler_entry_write::write_stub_32_from_8, delegate.name(), this)); else if (m_datawidth == 64) - set_delegate(write64_delegate(write64_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(write64_delegate(&handler_entry_write::write_stub_64_from_8, delegate.name(), this)); } } @@ -4812,9 +4812,9 @@ void handler_entry_write::set_delegate(write16_delegate delegate, UINT64 mask) { configure_subunits(mask, 16); if (m_datawidth == 32) - set_delegate(write32_delegate(write32_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(write32_delegate(&handler_entry_write::write_stub_32_from_16, delegate.name(), this)); else if (m_datawidth == 64) - set_delegate(write64_delegate(write64_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(write64_delegate(&handler_entry_write::write_stub_64_from_16, delegate.name(), this)); } } @@ -4834,7 +4834,7 @@ void handler_entry_write::set_delegate(write32_delegate delegate, UINT64 mask) { configure_subunits(mask, 32); if (m_datawidth == 64) - set_delegate(write64_delegate(write64_proto_delegate::_create_member(delegate.name()), *this)); + set_delegate(write64_delegate(&handler_entry_write::write_stub_64_from_32, delegate.name(), this)); } } @@ -4859,28 +4859,28 @@ void handler_entry_write::set_legacy_func(address_space &space, write8_space_fun { m_legacy_handler.space8 = func; m_legacy_object.space = &space; - set_delegate(write8_delegate(write8_proto_delegate::_create_member(name), *this), mask); + set_delegate(write8_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } void handler_entry_write::set_legacy_func(address_space &space, write16_space_func func, const char *name, UINT64 mask) { m_legacy_handler.space16 = func; m_legacy_object.space = &space; - set_delegate(write16_delegate(write16_proto_delegate::_create_member(name), *this), mask); + set_delegate(write16_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } void handler_entry_write::set_legacy_func(address_space &space, write32_space_func func, const char *name, UINT64 mask) { m_legacy_handler.space32 = func; m_legacy_object.space = &space; - set_delegate(write32_delegate(write32_proto_delegate::_create_member(name), *this), mask); + set_delegate(write32_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } void handler_entry_write::set_legacy_func(address_space &space, write64_space_func func, const char *name, UINT64 mask) { m_legacy_handler.space64 = func; m_legacy_object.space = &space; - set_delegate(write64_delegate(write64_proto_delegate::_create_member(name), *this), mask); + set_delegate(write64_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } @@ -4893,28 +4893,28 @@ void handler_entry_write::set_legacy_func(device_t &device, write8_device_func f { m_legacy_handler.device8 = func; m_legacy_object.device = &device; - set_delegate(write8_delegate(write8_proto_delegate::_create_member(name), *this), mask); + set_delegate(write8_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } void handler_entry_write::set_legacy_func(device_t &device, write16_device_func func, const char *name, UINT64 mask) { m_legacy_handler.device16 = func; m_legacy_object.device = &device; - set_delegate(write16_delegate(write16_proto_delegate::_create_member(name), *this), mask); + set_delegate(write16_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } void handler_entry_write::set_legacy_func(device_t &device, write32_device_func func, const char *name, UINT64 mask) { m_legacy_handler.device32 = func; m_legacy_object.device = &device; - set_delegate(write32_delegate(write32_proto_delegate::_create_member(name), *this), mask); + set_delegate(write32_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } void handler_entry_write::set_legacy_func(device_t &device, write64_device_func func, const char *name, UINT64 mask) { m_legacy_handler.device64 = func; m_legacy_object.device = &device; - set_delegate(write64_delegate(write64_proto_delegate::_create_member(name), *this), mask); + set_delegate(write64_delegate(&handler_entry_write::write_stub_legacy, name, this), mask); } @@ -4927,13 +4927,13 @@ void handler_entry_write::set_ioport(const input_port_config &ioport) { m_ioport = &ioport; if (m_datawidth == 8) - set_delegate(write8_delegate(write8_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport, ioport.tag, this)); else if (m_datawidth == 16) - set_delegate(write16_delegate(write16_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport, ioport.tag, this)); else if (m_datawidth == 32) - set_delegate(write32_delegate(write32_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport, ioport.tag, this)); else if (m_datawidth == 64) - set_delegate(write64_delegate(write64_proto_delegate::_create_member >(ioport.tag), *this)); + set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport, ioport.tag, this)); } diff --git a/src/emu/memory.h b/src/emu/memory.h index e6b59a07394..dd8ac20edf2 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -151,65 +151,25 @@ struct data_accessors // ======================> direct_update_delegate // direct region update handler -typedef proto_delegate_2param direct_update_proto_delegate; -typedef delegate_2param direct_update_delegate; - -#define direct_update_delegate_create(_Class, _Method, _Object) direct_update_delegate(direct_update_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object) -#define direct_update_delegate_create_static(_Function, _Object) direct_update_delegate(direct_update_proto_delegate::_create_static(#_Function), _Object) +typedef delegate direct_update_delegate; // ======================> read_delegate -// declare proto-delegates for each width -typedef proto_delegate_3param read8_proto_delegate; -typedef proto_delegate_3param read16_proto_delegate; -typedef proto_delegate_3param read32_proto_delegate; -typedef proto_delegate_3param read64_proto_delegate; - // declare delegates for each width -typedef delegate_3param read8_delegate; -typedef delegate_3param read16_delegate; -typedef delegate_3param read32_delegate; -typedef delegate_3param read64_delegate; - -// macros for creating read proto-delegates -#define read8_proto_delegate_create(_Class, _Method) read8_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) -#define read16_proto_delegate_create(_Class, _Method) read16_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) -#define read32_proto_delegate_create(_Class, _Method) read32_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) -#define read64_proto_delegate_create(_Class, _Method) read64_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) - -// macros for creating read delegates, bound to the provided object -#define read8_delegate_create(_Class, _Method, _Object) read8_delegate(read8_proto_delegate_create(_Class, _Method), _Object) -#define read16_delegate_create(_Class, _Method, _Object) read16_delegate(read16_proto_delegate_create(_Class, _Method), _Object) -#define read32_delegate_create(_Class, _Method, _Object) read32_delegate(read32_proto_delegate_create(_Class, _Method), _Object) -#define read64_delegate_create(_Class, _Method, _Object) read64_delegate(read64_proto_delegate_create(_Class, _Method), _Object) +typedef delegate read8_delegate; +typedef delegate read16_delegate; +typedef delegate read32_delegate; +typedef delegate read64_delegate; // ======================> write_delegate -// declare proto-delegates for each width -typedef proto_delegate_4param write8_proto_delegate; -typedef proto_delegate_4param write16_proto_delegate; -typedef proto_delegate_4param write32_proto_delegate; -typedef proto_delegate_4param write64_proto_delegate; - // declare delegates for each width -typedef delegate_4param write8_delegate; -typedef delegate_4param write16_delegate; -typedef delegate_4param write32_delegate; -typedef delegate_4param write64_delegate; - -// macros for creating write proto-delegates -#define write8_proto_delegate_create(_Class, _Method) write8_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) -#define write16_proto_delegate_create(_Class, _Method) write16_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) -#define write32_proto_delegate_create(_Class, _Method) write32_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) -#define write64_proto_delegate_create(_Class, _Method) write64_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method) - -// macros for creating write delegates, bound to the provided object -#define write8_delegate_create(_Class, _Method, _Object) write8_delegate(write8_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object) -#define write16_delegate_create(_Class, _Method, _Object) write16_delegate(write16_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object) -#define write32_delegate_create(_Class, _Method, _Object) write32_delegate(write32_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object) -#define write64_delegate_create(_Class, _Method, _Object) write64_delegate(write64_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object) +typedef delegate write8_delegate; +typedef delegate write16_delegate; +typedef delegate write32_delegate; +typedef delegate write64_delegate; // ======================> direct_read_data @@ -604,7 +564,7 @@ protected: // opcode base adjustment handler function macro #define DIRECT_UPDATE_MEMBER(name) offs_t name(ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address) -#define DIRECT_UPDATE_HANDLER(name) offs_t name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address) +#define DIRECT_UPDATE_HANDLER(name) offs_t name(ATTR_UNUSED running_machine &machine, ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address) // space read/write handler function macros diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index e694bec5dc7..b95600891c5 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -258,7 +258,7 @@ static DEVICE_START( k053260 ) /* setup SH1 timer if necessary */ if ( ic->intf->irq ) - device->machine().scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, FUNC(ic->intf->irq )); + device->machine().scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, ic->intf->irq, "ic->intf->irq" ); } INLINE void check_bounds( k053260_state *ic, int channel ) diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c index d63278331d4..740f9395548 100644 --- a/src/emu/sound/pokey.c +++ b/src/emu/sound/pokey.c @@ -648,7 +648,7 @@ static DEVICE_START( pokey ) chip->clockmult = DIV_64; chip->KBCODE = 0x09; /* Atari 800 'no key' */ chip->SKCTL = SK_RESET; /* let the RNG run after reset */ - chip->rtimer = device->machine().scheduler().timer_alloc(FUNC(NULL)); + chip->rtimer = device->machine().scheduler().timer_alloc(FUNC_NULL); chip->timer[0] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); chip->timer[1] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 04f7938dae3..be781897aac 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -116,16 +116,16 @@ static TIMER_CALLBACK( update_irq_state_timer_5 ); static TIMER_CALLBACK( update_irq_state_timer_6 ); static TIMER_CALLBACK( update_irq_state_timer_7 ); -static const timer_expired_func update_irq_state_cb[] = +static const struct { timer_expired_func func; const char *name; } update_irq_state_cb[] = { - update_irq_state_timer_0, - update_irq_state_timer_1, - update_irq_state_timer_2, - update_irq_state_timer_3, - update_irq_state_timer_4, - update_irq_state_timer_5, - update_irq_state_timer_6, - update_irq_state_timer_7 + { FUNC(update_irq_state_timer_0) }, + { FUNC(update_irq_state_timer_1) }, + { FUNC(update_irq_state_timer_2) }, + { FUNC(update_irq_state_timer_3) }, + { FUNC(update_irq_state_timer_4) }, + { FUNC(update_irq_state_timer_5) }, + { FUNC(update_irq_state_timer_6) }, + { FUNC(update_irq_state_timer_7) } }; @@ -205,7 +205,7 @@ static STATE_POSTLOAD( YMZ280B_state_save_update_step ) struct YMZ280BVoice *voice = &chip->voice[j]; update_step(chip, voice); if(voice->irq_schedule) - machine.scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[j]), 0, chip); + machine.scheduler().timer_set(attotime::zero, update_irq_state_cb[j].func, update_irq_state_cb[j].name, 0, chip); } } @@ -581,7 +581,7 @@ static STREAM_UPDATE( ymz280b_update ) voice->playing = 0; /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */ - chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[v]), 0, chip); + chip->device->machine().scheduler().timer_set(attotime::zero, update_irq_state_cb[v].func, update_irq_state_cb[v].name, 0, chip); voice->irq_schedule = 1; } } diff --git a/src/emu/video.c b/src/emu/video.c index aed2ef572bc..84576f7b8d6 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -180,7 +180,7 @@ video_manager::video_manager(running_machine &machine) // if no screens, create a periodic timer to drive updates if (machine.primary_screen == NULL) { - m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(&screenless_update_callback), this); + m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(screenless_update_callback), this); m_screenless_frame_timer->adjust(screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD); } } diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c index c38b10067ae..10608d6eaf4 100644 --- a/src/emu/video/pc_vga.c +++ b/src/emu/video/pc_vga.c @@ -598,8 +598,8 @@ static void vga_cpu_interface(running_machine &machine) { address_space *space = machine.firstcpu->memory().space(AS_PROGRAM); static int sequencer, gc; - read8_space_func read_handler; - write8_space_func write_handler; + read8_space_func read_handler; const char *read_handler_name; + write8_space_func write_handler; const char *write_handler_name; read16_space_func read_handler16; write16_space_func write_handler16; read32_space_func read_handler32; @@ -616,8 +616,8 @@ static void vga_cpu_interface(running_machine &machine) if (vga.sequencer.data[4]&8) { - read_handler = vga_vga_r; - write_handler = vga_vga_w; + read_handler = vga_vga_r; read_handler_name = "vga_vga_r"; + write_handler = vga_vga_w; write_handler_name = "vga_vga_w"; read_handler16 = vga_vga16_r; write_handler16 = vga_vga16_w; read_handler32 = vga_vga32_r; @@ -627,8 +627,8 @@ static void vga_cpu_interface(running_machine &machine) } else if (vga.sequencer.data[4] & 4) { - read_handler = vga_ega_r; - write_handler = vga_ega_w; + read_handler = vga_ega_r; read_handler_name = "vga_ega_r"; + write_handler = vga_ega_w; read_handler_name = "vga_ega_w"; read_handler16 = vga_ega16_r; write_handler16 = vga_ega16_w; read_handler32 = vga_ega32_r; @@ -638,8 +638,8 @@ static void vga_cpu_interface(running_machine &machine) } else { - read_handler = vga_text_r; - write_handler = vga_text_w; + read_handler = vga_text_r; read_handler_name = "vga_text_r"; + write_handler = vga_text_w; read_handler_name = "vga_text_w"; read_handler16 = vga_text16_r; write_handler16 = vga_text16_w; read_handler32 = vga_text32_r; @@ -682,12 +682,12 @@ static void vga_cpu_interface(running_machine &machine) sel = vga.gc.data[6] & 0x0c; if (sel) { - if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler) ); else space->nop_read(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler) ); else space->nop_read(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler) ); else space->nop_read(0xb8000, 0xbffff); - if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler)); else space->nop_write(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler)); else space->nop_write(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler)); else space->nop_write(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler, read_handler_name); else space->nop_read(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler, read_handler_name); else space->nop_read(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler, read_handler_name); else space->nop_read(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler, write_handler_name); else space->nop_write(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler, write_handler_name); else space->nop_write(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler, write_handler_name); else space->nop_write(0xb8000, 0xbffff); } else { @@ -701,12 +701,12 @@ static void vga_cpu_interface(running_machine &machine) sel = vga.gc.data[6] & 0x0c; if (sel) { - if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler16) ); else space->nop_read(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler16) ); else space->nop_read(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler16) ); else space->nop_read(0xb8000, 0xbffff); - if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler16)); else space->nop_write(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler16)); else space->nop_write(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler16)); else space->nop_write(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler16, read_handler_name); else space->nop_read(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler16, read_handler_name); else space->nop_read(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler16, read_handler_name); else space->nop_read(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler16, write_handler_name); else space->nop_write(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler16, write_handler_name); else space->nop_write(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler16, write_handler_name); else space->nop_write(0xb8000, 0xbffff); } else { @@ -720,12 +720,12 @@ static void vga_cpu_interface(running_machine &machine) sel = vga.gc.data[6] & 0x0c; if (sel) { - if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler32) ); else space->nop_read(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler32) ); else space->nop_read(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler32) ); else space->nop_read(0xb8000, 0xbffff); - if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler32)); else space->nop_write(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler32)); else space->nop_write(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler32)); else space->nop_write(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler32, read_handler_name); else space->nop_read(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler32, read_handler_name); else space->nop_read(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler32, read_handler_name); else space->nop_read(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler32, write_handler_name); else space->nop_write(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler32, write_handler_name); else space->nop_write(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler32, write_handler_name); else space->nop_write(0xb8000, 0xbffff); } else { @@ -739,12 +739,12 @@ static void vga_cpu_interface(running_machine &machine) sel = vga.gc.data[6] & 0x0c; if (sel) { - if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler64) ); else space->nop_read(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler64) ); else space->nop_read(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler64) ); else space->nop_read(0xb8000, 0xbffff); - if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler64)); else space->nop_write(0xa0000, 0xaffff); - if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler64)); else space->nop_write(0xb0000, 0xb7fff); - if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler64)); else space->nop_write(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler64, read_handler_name); else space->nop_read(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler64, read_handler_name); else space->nop_read(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler64, read_handler_name); else space->nop_read(0xb8000, 0xbffff); + if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler64, write_handler_name); else space->nop_write(0xa0000, 0xaffff); + if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler64, write_handler_name); else space->nop_write(0xb0000, 0xb7fff); + if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler64, write_handler_name); else space->nop_write(0xb8000, 0xbffff); } else { diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index 164ad33f663..92a515647dd 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -560,14 +560,14 @@ static DEVICE_START( common_sh_start ) state->m_i80186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device); state->m_i80186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device); state->m_i80186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device); - state->m_i80186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC(NULL)); - state->m_i80186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC(NULL)); - state->m_i80186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC(NULL)); + state->m_i80186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); + state->m_i80186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); + state->m_i80186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); state->m_i80186.dma[0].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback), device); state->m_i80186.dma[1].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback), device); for (i = 0; i < 9; i++) - state->m_counter[i].timer = machine.scheduler().timer_alloc(FUNC(NULL)); + state->m_counter[i].timer = machine.scheduler().timer_alloc(FUNC_NULL); } static DEVICE_START( leland_80186_sound ) diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c index b7184b71791..def0ebbefd5 100644 --- a/src/mame/drivers/atarig42.c +++ b/src/mame/drivers/atarig42.c @@ -144,7 +144,7 @@ DIRECT_UPDATE_HANDLER( atarig42_sloop_direct_handler ) { if (address < 0x80000) { - atarig42_state *state = machine->driver_data(); + atarig42_state *state = machine.driver_data(); direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, state->m_sloop_base); return (offs_t)-1; } @@ -802,7 +802,7 @@ static DRIVER_INIT( roadriot ) address_space *main = machine.device("maincpu")->space(AS_PROGRAM); state->m_sloop_base = main->install_legacy_readwrite_handler(0x000000, 0x07ffff, FUNC(roadriot_sloop_data_r), FUNC(roadriot_sloop_data_w)); - main->set_direct_update_handler(direct_update_delegate_create_static(atarig42_sloop_direct_handler, machine)); + main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_sloop_direct_handler), &machine)); asic65_config(machine, ASIC65_ROMBASED); /* @@ -841,7 +841,7 @@ static DRIVER_INIT( guardian ) address_space *main = machine.device("maincpu")->space(AS_PROGRAM); state->m_sloop_base = main->install_legacy_readwrite_handler(0x000000, 0x07ffff, FUNC(guardians_sloop_data_r), FUNC(guardians_sloop_data_w)); - main->set_direct_update_handler(direct_update_delegate_create_static(atarig42_sloop_direct_handler, machine)); + main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_sloop_direct_handler), &machine)); asic65_config(machine, ASIC65_GUARDIANS); /* diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index eeffd25bb1e..a727c6b0a91 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -213,7 +213,7 @@ DIRECT_UPDATE_HANDLER( atarisy2_direct_handler ) /* make sure slapstic area looks like ROM */ if (address >= 0x8000 && address < 0x8200) { - atarisy2_state *state = machine->driver_data(); + atarisy2_state *state = machine.driver_data(); direct.explicit_configure(0x8000, 0x81ff, 0x1ff, (UINT8 *)state->m_slapstic_base); return ~0; } @@ -246,7 +246,7 @@ static MACHINE_RESET( atarisy2 ) atarigen_scanline_timer_reset(*machine.primary_screen, scanline_update, 64); address_space *main = machine.device("maincpu")->space(AS_PROGRAM); - main->set_direct_update_handler(direct_update_delegate_create_static(atarisy2_direct_handler, machine)); + main->set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_direct_handler), &machine)); state->m_p2portwr_state = 0; state->m_p2portrd_state = 0; diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index 67f282aea94..6ffdb5d4412 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -503,8 +503,8 @@ static DRIVER_INIT( beathead ) atarijsa_init(machine, "IN2", 0x0040); /* prepare the speedups */ - state->m_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate_create(beathead_state, speedup_r, *state)); - state->m_movie_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate_create(beathead_state, movie_speedup_r, *state)); + state->m_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), state)); + state->m_movie_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), state)); } diff --git a/src/mame/drivers/btoads.c b/src/mame/drivers/btoads.c index fc0710bf97d..8a265372d9c 100644 --- a/src/mame/drivers/btoads.c +++ b/src/mame/drivers/btoads.c @@ -53,7 +53,7 @@ static TIMER_CALLBACK( delayed_sound_w ) device_triggerint(machine.device("audiocpu")); /* use a timer to make long transfers faster */ - machine.scheduler().timer_set(attotime::from_usec(50), FUNC(NULL)); + machine.scheduler().timer_set(attotime::from_usec(50), FUNC_NULL); } diff --git a/src/mame/drivers/combatsc.c b/src/mame/drivers/combatsc.c index 2f5e4b9df54..ff8a43382c4 100644 --- a/src/mame/drivers/combatsc.c +++ b/src/mame/drivers/combatsc.c @@ -687,7 +687,7 @@ static MACHINE_START( combatsc ) state->m_page[0] = MEM + 0x4000; state->m_page[1] = MEM + 0x6000; - state->m_interleave_timer = machine.scheduler().timer_alloc(FUNC(NULL)); + state->m_interleave_timer = machine.scheduler().timer_alloc(FUNC_NULL); state->m_audiocpu = machine.device("audiocpu"); state->m_k007121_1 = machine.device("k007121_1"); diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 2bd30433cde..071c1053122 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -731,7 +731,7 @@ static void init_common(running_machine &machine, UINT32 key1, UINT32 key2, int state->m_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4); address_space *main = machine.device("maincpu")->space(AS_PROGRAM); - main->set_direct_update_handler(direct_update_delegate_create_static(cps3_direct_handler, machine)); + main->set_direct_update_handler(direct_update_delegate(FUNC(cps3_direct_handler), &machine)); // flash roms astring tempstr; @@ -1298,7 +1298,7 @@ static WRITE32_HANDLER( cps3_0xc0000000_ram_w ) DIRECT_UPDATE_HANDLER( cps3_direct_handler ) { - cps3_state *state = machine->driver_data(); + cps3_state *state = machine.driver_data(); // if(DEBUG_PRINTF) printf("address %04x\n",address); /* BIOS ROM */ diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index bde848ab407..3937a3cb6fd 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -2210,15 +2210,15 @@ static void security_w(device_t *device, UINT8 data) /*****************************************************************************/ -static void init_lights(running_machine &machine, write32_space_func out1, write32_space_func out2, write32_space_func out3) +static void init_lights(running_machine &machine, write32_space_func out1, const char *out1name, write32_space_func out2, const char *out2name, write32_space_func out3, const char *out3name) { - if(!out1) out1 = lamp_output_w; - if(!out2) out1 = lamp_output2_w; - if(!out3) out1 = lamp_output3_w; + if(!out1) out1 = lamp_output_w, out1name = "lamp_output_w"; + if(!out2) out2 = lamp_output2_w, out2name = "lamp_output2_w"; + if(!out3) out3 = lamp_output3_w, out3name = "lamp_output3_w"; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000804, 0x7d000807, FUNC(out1)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000320, 0x7d000323, FUNC(out2)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000324, 0x7d000327, FUNC(out3)); + machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000804, 0x7d000807, out1, out1name); + machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000320, 0x7d000323, out2, out2name); + machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000324, 0x7d000327, out3, out3name); } static void init_firebeat(running_machine &machine) @@ -2240,20 +2240,20 @@ static void init_firebeat(running_machine &machine) set_ibutton(state, rom); - init_lights(machine, NULL, NULL, NULL); + init_lights(machine, FUNC_NULL, FUNC_NULL, FUNC_NULL); } static DRIVER_INIT(ppp) { init_firebeat(machine); - init_lights(machine, lamp_output_ppp_w, lamp_output2_ppp_w, lamp_output3_ppp_w); + init_lights(machine, FUNC(lamp_output_ppp_w), FUNC(lamp_output2_ppp_w), FUNC(lamp_output3_ppp_w)); } static DRIVER_INIT(ppd) { firebeat_state *state = machine.driver_data(); init_firebeat(machine); - init_lights(machine, lamp_output_ppp_w, lamp_output2_ppp_w, lamp_output3_ppp_w); + init_lights(machine, FUNC(lamp_output_ppp_w), FUNC(lamp_output2_ppp_w), FUNC(lamp_output3_ppp_w)); state->m_cur_cab_data = ppd_cab_data; } @@ -2270,7 +2270,7 @@ static DRIVER_INIT(kbm) { firebeat_state *state = machine.driver_data(); init_firebeat(machine); - init_lights(machine, lamp_output_kbm_w, NULL, NULL); + init_lights(machine, FUNC(lamp_output_kbm_w), FUNC_NULL, FUNC_NULL); init_keyboard(machine); diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index bf52a82059f..eb34b6b58d0 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -1107,7 +1107,7 @@ ADDRESS_MAP_END DIRECT_UPDATE_HANDLER( KL5C80_direct_handler ) { - hng64_state *state = machine->driver_data(); + hng64_state *state = machine.driver_data(); direct.explicit_configure(0x0000, 0xffff, 0xffff, state->m_com_op_base); return ~0; @@ -1702,7 +1702,7 @@ static MACHINE_RESET(hyperneo) KL5C80_virtual_mem_sync(state); address_space *space = machine.device("comm")->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(KL5C80_direct_handler, machine)); + space->set_direct_update_handler(direct_update_delegate(FUNC(KL5C80_direct_handler), &machine)); cputag_set_input_line(machine, "comm", INPUT_LINE_RESET, PULSE_LINE); // reset the CPU and let 'er rip // cputag_set_input_line(machine, "comm", INPUT_LINE_HALT, ASSERT_LINE); // hold on there pardner... diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 5c6b2460bdb..e91c59edf45 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -1232,11 +1232,11 @@ static READ32_HANDLER( speedup9_r ) { return generic_speedup(space, 9); } static READ32_HANDLER( speedup10_r ) { return generic_speedup(space, 10); } static READ32_HANDLER( speedup11_r ) { return generic_speedup(space, 11); } -static const read32_space_func speedup_handlers[] = +static const struct { read32_space_func func; const char *name; } speedup_handlers[] = { - speedup0_r, speedup1_r, speedup2_r, speedup3_r, - speedup4_r, speedup5_r, speedup6_r, speedup7_r, - speedup8_r, speedup9_r, speedup10_r, speedup11_r + { FUNC(speedup0_r) }, { FUNC(speedup1_r) }, { FUNC(speedup2_r) }, { FUNC(speedup3_r) }, + { FUNC(speedup4_r) }, { FUNC(speedup5_r) }, { FUNC(speedup6_r) }, { FUNC(speedup7_r) }, + { FUNC(speedup8_r) }, { FUNC(speedup9_r) }, { FUNC(speedup10_r) }, { FUNC(speedup11_r) } }; #ifdef MAME_DEBUG @@ -1261,7 +1261,7 @@ static void install_speedups(running_machine &machine, const speedup_entry *entr state->m_speedup_count = count; for (i = 0; i < count; i++) - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, FUNC(speedup_handlers[i])); + machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, speedup_handlers[i].func, speedup_handlers[i].name); #ifdef MAME_DEBUG machine.add_notifier(MACHINE_NOTIFY_EXIT, report_speedups); diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index 79b8295d663..89748d9348d 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -78,8 +78,8 @@ static TIMER_CALLBACK( invasn_gun_callback ); static MACHINE_START( midzeus ) { - timer[0] = machine.scheduler().timer_alloc(FUNC(NULL)); - timer[1] = machine.scheduler().timer_alloc(FUNC(NULL)); + timer[0] = machine.scheduler().timer_alloc(FUNC_NULL); + timer[1] = machine.scheduler().timer_alloc(FUNC_NULL); gun_timer[0] = machine.scheduler().timer_alloc(FUNC(invasn_gun_callback)); gun_timer[1] = machine.scheduler().timer_alloc(FUNC(invasn_gun_callback)); diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index 91cd325f224..d4da8b794cb 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -515,7 +515,7 @@ static MACHINE_START( missile ) /* set up an opcode base handler since we use mapped handlers for RAM */ address_space *space = machine.device("maincpu")->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(missile_direct_handler, machine)); + space->set_direct_update_handler(direct_update_delegate(FUNC(missile_direct_handler), &machine)); /* create a timer to speed/slow the CPU */ state->m_cpu_timer = machine.scheduler().timer_alloc(FUNC(adjust_cpu_speed)); diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index 1aad86c55e8..77cecc55323 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -884,29 +884,30 @@ static const struct { const char *s_name; read32_space_func keycus_r; + const char *keycus_r_name; int n_daughterboard; } namcos11_config_table[] = { - { "tekken", NULL, 32 }, - { "tekkena", NULL, 32 }, - { "tekkenb", NULL, 32 }, - { "tekkenc", NULL, 32 }, - { "tekken2", keycus_c406_r, 32 }, - { "tekken2a", keycus_c406_r, 32 }, - { "tekken2b", keycus_c406_r, 32 }, - { "souledge", keycus_c409_r, 32 }, - { "souledgea", keycus_c409_r, 32 }, - { "souledge1", keycus_c409_r, 32 }, - { "souledge1j", keycus_c409_r, 32 }, - { "dunkmnia", keycus_c410_r, 32 }, - { "dunkmniaj", keycus_c410_r, 32 }, - { "xevi3dg", keycus_c430_r, 32 }, - { "primglex", keycus_c411_r, 32 }, - { "danceyes", keycus_c431_r, 32 }, - { "pocketrc", keycus_c432_r, 32 }, - { "starswep", keycus_c442_r, 0 }, - { "myangel3", keycus_c443_r, 64 }, - { "ptblank2a",keycus_c443_r, 64 }, + { "tekken", FUNC_NULL, 32 }, + { "tekkena", FUNC_NULL, 32 }, + { "tekkenb", FUNC_NULL, 32 }, + { "tekkenc", FUNC_NULL, 32 }, + { "tekken2", FUNC(keycus_c406_r), 32 }, + { "tekken2a", FUNC(keycus_c406_r), 32 }, + { "tekken2b", FUNC(keycus_c406_r), 32 }, + { "souledge", FUNC(keycus_c409_r), 32 }, + { "souledgea", FUNC(keycus_c409_r), 32 }, + { "souledge1", FUNC(keycus_c409_r), 32 }, + { "souledge1j", FUNC(keycus_c409_r), 32 }, + { "dunkmnia", FUNC(keycus_c410_r), 32 }, + { "dunkmniaj", FUNC(keycus_c410_r), 32 }, + { "xevi3dg", FUNC(keycus_c430_r), 32 }, + { "primglex", FUNC(keycus_c411_r), 32 }, + { "danceyes", FUNC(keycus_c431_r), 32 }, + { "pocketrc", FUNC(keycus_c432_r), 32 }, + { "starswep", FUNC(keycus_c442_r), 0 }, + { "myangel3", FUNC(keycus_c443_r), 64 }, + { "ptblank2a",FUNC(keycus_c443_r), 64 }, { NULL, NULL } }; @@ -932,7 +933,7 @@ static DRIVER_INIT( namcos11 ) { if( namcos11_config_table[ n_game ].keycus_r != NULL ) { - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(namcos11_config_table[ n_game ].keycus_r) ); + machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, namcos11_config_table[ n_game ].keycus_r, namcos11_config_table[ n_game ].keycus_r_name ); } if( namcos11_config_table[ n_game ].n_daughterboard != 0 ) { diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index 179463db3d8..ab8a0ccd2cc 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -315,7 +315,7 @@ static READ16_HANDLER( dsp56k_bootload_r ) DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler ) { - polygonet_state *state = machine->driver_data(); + polygonet_state *state = machine.driver_data(); /* Call the dsp's update handler first */ if (!state->m_dsp56k_update_handler.isnull()) @@ -757,7 +757,7 @@ static DRIVER_INIT(polygonet) /* The dsp56k occasionally executes out of mapped memory */ address_space *space = machine.device("dsp")->space(AS_PROGRAM); - state->m_dsp56k_update_handler = space->set_direct_update_handler(direct_update_delegate_create_static(plygonet_dsp56k_direct_handler, machine)); + state->m_dsp56k_update_handler = space->set_direct_update_handler(direct_update_delegate(FUNC(plygonet_dsp56k_direct_handler), &machine)); /* save states */ state->save_item(NAME(state->m_dsp56k_bank00_ram)); diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index 4602dadf342..b73af8a741b 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -342,17 +342,17 @@ static const ppi8255_interface single_ppi_intf = static const segaic16_memory_map_entry outrun_info[] = { - { 0x35/2, 0x90000, 0x10000, 0xf00000, ~0, segaic16_road_control_0_r, NULL, segaic16_road_control_0_w, NULL, NULL, "road control" }, - { 0x35/2, 0x80000, 0x01000, 0xf0f000, ~0, NULL, "bank10", NULL, "bank10", &segaic16_roadram_0, "road RAM" }, - { 0x35/2, 0x60000, 0x08000, 0xf18000, ~0, NULL, "bank11", NULL, "bank11", &cpu1ram, "CPU 1 RAM" }, - { 0x35/2, 0x00000, 0x60000, 0xf00000, ~0, NULL, "bank12", NULL, NULL, &cpu1rom, "CPU 1 ROM" }, - { 0x31/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x2d/2, 0x00000, 0x01000, 0xfff000, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x29/2, 0x00000, 0x02000, 0xffe000, ~0, NULL, "bank14", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x25/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank15", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x25/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank16", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x21/2, 0x60000, 0x08000, 0xf98000, ~0, NULL, "bank17", NULL, "bank17", &workram, "CPU 0 RAM" }, - { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, NULL, "bank18", NULL, NULL, NULL, "CPU 0 ROM" }, + { 0x35/2, 0x90000, 0x10000, 0xf00000, ~0, FUNC(segaic16_road_control_0_r), NULL, FUNC(segaic16_road_control_0_w), NULL, NULL, "road control" }, + { 0x35/2, 0x80000, 0x01000, 0xf0f000, ~0, FUNC_NULL, "bank10", FUNC_NULL, "bank10", &segaic16_roadram_0, "road RAM" }, + { 0x35/2, 0x60000, 0x08000, 0xf18000, ~0, FUNC_NULL, "bank11", FUNC_NULL, "bank11", &cpu1ram, "CPU 1 RAM" }, + { 0x35/2, 0x00000, 0x60000, 0xf00000, ~0, FUNC_NULL, "bank12", FUNC_NULL, NULL, &cpu1rom, "CPU 1 ROM" }, + { 0x31/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x2d/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x29/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank14", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x25/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank15", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x25/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank16", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x21/2, 0x60000, 0x08000, 0xf98000, ~0, FUNC_NULL, "bank17", FUNC_NULL, "bank17", &workram, "CPU 0 RAM" }, + { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, FUNC_NULL, "bank18", FUNC_NULL, NULL, NULL, "CPU 0 ROM" }, { 0 } }; diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index 1aca33d151b..07f29e5b8b0 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -937,71 +937,71 @@ static WRITE16_HANDLER( atomicp_sound_w ); static const segaic16_memory_map_entry rom_171_5358_info_small[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, NULL, "bank15", NULL, NULL, NULL, "ROM 2" }, - { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, NULL, "bank16", NULL, NULL, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL, "bank15", FUNC_NULL, NULL, NULL, "ROM 2" }, + { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5358_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, NULL, "bank15", NULL, NULL, NULL, "ROM 2" }, - { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, NULL, "bank16", NULL, NULL, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, FUNC_NULL, "bank15", FUNC_NULL, NULL, NULL, "ROM 2" }, + { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5704_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, rom_5704_bank_w, NULL, NULL, "tile bank" }, - { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, NULL, "bank16", NULL, NULL, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(rom_5704_bank_w), NULL, NULL, "tile bank" }, + { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_atomicp_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, rom_5704_bank_w, NULL, NULL, "tile bank" }, - { 0x25/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, atomicp_sound_w, NULL, NULL, "sound" }, - { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(rom_5704_bank_w), NULL, NULL, "tile bank" }, + { 0x25/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(atomicp_sound_w), NULL, NULL, "sound" }, + { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5797_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, unknown_rgn2_r, NULL, unknown_rgn2_w, NULL, NULL, "???" }, - { 0x25/2, 0x00000, 0x04000, 0xffc000, ~0, rom_5797_bank_math_r, NULL, rom_5797_bank_math_w, NULL, NULL, "tile bank/math" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC(unknown_rgn2_r), NULL, FUNC(unknown_rgn2_w), NULL, NULL, "???" }, + { 0x25/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(rom_5797_bank_math_r), NULL, FUNC(rom_5797_bank_math_w), NULL, NULL, "tile bank/math" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index dc632a6a254..fe831bb7fbf 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -82,43 +82,43 @@ static WRITE16_HANDLER( rom_5987_bank_w ); static const segaic16_memory_map_entry rom_171_shad_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, NULL, NULL, NULL, "????" }, - { 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, NULL, genesis_vdp_w, NULL, NULL, "VDP" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC_NULL, NULL, NULL, "????" }, + { 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, NULL, "VDP" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5874_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, NULL, genesis_vdp_w, NULL, NULL, "VDP" }, - { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, NULL, "bank16", NULL, NULL, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, NULL, "VDP" }, + { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5987_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, NULL, misc_io_w, NULL, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, NULL, "bank10", segaic16_paletteram_w, NULL, &segaic16_paletteram, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, NULL, "bank11", segaic16_tileram_0_w, NULL, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, NULL, "bank12", segaic16_textram_0_w, NULL, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, NULL, "bank13", NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, NULL, "bank14", NULL, "bank14", &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, NULL, genesis_vdp_w, NULL, NULL, "VDP" }, - { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, NULL, "bank16", rom_5987_bank_w, NULL, NULL, "ROM 1/banking" }, - { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, NULL, "bank17", NULL, NULL, NULL, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, NULL, "VDP" }, + { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL, "bank16", FUNC(rom_5987_bank_w), NULL, NULL, "ROM 1/banking" }, + { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index f96fe825b90..9c9e2e6574e 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -123,7 +123,7 @@ static WRITE8_HANDLER( esb_slapstic_w ) DIRECT_UPDATE_HANDLER( esb_setdirect ) { - starwars_state *state = machine->driver_data(); + starwars_state *state = machine.driver_data(); /* if we are in the slapstic region, process it */ if ((address & 0xe000) == 0x8000) { @@ -521,7 +521,7 @@ static DRIVER_INIT( esb ) /* install an opcode base handler */ address_space *space = machine.device("maincpu")->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(esb_setdirect, machine)); + space->set_direct_update_handler(direct_update_delegate(FUNC(esb_setdirect), &machine)); /* install read/write handlers for it */ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x8000, 0x9fff, FUNC(esb_slapstic_r), FUNC(esb_slapstic_w)); diff --git a/src/mame/drivers/vcombat.c b/src/mame/drivers/vcombat.c index 962c556f906..86e2fbba2ca 100644 --- a/src/mame/drivers/vcombat.c +++ b/src/mame/drivers/vcombat.c @@ -404,7 +404,7 @@ static MACHINE_RESET( shadfgtr ) DIRECT_UPDATE_HANDLER( vcombat_vid_0_direct_handler ) { - vcombat_state *state = machine->driver_data(); + vcombat_state *state = machine.driver_data(); if (address >= 0xfffc0000 && address <= 0xffffffff) { direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_0_shared_RAM); @@ -415,7 +415,7 @@ DIRECT_UPDATE_HANDLER( vcombat_vid_0_direct_handler ) DIRECT_UPDATE_HANDLER( vcombat_vid_1_direct_handler ) { - vcombat_state *state = machine->driver_data(); + vcombat_state *state = machine.driver_data(); if (address >= 0xfffc0000 && address <= 0xffffffff) { direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_1_shared_RAM); @@ -432,10 +432,10 @@ static DRIVER_INIT( vcombat ) /* The two i860s execute out of RAM */ address_space *space = machine.device("vid_0")->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_0_direct_handler, machine)); + space->set_direct_update_handler(direct_update_delegate(FUNC(vcombat_vid_0_direct_handler), &machine)); space = machine.device("vid_1")->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_1_direct_handler, machine)); + space->set_direct_update_handler(direct_update_delegate(FUNC(vcombat_vid_1_direct_handler), &machine)); /* Allocate the 68000 framebuffers */ state->m_m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); @@ -480,7 +480,7 @@ static DRIVER_INIT( shadfgtr ) /* The i860 executes out of RAM */ address_space *space = machine.device("vid_0")->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_0_direct_handler, machine)); + space->set_direct_update_handler(direct_update_delegate(FUNC(vcombat_vid_0_direct_handler), &machine)); } diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c index 06b3b591b1f..418a63533b0 100644 --- a/src/mame/drivers/vegas.c +++ b/src/mame/drivers/vegas.c @@ -528,8 +528,8 @@ static MACHINE_START( vegas ) state->m_voodoo = machine.device("voodoo"); /* allocate timers for the NILE */ - state->m_timer[0] = machine.scheduler().timer_alloc(FUNC(NULL)); - state->m_timer[1] = machine.scheduler().timer_alloc(FUNC(NULL)); + state->m_timer[0] = machine.scheduler().timer_alloc(FUNC_NULL); + state->m_timer[1] = machine.scheduler().timer_alloc(FUNC_NULL); state->m_timer[2] = machine.scheduler().timer_alloc(FUNC(nile_timer_callback)); state->m_timer[3] = machine.scheduler().timer_alloc(FUNC(nile_timer_callback)); diff --git a/src/mame/includes/mcr68.h b/src/mame/includes/mcr68.h index 6e06c9f28cc..b912e2de5cd 100644 --- a/src/mame/includes/mcr68.h +++ b/src/mame/includes/mcr68.h @@ -32,6 +32,7 @@ public: UINT8 m_v493_irq_state; UINT8 m_v493_irq_vector; timer_expired_func m_v493_callback; + const char *m_v493_callback_name; UINT8 m_zwackery_sound_data; attotime m_m6840_counter_periods[3]; attotime m_m6840_internal_counter_period; diff --git a/src/mame/machine/archimds.c b/src/mame/machine/archimds.c index 512a1fb108f..f9f3e5807bd 100644 --- a/src/mame/machine/archimds.c +++ b/src/mame/machine/archimds.c @@ -340,7 +340,7 @@ DIRECT_UPDATE_HANDLER( a310_setopbase ) void archimedes_driver_init(running_machine &machine) { // address_space *space = machine.device("maincpu")->space(AS_PROGRAM); -// space->set_direct_update_handler(direct_update_delegate_create_static(a310_setopbase, machine)); +// space->set_direct_update_handler(direct_update_delegate(FUNC(a310_setopbase), &machine)); } static const char *const ioc_regnames[] = diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index 397b223659c..c9aaef9d513 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -454,7 +454,7 @@ static STATE_POSTLOAD( slapstic_postload ) DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect ) { - atarigen_state *state = machine->driver_data(); + atarigen_state *state = machine.driver_data(); /* if we jump to an address in the slapstic region, tweak the slapstic at that address and return ~0; this will cause us to be called on @@ -511,7 +511,7 @@ void atarigen_slapstic_init(device_t *device, offs_t base, offs_t mirror, int ch state->m_slapstic_mirror = mirror; address_space *space = downcast(device)->space(AS_PROGRAM); - space->set_direct_update_handler(direct_update_delegate_create_static(atarigen_slapstic_setdirect, device->machine())); + space->set_direct_update_handler(direct_update_delegate(FUNC(atarigen_slapstic_setdirect), &device->machine())); } } diff --git a/src/mame/machine/beezer.c b/src/mame/machine/beezer.c index aef8d4de368..c49876e457f 100644 --- a/src/mame/machine/beezer.c +++ b/src/mame/machine/beezer.c @@ -173,7 +173,7 @@ WRITE8_HANDLER( beezer_bankswitch_w ) space->install_legacy_write_handler(0xc600, 0xc7ff, FUNC(watchdog_reset_w)); space->install_legacy_write_handler(0xc800, 0xc9ff, FUNC(beezer_map_w)); space->install_legacy_read_handler(0xca00, 0xcbff, FUNC(beezer_line_r)); - space->install_readwrite_handler(0xce00, 0xcfff, read8_delegate_create(via6522_device, read, *via_0), write8_delegate_create(via6522_device, write, *via_0)); + space->install_readwrite_handler(0xce00, 0xcfff, read8_delegate(FUNC(via6522_device::read), via_0), write8_delegate(FUNC(via6522_device::write), via_0)); } else { diff --git a/src/mame/machine/mcr68.c b/src/mame/machine/mcr68.c index 10f139a173d..d5d5b2fef50 100644 --- a/src/mame/machine/mcr68.c +++ b/src/mame/machine/mcr68.c @@ -182,6 +182,7 @@ MACHINE_RESET( mcr68 ) /* for the most part all MCR/68k games are the same */ mcr68_common_init(machine); state->m_v493_callback = mcr68_493_callback; + state->m_v493_callback_name = "mcr68_493_callback"; /* vectors are 1 and 2 */ state->m_v493_irq_vector = 1; @@ -201,6 +202,7 @@ MACHINE_RESET( zwackery ) /* for the most part all MCR/68k games are the same */ mcr68_common_init(machine); state->m_v493_callback = zwackery_493_callback; + state->m_v493_callback_name = "zwackery_493_callback"; /* vectors are 5 and 6 */ state->m_v493_irq_vector = 5; @@ -227,7 +229,7 @@ INTERRUPT_GEN( mcr68_interrupt ) /* also set a timer to generate the 493 signal at a specific time before the next VBLANK */ /* the timing of this is crucial for Blasted and Tri-Sports, which check the timing of */ /* VBLANK and 493 using counter 2 */ - device->machine().scheduler().timer_set(attotime::from_hz(30) - state->m_timing_factor, FUNC(state->m_v493_callback)); + device->machine().scheduler().timer_set(attotime::from_hz(30) - state->m_timing_factor, state->m_v493_callback, state->m_v493_callback_name); } diff --git a/src/mame/machine/mhavoc.c b/src/mame/machine/mhavoc.c index 1644ccc27fe..962dc41f975 100644 --- a/src/mame/machine/mhavoc.c +++ b/src/mame/machine/mhavoc.c @@ -136,7 +136,7 @@ static TIMER_CALLBACK( delayed_gamma_w ) cputag_set_input_line(machine, "gamma", INPUT_LINE_NMI, PULSE_LINE); /* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */ - machine.scheduler().timer_set(attotime::from_usec(250), FUNC(NULL)); + machine.scheduler().timer_set(attotime::from_usec(250), FUNC_NULL); } diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c index 03d1c041b0d..2d96e87d2ca 100644 --- a/src/mame/machine/midyunit.c +++ b/src/mame/machine/midyunit.c @@ -506,7 +506,7 @@ DRIVER_INIT( mkyturbo ) /********************** Terminator 2 **********************/ -static void term2_init_common(running_machine &machine, write16_space_func hack_w) +static void term2_init_common(running_machine &machine, write16_space_func hack_w, const char *name) { midyunit_state *state = machine.driver_data(); /* protection */ @@ -526,13 +526,13 @@ static void term2_init_common(running_machine &machine, write16_space_func hack_ /* HACK: this prevents the freeze on the movies */ /* until we figure whats causing it, this is better than nothing */ - state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x010aa0e0, 0x010aa0ff, FUNC(hack_w)); + state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x010aa0e0, 0x010aa0ff, hack_w, name); } -DRIVER_INIT( term2 ) { term2_init_common(machine, term2_hack_w); } -DRIVER_INIT( term2la3 ) { term2_init_common(machine, term2la3_hack_w); } -DRIVER_INIT( term2la2 ) { term2_init_common(machine, term2la2_hack_w); } -DRIVER_INIT( term2la1 ) { term2_init_common(machine, term2la1_hack_w); } +DRIVER_INIT( term2 ) { term2_init_common(machine, FUNC(term2_hack_w)); } +DRIVER_INIT( term2la3 ) { term2_init_common(machine, FUNC(term2la3_hack_w)); } +DRIVER_INIT( term2la2 ) { term2_init_common(machine, FUNC(term2la2_hack_w)); } +DRIVER_INIT( term2la1 ) { term2_init_common(machine, FUNC(term2la1_hack_w)); } diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index 965ad7049e4..b7c09253357 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -58,20 +58,20 @@ static WRITE8_HANDLER( bank14_w ) { bank_w(space, offset, data, 13); } static WRITE8_HANDLER( bank15_w ) { bank_w(space, offset, data, 14); } static WRITE8_HANDLER( bank16_w ) { bank_w(space, offset, data, 15); } -static const read8_space_func io_bank_handler_r[16] = +static const struct { read8_space_func func; const char *name; } io_bank_handler_r[16] = { - bank1_r, bank2_r, bank3_r, bank4_r, - bank5_r, bank6_r, bank7_r, bank8_r, - bank9_r, bank10_r, bank11_r, bank12_r, - bank13_r, bank14_r, bank15_r, bank16_r + { FUNC(bank1_r) }, { FUNC(bank2_r) }, { FUNC(bank3_r) }, { FUNC(bank4_r) }, + { FUNC(bank5_r) }, { FUNC(bank6_r) }, { FUNC(bank7_r) }, { FUNC(bank8_r) }, + { FUNC(bank9_r) }, { FUNC(bank10_r) }, { FUNC(bank11_r) }, { FUNC(bank12_r) }, + { FUNC(bank13_r) }, { FUNC(bank14_r) }, { FUNC(bank15_r) }, { FUNC(bank16_r) } }; -static const write8_space_func io_bank_handler_w[16] = +static const struct { write8_space_func func; const char *name; } io_bank_handler_w[16] = { - bank1_w, bank2_w, bank3_w, bank4_w, - bank5_w, bank6_w, bank7_w, bank8_w, - bank9_w, bank10_w, bank11_w, bank12_w, - bank13_w, bank14_w, bank15_w, bank16_w + { FUNC(bank1_w) }, { FUNC(bank2_w) }, { FUNC(bank3_w) }, { FUNC(bank4_w) }, + { FUNC(bank5_w) }, { FUNC(bank6_w) }, { FUNC(bank7_w) }, { FUNC(bank8_w) }, + { FUNC(bank9_w) }, { FUNC(bank10_w) }, { FUNC(bank11_w) }, { FUNC(bank12_w) }, + { FUNC(bank13_w) }, { FUNC(bank14_w) }, { FUNC(bank15_w) }, { FUNC(bank16_w) } }; @@ -690,7 +690,7 @@ static void set_bank(running_machine &machine, int banknum, const bankhandler *h else { if (!state->m_active_bank[banknum].bank_handler_r) - space->install_legacy_read_handler(bankstart, bankstart + 0x1fff, FUNC(io_bank_handler_r[banknum])); + space->install_legacy_read_handler(bankstart, bankstart + 0x1fff, io_bank_handler_r[banknum].func, io_bank_handler_r[banknum].name); } /* write handlers (except for the 0xe000-0xffff range) */ @@ -704,7 +704,7 @@ static void set_bank(running_machine &machine, int banknum, const bankhandler *h else { if (!state->m_active_bank[banknum].bank_handler_r) - space->install_legacy_write_handler(bankstart, bankstart + 0x1fff, FUNC(io_bank_handler_w[banknum])); + space->install_legacy_write_handler(bankstart, bankstart + 0x1fff, io_bank_handler_w[banknum].func, io_bank_handler_w[banknum].name); } } diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 9f636dd609b..4cb2111b3ff 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -314,29 +314,31 @@ static void update_memory_mapping(running_machine &machine, struct memory_mapper offs_t region_end = region_start + ((rgn->length - 1 < region_size) ? rgn->length - 1 : region_size); const char *writebank = rgn->writebank; write16_space_func write = rgn->write; + const char *writename = rgn->writename; const char *readbank = rgn->readbank; read16_space_func read = rgn->read; + const char *readname = rgn->readname; /* ROM areas need extra clamping */ if (rgn->romoffset != ~0) { offs_t romsize = chip->cpu->region()->bytes(); if (region_start >= romsize) - read = NULL; + read = NULL, readname = "(null)"; else if (region_start + rgn->length > romsize) region_end = romsize - 1; } /* map it */ if (read != NULL) - space->install_legacy_read_handler(region_start, region_end, 0, region_mirror, FUNC(read)); + space->install_legacy_read_handler(region_start, region_end, 0, region_mirror, read, readname); else if (readbank != NULL) space->install_read_bank(region_start, region_end, 0, region_mirror, readbank); else space->install_legacy_read_handler(region_start, region_end, 0, region_mirror, FUNC(segaic16_open_bus_r)); if (write != NULL) - space->install_legacy_write_handler(region_start, region_end, 0, region_mirror, FUNC(write)); + space->install_legacy_write_handler(region_start, region_end, 0, region_mirror, write, writename); else if (writebank != NULL) space->install_write_bank(region_start, region_end, 0, region_mirror, writebank); else diff --git a/src/mame/machine/segaic16.h b/src/mame/machine/segaic16.h index 4aa70f9492b..279748988fe 100644 --- a/src/mame/machine/segaic16.h +++ b/src/mame/machine/segaic16.h @@ -19,8 +19,10 @@ struct _segaic16_memory_map_entry offs_t mirror; /* maximal mirror values (will be truncated) */ offs_t romoffset; /* offset within REGION_CPU0, or ~0 for independent entries */ read16_space_func read; /* read handler */ + const char * readname; const char * readbank; /* bank for reading */ write16_space_func write; /* write handler */ + const char * writename; const char * writebank; /* bank for writing */ UINT16 ** base; /* pointer to memory base */ const char * name; /* friendly name for debugging */ diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 75c06730569..6f1e21b6ef2 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -1836,7 +1836,7 @@ static void snes_init_ram( running_machine &machine ) DIRECT_UPDATE_HANDLER( snes_spc_direct ) { - direct.explicit_configure(0x0000, 0xffff, 0xffff, spc_get_ram(machine->device("spc700"))); + direct.explicit_configure(0x0000, 0xffff, 0xffff, spc_get_ram(machine.device("spc700"))); return ~0; } @@ -1856,8 +1856,8 @@ MACHINE_START( snes ) state->m_spc700 = machine.device("spc700"); state->m_superfx = machine.device("superfx"); - state->m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(snes_direct, machine)); - state->m_soundcpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(snes_spc_direct, machine)); + state->m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(snes_direct), &machine)); + state->m_soundcpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(snes_spc_direct), &machine)); // power-on sets these registers like this snes_ram[WRIO] = 0xff; diff --git a/src/mame/video/victory.c b/src/mame/video/victory.c index 229331706d8..8573b8276a4 100644 --- a/src/mame/video/victory.c +++ b/src/mame/video/victory.c @@ -57,7 +57,7 @@ VIDEO_START( victory ) state->m_scrollx = state->m_scrolly = 0; state->m_video_control = 0; memset(&state->m_micro, 0, sizeof(state->m_micro)); - state->m_micro.timer = machine.scheduler().timer_alloc(FUNC(NULL)); + state->m_micro.timer = machine.scheduler().timer_alloc(FUNC_NULL); /* register for state saving */ state_save_register_global_array(machine, state->m_paletteram);