From 0f099891b4d1a8416a18ecae59192f4e94ecf62f Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Tue, 8 Apr 2014 16:11:51 +0000 Subject: [PATCH] tc0080vco: updated to use inline configs. nw. --- src/mame/drivers/taito_h.c | 32 ++++++++++----------- src/mame/drivers/taito_o.c | 13 ++++----- src/mame/drivers/taitoair.c | 13 ++++----- src/mame/video/tc0080vco.c | 25 ++++------------ src/mame/video/tc0080vco.h | 57 ++++++++++++++++++++++--------------- 5 files changed, 65 insertions(+), 75 deletions(-) diff --git a/src/mame/drivers/taito_h.c b/src/mame/drivers/taito_h.c index 928a89c654f..20baa4c0a37 100644 --- a/src/mame/drivers/taito_h.c +++ b/src/mame/drivers/taito_h.c @@ -646,20 +646,6 @@ void taitoh_state::machine_start() } -static const tc0080vco_interface syvalion_tc0080vco_intf = -{ - 0, 1, /* gfxnum, txnum */ - 1, 1, -2, - 1 -}; - -static const tc0080vco_interface recordbr_tc0080vco_intf = -{ - 0, 1, /* gfxnum, txnum */ - 1, 1, -2, - 0 -}; - static MACHINE_CONFIG_START( syvalion, taitoh_state ) /* basic machine hardware */ @@ -693,7 +679,11 @@ static MACHINE_CONFIG_START( syvalion, taitoh_state ) MCFG_PALETTE_ADD("palette", 33*16) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_TC0080VCO_ADD("tc0080vco", syvalion_tc0080vco_intf) + MCFG_DEVICE_ADD("tc0080vco", TC0080VCO, 0) + MCFG_TC0080VCO_GFX_REGION(0) + MCFG_TC0080VCO_TX_REGION(1) + MCFG_TC0080VCO_OFFSETS(1, 1) + MCFG_TC0080VCO_BGFLIP_OFFS(-2) MCFG_TC0080VCO_GFXDECODE("gfxdecode") MCFG_TC0080VCO_PALETTE("palette") @@ -745,7 +735,11 @@ static MACHINE_CONFIG_START( recordbr, taitoh_state ) MCFG_PALETTE_ADD("palette", 32*16) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_TC0080VCO_ADD("tc0080vco", recordbr_tc0080vco_intf) + MCFG_DEVICE_ADD("tc0080vco", TC0080VCO, 0) + MCFG_TC0080VCO_GFX_REGION(0) + MCFG_TC0080VCO_TX_REGION(1) + MCFG_TC0080VCO_OFFSETS(1, 1) + MCFG_TC0080VCO_BGFLIP_OFFS(-2) MCFG_TC0080VCO_GFXDECODE("gfxdecode") MCFG_TC0080VCO_PALETTE("palette") @@ -805,7 +799,11 @@ static MACHINE_CONFIG_START( dleague, taitoh_state ) MCFG_PALETTE_ADD("palette", 33*16) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_TC0080VCO_ADD("tc0080vco", recordbr_tc0080vco_intf) + MCFG_DEVICE_ADD("tc0080vco", TC0080VCO, 0) + MCFG_TC0080VCO_GFX_REGION(0) + MCFG_TC0080VCO_TX_REGION(1) + MCFG_TC0080VCO_OFFSETS(1, 1) + MCFG_TC0080VCO_BGFLIP_OFFS(-2) MCFG_TC0080VCO_GFXDECODE("gfxdecode") MCFG_TC0080VCO_PALETTE("palette") diff --git a/src/mame/drivers/taito_o.c b/src/mame/drivers/taito_o.c index 40c730de07d..322852655ae 100644 --- a/src/mame/drivers/taito_o.c +++ b/src/mame/drivers/taito_o.c @@ -230,13 +230,6 @@ static const ay8910_interface ay8910_config = DEVCB_NULL, DEVCB_NULL, }; -static const tc0080vco_interface parentj_intf = -{ - 0, 1, /* gfxnum, txnum */ - 1, 1, -2, - 0 -}; - void taitoo_state::machine_start() { } @@ -260,7 +253,11 @@ static MACHINE_CONFIG_START( parentj, taitoo_state ) MCFG_PALETTE_ADD("palette", 33*16) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_TC0080VCO_ADD("tc0080vco", parentj_intf) + MCFG_DEVICE_ADD("tc0080vco", TC0080VCO, 0) + MCFG_TC0080VCO_GFX_REGION(0) + MCFG_TC0080VCO_TX_REGION(1) + MCFG_TC0080VCO_OFFSETS(1, 1) + MCFG_TC0080VCO_BGFLIP_OFFS(-2) MCFG_TC0080VCO_GFXDECODE("gfxdecode") MCFG_TC0080VCO_PALETTE("palette") diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c index 05e3ea4c116..2743ce45d2e 100644 --- a/src/mame/drivers/taitoair.c +++ b/src/mame/drivers/taitoair.c @@ -638,13 +638,6 @@ WRITE_LINE_MEMBER(taitoair_state::irqhandler) MACHINE DRIVERS ************************************************************/ -static const tc0080vco_interface airsys_tc0080vco_intf = -{ - 0, 1, /* gfxnum, txnum */ - 1, 1, -2, - 0 -}; - void taitoair_state::machine_start() { UINT8 *ROM = memregion("audiocpu")->base(); @@ -716,7 +709,11 @@ static MACHINE_CONFIG_START( airsys, taitoair_state ) MCFG_PALETTE_ADD_INIT_BLACK("palette", 512*16+512*16) - MCFG_TC0080VCO_ADD("tc0080vco", airsys_tc0080vco_intf) + MCFG_DEVICE_ADD("tc0080vco", TC0080VCO, 0) + MCFG_TC0080VCO_GFX_REGION(0) + MCFG_TC0080VCO_TX_REGION(1) + MCFG_TC0080VCO_OFFSETS(1, 1) + MCFG_TC0080VCO_BGFLIP_OFFS(-2) MCFG_TC0080VCO_GFXDECODE("gfxdecode") MCFG_TC0080VCO_PALETTE("palette") diff --git a/src/mame/video/tc0080vco.c b/src/mame/video/tc0080vco.c index 912169eed80..269b769c907 100644 --- a/src/mame/video/tc0080vco.c +++ b/src/mame/video/tc0080vco.c @@ -95,6 +95,12 @@ tc0080vco_device::tc0080vco_device(const machine_config &mconfig, const char *ta m_bg1_scrollx(0), m_bg1_scrolly(0), m_flipscreen(0), + m_gfxnum(0), + m_txnum(0), + m_bg_xoffs(0), + m_bg_yoffs(0), + m_bg_flip_yoffs(0), + m_has_fg0(1), m_gfxdecode(*this), m_palette(*this) { @@ -120,25 +126,6 @@ void tc0080vco_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 tc0080vco_device::device_config_complete() -{ - // inherit a copy of the static data - const tc0080vco_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/tc0080vco.h b/src/mame/video/tc0080vco.h index 253d23bf43a..e1fbbc624c7 100644 --- a/src/mame/video/tc0080vco.h +++ b/src/mame/video/tc0080vco.h @@ -1,19 +1,7 @@ #ifndef __TC0080VCO_H__ #define __TC0080VCO_H__ -struct tc0080vco_interface -{ - int m_gfxnum; - int m_txnum; - - int m_bg_xoffs, m_bg_yoffs; - int m_bg_flip_yoffs; - - int m_has_fg0; /* for debug */ -}; - -class tc0080vco_device : public device_t, - public tc0080vco_interface +class tc0080vco_device : public device_t { public: tc0080vco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -22,12 +10,22 @@ 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 gfxnum) { downcast(device).m_gfxnum = gfxnum; } + static void set_tx_region(device_t &device, int txnum) { downcast(device).m_txnum = txnum; } + static void set_offsets(device_t &device, int x_offset, int y_offset) + { + tc0080vco_device &dev = downcast(device); + dev.m_bg_xoffs = x_offset; + dev.m_bg_yoffs = y_offset; + } + static void set_bgflip_yoffs(device_t &device, int offs) { downcast(device).m_bg_flip_yoffs = offs; } + DECLARE_READ16_MEMBER( word_r ); DECLARE_WRITE16_MEMBER( word_w ); void tilemap_update(); void tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority); + void set_fg0_debug(bool debug) { m_has_fg0 = debug ? 0 : 1; } DECLARE_READ16_MEMBER( cram_0_r ); DECLARE_READ16_MEMBER( cram_1_r ); @@ -37,12 +35,11 @@ public: READ_LINE_MEMBER( flipscreen_r ); void postload(); - protected: +protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); - private: +private: // internal state UINT16 * m_ram; UINT16 * m_bg0_ram_0; @@ -54,8 +51,7 @@ public: UINT16 * m_char_ram; UINT16 * m_bgscroll_ram; -/* FIXME: This sprite related stuff still needs to be accessed in - video/taito_h */ +/* FIXME: This sprite related stuff still needs to be accessed in video/taito_h */ UINT16 * m_chain_ram_0; UINT16 * m_chain_ram_1; UINT16 * m_spriteram; @@ -66,9 +62,16 @@ public: UINT16 m_bg1_scrollx; UINT16 m_bg1_scrolly; - tilemap_t *m_tilemap[3]; + tilemap_t *m_tilemap[3]; INT32 m_flipscreen; + + int m_gfxnum; + int m_txnum; + int m_bg_xoffs, m_bg_yoffs; + int m_bg_flip_yoffs; + int m_has_fg0; // for debug, it can be enabled with set_fg0_debug(true) + required_device m_gfxdecode; required_device m_palette; @@ -81,9 +84,17 @@ public: extern const device_type TC0080VCO; -#define MCFG_TC0080VCO_ADD(_tag, _interface) \ - MCFG_DEVICE_ADD(_tag, TC0080VCO, 0) \ - MCFG_DEVICE_CONFIG(_interface) +#define MCFG_TC0080VCO_GFX_REGION(_region) \ + tc0080vco_device::set_gfx_region(*device, _region); + +#define MCFG_TC0080VCO_TX_REGION(_region) \ + tc0080vco_device::set_tx_region(*device, _region); + +#define MCFG_TC0080VCO_OFFSETS(_xoffs, _yoffs) \ + tc0080vco_device::set_offsets(*device, _xoffs, _yoffs); + +#define MCFG_TC0080VCO_BGFLIP_OFFS(_offs) \ + tc0080vco_device::set_bgflip_yoffs(*device, _offs); #define MCFG_TC0080VCO_GFXDECODE(_gfxtag) \ tc0080vco_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);