diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c index 741550d6128..17fce3f8465 100644 --- a/src/mame/drivers/darius.c +++ b/src/mame/drivers/darius.c @@ -784,12 +784,6 @@ static const ay8910_interface ay8910_config_2 = MACHINE DRIVERS ***********************************************************/ -static const pc080sn_interface darius_pc080sn_intf = -{ - 1, /* gfxnum */ - -16, 8, 0, 1 /* x_offset, y_offset, y_invert, dblwidth */ -}; - void darius_state::darius_postload() { parse_control(); @@ -891,8 +885,11 @@ static MACHINE_CONFIG_START( darius, darius_state ) MCFG_SCREEN_UPDATE_DRIVER(darius_state, screen_update_darius_right) MCFG_SCREEN_PALETTE("palette") - - MCFG_PC080SN_ADD("pc080sn", darius_pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) + MCFG_PC080SN_OFFSETS(-16, 8) + MCFG_PC080SN_YINVERT(0) + MCFG_PC080SN_DBLWIDTH(1) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c index e8ed5599aa1..86f4153543f 100644 --- a/src/mame/drivers/opwolf.c +++ b/src/mame/drivers/opwolf.c @@ -680,12 +680,6 @@ GFXDECODE_END MACHINE DRIVERS ***********************************************************/ -static const pc080sn_interface opwolf_pc080sn_intf = -{ - 1, /* gfxnum */ - 0, 0, 0, 0 /* x_offset, y_offset, y_invert, dblwidth */ -}; - static MACHINE_CONFIG_START( opwolf, opwolf_state ) /* basic machine hardware */ @@ -713,7 +707,8 @@ static MACHINE_CONFIG_START( opwolf, opwolf_state ) MCFG_PALETTE_ADD("palette", 8192) MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB) - MCFG_PC080SN_ADD("pc080sn", opwolf_pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") @@ -778,7 +773,8 @@ static MACHINE_CONFIG_START( opwolfb, opwolf_state ) /* OSC clocks unknown for t MCFG_PALETTE_ADD("palette", 8192) MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB) - MCFG_PC080SN_ADD("pc080sn", opwolf_pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") diff --git a/src/mame/drivers/rainbow.c b/src/mame/drivers/rainbow.c index 16148ea6a5e..c69f5252216 100644 --- a/src/mame/drivers/rainbow.c +++ b/src/mame/drivers/rainbow.c @@ -619,18 +619,6 @@ GFXDECODE_END MACHINE DRIVERS ***********************************************************/ -static const pc080sn_interface rbisland_pc080sn_intf = -{ - 1, /* gfxnum */ - 0, 0, 0, 0 /* x_offset, y_offset, y_invert, dblwidth */ -}; - -static const pc080sn_interface jumping_pc080sn_intf = -{ - 1, /* gfxnum */ - 0, 0, 1, 0 /* x_offset, y_offset, y_invert, dblwidth */ -}; - void rbisland_state::machine_start() { } @@ -661,7 +649,8 @@ static MACHINE_CONFIG_START( rbisland, rbisland_state ) MCFG_PALETTE_ADD("palette", 8192) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_PC080SN_ADD("pc080sn", rbisland_pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") @@ -713,7 +702,9 @@ static MACHINE_CONFIG_START( jumping, rbisland_state ) MCFG_VIDEO_START_OVERRIDE(rbisland_state,jumping) - MCFG_PC080SN_ADD("pc080sn", jumping_pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) + MCFG_PC080SN_YINVERT(1) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") diff --git a/src/mame/drivers/rastan.c b/src/mame/drivers/rastan.c index 4a71825d6e5..31f20a21030 100644 --- a/src/mame/drivers/rastan.c +++ b/src/mame/drivers/rastan.c @@ -356,12 +356,6 @@ void rastan_state::machine_reset() } -static const pc080sn_interface rastan_pc080sn_intf = -{ - 0, /* gfxnum */ - 0, 0, 0, 0 /* x_offset, y_offset, y_invert, dblwidth */ -}; - static MACHINE_CONFIG_START( rastan, rastan_state ) /* basic machine hardware */ @@ -388,7 +382,7 @@ static MACHINE_CONFIG_START( rastan, rastan_state ) MCFG_PALETTE_ADD("palette", 8192) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_PC080SN_ADD("pc080sn", rastan_pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn", PC080SN, 0) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c index b0a9ecb2c4c..03c4da4060a 100644 --- a/src/mame/drivers/topspeed.c +++ b/src/mame/drivers/topspeed.c @@ -525,12 +525,6 @@ GFXDECODE_END DEVICES ***********************************************************/ -static const pc080sn_interface pc080sn_intf = -{ - 1, // gfxnum - 0, 8, 0, 0 // x_offset, y_offset, y_invert, dblwidth -}; - static Z80CTC_INTERFACE( ctc_intf ) { DEVCB_NULL, // Interrupt handler @@ -591,10 +585,15 @@ static MACHINE_CONFIG_START( topspeed, topspeed_state ) MCFG_Z80CTC_ADD("ctc", XTAL_16MHz / 4, ctc_intf) - MCFG_PC080SN_ADD("pc080sn_1", pc080sn_intf) + MCFG_DEVICE_ADD("pc080sn_1", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) + MCFG_PC080SN_OFFSETS(0, 8) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") - MCFG_PC080SN_ADD("pc080sn_2", pc080sn_intf) + + MCFG_DEVICE_ADD("pc080sn_2", PC080SN, 0) + MCFG_PC080SN_GFX_REGION(1) + MCFG_PC080SN_OFFSETS(0, 8) MCFG_PC080SN_GFXDECODE("gfxdecode") MCFG_PC080SN_PALETTE("palette") diff --git a/src/mame/video/pc080sn.c b/src/mame/video/pc080sn.c index b15aed31766..01b4a8f4445 100644 --- a/src/mame/video/pc080sn.c +++ b/src/mame/video/pc080sn.c @@ -52,6 +52,11 @@ const device_type PC080SN = &device_creator; pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock, "pc080sn", __FILE__), m_ram(NULL), + m_gfxnum(0), + m_x_offset(0), + m_y_offset(0), + m_y_invert(0), + m_dblwidth(0), m_gfxdecode(*this), m_palette(*this) //m_bg_ram[0](NULL), @@ -81,25 +86,6 @@ void pc080sn_device::static_set_palette_tag(device_t &device, const char *tag) downcast(device).m_palette.set_tag(tag); } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void pc080sn_device::device_config_complete() -{ - // inherit a copy of the static data - const pc080sn_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { - } -} - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/mame/video/pc080sn.h b/src/mame/video/pc080sn.h index 8acee56e618..ed6b7b6e506 100644 --- a/src/mame/video/pc080sn.h +++ b/src/mame/video/pc080sn.h @@ -1,17 +1,7 @@ #ifndef __PC080SN_H__ #define __PC080SN_H__ -struct pc080sn_interface -{ - int m_gfxnum; - - int m_x_offset, m_y_offset; - int m_y_invert; - int m_dblwidth; -}; - -class pc080sn_device : public device_t, - public pc080sn_interface +class pc080sn_device : public device_t { public: pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -20,7 +10,16 @@ public: // static configuration static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void static_set_palette_tag(device_t &device, const char *tag); - + static void set_gfx_region(device_t &device, int gfxregion) { downcast(device).m_gfxnum = gfxregion; } + static void set_yinvert(device_t &device, int y_inv) { downcast(device).m_y_invert = y_inv; } + static void set_dblwidth(device_t &device, int dblwidth) { downcast(device).m_dblwidth = dblwidth; } + static void set_offsets(device_t &device, int x_offset, int y_offset) + { + pc080sn_device &dev = downcast(device); + dev.m_x_offset = x_offset; + dev.m_y_offset = y_offset; + } + DECLARE_READ16_MEMBER( word_r ); DECLARE_WRITE16_MEMBER( word_w ); DECLARE_WRITE16_MEMBER( xscroll_word_w ); @@ -48,7 +47,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); private: @@ -62,15 +60,30 @@ public: int m_bgscrollx[2], m_bgscrolly[2]; tilemap_t *m_tilemap[2]; + + int m_gfxnum; + int m_x_offset, m_y_offset; + int m_y_invert; + int m_dblwidth; + required_device m_gfxdecode; required_device m_palette; }; extern const device_type PC080SN; -#define MCFG_PC080SN_ADD(_tag, _interface) \ - MCFG_DEVICE_ADD(_tag, PC080SN, 0) \ - MCFG_DEVICE_CONFIG(_interface) + +#define MCFG_PC080SN_GFX_REGION(_region) \ + pc080sn_device::set_gfx_region(*device, _region); + +#define MCFG_PC080SN_OFFSETS(_xoffs, _yoffs) \ + pc080sn_device::set_offsets(*device, _xoffs, _yoffs); + +#define MCFG_PC080SN_YINVERT(_yinv) \ + pc080sn_device::set_yinvert(*device, _yinv); + +#define MCFG_PC080SN_DBLWIDTH(_dbl) \ + pc080sn_device::set_dblwidth(*device, _dbl); #define MCFG_PC080SN_GFXDECODE(_gfxtag) \ pc080sn_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);