diff --git a/src/emu/video/tms9927.c b/src/emu/video/tms9927.c index 9ed8dda72d3..18e84ac2397 100644 --- a/src/emu/video/tms9927.c +++ b/src/emu/video/tms9927.c @@ -39,6 +39,8 @@ tms9927_device::tms9927_device(const machine_config &mconfig, const char *tag, d : device_t(mconfig, TMS9927, "TMS9927 VTC", tag, owner, clock, "tms9927", __FILE__), device_video_interface(mconfig, *this), m_write_vsyn(*this), + m_hpixels_per_column(0), + m_selfload_region(NULL), m_reset(0) { memset(m_reg, 0x00, sizeof(m_reg)); @@ -48,6 +50,8 @@ tms9927_device::tms9927_device(const machine_config &mconfig, device_type type, : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_video_interface(mconfig, *this), m_write_vsyn(*this), + m_hpixels_per_column(0), + m_selfload_region(NULL), m_reset(0) { memset(m_reg, 0x00, sizeof(m_reg)); @@ -69,22 +73,6 @@ crt5057_device::crt5057_device(const machine_config &mconfig, const char *tag, d } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void tms9927_device::device_config_complete() -{ - // inherit a copy of the static data - const tms9927_interface *intf = reinterpret_cast(static_config()); - - assert(intf != NULL); - - *static_cast(this) = *intf; -} - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/emu/video/tms9927.h b/src/emu/video/tms9927.h index 8f0b7f2b0a7..071c0fbff23 100644 --- a/src/emu/video/tms9927.h +++ b/src/emu/video/tms9927.h @@ -14,17 +14,15 @@ #define MCFG_TMS9927_VSYN_CALLBACK(_write) \ devcb = &tms9927_device::set_vsyn_wr_callback(*device, DEVCB2_##_write); -/* interface */ -struct tms9927_interface -{ - int m_hpixels_per_column; /* number of pixels per video memory address */ - const char *m_selfload_region; /* name of the region with self-load data */ -}; +#define MCFG_TMS9927_CHAR_WIDTH(_pixels) \ + tms9927_device::set_char_width(*device, _pixels); + +#define MCFG_TMS9927_REGION(_tag) \ + tms9927_device::set_region_tag(*device, _tag); class tms9927_device : public device_t, - public device_video_interface, - public tms9927_interface + public device_video_interface { public: tms9927_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -33,6 +31,9 @@ public: template static devcb2_base &set_vsyn_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_vsyn.set_callback(object); } + static void set_char_width(device_t &device, int pixels) { downcast(device).m_hpixels_per_column = pixels; } + static void set_region_tag(device_t &device, const char *tag) { downcast(device).m_selfload_region = tag; } + DECLARE_WRITE8_MEMBER(write); DECLARE_READ8_MEMBER(read); @@ -42,7 +43,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_stop(); virtual void device_reset(); @@ -59,6 +59,8 @@ private: void generic_access(address_space &space, offs_t offset); devcb2_write_line m_write_vsyn; + int m_hpixels_per_column; /* number of pixels per video memory address */ + const char *m_selfload_region; /* name of the region with self-load data */ // internal state const UINT8 *m_selfload; @@ -106,15 +108,4 @@ public: extern const device_type CRT5057; - -#define MCFG_TMS9927_ADD(_tag, _clock, _config) \ - MCFG_DEVICE_ADD(_tag, TMS9927, _clock) \ - MCFG_DEVICE_CONFIG(_config) - -#define MCFG_TMS9927_RECONFIG(_tag, _clock, _config) \ - MCFG_DEVICE_MODIFY(_tag) \ - MCFG_DEVICE_CLOCK(_clock) \ - MCFG_DEVICE_CONFIG(_config) - - #endif diff --git a/src/mame/drivers/statriv2.c b/src/mame/drivers/statriv2.c index 28027aeb3c5..21ccb39afb3 100644 --- a/src/mame/drivers/statriv2.c +++ b/src/mame/drivers/statriv2.c @@ -564,21 +564,6 @@ static GFXDECODE_START( vertical ) GFXDECODE_END - -/************************************* - * - * TMS9927 interface - * - *************************************/ - -static const tms9927_interface tms9927_intf = -{ - 8, - NULL -}; - - - /************************************* * * Machine drivers @@ -610,7 +595,8 @@ static MACHINE_CONFIG_START( statriv2, statriv2_state ) MCFG_SCREEN_UPDATE_DRIVER(statriv2_state, screen_update_statriv2) MCFG_SCREEN_PALETTE("palette") - MCFG_TMS9927_ADD("tms", MASTER_CLOCK/2, tms9927_intf) + MCFG_DEVICE_ADD("tms", TMS9927, MASTER_CLOCK/2) + MCFG_TMS9927_CHAR_WIDTH(8) MCFG_GFXDECODE_ADD("gfxdecode", "palette", horizontal) MCFG_PALETTE_ADD("palette", 2*64) diff --git a/src/mame/drivers/thief.c b/src/mame/drivers/thief.c index 3218828c29c..902ee3e6004 100644 --- a/src/mame/drivers/thief.c +++ b/src/mame/drivers/thief.c @@ -424,13 +424,6 @@ static const samples_interface natodef_samples_interface = natodef_sample_names }; -static const tms9927_interface tms9927_intf = -{ - 8, - NULL -}; - - static MACHINE_CONFIG_START( sharkatt, thief_state ) /* basic machine hardware */ @@ -448,11 +441,11 @@ static MACHINE_CONFIG_START( sharkatt, thief_state ) MCFG_SCREEN_UPDATE_DRIVER(thief_state, screen_update_thief) MCFG_SCREEN_PALETTE("palette") - MCFG_TMS9927_ADD("tms", MASTER_CLOCK/4, tms9927_intf) + MCFG_DEVICE_ADD("tms", TMS9927, MASTER_CLOCK/4) + MCFG_TMS9927_CHAR_WIDTH(8) MCFG_PALETTE_ADD("palette", 16) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -484,11 +477,11 @@ static MACHINE_CONFIG_START( thief, thief_state ) MCFG_SCREEN_UPDATE_DRIVER(thief_state, screen_update_thief) MCFG_SCREEN_PALETTE("palette") - MCFG_TMS9927_ADD("tms", MASTER_CLOCK/4, tms9927_intf) + MCFG_DEVICE_ADD("tms", TMS9927, MASTER_CLOCK/4) + MCFG_TMS9927_CHAR_WIDTH(8) MCFG_PALETTE_ADD("palette", 16) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -520,11 +513,11 @@ static MACHINE_CONFIG_START( natodef, thief_state ) MCFG_SCREEN_UPDATE_DRIVER(thief_state, screen_update_thief) MCFG_SCREEN_PALETTE("palette") - MCFG_TMS9927_ADD("tms", MASTER_CLOCK/4, tms9927_intf) + MCFG_DEVICE_ADD("tms", TMS9927, MASTER_CLOCK/4) + MCFG_TMS9927_CHAR_WIDTH(8) MCFG_PALETTE_ADD("palette", 16) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/attache.c b/src/mess/drivers/attache.c index f9e2d49a414..5c1dfd3039f 100644 --- a/src/mess/drivers/attache.c +++ b/src/mess/drivers/attache.c @@ -880,12 +880,6 @@ static const z80_daisy_config attache_daisy_chain[] = { NULL } }; -static const tms9927_interface crtc_interface = -{ - 8, // guessing for now - NULL -}; - static SLOT_INTERFACE_START( attache_floppies ) SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) SLOT_INTERFACE_END @@ -989,7 +983,8 @@ static MACHINE_CONFIG_START( attache, attache_state ) MCFG_FLOPPY_DRIVE_ADD("fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_TMS9927_ADD("crtc", 12324000, crtc_interface) + MCFG_DEVICE_ADD("crtc", TMS9927, 12324000) + MCFG_TMS9927_CHAR_WIDTH(8) MCFG_NVRAM_ADD_0FILL("nvram") diff --git a/src/mess/drivers/compucolor.c b/src/mess/drivers/compucolor.c index 1d81daf757e..1485860c1e4 100644 --- a/src/mess/drivers/compucolor.c +++ b/src/mess/drivers/compucolor.c @@ -320,12 +320,6 @@ UINT32 compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &bit return 0; } -static struct tms9927_interface crtc_intf = -{ - 6, // pixels per video memory address - NULL // self-load data -}; - READ8_MEMBER( compucolor2_state::xi_r ) { UINT8 data = 0xff; @@ -465,8 +459,9 @@ static MACHINE_CONFIG_START( compucolor2, compucolor2_state ) MCFG_SCREEN_UPDATE_DRIVER(compucolor2_state, screen_update) MCFG_SCREEN_SIZE(64*6, 32*8) MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) + MCFG_DEVICE_ADD(CRT5027_TAG, CRT5027, XTAL_17_9712MHz/2) - MCFG_DEVICE_CONFIG(crtc_intf) + MCFG_TMS9927_CHAR_WIDTH(6) MCFG_TMS9927_VSYN_CALLBACK(DEVWRITELINE(TMS5501_TAG, tms5501_device, sens_w)) MCFG_VIDEO_SET_SCREEN("screen") diff --git a/src/mess/drivers/itt3030.c b/src/mess/drivers/itt3030.c index 802ab5a9d2c..c88ef5548b9 100644 --- a/src/mess/drivers/itt3030.c +++ b/src/mess/drivers/itt3030.c @@ -589,12 +589,6 @@ static SLOT_INTERFACE_START( itt3030_floppies ) SLOT_INTERFACE_END -static struct tms9927_interface crtc_intf = -{ - 16, // pixels per video memory address - NULL // "self-load data"? -}; - static MACHINE_CONFIG_START( itt3030, itt3030_state ) /* basic machine hardware */ @@ -620,8 +614,10 @@ static MACHINE_CONFIG_START( itt3030, itt3030_state ) MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) MCFG_ADDRESS_MAP_BANK_STRIDE(0x10000) + MCFG_DEVICE_ADD("crt5027", CRT5027, XTAL_6MHz) - MCFG_DEVICE_CONFIG(crtc_intf) + MCFG_TMS9927_CHAR_WIDTH(16) + MCFG_FD1791x_ADD("fdc", XTAL_20MHz / 20) MCFG_WD_FDC_FORCE_READY MCFG_FLOPPY_DRIVE_ADD("fdc:0", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) diff --git a/src/mess/drivers/tdv2324.c b/src/mess/drivers/tdv2324.c index e2267bc4d64..bff59b14dcd 100644 --- a/src/mess/drivers/tdv2324.c +++ b/src/mess/drivers/tdv2324.c @@ -235,17 +235,6 @@ UINT32 tdv2324_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // DEVICE CONFIGURATION //************************************************************************** -//------------------------------------------------- -// tms9927_interface vtac_intf -//------------------------------------------------- - -static const tms9927_interface vtac_intf = -{ - 8, - NULL -}; - - //------------------------------------------------- // SLOT_INTERFACE( tdv2324_floppies ) //------------------------------------------------- @@ -286,7 +275,8 @@ static MACHINE_CONFIG_START( tdv2324, tdv2324_state ) MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - MCFG_TMS9927_ADD(TMS9937NL_TAG, XTAL_25_39836MHz, vtac_intf) + MCFG_DEVICE_ADD(TMS9937NL_TAG, TMS9927, XTAL_25_39836MHz) + MCFG_TMS9927_CHAR_WIDTH(8) // devices MCFG_PIC8259_ADD(P8259A_TAG, NULL, VCC, NULL)