diff options
Diffstat (limited to 'src/devices/cpu/esrip/esrip.h')
-rw-r--r-- | src/devices/cpu/esrip/esrip.h | 144 |
1 files changed, 67 insertions, 77 deletions
diff --git a/src/devices/cpu/esrip/esrip.h b/src/devices/cpu/esrip/esrip.h index 7af07d8f7c4..873a8bf1580 100644 --- a/src/devices/cpu/esrip/esrip.h +++ b/src/devices/cpu/esrip/esrip.h @@ -8,18 +8,11 @@ ***************************************************************************/ -#ifndef _ESRIP_H -#define _ESRIP_H +#ifndef MAME_CPU_ESRIP_ESRIP_H +#define MAME_CPU_ESRIP_ESRIP_H +#pragma once -/*************************************************************************** - COMPILE-TIME DEFINITIONS -***************************************************************************/ - - -/*************************************************************************** - GLOBAL CONSTANTS -***************************************************************************/ /*************************************************************************** INTERFACE CONFIGURATION MACROS @@ -36,77 +29,18 @@ devcb = &esrip_device::static_set_status_in_callback(*device, DEVCB_##_read); #define MCFG_ESRIP_DRAW_CALLBACK_OWNER(_class, _method) \ - esrip_device::static_set_draw_callback(*device, esrip_draw_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + esrip_device::static_set_draw_callback(*device, esrip_device::draw_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); #define MCFG_ESRIP_LBRM_PROM(_tag) \ esrip_device::static_lbrm_prom(*device, _tag); -/*************************************************************************** - REGISTER ENUMERATION -***************************************************************************/ - -enum -{ - ESRIP_PC = 1, - ESRIP_ACC, - ESRIP_DLATCH, - ESRIP_ILATCH, - ESRIP_RAM00, - ESRIP_RAM01, - ESRIP_RAM02, - ESRIP_RAM03, - ESRIP_RAM04, - ESRIP_RAM05, - ESRIP_RAM06, - ESRIP_RAM07, - ESRIP_RAM08, - ESRIP_RAM09, - ESRIP_RAM0A, - ESRIP_RAM0B, - ESRIP_RAM0C, - ESRIP_RAM0D, - ESRIP_RAM0E, - ESRIP_RAM0F, - ESRIP_RAM10, - ESRIP_RAM11, - ESRIP_RAM12, - ESRIP_RAM13, - ESRIP_RAM14, - ESRIP_RAM15, - ESRIP_RAM16, - ESRIP_RAM17, - ESRIP_RAM18, - ESRIP_RAM19, - ESRIP_RAM1A, - ESRIP_RAM1B, - ESRIP_RAM1C, - ESRIP_RAM1D, - ESRIP_RAM1E, - ESRIP_RAM1F, - ESRIP_STATW, - ESRIP_FDTC, - ESRIP_IPTC, - ESRIP_XSCALE, - ESRIP_YSCALE, - ESRIP_BANK, - ESRIP_LINE, - ESRIP_FIG, - ESRIP_ATTR, - ESRIP_ADRL, - ESRIP_ADRR, - ESRIP_COLR, - ESRIP_IADDR -}; - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -typedef device_delegate<int (int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank)> esrip_draw_delegate; // device type definition -extern const device_type ESRIP; +DECLARE_DEVICE_TYPE(ESRIP, esrip_device) // ======================> esrip_device @@ -114,20 +48,76 @@ extern const device_type ESRIP; class esrip_device : public cpu_device { public: + typedef device_delegate<int (int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank)> draw_delegate; + // construction/destruction esrip_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // inline configuration helpers - template<class _Object> static devcb_base &static_set_fdt_r_callback(device_t &device, _Object object) { return downcast<esrip_device &>(device).m_fdt_r.set_callback(object); } - template<class _Object> static devcb_base &static_set_fdt_w_callback(device_t &device, _Object object) { return downcast<esrip_device &>(device).m_fdt_w.set_callback(object); } - template<class _Object> static devcb_base &static_set_status_in_callback(device_t &device, _Object object) { return downcast<esrip_device &>(device).m_status_in.set_callback(object); } - static void static_set_draw_callback(device_t &device, esrip_draw_delegate func) { downcast<esrip_device &>(device).m_draw = func; } + template <class Object> static devcb_base &static_set_fdt_r_callback(device_t &device, Object &&cb) { return downcast<esrip_device &>(device).m_fdt_r.set_callback(std::forward<Object>(cb)); } + template <class Object> static devcb_base &static_set_fdt_w_callback(device_t &device, Object &&cb) { return downcast<esrip_device &>(device).m_fdt_w.set_callback(std::forward<Object>(cb)); } + template <class Object> static devcb_base &static_set_status_in_callback(device_t &device, Object &&cb) { return downcast<esrip_device &>(device).m_status_in.set_callback(std::forward<Object>(cb)); } + static void static_set_draw_callback(device_t &device, draw_delegate func) { downcast<esrip_device &>(device).m_draw = func; } static void static_lbrm_prom(device_t &device, const char *name) { downcast<esrip_device &>(device).m_lbrm_prom = name; } // public interfaces uint8_t get_rip_status(); protected: + // register enumeration + enum + { + ESRIP_PC = 1, + ESRIP_ACC, + ESRIP_DLATCH, + ESRIP_ILATCH, + ESRIP_RAM00, + ESRIP_RAM01, + ESRIP_RAM02, + ESRIP_RAM03, + ESRIP_RAM04, + ESRIP_RAM05, + ESRIP_RAM06, + ESRIP_RAM07, + ESRIP_RAM08, + ESRIP_RAM09, + ESRIP_RAM0A, + ESRIP_RAM0B, + ESRIP_RAM0C, + ESRIP_RAM0D, + ESRIP_RAM0E, + ESRIP_RAM0F, + ESRIP_RAM10, + ESRIP_RAM11, + ESRIP_RAM12, + ESRIP_RAM13, + ESRIP_RAM14, + ESRIP_RAM15, + ESRIP_RAM16, + ESRIP_RAM17, + ESRIP_RAM18, + ESRIP_RAM19, + ESRIP_RAM1A, + ESRIP_RAM1B, + ESRIP_RAM1C, + ESRIP_RAM1D, + ESRIP_RAM1E, + ESRIP_RAM1F, + ESRIP_STATW, + ESRIP_FDTC, + ESRIP_IPTC, + ESRIP_XSCALE, + ESRIP_YSCALE, + ESRIP_BANK, + ESRIP_LINE, + ESRIP_FIG, + ESRIP_ATTR, + ESRIP_ADRL, + ESRIP_ADRR, + ESRIP_COLR, + ESRIP_IADDR + }; + // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -212,7 +202,7 @@ protected: devcb_read16 m_fdt_r; devcb_write16 m_fdt_w; devcb_read8 m_status_in; - esrip_draw_delegate m_draw; + draw_delegate m_draw; const char *m_lbrm_prom; typedef void (esrip_device::*ophandler)(uint16_t inst); @@ -279,4 +269,4 @@ private: CPU_DISASSEMBLE( esrip ); -#endif /* _ESRIP_H */ +#endif // MAME_CPU_ESRIP_ESRIP_H |