From 25c46b0656de6c59c14f295dfac6bf199b4b8dba Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 12 Mar 2014 17:59:33 +0000 Subject: [PATCH] Updated seibu_crtc.c to use devcb2 (nw) --- src/mame/drivers/bloodbro.c | 12 ++++-------- src/mame/drivers/dcon.c | 15 ++++++-------- src/mame/drivers/goodejan.c | 10 +++------- src/mame/drivers/raiden.c | 10 +++------- src/mame/drivers/raiden2.c | 16 +++++++-------- src/mame/drivers/sengokmj.c | 10 +++------- src/mame/video/seibu_crtc.c | 36 ++++++++-------------------------- src/mame/video/seibu_crtc.h | 39 +++++++++++++------------------------ 8 files changed, 47 insertions(+), 101 deletions(-) diff --git a/src/mame/drivers/bloodbro.c b/src/mame/drivers/bloodbro.c index 7ae7a465442..0a2e371ebb1 100644 --- a/src/mame/drivers/bloodbro.c +++ b/src/mame/drivers/bloodbro.c @@ -449,13 +449,6 @@ WRITE16_MEMBER( bloodbro_state::layer_scroll_w ) COMBINE_DATA(&m_scrollram[offset]); } - -SEIBU_CRTC_INTERFACE(crtc_intf) -{ - DEVCB_DRIVER_MEMBER16(bloodbro_state, layer_en_w), - DEVCB_DRIVER_MEMBER16(bloodbro_state, layer_scroll_w), -}; - /* Machine Drivers */ static MACHINE_CONFIG_START( bloodbro, bloodbro_state ) @@ -475,7 +468,10 @@ static MACHINE_CONFIG_START( bloodbro, bloodbro_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(bloodbro_state, screen_update_bloodbro) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(bloodbro_state, layer_en_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(bloodbro_state, layer_scroll_w)) + MCFG_GFXDECODE_ADD("gfxdecode", bloodbro) MCFG_PALETTE_ADD("palette", 2048) diff --git a/src/mame/drivers/dcon.c b/src/mame/drivers/dcon.c index e0399f9f80c..817a91eb2bd 100644 --- a/src/mame/drivers/dcon.c +++ b/src/mame/drivers/dcon.c @@ -255,13 +255,6 @@ WRITE16_MEMBER( dcon_state::layer_scroll_w ) COMBINE_DATA(&m_scroll_ram[offset]); } - -SEIBU_CRTC_INTERFACE(crtc_intf) -{ - DEVCB_DRIVER_MEMBER16(dcon_state, layer_en_w), - DEVCB_DRIVER_MEMBER16(dcon_state, layer_scroll_w), -}; - /******************************************************************************/ static MACHINE_CONFIG_START( dcon, dcon_state ) @@ -281,7 +274,9 @@ static MACHINE_CONFIG_START( dcon, dcon_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE_DRIVER(dcon_state, screen_update_dcon) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(dcon_state, layer_en_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(dcon_state, layer_scroll_w)) MCFG_GFXDECODE_ADD("gfxdecode", dcon) MCFG_PALETTE_ADD("palette", 2048) @@ -308,7 +303,9 @@ static MACHINE_CONFIG_START( sdgndmps, dcon_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(dcon_state, screen_update_sdgndmps) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(dcon_state, layer_en_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(dcon_state, layer_scroll_w)) MCFG_GFXDECODE_ADD("gfxdecode", dcon) MCFG_PALETTE_ADD("palette", 2048) diff --git a/src/mame/drivers/goodejan.c b/src/mame/drivers/goodejan.c index 4a788869c7e..a0115f9150e 100644 --- a/src/mame/drivers/goodejan.c +++ b/src/mame/drivers/goodejan.c @@ -636,12 +636,6 @@ WRITE16_MEMBER( goodejan_state::layer_scroll_w ) } -SEIBU_CRTC_INTERFACE(crtc_intf) -{ - DEVCB_DRIVER_MEMBER16(goodejan_state, layer_en_w), - DEVCB_DRIVER_MEMBER16(goodejan_state, layer_scroll_w), - -}; static MACHINE_CONFIG_START( goodejan, goodejan_state ) @@ -661,7 +655,9 @@ static MACHINE_CONFIG_START( goodejan, goodejan_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution MCFG_SCREEN_UPDATE_DRIVER(goodejan_state, screen_update_goodejan) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(goodejan_state, layer_en_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(goodejan_state, layer_scroll_w)) MCFG_GFXDECODE_ADD("gfxdecode", goodejan) MCFG_PALETTE_ADD("palette", 0x1000) diff --git a/src/mame/drivers/raiden.c b/src/mame/drivers/raiden.c index 73ccf1b0555..53f331d9618 100644 --- a/src/mame/drivers/raiden.c +++ b/src/mame/drivers/raiden.c @@ -313,12 +313,6 @@ WRITE16_MEMBER( raiden_state::raidenb_layer_scroll_w ) COMBINE_DATA(&m_raidenb_scroll_ram[offset]); } -SEIBU_CRTC_INTERFACE(crtc_intf) -{ - DEVCB_DRIVER_MEMBER16(raiden_state, raidenb_layer_enable_w), - DEVCB_DRIVER_MEMBER16(raiden_state, raidenb_layer_scroll_w), -}; - static MACHINE_CONFIG_DERIVED( raidenb, raiden ) /* basic machine hardware */ @@ -328,7 +322,9 @@ static MACHINE_CONFIG_DERIVED( raidenb, raiden ) /* video hardware */ MCFG_VIDEO_START_OVERRIDE(raiden_state,raidenb) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(raiden_state, raidenb_layer_enable_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(raiden_state, raidenb_layer_scroll_w)) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(raiden_state, screen_update_raidenb) diff --git a/src/mame/drivers/raiden2.c b/src/mame/drivers/raiden2.c index 294124100c0..c065b0fac6e 100644 --- a/src/mame/drivers/raiden2.c +++ b/src/mame/drivers/raiden2.c @@ -1858,13 +1858,7 @@ static GFXDECODE_START( raiden2 ) GFXDECODE_ENTRY( "gfx3", 0x00000, raiden2_spritelayout, 0x000, 128 ) GFXDECODE_END -SEIBU_CRTC_INTERFACE(crtc_intf) -{ - DEVCB_DRIVER_MEMBER16(raiden2_state, tilemap_enable_w), - DEVCB_DRIVER_MEMBER16(raiden2_state, tile_scroll_w), -}; - - + /* MACHINE DRIVERS */ static MACHINE_CONFIG_START( raiden2, raiden2_state ) @@ -1890,7 +1884,9 @@ static MACHINE_CONFIG_START( raiden2, raiden2_state ) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(raiden2_state, tilemap_enable_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(raiden2_state, tile_scroll_w)) MCFG_VIDEO_START_OVERRIDE(raiden2_state,raiden2) @@ -1944,7 +1940,9 @@ static MACHINE_CONFIG_START( zeroteam, raiden2_state ) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(raiden2_state, tilemap_enable_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(raiden2_state, tile_scroll_w)) MCFG_VIDEO_START_OVERRIDE(raiden2_state,raiden2) diff --git a/src/mame/drivers/sengokmj.c b/src/mame/drivers/sengokmj.c index fe593455206..614685ec98e 100644 --- a/src/mame/drivers/sengokmj.c +++ b/src/mame/drivers/sengokmj.c @@ -554,12 +554,6 @@ WRITE16_MEMBER( sengokmj_state::layer_scroll_w ) } -SEIBU_CRTC_INTERFACE(crtc_intf) -{ - DEVCB_DRIVER_MEMBER16(sengokmj_state, layer_en_w), - DEVCB_DRIVER_MEMBER16(sengokmj_state, layer_scroll_w), -}; - static MACHINE_CONFIG_START( sengokmj, sengokmj_state ) /* basic machine hardware */ @@ -580,7 +574,9 @@ static MACHINE_CONFIG_START( sengokmj, sengokmj_state ) MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution MCFG_SCREEN_UPDATE_DRIVER(sengokmj_state, screen_update_sengokmj) - MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0) + MCFG_DEVICE_ADD("crtc", SEIBU_CRTC, 0) + MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(WRITE16(sengokmj_state, layer_en_w)) + MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(WRITE16(sengokmj_state, layer_scroll_w)) MCFG_GFXDECODE_ADD("gfxdecode", sengokmj) MCFG_PALETTE_ADD("palette", 0x800) diff --git a/src/mame/video/seibu_crtc.c b/src/mame/video/seibu_crtc.c index 49044e3f996..59bdf410113 100644 --- a/src/mame/video/seibu_crtc.c +++ b/src/mame/video/seibu_crtc.c @@ -185,14 +185,14 @@ ADDRESS_MAP_END WRITE16_MEMBER( seibu_crtc_device::layer_en_w) { - if (!m_layer_en_func.isnull()) - m_layer_en_func(0,data,mem_mask); + if (!m_layer_en_cb.isnull()) + m_layer_en_cb(0,data,mem_mask); } WRITE16_MEMBER( seibu_crtc_device::layer_scroll_w) { - if (!m_layer_scroll_func.isnull()) - m_layer_scroll_func(offset,data,mem_mask); + if (!m_layer_scroll_cb.isnull()) + m_layer_scroll_cb(offset,data,mem_mask); } //************************************************************************** @@ -207,6 +207,8 @@ seibu_crtc_device::seibu_crtc_device(const machine_config &mconfig, const char * : device_t(mconfig, SEIBU_CRTC, "Seibu CRT Controller", tag, owner, clock, "seibu_crtc", __FILE__), device_memory_interface(mconfig, *this), device_video_interface(mconfig, *this), + m_layer_en_cb(*this), + m_layer_scroll_cb(*this), m_space_config("vregs", ENDIANNESS_LITTLE, 16, 7, 0, NULL, *ADDRESS_MAP_NAME(seibu_crtc_vregs)) { } @@ -221,36 +223,14 @@ void seibu_crtc_device::device_validity_check(validity_checker &valid) const { } - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void seibu_crtc_device::device_config_complete() -{ - // inherit a copy of the static data - const seibu_crtc_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { -// memset(&m_layer_en, 0, sizeof(m_layer_en)); - } -} - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void seibu_crtc_device::device_start() { - m_layer_en_func.resolve(m_layer_en_cb, *this); - m_layer_scroll_func.resolve(m_layer_scroll_cb, *this); - + m_layer_en_cb.resolve(); + m_layer_scroll_cb.resolve(); } diff --git a/src/mame/video/seibu_crtc.h b/src/mame/video/seibu_crtc.h index 45fe558206b..82155241927 100644 --- a/src/mame/video/seibu_crtc.h +++ b/src/mame/video/seibu_crtc.h @@ -1,6 +1,6 @@ /*************************************************************************** -Template for skeleton device + Seibu CRTC device ***************************************************************************/ @@ -9,23 +9,16 @@ Template for skeleton device #ifndef __SEIBU_CRTCDEV_H__ #define __SEIBU_CRTCDEV_H__ -struct seibu_crtc_interface -{ - devcb_write16 m_layer_en_cb; - devcb_write16 m_layer_scroll_cb; - -}; //************************************************************************** // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_SEIBU_CRTC_ADD(_tag,_config,_freq) \ - MCFG_DEVICE_ADD(_tag, SEIBU_CRTC, _freq) \ - MCFG_DEVICE_CONFIG(_config) - -#define SEIBU_CRTC_INTERFACE(name) \ - const seibu_crtc_interface (name) = +#define MCFG_SEIBU_CRTC_LAYER_EN_CALLBACK(_devcb) \ + devcb = &seibu_crtc_device::set_layer_en_callback(*device, DEVCB2_##_devcb); + +#define MCFG_SEIBU_CRTC_LAYER_SCROLL_CALLBACK(_devcb) \ + devcb = &seibu_crtc_device::set_layer_scroll_callback(*device, DEVCB2_##_devcb); //************************************************************************** @@ -36,13 +29,15 @@ struct seibu_crtc_interface class seibu_crtc_device : public device_t, public device_memory_interface, - public device_video_interface, - public seibu_crtc_interface + public device_video_interface { public: // construction/destruction seibu_crtc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + template static devcb2_base &set_layer_en_callback(device_t &device, _Object object) { return downcast(device).m_layer_en_cb.set_callback(object); } + template static devcb2_base &set_layer_scroll_callback(device_t &device, _Object object) { return downcast(device).m_layer_scroll_cb.set_callback(object); } + // I/O operations DECLARE_WRITE16_MEMBER( write ); DECLARE_WRITE16_MEMBER( write_alt ); @@ -52,17 +47,17 @@ public: DECLARE_READ16_MEMBER( read_xor ); DECLARE_WRITE16_MEMBER(layer_en_w); DECLARE_WRITE16_MEMBER(layer_scroll_w); + protected: // device-level overrides virtual void device_validity_check(validity_checker &valid) const; - virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; - devcb_resolved_write16 m_layer_en_func; - devcb_resolved_write16 m_layer_scroll_func; private: + devcb2_write16 m_layer_en_cb; + devcb2_write16 m_layer_scroll_cb; const address_space_config m_space_config; inline UINT16 read_word(offs_t address); inline void write_word(offs_t address, UINT16 data); @@ -72,12 +67,4 @@ private: // device type definition extern const device_type SEIBU_CRTC; - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - #endif