diff options
Diffstat (limited to 'src/devices/machine/tms1024.h')
-rw-r--r-- | src/devices/machine/tms1024.h | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/src/devices/machine/tms1024.h b/src/devices/machine/tms1024.h index 89f6139a786..fec6685c42d 100644 --- a/src/devices/machine/tms1024.h +++ b/src/devices/machine/tms1024.h @@ -6,8 +6,10 @@ */ -#ifndef _TMS1024_H_ -#define _TMS1024_H_ +#ifndef MAME_MACHINE_TMS1024_H +#define MAME_MACHINE_TMS1024_H + +#pragma once @@ -15,22 +17,10 @@ // 4-bit ports (3210 = DCBA) // valid ports: 4-7 for TMS1024, 1-7 for TMS1025 -#define MCFG_TMS1025_READ_PORT_CB(X, _devcb) \ - devcb = &tms1024_device::set_read_port_callback(*device, X, DEVCB_##_devcb); -#define MCFG_TMS1025_WRITE_PORT_CB(X, _devcb) \ - devcb = &tms1024_device::set_write_port_callback(*device, X, DEVCB_##_devcb); - -enum -{ - TMS1025_PORT1 = 0, - TMS1025_PORT2, - TMS1025_PORT3, - TMS1025_PORT4, - TMS1025_PORT5, - TMS1025_PORT6, - TMS1025_PORT7 -}; - +#define MCFG_TMS1025_READ_PORT_CB(X, cb) \ + devcb = &tms1024_device::set_read_port_callback<(tms1024_device::X)>(*device, (DEVCB_##cb)); +#define MCFG_TMS1025_WRITE_PORT_CB(X, cb) \ + devcb = &tms1024_device::set_write_port_callback<(tms1024_device::X)>(*device, (DEVCB_##cb)); // pinout reference @@ -65,19 +55,27 @@ enum class tms1024_device : public device_t { public: + enum + { + PORT1 = 0, + PORT2, + PORT3, + PORT4, + PORT5, + PORT6, + PORT7 + }; + tms1024_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - tms1024_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); // static configuration helpers - template<class _Object> static devcb_base &set_read_port_callback(device_t &device, int port, _Object &&object) + template <unsigned N, class Object> static devcb_base &set_read_port_callback(device_t &device, Object &&cb) { - assert(port >= TMS1025_PORT1 && port <= TMS1025_PORT7); - return downcast<tms1024_device &>(device).m_read_port[port].set_callback(std::forward<_Object>(object)); + return downcast<tms1024_device &>(device).m_read_port[N].set_callback(std::forward<Object>(cb)); } - template<class _Object> static devcb_base &set_write_port_callback(device_t &device, int port, _Object &&object) + template <unsigned N, class Object> static devcb_base &set_write_port_callback(device_t &device, Object &&cb) { - assert(port >= TMS1025_PORT1 && port <= TMS1025_PORT7); - return downcast<tms1024_device &>(device).m_write_port[port].set_callback(std::forward<_Object>(object)); + return downcast<tms1024_device &>(device).m_write_port[N].set_callback(std::forward<Object>(cb)); } DECLARE_WRITE8_MEMBER(write_h); @@ -87,6 +85,8 @@ public: DECLARE_WRITE_LINE_MEMBER(write_ms); protected: + tms1024_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + // device-level overrides virtual void device_start() override; @@ -109,8 +109,7 @@ public: -extern const device_type TMS1024; -extern const device_type TMS1025; - +DECLARE_DEVICE_TYPE(TMS1024, tms1024_device) +DECLARE_DEVICE_TYPE(TMS1025, tms1025_device) -#endif /* _TMS1024_H_ */ +#endif // MAME_MACHINE_TMS1024_H |