esrip sys converted to use devcb2 and delegates (nw)

Also added support to delegates with up to 8 params 

out of whatsnet:
note that old code did not take care of mem_mask
that caused me troubles debugging this
This commit is contained in:
Miodrag Milanovic 2014-03-29 05:57:07 +00:00
parent 7da391cab6
commit b209185205
6 changed files with 197 additions and 108 deletions

View File

@ -177,14 +177,12 @@ void esrip_device::make_ops()
void esrip_device::device_start()
{
esrip_config* _config = (esrip_config*)static_config();
/* Register configuration structure callbacks */
m_fdt_r = _config->fdt_r;
m_fdt_w = _config->fdt_w;
m_lbrm = (UINT8*)machine().root_device().memregion(_config->lbrm_prom)->base();
m_status_in = _config->status_in;
m_draw = _config->draw;
m_fdt_r.resolve_safe(0);
m_fdt_w.resolve_safe();
m_lbrm = (UINT8*)machine().root_device().memregion(m_lbrm_prom)->base();
m_status_in.resolve_safe(0);
m_draw.bind_relative_to(*owner());
/* Allocate image pointer table RAM */
m_ipt_ram.resize(IPT_RAM_SIZE/2);
@ -1693,7 +1691,11 @@ const device_type ESRIP = &device_creator<esrip_device>;
esrip_device::esrip_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, ESRIP, "ESRIP", tag, owner, clock, "esrip", __FILE__),
m_program_config("program", ENDIANNESS_BIG, 64, 9, -3)
m_program_config("program", ENDIANNESS_BIG, 64, 9, -3),
m_fdt_r(*this),
m_fdt_w(*this),
m_status_in(*this),
m_lbrm_prom(NULL)
{
// build the opcode table
for (int op = 0; op < 24; op++)
@ -1701,19 +1703,6 @@ esrip_device::esrip_device(const machine_config &mconfig, const char *tag, devic
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void esrip_device::static_set_config(device_t &device, const esrip_config &config)
{
esrip_device &esrip = downcast<esrip_device &>(device);
static_cast<esrip_config &>(esrip) = config;
static_set_static_config(device, &config);
}
//**************************************************************************
// STATIC OPCODE TABLES
//**************************************************************************
@ -1799,7 +1788,7 @@ void esrip_device::execute_run()
UINT8 status;
/* I think we can get away with placing this outside of the loop */
status = m_status_in(machine());
status = m_status_in(*m_program, 0);
/* Core execution loop */
do
@ -1832,7 +1821,7 @@ void esrip_device::execute_run()
/* FDT RAM: /Enable, Direction and /RAM OE */
else if (!bl44 && !_BIT(m_l2, 3) && bl46)
y_bus = m_fdt_r(this, *m_program, m_fdt_cnt, 0);
y_bus = m_fdt_r(*m_program, m_fdt_cnt, 0xffff);
/* IPT RAM: /Enable and /READ */
else if (!_BIT(m_l2, 6) && !_BIT(m_l4, 5))
@ -1859,7 +1848,7 @@ void esrip_device::execute_run()
/* FDT RAM */
if (!bl44)
x_bus = m_fdt_r(this, *m_program, m_fdt_cnt, 0);
x_bus = m_fdt_r(*m_program, m_fdt_cnt, 0xffff);
/* Buffer is enabled - write direction */
else if (!BIT(m_l2, 3) && !bl46)
@ -1884,7 +1873,7 @@ void esrip_device::execute_run()
/* Write FDT RAM: /Enable, Direction and WRITE */
if (!BIT(m_l2, 3) && !bl46 && !BIT(m_l4, 3))
m_fdt_w(this, *m_program, m_fdt_cnt, x_bus, 0);
m_fdt_w(*m_program, m_fdt_cnt, x_bus, 0xffff);
/* Write IPT RAM: /Enable and /WR */
if (!BIT(m_l2, 7) && !BIT(m_l4, 5))
@ -1942,7 +1931,7 @@ void esrip_device::execute_run()
m_attr_latch = x_bus;
m_fig = 1;
m_fig_cycles = m_draw(machine(), m_adl_latch, m_adr_latch, m_fig_latch, m_attr_latch, m_iaddr_latch, m_c_latch, m_x_scale, m_img_bank);
m_fig_cycles = m_draw(m_adl_latch, m_adr_latch, m_fig_latch, m_attr_latch, m_iaddr_latch, m_c_latch, m_x_scale, m_img_bank);
}
/* X-scale */

View File

@ -9,6 +9,7 @@
#ifndef _ESRIP_H
#define _ESRIP_H
#include "emu.h"
/***************************************************************************
COMPILE-TIME DEFINITIONS
@ -19,13 +20,26 @@
GLOBAL CONSTANTS
***************************************************************************/
/***************************************************************************
INTERFACE CONFIGURATION MACROS
***************************************************************************/
#define ESRIP_DRAW(name) int name(int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank)
#define MCFG_ESRIP_FDT_R_CALLBACK(_read) \
devcb = &esrip_device::static_set_fdt_r_callback(*device, DEVCB2_##_read);
#define MCFG_ESRIP_FDT_W_CALLBACK(_write) \
devcb = &esrip_device::static_set_fdt_w_callback(*device, DEVCB2_##_write);
#define MCFG_ESRIP_STATUS_IN_CALLBACK(_read) \
devcb = &esrip_device::static_set_status_in_callback(*device, DEVCB2_##_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)));
#define MCFG_ESRIP_LBRM_PROM(_tag) \
esrip_device::static_lbrm_prom(*device, _tag);
#define MCFG_CPU_ESRIP_CONFIG(_config) \
esrip_device::static_set_config(*device, _config);
/***************************************************************************
REGISTER ENUMERATION
@ -88,19 +102,7 @@ enum
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class esrip_device;
// ======================> esrip_config
struct esrip_config
{
read16_device_func fdt_r;
write16_device_func fdt_w;
UINT8 (*status_in)(running_machine &machine);
int (*draw)(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank);
const char* lbrm_prom;
};
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;
@ -108,15 +110,18 @@ extern const device_type ESRIP;
// ======================> esrip_device
// Used by core CPU interface
class esrip_device : public cpu_device,
public esrip_config
class esrip_device : public cpu_device
{
public:
// construction/destruction
esrip_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// inline configuration helpers
static void static_set_config(device_t &device, const esrip_config &config);
template<class _Object> static devcb2_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 devcb2_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 devcb2_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; }
static void static_lbrm_prom(device_t &device, const char *name) { downcast<esrip_device &>(device).m_lbrm_prom = name; }
// public interfaces
UINT8 get_rip_status();
@ -203,10 +208,11 @@ protected:
int m_icount;
read16_device_func m_fdt_r;
write16_device_func m_fdt_w;
UINT8 (*m_status_in)(running_machine &machine);
int (*m_draw)(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank);
devcb2_read16 m_fdt_r;
devcb2_write16 m_fdt_w;
devcb2_read8 m_status_in;
esrip_draw_delegate m_draw;
const char *m_lbrm_prom;
typedef void (esrip_device::*ophandler)(UINT16 inst);

View File

@ -149,20 +149,44 @@ public:
// 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 _noparam
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type>
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type, typename _P7Type, typename _P8Type>
struct delegate_traits
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type);
typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type);
};
// dummy class used to indicate a non-existant parameter
class _noparam { };
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type, typename _P7Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type);
typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type);
};
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type);
typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type);
};
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _noparam, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type);
typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type, _P4Type, _P5Type);
};
// dummy class used to indicate a non-existant parameter
class _noparam { };
// specialization for 4 parameters
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _noparam>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _noparam, _noparam, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type);
@ -171,7 +195,7 @@ struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Ty
// specialization for 3 parameters
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _noparam, _noparam>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _noparam, _noparam, _noparam, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type);
@ -180,7 +204,7 @@ struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, _nopa
// specialization for 2 parameters
template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _noparam, _noparam, _noparam>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type);
@ -189,7 +213,7 @@ struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _noparam, _nop
// specialization for 1 parameter
template<typename _ClassType, typename _ReturnType, typename _P1Type>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _noparam, _noparam, _noparam, _noparam>
struct delegate_traits<_ClassType, _ReturnType, _P1Type, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type);
typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type);
@ -198,7 +222,7 @@ struct delegate_traits<_ClassType, _ReturnType, _P1Type, _noparam, _noparam, _no
// specialization for no parameters
template<typename _ClassType, typename _ReturnType>
struct delegate_traits<_ClassType, _ReturnType, _noparam, _noparam, _noparam, _noparam, _noparam>
struct delegate_traits<_ClassType, _ReturnType, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam>
{
typedef _ReturnType (*static_func_type)(_ClassType *);
typedef _ReturnType (*static_ref_func_type)(_ClassType &);
@ -317,6 +341,33 @@ private:
return (reinterpret_cast<_FunctionClass *>(_this->m_realobject)->*mfp)(p1, p2, p3, p4, p5);
}
template<class _FunctionClass, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type>
static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6)
{
delegate_mfp *_this = reinterpret_cast<delegate_mfp *>(object);
typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6);
mfptype &mfp = *reinterpret_cast<mfptype *>(&_this->m_rawdata);
return (reinterpret_cast<_FunctionClass *>(_this->m_realobject)->*mfp)(p1, p2, p3, p4, p5, p6);
}
template<class _FunctionClass, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type, typename _P7Type>
static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7)
{
delegate_mfp *_this = reinterpret_cast<delegate_mfp *>(object);
typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7);
mfptype &mfp = *reinterpret_cast<mfptype *>(&_this->m_rawdata);
return (reinterpret_cast<_FunctionClass *>(_this->m_realobject)->*mfp)(p1, p2, p3, p4, p5, p6, p7);
}
template<class _FunctionClass, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type, typename _P7Type, typename _P8Type>
static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7, _P8Type p8)
{
delegate_mfp *_this = reinterpret_cast<delegate_mfp *>(object);
typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7, _P8Type p8);
mfptype &mfp = *reinterpret_cast<mfptype *>(&_this->m_rawdata);
return (reinterpret_cast<_FunctionClass *>(_this->m_realobject)->*mfp)(p1, p2, p3, p4, p5, p6, p7, p8);
}
// helper to convert a function of a given type to a generic function, forcing template
// instantiation to match the source type
template <typename _SourceType>
@ -405,7 +456,7 @@ private:
// ======================> delegate_base
// general delegate class template supporting up to 5 parameters
template<typename _ReturnType, typename _P1Type = _noparam, typename _P2Type = _noparam, typename _P3Type = _noparam, typename _P4Type = _noparam, typename _P5Type = _noparam>
template<typename _ReturnType, typename _P1Type = _noparam, typename _P2Type = _noparam, typename _P3Type = _noparam, typename _P4Type = _noparam, typename _P5Type = _noparam, typename _P6Type = _noparam, typename _P7Type = _noparam, typename _P8Type = _noparam>
class delegate_base
{
public:
@ -413,9 +464,9 @@ public:
template<class _FunctionClass>
struct traits
{
typedef typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type>::member_func_type member_func_type;
typedef typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type>::static_func_type static_func_type;
typedef typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type>::static_ref_func_type static_ref_func_type;
typedef typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type>::member_func_type member_func_type;
typedef typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type>::static_func_type static_func_type;
typedef typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type>::static_ref_func_type static_ref_func_type;
};
typedef typename traits<delegate_generic_class>::static_func_type generic_static_func;
@ -517,6 +568,9 @@ public:
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_object, p1, p2, p3); }
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_object, p1, p2, p3, p4); }
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5) const { return (*m_function)(m_object, p1, p2, p3, p4, p5); }
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6) const { return (*m_function)(m_object, p1, p2, p3, p4, p5, p6); }
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7) const { return (*m_function)(m_object, p1, p2, p3, p4, p5, p6, p7); }
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7, _P8Type p8) const { return (*m_function)(m_object, p1, p2, p3, p4, p5, p6, p7, p8); }
// getters
bool has_object() const { return (object() != NULL); }
@ -679,4 +733,55 @@ public:
delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
};
// specialize for 6 parameters
template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type>
class delegate<_ReturnType (_P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type>
{
typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type> basetype;
public:
// create a standard set of constructors
delegate() : basetype() { }
delegate(const basetype &src) : basetype(src) { }
delegate(const basetype &src, delegate_late_bind &object) : basetype(src, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
};
// specialize for 7 parameters
template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type, typename _P7Type>
class delegate<_ReturnType (_P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type>
{
typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type> basetype;
public:
// create a standard set of constructors
delegate() : basetype() { }
delegate(const basetype &src) : basetype(src) { }
delegate(const basetype &src, delegate_late_bind &object) : basetype(src, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
};
// specialize for 8 parameters
template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type, typename _P5Type, typename _P6Type, typename _P7Type, typename _P8Type>
class delegate<_ReturnType (_P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type>
{
typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type, _P5Type, _P6Type, _P7Type, _P8Type> basetype;
public:
// create a standard set of constructors
delegate() : basetype() { }
delegate(const basetype &src) : basetype(src) { }
delegate(const basetype &src, delegate_late_bind &object) : basetype(src, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
};
#endif /* __DELEGATE_H__ */

View File

@ -196,31 +196,29 @@ WRITE8_MEMBER(esripsys_state::fdt_w)
*
*************************************/
static READ16_DEVICE_HANDLER( fdt_rip_r )
READ16_MEMBER( esripsys_state::fdt_rip_r )
{
esripsys_state *state = space.machine().driver_data<esripsys_state>();
offset = (offset & 0x7ff) << 1;
if (!state->m_fasel)
return (state->m_fdt_a[offset] << 8) | state->m_fdt_a[offset + 1];
if (!m_fasel)
return (m_fdt_a[offset] << 8) | m_fdt_a[offset + 1];
else
return (state->m_fdt_b[offset] << 8) | state->m_fdt_b[offset + 1];
return (m_fdt_b[offset] << 8) | m_fdt_b[offset + 1];
}
static WRITE16_DEVICE_HANDLER( fdt_rip_w )
WRITE16_MEMBER( esripsys_state::fdt_rip_w )
{
esripsys_state *state = space.machine().driver_data<esripsys_state>();
offset = (offset & 0x7ff) << 1;
if (!state->m_fasel)
if (!m_fasel)
{
state->m_fdt_a[offset + 0] = data >> 8;
state->m_fdt_a[offset + 1] = data & 0xff;
m_fdt_a[offset + 0] = data >> 8;
m_fdt_a[offset + 1] = data & 0xff;
}
else
{
state->m_fdt_b[offset + 0] = data >> 8;
state->m_fdt_b[offset + 1] = data & 0xff;
m_fdt_b[offset + 0] = data >> 8;
m_fdt_b[offset + 1] = data & 0xff;
}
}
@ -235,8 +233,7 @@ static WRITE16_DEVICE_HANDLER( fdt_rip_w )
D7 = /FDONE
*/
UINT8 esripsys_state::static_rip_status_in(running_machine &machine) { return machine.driver_data<esripsys_state>()->rip_status_in(); }
UINT8 esripsys_state::rip_status_in()
READ8_MEMBER(esripsys_state::rip_status_in)
{
int vpos = m_screen->vpos();
UINT8 _vblank = !(vpos >= ESRIPSYS_VBLANK_START);
@ -681,15 +678,6 @@ DRIVER_INIT_MEMBER(esripsys_state,esripsys)
save_item(NAME(m_fbsel));
}
static const esrip_config rip_config =
{
fdt_rip_r,
fdt_rip_w,
&esripsys_state::static_rip_status_in,
esripsys_draw,
"proms"
};
static MACHINE_CONFIG_START( esripsys, esripsys_state )
MCFG_CPU_ADD("game_cpu", M6809E, XTAL_8MHz)
MCFG_CPU_PROGRAM_MAP(game_cpu_map)
@ -701,7 +689,11 @@ static MACHINE_CONFIG_START( esripsys, esripsys_state )
MCFG_CPU_ADD("video_cpu", ESRIP, XTAL_40MHz / 4)
MCFG_CPU_PROGRAM_MAP(video_cpu_map)
MCFG_CPU_ESRIP_CONFIG(rip_config)
MCFG_ESRIP_FDT_R_CALLBACK(READ16(esripsys_state, fdt_rip_r))
MCFG_ESRIP_FDT_W_CALLBACK(WRITE16(esripsys_state, fdt_rip_w))
MCFG_ESRIP_STATUS_IN_CALLBACK(READ8(esripsys_state, rip_status_in))
MCFG_ESRIP_DRAW_CALLBACK_OWNER(esripsys_state, esripsys_draw)
MCFG_ESRIP_LBRM_PROM("proms")
MCFG_CPU_ADD("sound_cpu", M6809E, XTAL_8MHz)
MCFG_CPU_PROGRAM_MAP(sound_cpu_map)

View File

@ -96,8 +96,9 @@ public:
DECLARE_WRITE8_MEMBER(frame_w);
DECLARE_READ8_MEMBER(fdt_r);
DECLARE_WRITE8_MEMBER(fdt_w);
static UINT8 static_rip_status_in(running_machine &machine);
UINT8 rip_status_in();
DECLARE_READ16_MEMBER( fdt_rip_r );
DECLARE_WRITE16_MEMBER( fdt_rip_w );
DECLARE_READ8_MEMBER(rip_status_in);
DECLARE_WRITE8_MEMBER(g_iobus_w);
DECLARE_READ8_MEMBER(g_iobus_r);
DECLARE_WRITE8_MEMBER(g_ioadd_w);
@ -123,10 +124,7 @@ public:
TIMER_CALLBACK_MEMBER(hblank_end_callback);
required_device<dac_device> m_dac;
required_device<screen_device> m_screen;
ESRIP_DRAW(esripsys_draw);
};
/*----------- defined in video/esripsys.c -----------*/
int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank);
#endif // _ESRIPSYS_H_

View File

@ -186,13 +186,12 @@ WRITE8_MEMBER(esripsys_state::esripsys_bg_intensity_w)
}
/* Draw graphics to a line buffer */
int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank)
ESRIP_DRAW(esripsys_state::esripsys_draw )
{
esripsys_state *state = machine.driver_data<esripsys_state>();
struct line_buffer_t *line_buffer = state->m_line_buffer;
UINT8 *colour_buf = line_buffer[state->m_12sel ? 1 : 0].colour_buf;
UINT8 *intensity_buf = line_buffer[state->m_12sel ? 1 : 0].intensity_buf;
UINT8 *priority_buf = line_buffer[state->m_12sel ? 1 : 0].priority_buf;
struct line_buffer_t *line_buffer = m_line_buffer;
UINT8 *colour_buf = line_buffer[m_12sel ? 1 : 0].colour_buf;
UINT8 *intensity_buf = line_buffer[m_12sel ? 1 : 0].intensity_buf;
UINT8 *priority_buf = line_buffer[m_12sel ? 1 : 0].priority_buf;
UINT8 pri = attr & 0xff;
UINT8 iny = (attr >> 8) & 0xf;
@ -206,7 +205,7 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
/* Fig is the number of pixels to draw / 2 - 1 */
if (xs_typ)
fig = state->m_fig_scale_table[fig * 64 + xs_val];
fig = m_fig_scale_table[fig * 64 + xs_val];
/* 8bpp case */
if (attr & 0x8000)
@ -220,13 +219,13 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
if (x_flip)
{
rom_l = state->memregion("8bpp_r")->base();
rom_r = state->memregion("8bpp_l")->base();
rom_l = memregion("8bpp_r")->base();
rom_r = memregion("8bpp_l")->base();
}
else
{
rom_l = machine.root_device().memregion("8bpp_l")->base();
rom_r = machine.root_device().memregion("8bpp_r")->base();
rom_l = memregion("8bpp_l")->base();
rom_r = memregion("8bpp_r")->base();
}
for (cnt = 0; cnt <= fig; cnt++)
@ -258,7 +257,7 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
/* Shrink */
if (!xs_typ)
{
if (state->m_scale_table[xs_val * 64 + (cnt & 0x3f)])
if (m_scale_table[xs_val * 64 + (cnt & 0x3f)])
{
--lpos;
++rpos;
@ -272,7 +271,7 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
}
else
{
if (!state->m_scale_table[xs_val * 64 + (cnt & 0x3f)])
if (!m_scale_table[xs_val * 64 + (cnt & 0x3f)])
{
if (++ptr == 4)
{
@ -289,7 +288,7 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
/* 4bpp case */
else
{
const UINT8* const rom = machine.root_device().memregion("4bpp")->base();
const UINT8* const rom = memregion("4bpp")->base();
int ptr = 0;
int cnt;
UINT32 lpos = l;
@ -335,7 +334,7 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
/* Shrink */
if (!xs_typ)
{
if (state->m_scale_table[xs_val * 64 + (cnt & 0x3f)])
if (m_scale_table[xs_val * 64 + (cnt & 0x3f)])
{
lpos--;
rpos++;
@ -349,7 +348,7 @@ int esripsys_draw(running_machine &machine, int l, int r, int fig, int attr, int
}
else
{
if (!state->m_scale_table[xs_val * 64 + (cnt & 0x3f)])
if (!m_scale_table[xs_val * 64 + (cnt & 0x3f)])
{
if (++ptr == 4)
{