summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2013-06-09 20:49:03 +0000
committer Curt Coder <curtcoder@mail.com>2013-06-09 20:49:03 +0000
commit2d45dec8707f69b1af09b811fabe26e3acd36b88 (patch)
tree29022faa264463767db94a9238b9f9fc6dfbc499
parentff8543fc339b89f70e6bc325ede5cb0f7a5b488b (diff)
(MESS) devcb2. (nw)
-rw-r--r--src/emu/sound/cdp1864.c104
-rw-r--r--src/emu/sound/cdp1864.h107
-rw-r--r--src/emu/video/cdp1861.c73
-rw-r--r--src/emu/video/cdp1861.h54
-rw-r--r--src/emu/video/cdp1862.c61
-rw-r--r--src/emu/video/cdp1862.h64
-rw-r--r--src/mess/drivers/cosmicos.c21
-rw-r--r--src/mess/drivers/elf.c17
-rw-r--r--src/mess/drivers/eti660.c21
-rw-r--r--src/mess/drivers/pc1512.c10
-rw-r--r--src/mess/drivers/studio2.c35
-rw-r--r--src/mess/drivers/tandy2k.c8
-rw-r--r--src/mess/drivers/tmc2000e.c21
-rw-r--r--src/mess/drivers/trs80m2.c9
-rw-r--r--src/mess/drivers/vip.c29
-rw-r--r--src/mess/machine/pc1512kb.c39
-rw-r--r--src/mess/machine/pc1512kb.h35
-rw-r--r--src/mess/machine/tandy2kb.c35
-rw-r--r--src/mess/machine/tandy2kb.h36
-rw-r--r--src/mess/machine/trs80m2kb.c33
-rw-r--r--src/mess/machine/trs80m2kb.h31
-rw-r--r--src/mess/machine/v1050kb.c1
-rw-r--r--src/mess/machine/v1050kb.h5
-rw-r--r--src/mess/machine/vip_byteio.c49
-rw-r--r--src/mess/machine/vip_byteio.h28
-rw-r--r--src/mess/machine/vip_exp.c102
-rw-r--r--src/mess/machine/vip_exp.h44
-rw-r--r--src/mess/machine/vp575.c50
-rw-r--r--src/mess/machine/vp590.c20
-rw-r--r--src/mess/video/tmc1800.c57
30 files changed, 343 insertions, 856 deletions
diff --git a/src/emu/sound/cdp1864.c b/src/emu/sound/cdp1864.c
index 38dc6f7a084..ed4874a8e17 100644
--- a/src/emu/sound/cdp1864.c
+++ b/src/emu/sound/cdp1864.c
@@ -61,12 +61,12 @@ const device_type CDP1864 = &device_creator<cdp1864_device>;
inline void cdp1864_device::initialize_palette()
{
- double res_total = m_res_r + m_res_g + m_res_b + m_res_bkg;
+ double res_total = m_chr_r + m_chr_g + m_chr_b + m_chr_bkg;
- int weight_r = (m_res_r / res_total) * 100;
- int weight_g = (m_res_g / res_total) * 100;
- int weight_b = (m_res_b / res_total) * 100;
- int weight_bkg = (m_res_bkg / res_total) * 100;
+ int weight_r = (m_chr_r / res_total) * 100;
+ int weight_g = (m_chr_g / res_total) * 100;
+ int weight_b = (m_chr_b / res_total) * 100;
+ int weight_bkg = (m_chr_bkg / res_total) * 100;
for (int i = 0; i < 16; i++)
{
@@ -100,6 +100,14 @@ inline void cdp1864_device::initialize_palette()
cdp1864_device::cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, CDP1864, "CDP1864", tag, owner, clock),
device_sound_interface(mconfig, *this),
+ m_read_inlace(*this),
+ m_read_rdata(*this),
+ m_read_bdata(*this),
+ m_read_gdata(*this),
+ m_write_irq(*this),
+ m_write_dma_out(*this),
+ m_write_efx(*this),
+ m_write_hsync(*this),
m_disp(0),
m_dmaout(0),
m_bgcolor(0),
@@ -111,48 +119,20 @@ cdp1864_device::cdp1864_device(const machine_config &mconfig, const char *tag, d
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void cdp1864_device::device_config_complete()
-{
- // inherit a copy of the static data
- const cdp1864_interface *intf = reinterpret_cast<const cdp1864_interface *>(static_config());
- if (intf != NULL)
- *static_cast<cdp1864_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_in_inlace_cb, 0, sizeof(m_in_inlace_cb));
- memset(&m_in_rdata_cb, 0, sizeof(m_in_rdata_cb));
- memset(&m_in_bdata_cb, 0, sizeof(m_in_bdata_cb));
- memset(&m_in_gdata_cb, 0, sizeof(m_in_gdata_cb));
- memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
- memset(&m_out_dmao_cb, 0, sizeof(m_out_dmao_cb));
- memset(&m_out_efx_cb, 0, sizeof(m_out_efx_cb));
- memset(&m_out_hsync_cb, 0, sizeof(m_out_hsync_cb));
- }
-}
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void cdp1864_device::device_start()
{
// resolve callbacks
- m_in_inlace_func.resolve(m_in_inlace_cb, *this);
- m_in_rdata_func.resolve(m_in_rdata_cb, *this);
- m_in_bdata_func.resolve(m_in_bdata_cb, *this);
- m_in_gdata_func.resolve(m_in_gdata_cb, *this);
- m_out_int_func.resolve(m_out_int_cb, *this);
- m_out_dmao_func.resolve(m_out_dmao_cb, *this);
- m_out_efx_func.resolve(m_out_efx_cb, *this);
- m_out_hsync_func.resolve(m_out_hsync_cb, *this);
+ m_read_inlace.resolve_safe(1);
+ m_read_rdata.resolve_safe(0);
+ m_read_bdata.resolve_safe(0);
+ m_read_gdata.resolve_safe(0);
+ m_write_irq.resolve_safe();
+ m_write_dma_out.resolve_safe();
+ m_write_efx.resolve_safe();
+ m_write_hsync.resolve_safe();
// initialize palette
initialize_palette();
@@ -167,7 +147,6 @@ void cdp1864_device::device_start()
m_hsync_timer = timer_alloc(TIMER_HSYNC);
// find devices
- m_cpu = machine().device<cpu_device>(m_cpu_tag);
m_screen = machine().device<screen_device>(m_screen_tag);
m_screen->register_screen_bitmap(m_bitmap);
@@ -191,14 +170,15 @@ void cdp1864_device::device_reset()
{
m_int_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_INT_START, 0));
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START, 0));
- m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1864_CYCLES_DMA_START));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_START));
m_disp = 0;
m_dmaout = 0;
- m_out_int_func(CLEAR_LINE);
- m_out_dmao_func(CLEAR_LINE);
- m_out_efx_func(CLEAR_LINE);
+ m_write_irq(CLEAR_LINE);
+ m_write_dma_out(CLEAR_LINE);
+ m_write_efx(CLEAR_LINE);
+ m_write_hsync(CLEAR_LINE);
}
@@ -217,7 +197,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- m_out_int_func(ASSERT_LINE);
+ m_write_irq(ASSERT_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos( CDP1864_SCANLINE_INT_END, 0));
@@ -226,7 +206,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- m_out_int_func(CLEAR_LINE);
+ m_write_irq(CLEAR_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_INT_START, 0));
@@ -237,22 +217,22 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (scanline)
{
case CDP1864_SCANLINE_EFX_TOP_START:
- m_out_efx_func(ASSERT_LINE);
+ m_write_efx(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_END, 0));
break;
case CDP1864_SCANLINE_EFX_TOP_END:
- m_out_efx_func(CLEAR_LINE);
+ m_write_efx(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_START, 0));
break;
case CDP1864_SCANLINE_EFX_BOTTOM_START:
- m_out_efx_func(ASSERT_LINE);
+ m_write_efx(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_END, 0));
break;
case CDP1864_SCANLINE_EFX_BOTTOM_END:
- m_out_efx_func(CLEAR_LINE);
+ m_write_efx(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START, 0));
break;
}
@@ -265,11 +245,11 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
{
- m_out_dmao_func(CLEAR_LINE);
+ m_write_dma_out(CLEAR_LINE);
}
}
- m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1864_CYCLES_DMA_WAIT));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_WAIT));
m_dmaout = 0;
}
@@ -279,11 +259,11 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
{
- m_out_dmao_func(ASSERT_LINE);
+ m_write_dma_out(ASSERT_LINE);
}
}
- m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
m_dmaout = 1;
}
@@ -309,7 +289,7 @@ void cdp1864_device::sound_stream_update(sound_stream &stream, stream_sample_t *
if (m_aoe)
{
- double frequency = m_cpu->unscaled_clock() / 8 / 4 / (m_latch + 1) / 2;
+ double frequency = unscaled_clock() / 8 / 4 / (m_latch + 1) / 2;
int rate = machine().sample_rate() / 2;
/* get progress through wave */
@@ -362,8 +342,8 @@ READ8_MEMBER( cdp1864_device::dispoff_r )
{
m_disp = 0;
- m_out_int_func(CLEAR_LINE);
- m_out_dmao_func(CLEAR_LINE);
+ m_write_irq(CLEAR_LINE);
+ m_write_dma_out(CLEAR_LINE);
return 0xff;
}
@@ -408,9 +388,9 @@ WRITE8_MEMBER( cdp1864_device::dma_w )
if (!m_con)
{
- rdata = m_in_rdata_func();
- bdata = m_in_bdata_func();
- gdata = m_in_gdata_func();
+ rdata = m_read_rdata();
+ bdata = m_read_bdata();
+ gdata = m_read_gdata();
}
for (int x = 0; x < 8; x++)
diff --git a/src/emu/sound/cdp1864.h b/src/emu/sound/cdp1864.h
index 25d820ea8df..56d12771ea2 100644
--- a/src/emu/sound/cdp1864.h
+++ b/src/emu/sound/cdp1864.h
@@ -80,69 +80,51 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_CDP1864_ADD(_tag, _clock, _config) \
+#define MCFG_CDP1864_ADD(_tag, _screen_tag, _clock, _inlace, _irq, _dma_out, _efx, _hsync, _rdata, _bdata, _gdata) \
MCFG_SOUND_ADD(_tag, CDP1864, _clock) \
- MCFG_DEVICE_CONFIG(_config)
-
+ downcast<cdp1864_device *>(device)->set_screen_tag(_screen_tag); \
+ downcast<cdp1864_device *>(device)->set_inlace_callback(DEVCB2_##_inlace); \
+ downcast<cdp1864_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
+ downcast<cdp1864_device *>(device)->set_dma_out_callback(DEVCB2_##_dma_out); \
+ downcast<cdp1864_device *>(device)->set_efx_callback(DEVCB2_##_efx); \
+ downcast<cdp1864_device *>(device)->set_hsync_callback(DEVCB2_##_hsync); \
+ downcast<cdp1864_device *>(device)->set_rdata_callback(DEVCB2_##_rdata); \
+ downcast<cdp1864_device *>(device)->set_bdata_callback(DEVCB2_##_bdata); \
+ downcast<cdp1864_device *>(device)->set_gdata_callback(DEVCB2_##_gdata);
+
+#define MCFG_CDP1864_CHROMINANCE(_r, _b, _g, _bkg) \
+ downcast<cdp1864_device *>(device)->set_chrominance_resistors(_r, _b, _g, _bkg);
#define MCFG_CDP1864_SCREEN_ADD(_tag, _clock) \
MCFG_SCREEN_ADD(_tag, RASTER) \
MCFG_SCREEN_RAW_PARAMS(_clock, CDP1864_SCREEN_WIDTH, CDP1864_HBLANK_END, CDP1864_HBLANK_START, CDP1864_TOTAL_SCANLINES, CDP1864_SCANLINE_VBLANK_END, CDP1864_SCANLINE_VBLANK_START)
-#define CDP1864_INTERFACE(name) \
- const cdp1864_interface (name) =
-
-
-#define CDP1864_NON_INTERLACED \
- DEVCB_LINE_VCC
-
-
-#define CDP1864_INTERLACED \
- DEVCB_LINE_GND
-
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> cdp1864_interface
-
-struct cdp1864_interface
-{
- const char *m_cpu_tag;
- const char *m_screen_tag;
-
- devcb_read_line m_in_inlace_cb;
-
- devcb_read_line m_in_rdata_cb;
- devcb_read_line m_in_bdata_cb;
- devcb_read_line m_in_gdata_cb;
-
- devcb_write_line m_out_int_cb;
- devcb_write_line m_out_dmao_cb;
- devcb_write_line m_out_efx_cb;
- devcb_write_line m_out_hsync_cb;
-
- double m_res_r; // red output resistor value
- double m_res_g; // green output resistor value
- double m_res_b; // blue output resistor value
- double m_res_bkg; // background output resistor value
-};
-
-
-
// ======================> cdp1864_device
class cdp1864_device : public device_t,
- public device_sound_interface,
- public cdp1864_interface
+ public device_sound_interface
{
public:
// construction/destruction
cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; }
+ template<class _inlace> void set_inlace_callback(_inlace inlace) { m_read_inlace.set_callback(inlace); }
+ template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
+ template<class _dma_out> void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); }
+ template<class _efx> void set_efx_callback(_efx efx) { m_write_efx.set_callback(efx); }
+ template<class _hsync> void set_hsync_callback(_hsync hsync) { m_write_hsync.set_callback(hsync); }
+ template<class _rdata> void set_rdata_callback(_rdata rdata) { m_read_rdata.set_callback(rdata); }
+ template<class _bdata> void set_bdata_callback(_bdata bdata) { m_read_bdata.set_callback(bdata); }
+ template<class _gdata> void set_gdata_callback(_gdata gdata) { m_read_gdata.set_callback(gdata); }
+ void set_chrominance_resistors(double r, double b, double g, double bkg) { m_chr_r = r; m_chr_b = b; m_chr_g = g; m_chr_bkg = bkg; }
+
DECLARE_READ8_MEMBER( dispon_r );
DECLARE_READ8_MEMBER( dispoff_r );
@@ -159,7 +141,6 @@ public:
protected:
// device-level overrides
- virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
@@ -170,26 +151,34 @@ protected:
private:
inline void initialize_palette();
- static const device_timer_id TIMER_INT = 0;
- static const device_timer_id TIMER_EFX = 1;
- static const device_timer_id TIMER_DMA = 2;
- static const device_timer_id TIMER_HSYNC = 3;
-
- devcb_resolved_read_line m_in_inlace_func;
- devcb_resolved_read_line m_in_rdata_func;
- devcb_resolved_read_line m_in_bdata_func;
- devcb_resolved_read_line m_in_gdata_func;
- devcb_resolved_write_line m_out_int_func;
- devcb_resolved_write_line m_out_dmao_func;
- devcb_resolved_write_line m_out_efx_func;
- devcb_resolved_write_line m_out_hsync_func;
-
- cpu_device *m_cpu;
+ enum
+ {
+ TIMER_INT,
+ TIMER_EFX,
+ TIMER_DMA,
+ TIMER_HSYNC
+ };
+
+ devcb2_read_line m_read_inlace;
+ devcb2_read_line m_read_rdata;
+ devcb2_read_line m_read_bdata;
+ devcb2_read_line m_read_gdata;
+ devcb2_write_line m_write_irq;
+ devcb2_write_line m_write_dma_out;
+ devcb2_write_line m_write_efx;
+ devcb2_write_line m_write_hsync;
+
+ const char *m_screen_tag;
screen_device *m_screen; // screen
bitmap_rgb32 m_bitmap; // bitmap
sound_stream *m_stream; // sound output
// video state
+ double m_chr_r; // red chrominance resistor value
+ double m_chr_b; // blue chrominance resistor value
+ double m_chr_g; // green chrominance resistor value
+ double m_chr_bkg; // background chrominance resistor value
+
rgb_t m_palette[16];
int m_disp; // display on
int m_dmaout; // DMA request active
diff --git a/src/emu/video/cdp1861.c b/src/emu/video/cdp1861.c
index 9eba2bdf11a..356eb9d316d 100644
--- a/src/emu/video/cdp1861.c
+++ b/src/emu/video/cdp1861.c
@@ -23,42 +23,28 @@
//**************************************************************************
-// LIVE DEVICE
+// DEVICE DEFINITIONS
//**************************************************************************
// device type definition
const device_type CDP1861 = &device_creator<cdp1861_device>;
-//-------------------------------------------------
-// cdp1861_device - constructor
-//-------------------------------------------------
-cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, CDP1861, "CDP1861", tag, owner, clock)
-{
-}
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
+// cdp1861_device - constructor
//-------------------------------------------------
-void cdp1861_device::device_config_complete()
+cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, CDP1861, "CDP1861", tag, owner, clock),
+ m_write_irq(*this),
+ m_write_dma_out(*this),
+ m_write_efx(*this)
{
- // inherit a copy of the static data
- const cdp1861_interface *intf = reinterpret_cast<const cdp1861_interface *>(static_config());
- if (intf != NULL)
- *static_cast<cdp1861_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
- memset(&m_out_dmao_cb, 0, sizeof(m_out_dmao_cb));
- memset(&m_out_efx_cb, 0, sizeof(m_out_efx_cb));
- }
}
@@ -69,9 +55,9 @@ void cdp1861_device::device_config_complete()
void cdp1861_device::device_start()
{
// resolve callbacks
- m_out_int_func.resolve(m_out_int_cb, *this);
- m_out_dmao_func.resolve(m_out_dmao_cb, *this);
- m_out_efx_func.resolve(m_out_efx_cb, *this);
+ m_write_irq.resolve_safe();
+ m_write_dma_out.resolve_safe();
+ m_write_efx.resolve_safe();
// allocate timers
m_int_timer = timer_alloc(TIMER_INT);
@@ -79,7 +65,6 @@ void cdp1861_device::device_start()
m_dma_timer = timer_alloc(TIMER_DMA);
// find devices
- m_cpu = machine().device<cpu_device>(m_cpu_tag);
m_screen = machine().device<screen_device>(m_screen_tag);
m_screen->register_screen_bitmap(m_bitmap);
@@ -99,15 +84,15 @@ void cdp1861_device::device_reset()
{
m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
- m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_START));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_START));
m_disp = 0;
m_dmaout = 0;
m_dispon = 0;
- m_out_int_func(CLEAR_LINE);
- m_out_dmao_func(CLEAR_LINE);
- m_out_efx_func(CLEAR_LINE);
+ m_write_irq(CLEAR_LINE);
+ m_write_dma_out(CLEAR_LINE);
+ m_write_efx(CLEAR_LINE);
}
@@ -126,7 +111,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- m_out_int_func(ASSERT_LINE);
+ m_write_irq(ASSERT_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos( CDP1861_SCANLINE_INT_END, 0));
@@ -135,7 +120,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- m_out_int_func(CLEAR_LINE);
+ m_write_irq(CLEAR_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
@@ -146,22 +131,22 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (scanline)
{
case CDP1861_SCANLINE_EFX_TOP_START:
- m_out_efx_func(ASSERT_LINE);
+ m_write_efx(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_END, 0));
break;
case CDP1861_SCANLINE_EFX_TOP_END:
- m_out_efx_func(CLEAR_LINE);
+ m_write_efx(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_START, 0));
break;
case CDP1861_SCANLINE_EFX_BOTTOM_START:
- m_out_efx_func(ASSERT_LINE);
+ m_write_efx(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_END, 0));
break;
case CDP1861_SCANLINE_EFX_BOTTOM_END:
- m_out_efx_func(CLEAR_LINE);
+ m_write_efx(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
break;
}
@@ -174,11 +159,11 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
{
- m_out_dmao_func(CLEAR_LINE);
+ m_write_dma_out(CLEAR_LINE);
}
}
- m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_WAIT));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_WAIT));
m_dmaout = 0;
}
@@ -188,11 +173,11 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
{
- m_out_dmao_func(ASSERT_LINE);
+ m_write_dma_out(ASSERT_LINE);
}
}
- m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
m_dmaout = 1;
}
@@ -242,8 +227,8 @@ WRITE_LINE_MEMBER( cdp1861_device::disp_off_w )
m_dispoff = state;
- m_out_int_func(CLEAR_LINE);
- m_out_dmao_func(CLEAR_LINE);
+ m_write_irq(CLEAR_LINE);
+ m_write_dma_out(CLEAR_LINE);
}
diff --git a/src/emu/video/cdp1861.h b/src/emu/video/cdp1861.h
index 2379cb561c3..67478835883 100644
--- a/src/emu/video/cdp1861.h
+++ b/src/emu/video/cdp1861.h
@@ -65,10 +65,12 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_CDP1861_ADD(_tag, _clock, _config) \
+#define MCFG_CDP1861_ADD(_tag, _screen_tag, _clock, _irq, _dma_out, _efx) \
MCFG_DEVICE_ADD(_tag, CDP1861, _clock) \
- MCFG_DEVICE_CONFIG(_config)
-
+ downcast<cdp1861_device *>(device)->set_screen_tag(_screen_tag); \
+ downcast<cdp1861_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
+ downcast<cdp1861_device *>(device)->set_dma_out_callback(DEVCB2_##_dma_out); \
+ downcast<cdp1861_device *>(device)->set_efx_callback(DEVCB2_##_efx);
#define MCFG_CDP1861_SCREEN_ADD(_cdptag, _tag, _clock) \
MCFG_SCREEN_ADD(_tag, RASTER) \
@@ -76,39 +78,24 @@
MCFG_SCREEN_RAW_PARAMS(_clock, CDP1861_SCREEN_WIDTH, CDP1861_HBLANK_END, CDP1861_HBLANK_START, CDP1861_TOTAL_SCANLINES, CDP1861_SCANLINE_VBLANK_END, CDP1861_SCANLINE_VBLANK_START)
-#define CDP1861_INTERFACE(name) \
- const cdp1861_interface (name) =
-
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-
-// ======================> cdp1861_interface
-
-struct cdp1861_interface
-{
- const char *m_cpu_tag;
- const char *m_screen_tag;
-
- devcb_write_line m_out_int_cb;
- devcb_write_line m_out_dmao_cb;
- devcb_write_line m_out_efx_cb;
-};
-
-
-
// ======================> cdp1861_device
-class cdp1861_device : public device_t,
- public cdp1861_interface
+class cdp1861_device : public device_t
{
public:
// construction/destruction
cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; }
+ template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
+ template<class _dma_out> void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); }
+ template<class _efx> void set_efx_callback(_efx efx) { m_write_efx.set_callback(efx); }
+
DECLARE_WRITE8_MEMBER( dma_w );
DECLARE_WRITE_LINE_MEMBER( disp_on_w );
DECLARE_WRITE_LINE_MEMBER( disp_off_w );
@@ -117,20 +104,23 @@ public:
protected:
// device-level overrides
- virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
private:
- static const device_timer_id TIMER_INT = 0;
- static const device_timer_id TIMER_EFX = 1;
- static const device_timer_id TIMER_DMA = 2;
+ enum
+ {
+ TIMER_INT,
+ TIMER_EFX,
+ TIMER_DMA
+ };
- devcb_resolved_write_line m_out_int_func;
- devcb_resolved_write_line m_out_dmao_func;
- devcb_resolved_write_line m_out_efx_func;
+ devcb2_write_line m_write_irq;
+ devcb2_write_line m_write_dma_out;
+ devcb2_write_line m_write_efx;
+ const char *m_screen_tag;
screen_device *m_screen; // screen
bitmap_rgb32 m_bitmap; // bitmap
@@ -143,8 +133,6 @@ private:
emu_timer *m_int_timer; // interrupt timer
emu_timer *m_efx_timer; // EFx timer
emu_timer *m_dma_timer; // DMA timer
-
- cpu_device *m_cpu;
};
diff --git a/src/emu/video/cdp1862.c b/src/emu/video/cdp1862.c
index 60589f9f4d7..0851dd0c91c 100644
--- a/src/emu/video/cdp1862.c
+++ b/src/emu/video/cdp1862.c
@@ -7,27 +7,24 @@
**********************************************************************/
-/*
-
- TODO:
+#include "cdp1862.h"
- - calculate colors from luminance/chrominance resistors
-*/
-#include "emu.h"
-#include "cdp1862.h"
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
-// device type definition
-const device_type CDP1862 = &device_creator<cdp1862_device>;
//**************************************************************************
-// MACROS / CONSTANTS
+// DEVICE DEFINITIONS
//**************************************************************************
-static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
+// device type definition
+const device_type CDP1862 = &device_creator<cdp1862_device>;
@@ -80,47 +77,27 @@ inline void cdp1862_device::initialize_palette()
//-------------------------------------------------
cdp1862_device::cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, CDP1862, "CDP1862", tag, owner, clock)
+ : device_t(mconfig, CDP1862, "CDP1862", tag, owner, clock),
+ m_read_rd(*this),
+ m_read_bd(*this),
+ m_read_gd(*this)
{
}
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void cdp1862_device::device_config_complete()
-{
- // inherit a copy of the static data
- const cdp1862_interface *intf = reinterpret_cast<const cdp1862_interface *>(static_config());
- if (intf != NULL)
- *static_cast<cdp1862_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_in_rd_cb, 0, sizeof(m_in_rd_cb));
- memset(&m_in_bd_cb, 0, sizeof(m_in_bd_cb));
- memset(&m_in_gd_cb, 0, sizeof(m_in_gd_cb));
- }
-}
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void cdp1862_device::device_start()
{
// resolve callbacks
- m_in_rd_func.resolve(m_in_rd_cb, *this);
- m_in_bd_func.resolve(m_in_bd_cb, *this);
- m_in_gd_func.resolve(m_in_gd_cb, *this);
+ m_read_rd.resolve_safe(0);
+ m_read_bd.resolve_safe(0);
+ m_read_gd.resolve_safe(0);
// find devices
- m_screen = machine().device<screen_device>(m_screen_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
m_screen->register_screen_bitmap(m_bitmap);
// init palette
@@ -156,9 +133,9 @@ WRITE8_MEMBER( cdp1862_device::dma_w )
if (!m_con)
{
- rd = m_in_rd_func();
- bd = m_in_bd_func();
- gd = m_in_gd_func();
+ rd = m_read_rd();
+ bd = m_read_bd();
+ gd = m_read_gd();
}
for (x = 0; x < 8; x++)
diff --git a/src/emu/video/cdp1862.h b/src/emu/video/cdp1862.h
index 5b23aae53bb..256993d976a 100644
--- a/src/emu/video/cdp1862.h
+++ b/src/emu/video/cdp1862.h
@@ -43,13 +43,18 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_CDP1862_ADD(_tag, _clock, _config) \
+#define MCFG_CDP1862_ADD(_tag, _screen_tag, _clock, _rd, _bd, _gd) \
MCFG_DEVICE_ADD(_tag, CDP1862, _clock) \
- MCFG_DEVICE_CONFIG(_config)
+ downcast<cdp1862_device *>(device)->set_screen_tag(_screen_tag); \
+ downcast<cdp1862_device *>(device)->set_rd_callback(DEVCB2_##_rd); \
+ downcast<cdp1862_device *>(device)->set_bd_callback(DEVCB2_##_bd); \
+ downcast<cdp1862_device *>(device)->set_gd_callback(DEVCB2_##_gd);
+#define MCFG_CDP1862_LUMINANCE(_r, _b, _g, _bkg) \
+ downcast<cdp1862_device *>(device)->set_luminance_resistors(_r, _b, _g, _bkg);
-#define CDP1862_INTERFACE(name) \
- const cdp1862_interface (name) =
+#define MCFG_CDP1862_CHROMINANCE(_r, _b, _g, _bkg) \
+ downcast<cdp1862_device *>(device)->set_chrominance_resistors(_r, _b, _g, _bkg);
@@ -57,38 +62,21 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> cdp1862_interface
-
-struct cdp1862_interface
-{
- const char *m_screen_tag;
-
- devcb_read_line m_in_rd_cb;
- devcb_read_line m_in_bd_cb;
- devcb_read_line m_in_gd_cb;
-
- double m_lum_r; // red luminance resistor value
- double m_lum_b; // blue luminance resistor value
- double m_lum_g; // green luminance resistor value
- double m_lum_bkg; // background luminance resistor value
-
- double m_chr_r; // red chrominance resistor value
- double m_chr_b; // blue chrominance resistor value
- double m_chr_g; // green chrominance resistor value
- double m_chr_bkg; // background chrominance resistor value
-};
-
-
-
// ======================> cdp1862_device
-class cdp1862_device : public device_t,
- public cdp1862_interface
+class cdp1862_device : public device_t
{
public:
// construction/destruction
cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; }
+ template<class _rd> void set_rd_callback(_rd rd) { m_read_rd.set_callback(rd); }
+ template<class _bd> void set_bd_callback(_bd bd) { m_read_bd.set_callback(bd); }
+ template<class _gd> void set_gd_callback(_gd gd) { m_read_gd.set_callback(gd); }
+ void set_luminance_resistors(double r, double b, double g, double bkg) { m_lum_r = r; m_lum_b = b; m_lum_g = g; m_lum_bkg = bkg; }
+ void set_chrominance_resistors(double r, double b, double g, double bkg) { m_chr_r = r; m_chr_b = b; m_chr_g = g; m_chr_bkg = bkg; }
+
DECLARE_WRITE8_MEMBER( dma_w );
DECLARE_WRITE_LINE_MEMBER( bkg_w );
DECLARE_WRITE_LINE_MEMBER( con_w );
@@ -97,20 +85,30 @@ public:
protected:
// device-level overrides
- virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
inline void initialize_palette();
- devcb_resolved_read_line m_in_rd_func;
- devcb_resolved_read_line m_in_bd_func;
- devcb_resolved_read_line m_in_gd_func;
+ devcb2_read_line m_read_rd;
+ devcb2_read_line m_read_bd;
+ devcb2_read_line m_read_gd;
+ const char *m_screen_tag;
screen_device *m_screen; // screen
bitmap_rgb32 m_bitmap; // bitmap
+ double m_lum_r; // red luminance resistor value
+ double m_lum_b; // blue luminance resistor value
+ double m_lum_g; // green luminance resistor value
+ double m_lum_bkg; // background luminance resistor value
+
+ double m_chr_r; // red chrominance resistor value
+ double m_chr_b; // blue chrominance resistor value
+ double m_chr_g; // green chrominance resistor value
+ double m_chr_bkg; // background chrominance resistor value
+
rgb_t m_palette[16];
int m_bgcolor; // background color
int m_con; // color on
diff --git a/src/mess/drivers/cosmicos.c b/src/mess/drivers/cosmicos.c
index f034ffdef28..d147b6bda7f 100644
--- a/src/mess/drivers/cosmicos.c
+++ b/src/mess/drivers/cosmicos.c
@@ -362,24 +362,6 @@ WRITE_LINE_MEMBER( cosmicos_state::efx_w )
m_efx = state;
}
-static CDP1864_INTERFACE( cosmicos_cdp1864_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- CDP1864_INTERLACED,
- DEVCB_LINE_VCC,
- DEVCB_LINE_VCC,
- DEVCB_LINE_VCC,
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_DRIVER_LINE_MEMBER(cosmicos_state, dmaout_w),
- DEVCB_DRIVER_LINE_MEMBER(cosmicos_state, efx_w),
- DEVCB_NULL,
- RES_K(2), // R2
- 0, // not connected
- 0, // not connected
- 0 // not connected
-};
-
/* CDP1802 Configuration */
READ_LINE_MEMBER( cosmicos_state::wait_r )
@@ -582,7 +564,8 @@ static MACHINE_CONFIG_START( cosmicos, cosmicos_state )
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, cosmicos_cdp1864_intf)
+ MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), WRITELINE(cosmicos_state, dmaout_w), WRITELINE(cosmicos_state, efx_w), NULL, VCC, VCC, VCC)
+ MCFG_CDP1864_CHROMINANCE(RES_K(2), 0, 0, 0) // R2
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
/* devices */
diff --git a/src/mess/drivers/elf.c b/src/mess/drivers/elf.c
index 33e6f183acb..a74b1a5fc3a 100644
--- a/src/mess/drivers/elf.c
+++ b/src/mess/drivers/elf.c
@@ -221,17 +221,6 @@ static MM74C923_INTERFACE( keyboard_intf )
DEVCB_NULL
};
-/* CDP1861 Interface */
-
-static CDP1861_INTERFACE( elf2_cdp1861_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)
-};
-
/* Machine Initialization */
void elf2_state::machine_start()
@@ -300,17 +289,15 @@ static MACHINE_CONFIG_START( elf2, elf2_state )
/* video hardware */
MCFG_DEFAULT_LAYOUT( layout_elf2 )
-
MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
MCFG_SCREEN_UPDATE_DEVICE(CDP1861_TAG, cdp1861_device, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL_3_579545MHz/2, CDP1861_SCREEN_WIDTH, CDP1861_HBLANK_END, CDP1861_HBLANK_START, CDP1861_TOTAL_SCANLINES, CDP1861_SCANLINE_VBLANK_END, CDP1861_SCANLINE_VBLANK_START)
+ /* devices */
MCFG_MM74C923_ADD(MM74C923_TAG, keyboard_intf)
MCFG_DM9368_ADD(DM9368_H_TAG, led_h_intf)
MCFG_DM9368_ADD(DM9368_L_TAG, led_l_intf)
- MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_3_579545MHz/2, elf2_cdp1861_intf)
-
- /* devices */
+ MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
MCFG_CASSETTE_ADD("cassette", elf_cassette_interface)
MCFG_QUICKLOAD_ADD("quickload", elf2_state, elf, "bin", 0)
diff --git a/src/mess/drivers/eti660.c b/src/mess/drivers/eti660.c
index 97c7b95be0c..f680b806eae 100644
--- a/src/mess/drivers/eti660.c
+++ b/src/mess/drivers/eti660.c
@@ -100,24 +100,6 @@ READ_LINE_MEMBER( eti660_state::gdata_r )
return BIT(m_color, 2);
}
-static CDP1864_INTERFACE( eti660_cdp1864_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- CDP1864_INTERLACED,
- DEVCB_DRIVER_LINE_MEMBER(eti660_state, rdata_r),
- DEVCB_DRIVER_LINE_MEMBER(eti660_state, bdata_r),
- DEVCB_DRIVER_LINE_MEMBER(eti660_state, gdata_r),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
- DEVCB_NULL,
- RES_K(2.2), /* R7 */
- RES_K(1), /* R5 */
- RES_K(4.7), /* R6 */
- RES_K(4.7) /* R4 */
-};
-
/* CDP1802 Interface */
READ_LINE_MEMBER( eti660_state::clear_r )
@@ -262,7 +244,8 @@ static MACHINE_CONFIG_START( eti660, eti660_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_8_867238MHz/5, eti660_cdp1864_intf)
+ MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_8_867238MHz/5, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(eti660_state, rdata_r), READLINE(eti660_state, bdata_r), READLINE(eti660_state, gdata_r))
+ MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(4.7), RES_K(4.7)) // R7, R5, R6, R4
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
/* devices */
diff --git a/src/mess/drivers/pc1512.c b/src/mess/drivers/pc1512.c
index 0458ba8148c..36e13d469af 100644
--- a/src/mess/drivers/pc1512.c
+++ b/src/mess/drivers/pc1512.c
@@ -777,12 +777,6 @@ WRITE_LINE_MEMBER( pc1512_state::kbclk_w )
m_kbclk = state;
}
-static PC1512_KEYBOARD_INTERFACE( kb_intf )
-{
- DEVCB_DRIVER_LINE_MEMBER(pc1512_state, kbdata_w),
- DEVCB_DRIVER_LINE_MEMBER(pc1512_state, kbclk_w)
-};
-
//-------------------------------------------------
// I8237_INTERFACE( dmac_intf )
@@ -1260,7 +1254,7 @@ static MACHINE_CONFIG_START( pc1512, pc1512_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
// devices
- MCFG_PC1512_KEYBOARD_ADD(kb_intf)
+ MCFG_PC1512_KEYBOARD_ADD(WRITELINE(pc1512_state, kbclk_w), WRITELINE(pc1512_state, kbdata_w))
MCFG_I8237_ADD(I8237A5_TAG, XTAL_24MHz/6, dmac_intf)
MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL)
MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
@@ -1306,7 +1300,7 @@ static MACHINE_CONFIG_START( pc1640, pc1640_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
// devices
- MCFG_PC1512_KEYBOARD_ADD(kb_intf)
+ MCFG_PC1512_KEYBOARD_ADD(WRITELINE(pc1512_state, kbclk_w), WRITELINE(pc1512_state, kbdata_w))
MCFG_I8237_ADD(I8237A5_TAG, XTAL_24MHz/6, dmac_intf)
MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL)
MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
diff --git a/src/mess/drivers/studio2.c b/src/mess/drivers/studio2.c
index 456cbce6af0..0286fbf656e 100644
--- a/src/mess/drivers/studio2.c
+++ b/src/mess/drivers/studio2.c
@@ -377,15 +377,6 @@ INPUT_PORTS_END
/* Video */
-static CDP1861_INTERFACE( studio2_cdp1861_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)
-};
-
static const rgb_t VISICOM_PALETTE[] =
{
MAKE_RGB(0x00, 0x80, 0x00),
@@ -409,24 +400,6 @@ READ_LINE_MEMBER( mpt02_state::gdata_r )
return BIT(m_color, 2);
}
-static CDP1864_INTERFACE( mpt02_cdp1864_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- CDP1864_INTERLACED,
- DEVCB_DRIVER_LINE_MEMBER(mpt02_state, rdata_r),
- DEVCB_DRIVER_LINE_MEMBER(mpt02_state, bdata_r),
- DEVCB_DRIVER_LINE_MEMBER(mpt02_state, gdata_r),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
- DEVCB_NULL,
- RES_K(2.2), // unverified
- RES_K(1), // unverified
- RES_K(5.1), // unverified
- RES_K(4.7) // unverified
-};
-
/* CDP1802 Configuration */
READ_LINE_MEMBER( studio2_state::clear_r )
@@ -546,7 +519,7 @@ static MACHINE_CONFIG_START( studio2, studio2_state )
/* video hardware */
MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, 1760000)
- MCFG_CDP1861_ADD(CDP1861_TAG, 1760000, studio2_cdp1861_intf)
+ MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, 1760000, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -565,7 +538,7 @@ static MACHINE_CONFIG_START( visicom, visicom_state )
/* video hardware */
MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2)
- MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_3_579545MHz/2/8, studio2_cdp1861_intf)
+ MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2/8, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -591,7 +564,9 @@ static MACHINE_CONFIG_START( mpt02, mpt02_state )
MCFG_SOUND_ADD("beeper", BEEP, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
- MCFG_CDP1864_ADD(CDP1864_TAG, CDP1864_CLOCK, mpt02_cdp1864_intf)
+ MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(mpt02_state, rdata_r), READLINE(mpt02_state, bdata_r), READLINE(mpt02_state, gdata_r))
+ MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified
+
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_FRAGMENT_ADD( studio2_cartslot )
diff --git a/src/mess/drivers/tandy2k.c b/src/mess/drivers/tandy2k.c
index cf07da75ee6..d0466948e2f 100644
--- a/src/mess/drivers/tandy2k.c
+++ b/src/mess/drivers/tandy2k.c
@@ -642,12 +642,6 @@ WRITE_LINE_MEMBER( tandy2k_state::kbddat_w )
m_kbddat = state;
}
-static TANDY2K_KEYBOARD_INTERFACE( kb_intf )
-{
- DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, kbdclk_w),
- DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, kbddat_w)
-};
-
// Machine Initialization
void tandy2k_state::machine_start()
@@ -720,7 +714,7 @@ static MACHINE_CONFIG_START( tandy2k, tandy2k_state )
MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":1", tandy2k_floppies, "525qd", floppy_image_device::default_floppy_formats)
MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, standard_centronics)
MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
- MCFG_TANDY2K_KEYBOARD_ADD(kb_intf)
+ MCFG_TANDY2K_KEYBOARD_ADD(WRITELINE(tandy2k_state, kbdclk_w), WRITELINE(tandy2k_state, kbddat_w))
// software lists
MCFG_SOFTWARE_LIST_ADD("flop_list", "tandy2k")
diff --git a/src/mess/drivers/tmc2000e.c b/src/mess/drivers/tmc2000e.c
index a7cbdc8728c..7d5985285c6 100644
--- a/src/mess/drivers/tmc2000e.c
+++ b/src/mess/drivers/tmc2000e.c
@@ -210,24 +210,6 @@ READ_LINE_MEMBER( tmc2000e_state::gdata_r )
return BIT(m_color, 0);
}
-static CDP1864_INTERFACE( tmc2000e_cdp1864_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- CDP1864_INTERLACED,
- DEVCB_DRIVER_LINE_MEMBER(tmc2000e_state, rdata_r),
- DEVCB_DRIVER_LINE_MEMBER(tmc2000e_state, bdata_r),
- DEVCB_DRIVER_LINE_MEMBER(tmc2000e_state, gdata_r),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
- DEVCB_NULL,
- RES_K(2.2), // unverified
- RES_K(1), // unverified
- RES_K(5.1), // unverified
- RES_K(4.7) // unverified
-};
-
/* CDP1802 Interface */
READ_LINE_MEMBER( tmc2000e_state::clear_r )
@@ -335,7 +317,8 @@ static MACHINE_CONFIG_START( tmc2000e, tmc2000e_state )
// sound hardware
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, tmc2000e_cdp1864_intf)
+ MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000e_state, rdata_r), READLINE(tmc2000e_state, bdata_r), READLINE(tmc2000e_state, gdata_r))
+ MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
/* devices */
diff --git a/src/mess/drivers/trs80m2.c b/src/mess/drivers/trs80m2.c
index dd856907b1d..fa0e500cfdd 100644
--- a/src/mess/drivers/trs80m2.c
+++ b/src/mess/drivers/trs80m2.c
@@ -500,11 +500,6 @@ WRITE_LINE_MEMBER( trs80m2_state::kb_clock_w )
m_kbclk = state;
}
-static TRS80M2_KEYBOARD_INTERFACE( kb_intf )
-{
- DEVCB_DRIVER_LINE_MEMBER(trs80m2_state, kb_clock_w)
-};
-
WRITE8_MEMBER( trs80m2_state::kbd_w )
{
// latch key data
@@ -844,7 +839,7 @@ static MACHINE_CONFIG_START( trs80m2, trs80m2_state )
MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":1", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats)
- MCFG_TRS80M2_KEYBOARD_ADD(kb_intf)
+ MCFG_TRS80M2_KEYBOARD_ADD(WRITELINE(trs80m2_state, kb_clock_w))
MCFG_ASCII_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf)
// internal RAM
@@ -895,7 +890,7 @@ static MACHINE_CONFIG_START( trs80m16, trs80m16_state )
MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats)
MCFG_PIC8259_ADD(AM9519A_TAG, INPUTLINE(M68000_TAG, M68K_IRQ_5), VCC, NULL )
- MCFG_TRS80M2_KEYBOARD_ADD(kb_intf)
+ MCFG_TRS80M2_KEYBOARD_ADD(WRITELINE(trs80m2_state, kb_clock_w))
// internal RAM
MCFG_RAM_ADD(RAM_TAG)
diff --git a/src/mess/drivers/vip.c b/src/mess/drivers/vip.c
index e628bd62d6a..8ea259ed382 100644
--- a/src/mess/drivers/vip.c
+++ b/src/mess/drivers/vip.c
@@ -546,15 +546,6 @@ WRITE_LINE_MEMBER( vip_state::vdc_ef1_w )
m_vdc_ef1 = state;
}
-static CDP1861_INTERFACE( vdc_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- DEVCB_DRIVER_LINE_MEMBER(vip_state, vdc_int_w),
- DEVCB_DRIVER_LINE_MEMBER(vip_state, vdc_dma_out_w),
- DEVCB_DRIVER_LINE_MEMBER(vip_state, vdc_ef1_w)
-};
-
UINT32 vip_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_vdc->screen_update(screen, bitmap, cliprect);
@@ -609,11 +600,6 @@ WRITE_LINE_MEMBER( vip_state::byteio_inst_w )
}
}
-static VIP_BYTEIO_PORT_INTERFACE( byteio_intf )
-{
- DEVCB_DRIVER_LINE_MEMBER(vip_state, byteio_inst_w)
-};
-
//-------------------------------------------------
// VIP_EXPANSION_INTERFACE( expansion_intf )
@@ -640,13 +626,6 @@ WRITE_LINE_MEMBER( vip_state::exp_dma_in_w )
update_interrupts();
}
-static VIP_EXPANSION_INTERFACE( expansion_intf )
-{
- DEVCB_DRIVER_LINE_MEMBER(vip_state, exp_int_w),
- DEVCB_DRIVER_LINE_MEMBER(vip_state, exp_dma_out_w),
- DEVCB_DRIVER_LINE_MEMBER(vip_state, exp_dma_in_w)
-};
-
//**************************************************************************
@@ -772,8 +751,7 @@ static MACHINE_CONFIG_START( vip, vip_state )
// video hardware
MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_52128MHz/2)
MCFG_SCREEN_UPDATE_DRIVER(vip_state, screen_update)
-
- MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz/2, vdc_intf)
+ MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_52128MHz/2, WRITELINE(vip_state, vdc_int_w), WRITELINE(vip_state, vdc_dma_out_w), WRITELINE(vip_state, vdc_ef1_w))
// sound hardware
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -782,8 +760,9 @@ static MACHINE_CONFIG_START( vip, vip_state )
MCFG_SOUND_CONFIG_DISCRETE(vip)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
- MCFG_VIP_BYTEIO_PORT_ADD(VIP_BYTEIO_PORT_TAG, byteio_intf, vip_byteio_cards, NULL)
- MCFG_VIP_EXPANSION_SLOT_ADD(VIP_EXPANSION_SLOT_TAG, XTAL_3_52128MHz/2, expansion_intf, vip_expansion_cards, NULL)
+ MCFG_VIP_BYTEIO_PORT_ADD(VIP_BYTEIO_PORT_TAG, vip_byteio_cards, NULL, WRITELINE(vip_state, byteio_inst_w))
+ MCFG_VIP_EXPANSION_SLOT_ADD(VIP_EXPANSION_SLOT_TAG, XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_CALLBACKS(WRITELINE(vip_state, exp_int_w), WRITELINE(vip_state, exp_dma_out_w), WRITELINE(vip_state, exp_dma_in_w))
// devices
MCFG_QUICKLOAD_ADD("quickload", vip_state, vip, "bin,c8,c8x", 0)
diff --git a/src/mess/machine/pc1512kb.c b/src/mess/machine/pc1512kb.c
index edcdcd3f7bb..add718ccdb5 100644
--- a/src/mess/machine/pc1512kb.c
+++ b/src/mess/machine/pc1512kb.c
@@ -18,13 +18,6 @@
#define I8048_TAG "ic801"
-enum
-{
- LED_CAPS = 0,
- LED_NUM
-};
-
-
//**************************************************************************
// DEVICE DEFINITIONS
@@ -34,28 +27,6 @@ const device_type PC1512_KEYBOARD = &device_creator<pc1512_keyboard_device>;
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void pc1512_keyboard_device::device_config_complete()
-{
- // inherit a copy of the static data
- const pc1512_keyboard_interface *intf = reinterpret_cast<const pc1512_keyboard_interface *>(static_config());
- if (intf != NULL)
- *static_cast<pc1512_keyboard_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
- memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb));
- }
-}
-
-
-//-------------------------------------------------
// ROM( pc1512_keyboard )
//-------------------------------------------------
@@ -270,6 +241,8 @@ pc1512_keyboard_device::pc1512_keyboard_device(const machine_config &mconfig, co
m_y10(*this, "Y10"),
m_y11(*this, "Y11"),
m_com(*this, "COM"),
+ m_write_clock(*this),
+ m_write_data(*this),
m_data_in(1),
m_clock_in(1),
m_kb_y(0xffff),
@@ -290,8 +263,8 @@ void pc1512_keyboard_device::device_start()
m_reset_timer = timer_alloc();
// resolve callbacks
- m_out_data_func.resolve(m_out_data_cb, *this);
- m_out_clock_func.resolve(m_out_clock_cb, *this);
+ m_write_clock.resolve_safe();
+ m_write_data.resolve_safe();
// state saving
save_item(NAME(m_data_in));
@@ -495,10 +468,10 @@ WRITE8_MEMBER( pc1512_keyboard_device::kb_p2_w )
*/
// keyboard data
- m_out_data_func(BIT(data, 0));
+ m_write_data(BIT(data, 0));
// keyboard clock
- m_out_clock_func(BIT(data, 1));
+ m_write_clock(BIT(data, 1));
// CAPS LOCK
output_set_led_value(LED_CAPS, BIT(data, 2));
diff --git a/src/mess/machine/pc1512kb.h b/src/mess/machine/pc1512kb.h
index 05487dec773..0e3cda19e48 100644
--- a/src/mess/machine/pc1512kb.h
+++ b/src/mess/machine/pc1512kb.h
@@ -30,13 +30,10 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_PC1512_KEYBOARD_ADD(_config) \
+#define MCFG_PC1512_KEYBOARD_ADD(_clock, _data) \
MCFG_DEVICE_ADD(PC1512_KEYBOARD_TAG, PC1512_KEYBOARD, 0) \
- MCFG_DEVICE_CONFIG(_config)
-
-
-#define PC1512_KEYBOARD_INTERFACE(_name) \
- const pc1512_keyboard_interface (_name) =
+ downcast<pc1512_keyboard_device *>(device)->set_clock_callback(DEVCB2_##_clock); \
+ downcast<pc1512_keyboard_device *>(device)->set_data_callback(DEVCB2_##_data);
@@ -44,24 +41,17 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> pc1512_keyboard_interface
-
-struct pc1512_keyboard_interface
-{
- devcb_write_line m_out_data_cb;
- devcb_write_line m_out_clock_cb;
-};
-
-
// ======================> pc1512_keyboard_device
-class pc1512_keyboard_device : public device_t,
- public pc1512_keyboard_interface
+class pc1512_keyboard_device : public device_t
{
public:
// construction/destruction
pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ template<class _clock> void set_clock_callback(_clock clock) { m_write_clock.set_callback(clock); }
+ template<class _data> void set_data_callback(_data data) { m_write_data.set_callback(data); }
+
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
@@ -84,11 +74,13 @@ protected:
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
- virtual void device_config_complete();
private:
- devcb_resolved_write_line m_out_data_func;
- devcb_resolved_write_line m_out_clock_func;
+ enum
+ {
+ LED_CAPS = 0,
+ LED_NUM
+ };
required_device<cpu_device> m_maincpu;
required_ioport m_y1;
@@ -104,6 +96,9 @@ private:
required_ioport m_y11;
required_ioport m_com;
+ devcb2_write_line m_write_clock;
+ devcb2_write_line m_write_data;
+
int m_data_in;
int m_clock_in;
int m_kb_y;
diff --git a/src/mess/machine/tandy2kb.c b/src/mess/machine/tandy2kb.c
index e4e7df72d06..376d2ac462d 100644
--- a/src/mess/machine/tandy2kb.c
+++ b/src/mess/machine/tandy2kb.c
@@ -17,11 +17,6 @@
#define I8048_TAG "m1"
-enum
-{
- LED_1 = 0,
- LED_2
-};
//**************************************************************************
@@ -246,32 +241,14 @@ tandy2k_keyboard_device::tandy2k_keyboard_device(const machine_config &mconfig,
m_y9(*this, "Y9"),
m_y10(*this, "Y10"),
m_y11(*this, "Y11"),
+ m_write_clock(*this),
+ m_write_data(*this),
m_keylatch(0xffff),
m_clock(0),
m_data(0)
{
}
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void tandy2k_keyboard_device::device_config_complete()
-{
- // inherit a copy of the static data
- const tandy2k_keyboard_interface *intf = reinterpret_cast<const tandy2k_keyboard_interface *>(static_config());
- if (intf != NULL)
- *static_cast<tandy2k_keyboard_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb));
- memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
- }
-}
//-------------------------------------------------
// device_start - device-specific startup
@@ -280,8 +257,8 @@ void tandy2k_keyboard_device::device_config_complete()
void tandy2k_keyboard_device::device_start()
{
// resolve callbacks
- m_out_clock_func.resolve(m_out_clock_cb, *this);
- m_out_data_func.resolve(m_out_data_cb, *this);
+ m_write_clock.resolve_safe();
+ m_write_data.resolve_safe();
// state saving
save_item(NAME(m_keylatch));
@@ -441,7 +418,7 @@ WRITE8_MEMBER( tandy2k_keyboard_device::kb_p2_w )
{
m_clock = clock;
- m_out_clock_func(m_clock);
+ m_write_clock(m_clock);
}
// keyboard data
@@ -451,6 +428,6 @@ WRITE8_MEMBER( tandy2k_keyboard_device::kb_p2_w )
{
m_data = kbddat;
- m_out_data_func(m_data);
+ m_write_data(m_data);
}
}
diff --git a/src/mess/machine/tandy2kb.h b/src/mess/machine/tandy2kb.h
index da356afc1f0..d7b5722a67f 100644
--- a/src/mess/machine/tandy2kb.h
+++ b/src/mess/machine/tandy2kb.h
@@ -12,7 +12,6 @@
#ifndef __TANDY2K_KEYBOARD__
#define __TANDY2K_KEYBOARD__
-
#include "emu.h"
#include "cpu/mcs48/mcs48.h"
@@ -30,13 +29,10 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_TANDY2K_KEYBOARD_ADD(_config) \
+#define MCFG_TANDY2K_KEYBOARD_ADD(_clock, _data) \
MCFG_DEVICE_ADD(TANDY2K_KEYBOARD_TAG, TANDY2K_KEYBOARD, 0) \
- MCFG_DEVICE_CONFIG(_config)
-
-
-#define TANDY2K_KEYBOARD_INTERFACE(_name) \
- const tandy2k_keyboard_interface (_name) =
+ downcast<tandy2k_keyboard_device *>(device)->set_clock_callback(DEVCB2_##_clock); \
+ downcast<tandy2k_keyboard_device *>(device)->set_data_callback(DEVCB2_##_data);
@@ -44,24 +40,17 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> tandy2k_keyboard_interface
-
-struct tandy2k_keyboard_interface
-{
- devcb_write_line m_out_clock_cb;
- devcb_write_line m_out_data_cb;
-};
-
-
// ======================> tandy2k_keyboard_device
-class tandy2k_keyboard_device : public device_t,
- public tandy2k_keyboard_interface
+class tandy2k_keyboard_device : public device_t
{
public:
// construction/destruction
tandy2k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ template<class _clock> void set_clock_callback(_clock clock) { m_write_clock.set_callback(clock); }
+ template<class _data> void set_data_callback(_data data) { m_write_data.set_callback(data); }
+
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
@@ -81,11 +70,13 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
- virtual void device_config_complete();
private:
- devcb_resolved_write_line m_out_clock_func;
- devcb_resolved_write_line m_out_data_func;
+ enum
+ {
+ LED_1 = 0,
+ LED_2
+ };
required_device<cpu_device> m_maincpu;
required_ioport m_y0;
@@ -101,6 +92,9 @@ private:
required_ioport m_y10;
required_ioport m_y11;
+ devcb2_write_line m_write_clock;
+ devcb2_write_line m_write_data;
+
UINT16 m_keylatch;
int m_clock;
diff --git a/src/mess/machine/trs80m2kb.c b/src/mess/machine/trs80m2kb.c
index 9c9ac621c8b..e836b607d7a 100644
--- a/src/mess/machine/trs80m2kb.c
+++ b/src/mess/machine/trs80m2kb.c
@@ -18,13 +18,6 @@
#define I8021_TAG "z4"
-enum
-{
- LED_0 = 0,
- LED_1
-};
-
-
//**************************************************************************
// DEVICE DEFINITIONS
@@ -249,6 +242,7 @@ trs80m2_keyboard_device::trs80m2_keyboard_device(const machine_config &mconfig,
m_y9(*this, "Y9"),
m_ya(*this, "YA"),
m_yb(*this, "YB"),
+ m_write_clock(*this),
m_busy(1),
m_data(1),
m_clk(0)
@@ -257,34 +251,13 @@ trs80m2_keyboard_device::trs80m2_keyboard_device(const machine_config &mconfig,
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void trs80m2_keyboard_device::device_config_complete()
-{
- // inherit a copy of the static data
- const trs80m2_keyboard_interface *intf = reinterpret_cast<const trs80m2_keyboard_interface *>(static_config());
- if (intf != NULL)
- *static_cast<trs80m2_keyboard_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb));
- }
-}
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void trs80m2_keyboard_device::device_start()
{
// resolve callbacks
- m_out_clock_func.resolve(m_out_clock_cb, *this);
+ m_write_clock.resolve_safe();
// state saving
save_item(NAME(m_busy));
@@ -386,7 +359,7 @@ WRITE8_MEMBER( trs80m2_keyboard_device::kb_p1_w )
if (m_clk != clk)
{
- m_out_clock_func(clk);
+ m_write_clock(clk);
m_clk = clk;
}
diff --git a/src/mess/machine/trs80m2kb.h b/src/mess/machine/trs80m2kb.h
index b6e126646c3..01f1789107a 100644
--- a/src/mess/machine/trs80m2kb.h
+++ b/src/mess/machine/trs80m2kb.h
@@ -12,7 +12,6 @@
#ifndef __TRS80M2_KEYBOARD__
#define __TRS80M2_KEYBOARD__
-
#include "emu.h"
#include "cpu/mcs48/mcs48.h"
#include "sound/discrete.h"
@@ -31,13 +30,9 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_TRS80M2_KEYBOARD_ADD(_config) \
+#define MCFG_TRS80M2_KEYBOARD_ADD(_clock) \
MCFG_DEVICE_ADD(TRS80M2_KEYBOARD_TAG, TRS80M2_KEYBOARD, 0) \
- MCFG_DEVICE_CONFIG(_config)
-
-
-#define TRS80M2_KEYBOARD_INTERFACE(_name) \
- const trs80m2_keyboard_interface (_name) =
+ downcast<trs80m2_keyboard_device *>(device)->set_clock_callback(DEVCB2_##_clock);
@@ -45,23 +40,16 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> trs80m2_keyboard_interface
-
-struct trs80m2_keyboard_interface
-{
- devcb_write_line m_out_clock_cb;
-};
-
-
// ======================> trs80m2_keyboard_device
-class trs80m2_keyboard_device : public device_t,
- public trs80m2_keyboard_interface
+class trs80m2_keyboard_device : public device_t
{
public:
// construction/destruction
trs80m2_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ template<class _clock> void set_clock_callback(_clock clock) { m_write_clock.set_callback(clock); }
+
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
@@ -80,10 +68,13 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
- virtual void device_config_complete();
private:
- devcb_resolved_write_line m_out_clock_func;
+ enum
+ {
+ LED_0 = 0,
+ LED_1
+ };
required_device<cpu_device> m_maincpu;
required_ioport m_y0;
@@ -99,6 +90,8 @@ private:
required_ioport m_ya;
required_ioport m_yb;
+ devcb2_write_line m_write_clock;
+
int m_busy;
int m_data;
int m_clk;
diff --git a/src/mess/machine/v1050kb.c b/src/mess/machine/v1050kb.c
index 338e2358506..93b10b3b564 100644
--- a/src/mess/machine/v1050kb.c
+++ b/src/mess/machine/v1050kb.c
@@ -27,7 +27,6 @@
const device_type V1050_KEYBOARD = &device_creator<v1050_keyboard_device>;
-
//-------------------------------------------------
// ROM( v1050_keyboard )
//-------------------------------------------------
diff --git a/src/mess/machine/v1050kb.h b/src/mess/machine/v1050kb.h
index 2a945104424..09a75ed4dbe 100644
--- a/src/mess/machine/v1050kb.h
+++ b/src/mess/machine/v1050kb.h
@@ -12,7 +12,6 @@
#ifndef __V1050_KEYBOARD__
#define __V1050_KEYBOARD__
-
#include "emu.h"
#include "cpu/mcs48/mcs48.h"
#include "sound/discrete.h"
@@ -35,10 +34,6 @@
MCFG_DEVICE_ADD(V1050_KEYBOARD_TAG, V1050_KEYBOARD, 0)
-#define V1050_KEYBOARD_INTERFACE(_name) \
- const V1050_keyboard_interface (_name) =
-
-
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/mess/machine/vip_byteio.c b/src/mess/machine/vip_byteio.c
index 49c603653b3..2d856c9623c 100644
--- a/src/mess/machine/vip_byteio.c
+++ b/src/mess/machine/vip_byteio.c
@@ -34,15 +34,6 @@ device_vip_byteio_port_interface::device_vip_byteio_port_interface(const machine
}
-//-------------------------------------------------
-// ~device_vip_byteio_port_interface - destructor
-//-------------------------------------------------
-
-device_vip_byteio_port_interface::~device_vip_byteio_port_interface()
-{
-}
-
-
//**************************************************************************
// LIVE DEVICE
@@ -54,43 +45,11 @@ device_vip_byteio_port_interface::~device_vip_byteio_port_interface()
vip_byteio_port_device::vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VIP_BYTEIO_PORT, "VIP byte I/O port", tag, owner, clock),
- device_slot_interface(mconfig, *this)
+ device_slot_interface(mconfig, *this),
+ m_write_inst(*this)
{
}
-
-//-------------------------------------------------
-// vip_byteio_port_device - destructor
-//-------------------------------------------------
-
-vip_byteio_port_device::~vip_byteio_port_device()
-{
-}
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void vip_byteio_port_device::device_config_complete()
-{
- // inherit a copy of the static data
- const vip_byteio_port_interface *intf = reinterpret_cast<const vip_byteio_port_interface *>(static_config());
- if (intf != NULL)
- {
- *static_cast<vip_byteio_port_interface *>(this) = *intf;
- }
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_inst_cb, 0, sizeof(m_out_inst_cb));
- }
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -100,7 +59,7 @@ void vip_byteio_port_device::device_start()
m_cart = dynamic_cast<device_vip_byteio_port_interface *>(get_card_device());
// resolve callbacks
- m_out_inst_func.resolve(m_out_inst_cb, *this);
+ m_write_inst.resolve_safe();
}
@@ -119,8 +78,6 @@ READ_LINE_MEMBER( vip_byteio_port_device::ef3_r ) { int state = CLEAR_LINE; if (
READ_LINE_MEMBER( vip_byteio_port_device::ef4_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef4_r(); return state; }
WRITE_LINE_MEMBER( vip_byteio_port_device::q_w ) { if (m_cart != NULL) m_cart->vip_q_w(state); }
-WRITE_LINE_MEMBER( vip_byteio_port_device::inst_w ) { m_out_inst_func(state); }
-
//-------------------------------------------------
// SLOT_INTERFACE( vip_byteio_cards )
diff --git a/src/mess/machine/vip_byteio.h b/src/mess/machine/vip_byteio.h
index 6211b967f1b..fbe6ad6d033 100644
--- a/src/mess/machine/vip_byteio.h
+++ b/src/mess/machine/vip_byteio.h
@@ -53,14 +53,10 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define VIP_BYTEIO_PORT_INTERFACE(_name) \
- const vip_byteio_port_interface (_name) =
-
-
-#define MCFG_VIP_BYTEIO_PORT_ADD(_tag, _config, _slot_intf, _def_slot) \
+#define MCFG_VIP_BYTEIO_PORT_ADD(_tag, _slot_intf, _def_slot, _inst) \
MCFG_DEVICE_ADD(_tag, VIP_BYTEIO_PORT, 0) \
- MCFG_DEVICE_CONFIG(_config) \
- MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<vip_byteio_port_device *>(device)->set_inst_callback(DEVCB2_##_inst);
@@ -68,26 +64,18 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> vip_byteio_port_interface
-
-struct vip_byteio_port_interface
-{
- devcb_write_line m_out_inst_cb;
-};
-
-
// ======================> vip_byteio_port_device
class device_vip_byteio_port_interface;
class vip_byteio_port_device : public device_t,
- public vip_byteio_port_interface,
public device_slot_interface
{
public:
// construction/destruction
vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~vip_byteio_port_device();
+
+ template<class _inst> void set_inst_callback(_inst inst) { m_write_inst.set_callback(inst); }
// computer interface
UINT8 in_r();
@@ -97,15 +85,14 @@ public:
DECLARE_WRITE_LINE_MEMBER( q_w );
// cartridge interface
- DECLARE_WRITE_LINE_MEMBER( inst_w );
+ DECLARE_WRITE_LINE_MEMBER( inst_w ) { m_write_inst(state); }
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
- virtual void device_config_complete();
- devcb_resolved_write_line m_out_inst_func;
+ devcb2_write_line m_write_inst;
device_vip_byteio_port_interface *m_cart;
};
@@ -119,7 +106,6 @@ class device_vip_byteio_port_interface : public device_slot_card_interface
public:
// construction/destruction
device_vip_byteio_port_interface(const machine_config &mconfig, device_t &device);
- virtual ~device_vip_byteio_port_interface();
virtual UINT8 vip_in_r() { return 0xff; };
virtual void vip_out_w(UINT8 data) { };
diff --git a/src/mess/machine/vip_exp.c b/src/mess/machine/vip_exp.c
index c641d56bfd5..832d0d0592a 100644
--- a/src/mess/machine/vip_exp.c
+++ b/src/mess/machine/vip_exp.c
@@ -42,15 +42,6 @@ device_vip_expansion_card_interface::device_vip_expansion_card_interface(const m
}
-//-------------------------------------------------
-// ~device_vip_expansion_card_interface - destructor
-//-------------------------------------------------
-
-device_vip_expansion_card_interface::~device_vip_expansion_card_interface()
-{
-}
-
-
//**************************************************************************
// LIVE DEVICE
@@ -61,58 +52,27 @@ device_vip_expansion_card_interface::~device_vip_expansion_card_interface()
//-------------------------------------------------
vip_expansion_slot_device::vip_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, VIP_EXPANSION_SLOT, "VIP expansion port", tag, owner, clock),
- device_slot_interface(mconfig, *this)
-{
-}
-
-
-//-------------------------------------------------
-// vip_expansion_slot_device - destructor
-//-------------------------------------------------
-
-vip_expansion_slot_device::~vip_expansion_slot_device()
+ device_t(mconfig, VIP_EXPANSION_SLOT, "VIP expansion port", tag, owner, clock),
+ device_slot_interface(mconfig, *this),
+ m_write_irq(*this),
+ m_write_dma_out(*this),
+ m_write_dma_in(*this)
{
}
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void vip_expansion_slot_device::device_config_complete()
-{
- // inherit a copy of the static data
- const vip_expansion_slot_interface *intf = reinterpret_cast<const vip_expansion_slot_interface *>(static_config());
- if (intf != NULL)
- {
- *static_cast<vip_expansion_slot_interface *>(this) = *intf;
- }
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_interrupt_cb, 0, sizeof(m_out_interrupt_cb));
- memset(&m_out_dma_out_cb, 0, sizeof(m_out_dma_out_cb));
- memset(&m_out_dma_in_cb, 0, sizeof(m_out_dma_in_cb));
- }
-}
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void vip_expansion_slot_device::device_start()
{
- m_cart = dynamic_cast<device_vip_expansion_card_interface *>(get_card_device());
+ m_card = dynamic_cast<device_vip_expansion_card_interface *>(get_card_device());
// resolve callbacks
- m_out_interrupt_func.resolve(m_out_interrupt_cb, *this);
- m_out_dma_out_func.resolve(m_out_dma_out_cb, *this);
- m_out_dma_in_func.resolve(m_out_dma_in_cb, *this);
+ m_write_irq.resolve_safe();
+ m_write_dma_out.resolve_safe();
+ m_write_dma_in.resolve_safe();
}
@@ -124,9 +84,9 @@ UINT8 vip_expansion_slot_device::program_r(address_space &space, offs_t offset,
{
UINT8 data = 0;
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- data = m_cart->vip_program_r(space, offset, cs, cdef, minh);
+ data = m_card->vip_program_r(space, offset, cs, cdef, minh);
}
return data;
@@ -139,9 +99,9 @@ UINT8 vip_expansion_slot_device::program_r(address_space &space, offs_t offset,
void vip_expansion_slot_device::program_w(address_space &space, offs_t offset, UINT8 data, int cdef, int *minh)
{
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- m_cart->vip_program_w(space, offset, data, cdef, minh);
+ m_card->vip_program_w(space, offset, data, cdef, minh);
}
}
@@ -154,9 +114,9 @@ UINT8 vip_expansion_slot_device::io_r(address_space &space, offs_t offset)
{
UINT8 data = 0;
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- data = m_cart->vip_io_r(space, offset);
+ data = m_card->vip_io_r(space, offset);
}
return data;
@@ -169,9 +129,9 @@ UINT8 vip_expansion_slot_device::io_r(address_space &space, offs_t offset)
void vip_expansion_slot_device::io_w(address_space &space, offs_t offset, UINT8 data)
{
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- m_cart->vip_io_w(space, offset, data);
+ m_card->vip_io_w(space, offset, data);
}
}
@@ -184,9 +144,9 @@ UINT8 vip_expansion_slot_device::dma_r(address_space &space, offs_t offset)
{
UINT8 data = 0;
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- data = m_cart->vip_dma_r(space, offset);
+ data = m_card->vip_dma_r(space, offset);
}
return data;
@@ -199,9 +159,9 @@ UINT8 vip_expansion_slot_device::dma_r(address_space &space, offs_t offset)
void vip_expansion_slot_device::dma_w(address_space &space, offs_t offset, UINT8 data)
{
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- m_cart->vip_dma_w(space, offset, data);
+ m_card->vip_dma_w(space, offset, data);
}
}
@@ -214,24 +174,20 @@ UINT32 vip_expansion_slot_device::screen_update(screen_device &screen, bitmap_rg
{
bool value = false;
- if (m_cart != NULL)
+ if (m_card != NULL)
{
- value = m_cart->vip_screen_update(screen, bitmap, cliprect);
+ value = m_card->vip_screen_update(screen, bitmap, cliprect);
}
return value;
}
-READ_LINE_MEMBER( vip_expansion_slot_device::ef1_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef1_r(); return state; }
-READ_LINE_MEMBER( vip_expansion_slot_device::ef3_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef3_r(); return state; }
-READ_LINE_MEMBER( vip_expansion_slot_device::ef4_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef4_r(); return state; }
-void vip_expansion_slot_device::sc_w(int data) { if (m_cart != NULL) m_cart->vip_sc_w(data); }
-WRITE_LINE_MEMBER( vip_expansion_slot_device::q_w ) { if (m_cart != NULL) m_cart->vip_q_w(state); }
-WRITE_LINE_MEMBER( vip_expansion_slot_device::run_w ) { if (m_cart != NULL) m_cart->vip_run_w(state); }
-
-WRITE_LINE_MEMBER( vip_expansion_slot_device::interrupt_w ) { m_out_interrupt_func(state); }
-WRITE_LINE_MEMBER( vip_expansion_slot_device::dma_out_w ) { m_out_dma_out_func(state); }
-WRITE_LINE_MEMBER( vip_expansion_slot_device::dma_in_w ) { m_out_dma_in_func(state); }
+READ_LINE_MEMBER( vip_expansion_slot_device::ef1_r ) { int state = CLEAR_LINE; if (m_card != NULL) state = m_card->vip_ef1_r(); return state; }
+READ_LINE_MEMBER( vip_expansion_slot_device::ef3_r ) { int state = CLEAR_LINE; if (m_card != NULL) state = m_card->vip_ef3_r(); return state; }
+READ_LINE_MEMBER( vip_expansion_slot_device::ef4_r ) { int state = CLEAR_LINE; if (m_card != NULL) state = m_card->vip_ef4_r(); return state; }
+void vip_expansion_slot_device::sc_w(int data) { if (m_card != NULL) m_card->vip_sc_w(data); }
+WRITE_LINE_MEMBER( vip_expansion_slot_device::q_w ) { if (m_card != NULL) m_card->vip_q_w(state); }
+WRITE_LINE_MEMBER( vip_expansion_slot_device::run_w ) { if (m_card != NULL) m_card->vip_run_w(state); }
diff --git a/src/mess/machine/vip_exp.h b/src/mess/machine/vip_exp.h
index 5893a1ad516..6d528625fb0 100644
--- a/src/mess/machine/vip_exp.h
+++ b/src/mess/machine/vip_exp.h
@@ -53,43 +53,35 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define VIP_EXPANSION_INTERFACE(_name) \
- const vip_expansion_slot_interface (_name) =
-
-
-#define MCFG_VIP_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot) \
+#define MCFG_VIP_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, VIP_EXPANSION_SLOT, _clock) \
- MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+#define MCFG_VIP_EXPANSION_SLOT_CALLBACKS(_irq, _dma_out, _dma_in) \
+ downcast<vip_expansion_slot_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
+ downcast<vip_expansion_slot_device *>(device)->set_dma_out_callback(DEVCB2_##_dma_out); \
+ downcast<vip_expansion_slot_device *>(device)->set_dma_in_callback(DEVCB2_##_dma_in);
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> vip_expansion_slot_interface
-
-struct vip_expansion_slot_interface
-{
- devcb_write_line m_out_interrupt_cb;
- devcb_write_line m_out_dma_out_cb;
- devcb_write_line m_out_dma_in_cb;
-};
-
-
// ======================> vip_expansion_slot_device
class device_vip_expansion_card_interface;
class vip_expansion_slot_device : public device_t,
- public vip_expansion_slot_interface,
public device_slot_interface
{
public:
// construction/destruction
vip_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~vip_expansion_slot_device();
+
+ template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
+ template<class _dma_out> void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); }
+ template<class _dma_in> void set_dma_in_callback(_dma_in dma_in) { m_write_dma_in.set_callback(dma_in); }
// computer interface
UINT8 program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh);
@@ -107,20 +99,19 @@ public:
DECLARE_WRITE_LINE_MEMBER( run_w );
// cartridge interface
- DECLARE_WRITE_LINE_MEMBER( interrupt_w );
- DECLARE_WRITE_LINE_MEMBER( dma_out_w );
- DECLARE_WRITE_LINE_MEMBER( dma_in_w );
+ DECLARE_WRITE_LINE_MEMBER( interrupt_w ) { m_write_irq(state); }
+ DECLARE_WRITE_LINE_MEMBER( dma_out_w ) { m_write_dma_out(state); }
+ DECLARE_WRITE_LINE_MEMBER( dma_in_w ) { m_write_dma_in(state); }
protected:
// device-level overrides
- virtual void device_config_complete();
virtual void device_start();
- devcb_resolved_write_line m_out_interrupt_func;
- devcb_resolved_write_line m_out_dma_out_func;
- devcb_resolved_write_line m_out_dma_in_func;
+ devcb2_write_line m_write_irq;
+ devcb2_write_line m_write_dma_out;
+ devcb2_write_line m_write_dma_in;
- device_vip_expansion_card_interface *m_cart;
+ device_vip_expansion_card_interface *m_card;
};
@@ -133,7 +124,6 @@ class device_vip_expansion_card_interface : public device_slot_card_interface
public:
// construction/destruction
device_vip_expansion_card_interface(const machine_config &mconfig, device_t &device);
- virtual ~device_vip_expansion_card_interface();
protected:
// runtime
diff --git a/src/mess/machine/vp575.c b/src/mess/machine/vp575.c
index 4de17fb3e2d..e31c7a10923 100644
--- a/src/mess/machine/vp575.c
+++ b/src/mess/machine/vp575.c
@@ -58,52 +58,22 @@ WRITE_LINE_MEMBER( vp575_device::exp3_dma_in_w ) { m_dma_in[2] = state; update_i
WRITE_LINE_MEMBER( vp575_device::exp4_dma_in_w ) { m_dma_in[3] = state; update_interrupts(); }
WRITE_LINE_MEMBER( vp575_device::exp5_dma_in_w ) { m_dma_in[4] = state; update_interrupts(); }
-static VIP_EXPANSION_INTERFACE( expansion1_intf )
-{
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp1_int_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp1_dma_out_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp1_dma_in_w)
-};
-
-static VIP_EXPANSION_INTERFACE( expansion2_intf )
-{
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp2_int_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp2_dma_out_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp2_dma_in_w)
-};
-
-static VIP_EXPANSION_INTERFACE( expansion3_intf )
-{
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp3_int_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp3_dma_out_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp3_dma_in_w)
-};
-
-static VIP_EXPANSION_INTERFACE( expansion4_intf )
-{
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp4_int_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp4_dma_out_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp4_dma_in_w)
-};
-
-static VIP_EXPANSION_INTERFACE( expansion5_intf )
-{
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp5_int_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp5_dma_out_w),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp5_dma_in_w)
-};
-
//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( vp575 )
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( vp575 )
- MCFG_VIP_EXPANSION_SLOT_ADD("exp1", XTAL_3_52128MHz/2, expansion1_intf, vip_expansion_cards, NULL)
- MCFG_VIP_EXPANSION_SLOT_ADD("exp2", XTAL_3_52128MHz/2, expansion2_intf, vip_expansion_cards, NULL)
- MCFG_VIP_EXPANSION_SLOT_ADD("exp3", XTAL_3_52128MHz/2, expansion3_intf, vip_expansion_cards, NULL)
- MCFG_VIP_EXPANSION_SLOT_ADD("exp4", XTAL_3_52128MHz/2, expansion4_intf, vip_expansion_cards, NULL)
- MCFG_VIP_EXPANSION_SLOT_ADD("exp5", XTAL_3_52128MHz/2, expansion5_intf, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp1", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp1_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp1_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp1_dma_in_w))
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp2", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp2_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp2_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp2_dma_in_w))
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp3", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp3_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp3_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp3_dma_in_w))
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp4", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp4_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp4_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp4_dma_in_w))
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp5", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
+ MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp5_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp5_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp5_dma_in_w))
MACHINE_CONFIG_END
diff --git a/src/mess/machine/vp590.c b/src/mess/machine/vp590.c
index 6dd4d72c95d..762124e1305 100644
--- a/src/mess/machine/vp590.c
+++ b/src/mess/machine/vp590.c
@@ -48,29 +48,15 @@ READ_LINE_MEMBER( vp590_device::gd_r )
return BIT(m_color, 3);
}
-static CDP1862_INTERFACE( cgc_intf )
-{
- SCREEN_TAG,
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp590_device, rd_r),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp590_device, bd_r),
- DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp590_device, gd_r),
- RES_R(510), // R3
- RES_R(360), // R4
- RES_K(1), // R5
- RES_K(1.5), // R6
- RES_K(3.9), // R7
- RES_K(10), // R8
- RES_K(2), // R9
- RES_K(3.3) // R10
-};
-
//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( vp590 )
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( vp590 )
- MCFG_CDP1862_ADD(CDP1862_TAG, CPD1862_CLOCK, cgc_intf)
+ MCFG_CDP1862_ADD(CDP1862_TAG, SCREEN_TAG, CPD1862_CLOCK, DEVREADLINE(DEVICE_SELF, vp590_device, rd_r), DEVREADLINE(DEVICE_SELF, vp590_device, bd_r), DEVREADLINE(DEVICE_SELF, vp590_device, gd_r))
+ MCFG_CDP1862_LUMINANCE(RES_R(510), RES_R(360), RES_K(1), RES_K(1.5)) // R3, R4, R5, R6
+ MCFG_CDP1862_CHROMINANCE(RES_K(3.9), RES_K(10), RES_K(2), RES_K(3.3)) // R7, R8, R9, R10
MACHINE_CONFIG_END
diff --git a/src/mess/video/tmc1800.c b/src/mess/video/tmc1800.c
index f80aee446ec..99adef4da89 100644
--- a/src/mess/video/tmc1800.c
+++ b/src/mess/video/tmc1800.c
@@ -5,17 +5,6 @@
#include "sound/cdp1864.h"
#include "machine/rescap.h"
-/* Telmac 1800 */
-
-static CDP1861_INTERFACE( tmc1800_cdp1861_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)
-};
-
/* Telmac 2000 */
READ_LINE_MEMBER( tmc2000_state::rdata_r )
@@ -33,44 +22,6 @@ READ_LINE_MEMBER( tmc2000_state::gdata_r )
return BIT(m_color, 0);
}
-static CDP1864_INTERFACE( tmc2000_cdp1864_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- CDP1864_INTERLACED,
- DEVCB_DRIVER_LINE_MEMBER(tmc2000_state, rdata_r),
- DEVCB_DRIVER_LINE_MEMBER(tmc2000_state, bdata_r),
- DEVCB_DRIVER_LINE_MEMBER(tmc2000_state, gdata_r),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
- DEVCB_NULL,
- RES_K(1.21), // RL64
- RES_K(2.05), // RL63
- RES_K(2.26), // RL61
- RES_K(3.92) // RL65 (also RH62 (2K pot) in series, but ignored here)
-};
-
-/* OSCOM Nano */
-
-static CDP1864_INTERFACE( nano_cdp1864_intf )
-{
- CDP1802_TAG,
- SCREEN_TAG,
- CDP1864_INTERLACED,
- DEVCB_LINE_VCC,
- DEVCB_LINE_VCC,
- DEVCB_LINE_VCC,
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
- DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
- DEVCB_NULL,
- RES_K(1.21), // R18 unconfirmed
- 0, // not connected
- 0, // not connected
- 0 // not connected
-};
-
/* OSM-200 */
UINT32 osc1000b_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -82,7 +33,7 @@ UINT32 osc1000b_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
MACHINE_CONFIG_FRAGMENT( tmc1800_video )
MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_1_75MHz)
- MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_1_75MHz, tmc1800_cdp1861_intf)
+ MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_1_75MHz, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
MACHINE_CONFIG_END
MACHINE_CONFIG_FRAGMENT( osc1000b_video )
@@ -98,7 +49,8 @@ MACHINE_CONFIG_FRAGMENT( tmc2000_video )
MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update)
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, tmc2000_cdp1864_intf)
+ MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000_state, rdata_r), READLINE(tmc2000_state, bdata_r), READLINE(tmc2000_state, gdata_r))
+ MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_K(2.05), RES_K(2.26), RES_K(3.92)) // RL64, RL63, RL61, RL65 (also RH62 (2K pot) in series, but ignored here)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
@@ -107,6 +59,7 @@ MACHINE_CONFIG_FRAGMENT( nano_video )
MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update)
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, nano_cdp1864_intf)
+ MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, VCC, VCC, VCC)
+ MCFG_CDP1864_CHROMINANCE(RES_K(1.21), 0, 0, 0) // R18 (unconfirmed)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END