summaryrefslogtreecommitdiffstats
path: root/src/devices/video
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2018-07-07 02:40:29 +1000
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2018-07-07 02:40:29 +1000
commitc3fb11c2c98a5c28ece6a27093a0f9def350ac64 (patch)
treec68b38f05ed1d32358add721fda7f45e8803479f /src/devices/video
parent5d9e33b786d7ef452317439359f3cbd8cc920513 (diff)
devcb3
There are multiple issues with the current device callbacks: * They always dispatch through a pointer-to-member * Chained callbacks are a linked list so the branch unit can't predict the early * There's a runtime decision made on the left/right shift direction * There are runtime NULL checks on various objects * Binding a lambda isn't practical * Arbitrary transformations are not supported * When chaining callbacks it isn't clear what the MCFG_DEVCB_ modifiers apply to * It isn't possible to just append to a callback in derived configuration * The macros need a magic, hidden local called devcb * Moving code that uses the magic locals around is error-prone * Writing the MCFG_ macros to make a device usable is a pain * You can't discover applicable MCFG_ macros with intellisense * Macros are not scoped * Using an inappropriate macro isn't detected at compile time * Lots of other things This changeset overcomes the biggest obstacle to remving MCFG_ macros altogether. Essentially, to allow a devcb to be configured, call .bind() and expose the result (a bind target for the callback). Bind target methods starting with "set" repace the current callbacks; methods starting with "append" append to them. You can't reconfigure a callback after resolving it. There's no need to use a macro matching the handler signatures - use FUNC for everything. Current device is implied if no tag/finder is supplied (no need for explicit this). Lambdas are supported, and the memory space and offset are optional. These kinds of things work: * .read_cb().set([this] () { return something; }); * .read_cb().set([this] (offs_t offset) { return ~offset; }); * .write_cb().set([this] (offs_t offset, u8 data) { m_array[offset] = data; }); * .write_cb().set([this] (int state) { some_var = state; }); Arbitrary transforms are allowed, and they can modify offset/mask for example: * .read_cb().set(FUNC(my_state::handler)).transform([] (u8 data) { return bitswap<4>(data, 1, 3, 0, 2); }); * .read_cb().set(m_dev, FUNC(some_device::member)).transform([] (offs_t &offset, u8 data) { offset ^= 3; return data; }); It's possible to stack arbitrary transforms, at the cost of compile time (the whole transform stack gets inlined at compile time). Shifts count as an arbitrary transform, but mask/exor does not. Order of mask/shift/exor now matters. Modifications are applied in the specified order. These are NOT EQUIVALENT: * .read_cb().set(FUNC(my_state::handler)).mask(0x06).lshift(2); * .read_cb().set(FUNC(my_state::handler)).lshift(2).mask(0x06); The bit helper no longer reverses its behaviour for read callbacks, and I/O ports are no longer aware of the field mask. Binding a read callback to no-op is not supported - specify a constant. The GND and VCC aliases have been removed intentionally - they're TTL-centric, and were already being abused. Other quirks have been preserved, including write logger only logging when the data is non-zero (quite unhelpful in many of the cases where it's used). Legacy syntax is still supported for simple cases, but will be phased out. New devices should not have MCFG_ macros. I don't think I've missed any fundamental issues, but if I've broken something, let me know.
Diffstat (limited to 'src/devices/video')
-rw-r--r--src/devices/video/315_5124.h18
-rw-r--r--src/devices/video/315_5313.h10
-rw-r--r--src/devices/video/cdp1861.h6
-rw-r--r--src/devices/video/cdp1862.h6
-rw-r--r--src/devices/video/cesblit.h2
-rw-r--r--src/devices/video/crt9007.h22
-rw-r--r--src/devices/video/crt9212.h6
-rw-r--r--src/devices/video/crtc_ega.h8
-rw-r--r--src/devices/video/dl1416.h4
-rw-r--r--src/devices/video/dm9368.h4
-rw-r--r--src/devices/video/ef9364.h2
-rw-r--r--src/devices/video/ef9365.h2
-rw-r--r--src/devices/video/gba_lcd.h10
-rw-r--r--src/devices/video/hd44352.h2
-rw-r--r--src/devices/video/hd61830.h2
-rw-r--r--src/devices/video/hlcd0515.h4
-rw-r--r--src/devices/video/hlcd0538.h4
-rw-r--r--src/devices/video/huc6202.h24
-rw-r--r--src/devices/video/huc6260.h8
-rw-r--r--src/devices/video/huc6270.h2
-rw-r--r--src/devices/video/huc6272.h2
-rw-r--r--src/devices/video/i8244.h4
-rw-r--r--src/devices/video/i82730.h2
-rw-r--r--src/devices/video/i8275.h16
-rw-r--r--src/devices/video/imagetek_i4100.h2
-rw-r--r--src/devices/video/mb88303.h6
-rw-r--r--src/devices/video/mc6845.h32
-rw-r--r--src/devices/video/mc6847.h9
-rw-r--r--src/devices/video/mos6566.h8
-rw-r--r--src/devices/video/ppu2c0x.h1
-rw-r--r--src/devices/video/ppu2c0x_vt.h4
-rw-r--r--src/devices/video/psx.h2
-rw-r--r--src/devices/video/saa5050.h2
-rw-r--r--src/devices/video/scn2674.h4
-rw-r--r--src/devices/video/snes_ppu.h9
-rw-r--r--src/devices/video/tms34061.h2
-rw-r--r--src/devices/video/tms9927.h6
-rw-r--r--src/devices/video/tms9928a.h6
-rw-r--r--src/devices/video/upd3301.h16
-rw-r--r--src/devices/video/upd7220.h8
-rw-r--r--src/devices/video/v9938.h2
-rw-r--r--src/devices/video/vic4567.h16
-rw-r--r--src/devices/video/voodoo.h6
-rw-r--r--src/devices/video/zeus2.h4
44 files changed, 164 insertions, 151 deletions
diff --git a/src/devices/video/315_5124.h b/src/devices/video/315_5124.h
index c358476df17..aa048723444 100644
--- a/src/devices/video/315_5124.h
+++ b/src/devices/video/315_5124.h
@@ -220,13 +220,13 @@ private:
downcast<sega315_5124_device &>(*device).set_signal_type(_bool);
#define MCFG_SEGA315_5124_INT_CB(_devcb) \
- devcb = &downcast<sega315_5124_device &>(*device).set_int_callback(DEVCB_##_devcb);
+ downcast<sega315_5124_device &>(*device).set_int_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5124_CSYNC_CB(_devcb) \
- devcb = &downcast<sega315_5124_device &>(*device).set_csync_callback(DEVCB_##_devcb);
+ downcast<sega315_5124_device &>(*device).set_csync_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5124_PAUSE_CB(_devcb) \
- devcb = &downcast<sega315_5124_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+ downcast<sega315_5124_device &>(*device).set_pause_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5246_SET_SCREEN MCFG_VIDEO_SET_SCREEN
@@ -235,13 +235,13 @@ private:
downcast<sega315_5246_device &>(*device).set_signal_type(_bool);
#define MCFG_SEGA315_5246_INT_CB(_devcb) \
- devcb = &downcast<sega315_5246_device &>(*device).set_int_callback(DEVCB_##_devcb);
+ downcast<sega315_5246_device &>(*device).set_int_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5246_CSYNC_CB(_devcb) \
- devcb = &downcast<sega315_5246_device &>(*device).set_csync_callback(DEVCB_##_devcb);
+ downcast<sega315_5246_device &>(*device).set_csync_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5246_PAUSE_CB(_devcb) \
- devcb = &downcast<sega315_5246_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+ downcast<sega315_5246_device &>(*device).set_pause_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5378_SET_SCREEN MCFG_VIDEO_SET_SCREEN
@@ -250,13 +250,13 @@ private:
downcast<sega315_5378_device &>(*device).set_signal_type(_bool);
#define MCFG_SEGA315_5378_INT_CB(_devcb) \
- devcb = &downcast<sega315_5378_device &>(*device).set_int_callback(DEVCB_##_devcb);
+ downcast<sega315_5378_device &>(*device).set_int_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5378_CSYNC_CB(_devcb) \
- devcb = &downcast<sega315_5378_device &>(*device).set_csync_callback(DEVCB_##_devcb);
+ downcast<sega315_5378_device &>(*device).set_csync_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5378_PAUSE_CB(_devcb) \
- devcb = &downcast<sega315_5378_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+ downcast<sega315_5378_device &>(*device).set_pause_callback(DEVCB_##_devcb);
#endif // MAME_VIDEO_315_5124_H
diff --git a/src/devices/video/315_5313.h b/src/devices/video/315_5313.h
index 3661dfb1bce..750c2d8d960 100644
--- a/src/devices/video/315_5313.h
+++ b/src/devices/video/315_5313.h
@@ -16,19 +16,19 @@
downcast<sega315_5313_device &>(*device).set_signal_type(_bool);
#define MCFG_SEGA315_5313_INT_CB(_devcb) \
- devcb = &downcast<sega315_5313_device &>(*device).set_int_callback(DEVCB_##_devcb);
+ downcast<sega315_5313_device &>(*device).set_int_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5313_PAUSE_CB(_devcb) \
- devcb = &downcast<sega315_5313_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+ downcast<sega315_5313_device &>(*device).set_pause_callback(DEVCB_##_devcb);
#define MCFG_SEGA315_5313_SND_IRQ_CALLBACK(_write) \
- devcb = &downcast<sega315_5313_device &>(*device).set_sndirqline_callback(DEVCB_##_write);
+ downcast<sega315_5313_device &>(*device).set_sndirqline_callback(DEVCB_##_write);
#define MCFG_SEGA315_5313_LV6_IRQ_CALLBACK(_write) \
- devcb = &downcast<sega315_5313_device &>(*device).set_lv6irqline_callback(DEVCB_##_write);
+ downcast<sega315_5313_device &>(*device).set_lv6irqline_callback(DEVCB_##_write);
#define MCFG_SEGA315_5313_LV4_IRQ_CALLBACK(_write) \
- devcb = &downcast<sega315_5313_device &>(*device).set_lv4irqline_callback(DEVCB_##_write);
+ downcast<sega315_5313_device &>(*device).set_lv4irqline_callback(DEVCB_##_write);
#define MCFG_SEGA315_5313_ALT_TIMING(_data) \
downcast<sega315_5313_device &>(*device).set_alt_timing(_data);
diff --git a/src/devices/video/cdp1861.h b/src/devices/video/cdp1861.h
index 765be92de8b..fc75e765279 100644
--- a/src/devices/video/cdp1861.h
+++ b/src/devices/video/cdp1861.h
@@ -34,13 +34,13 @@
//**************************************************************************
#define MCFG_CDP1861_IRQ_CALLBACK(_write) \
- devcb = &downcast<cdp1861_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+ downcast<cdp1861_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
#define MCFG_CDP1861_DMA_OUT_CALLBACK(_write) \
- devcb = &downcast<cdp1861_device &>(*device).set_dma_out_wr_callback(DEVCB_##_write);
+ downcast<cdp1861_device &>(*device).set_dma_out_wr_callback(DEVCB_##_write);
#define MCFG_CDP1861_EFX_CALLBACK(_write) \
- devcb = &downcast<cdp1861_device &>(*device).set_efx_wr_callback(DEVCB_##_write);
+ downcast<cdp1861_device &>(*device).set_efx_wr_callback(DEVCB_##_write);
#define MCFG_CDP1861_SCREEN_ADD(_cdptag, _tag, _clock) \
diff --git a/src/devices/video/cdp1862.h b/src/devices/video/cdp1862.h
index 66dce2a4f12..71c977ff72f 100644
--- a/src/devices/video/cdp1862.h
+++ b/src/devices/video/cdp1862.h
@@ -42,13 +42,13 @@
//**************************************************************************
#define MCFG_CDP1861_RD_CALLBACK(_read) \
- devcb = &downcast<cdp1862_device &>(*device).set_rd_rd_callback(DEVCB_##_read);
+ downcast<cdp1862_device &>(*device).set_rd_rd_callback(DEVCB_##_read);
#define MCFG_CDP1861_BD_CALLBACK(_read) \
- devcb = &downcast<cdp1862_device &>(*device).set_bd_rd_callback(DEVCB_##_read);
+ downcast<cdp1862_device &>(*device).set_bd_rd_callback(DEVCB_##_read);
#define MCFG_CDP1861_GD_CALLBACK(_read) \
- devcb = &downcast<cdp1862_device &>(*device).set_gd_rd_callback(DEVCB_##_read);
+ downcast<cdp1862_device &>(*device).set_gd_rd_callback(DEVCB_##_read);
#define MCFG_CDP1862_LUMINANCE(_r, _b, _g, _bkg) \
downcast<cdp1862_device &>(*device).set_luminance(_r, _b, _g, _bkg);
diff --git a/src/devices/video/cesblit.h b/src/devices/video/cesblit.h
index e5bc962c314..f22f16df260 100644
--- a/src/devices/video/cesblit.h
+++ b/src/devices/video/cesblit.h
@@ -25,7 +25,7 @@
downcast<cesblit_device &>(*device).set_compute_addr(_compute_addr);
#define MCFG_CESBLIT_IRQ_CB(_devcb) \
- devcb = &downcast<cesblit_device &>(*device).set_irq_callback(DEVCB_##_devcb);
+ downcast<cesblit_device &>(*device).set_irq_callback(DEVCB_##_devcb);
/***************************************************************************
TYPE DEFINITIONS
diff --git a/src/devices/video/crt9007.h b/src/devices/video/crt9007.h
index d7487c81ab0..060fbfcec24 100644
--- a/src/devices/video/crt9007.h
+++ b/src/devices/video/crt9007.h
@@ -45,37 +45,37 @@
downcast<crt9007_device &>(*device).config_set_character_width(_value);
#define MCFG_CRT9007_INT_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_int_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_int_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_DMAR_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_dmar_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_dmar_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_VS_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_vs_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_vs_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_HS_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_hs_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_hs_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_VLT_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_vlt_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_vlt_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_CURS_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_curs_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_curs_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_DRB_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_drb_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_drb_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_WBEN_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_wben_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_wben_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_CBLANK_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_cblank_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_cblank_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_SLG_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_slg_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_slg_wr_callback(DEVCB_##_write);
#define MCFG_CRT9007_SLD_CALLBACK(_write) \
- devcb = &downcast<crt9007_device &>(*device).set_sld_wr_callback(DEVCB_##_write);
+ downcast<crt9007_device &>(*device).set_sld_wr_callback(DEVCB_##_write);
diff --git a/src/devices/video/crt9212.h b/src/devices/video/crt9212.h
index 639ea1dd213..b3547f698c1 100644
--- a/src/devices/video/crt9212.h
+++ b/src/devices/video/crt9212.h
@@ -39,13 +39,13 @@
downcast<crt9212_device &>(*device).set_wen2(1);
#define MCFG_CRT9212_DOUT_CALLBACK(_write) \
- devcb = &downcast<crt9212_device &>(*device).set_dout_wr_callback(DEVCB_##_write);
+ downcast<crt9212_device &>(*device).set_dout_wr_callback(DEVCB_##_write);
#define MCFG_CRT9212_ROF_CALLBACK(_write) \
- devcb = &downcast<crt9212_device &>(*device).set_rof_wr_callback(DEVCB_##_write);
+ downcast<crt9212_device &>(*device).set_rof_wr_callback(DEVCB_##_write);
#define MCFG_CRT9212_WOF_CALLBACK(_write) \
- devcb = &downcast<crt9212_device &>(*device).set_wof_wr_callback(DEVCB_##_write);
+ downcast<crt9212_device &>(*device).set_wof_wr_callback(DEVCB_##_write);
diff --git a/src/devices/video/crtc_ega.h b/src/devices/video/crtc_ega.h
index c3eb7dcc319..e995cdf8a30 100644
--- a/src/devices/video/crtc_ega.h
+++ b/src/devices/video/crtc_ega.h
@@ -33,16 +33,16 @@
downcast<crtc_ega_device &>(*device).config_set_hpixels_per_column(_pix);
#define MCFG_CRTC_EGA_RES_OUT_DE_CB(_devcb) \
- devcb = &downcast<crtc_ega_device &>(*device).set_res_out_de_callback(DEVCB_##_devcb);
+ downcast<crtc_ega_device &>(*device).set_res_out_de_callback(DEVCB_##_devcb);
#define MCFG_CRTC_EGA_RES_OUT_HSYNC_CB(_devcb) \
- devcb = &downcast<crtc_ega_device &>(*device).set_res_out_hsync_callback(DEVCB_##_devcb);
+ downcast<crtc_ega_device &>(*device).set_res_out_hsync_callback(DEVCB_##_devcb);
#define MCFG_CRTC_EGA_RES_OUT_VSYNC_CB(_devcb) \
- devcb = &downcast<crtc_ega_device &>(*device).set_res_out_vsync_callback(DEVCB_##_devcb);
+ downcast<crtc_ega_device &>(*device).set_res_out_vsync_callback(DEVCB_##_devcb);
#define MCFG_CRTC_EGA_RES_OUT_VBLANK_CB(_devcb) \
- devcb = &downcast<crtc_ega_device &>(*device).set_res_out_vblank_callback(DEVCB_##_devcb);
+ downcast<crtc_ega_device &>(*device).set_res_out_vblank_callback(DEVCB_##_devcb);
class crtc_ega_device : public device_t,
diff --git a/src/devices/video/dl1416.h b/src/devices/video/dl1416.h
index 1d49e00c410..1927905ac4d 100644
--- a/src/devices/video/dl1416.h
+++ b/src/devices/video/dl1416.h
@@ -31,10 +31,10 @@ DECLARE_DEVICE_TYPE(DL1416T, dl1416_device)
***************************************************************************/
#define MCFG_DL1414_UPDATE_HANDLER(_devcb) \
- devcb = &downcast<dl1414_device &>(*device).set_update_handler(DEVCB_##_devcb);
+ downcast<dl1414_device &>(*device).set_update_handler(DEVCB_##_devcb);
#define MCFG_DL1416_UPDATE_HANDLER(_devcb) \
- devcb = &downcast<dl1414_device &>(*device).set_update_handler(DEVCB_##_devcb);
+ downcast<dl1414_device &>(*device).set_update_handler(DEVCB_##_devcb);
/***************************************************************************
diff --git a/src/devices/video/dm9368.h b/src/devices/video/dm9368.h
index 05e7fbb170f..9dc77424a2e 100644
--- a/src/devices/video/dm9368.h
+++ b/src/devices/video/dm9368.h
@@ -29,10 +29,10 @@
//**************************************************************************
#define MCFG_DM9368_UPDATE_CALLBACK(cb) \
- devcb = &downcast<dm9368_device &>(*device).set_update_callback(DEVCB_##cb);
+ downcast<dm9368_device &>(*device).set_update_callback(DEVCB_##cb);
#define MCFG_DM9368_RBO_CALLBACK(cb) \
- devcb = &downcast<dm9368_device &>(*device).set_rbo_callback(DEVCB_##cb);
+ downcast<dm9368_device &>(*device).set_rbo_callback(DEVCB_##cb);
diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h
index ef7fc2cb99a..1082173733c 100644
--- a/src/devices/video/ef9364.h
+++ b/src/devices/video/ef9364.h
@@ -22,7 +22,7 @@
downcast<ef9364_device &>(*device).set_nb_of_pages(_pages_number);
#define MCFG_EF9364_IRQ_HANDLER(_devcb) \
- devcb = &downcast<ef9364_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+ downcast<ef9364_device &>(*device).set_irq_handler(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h
index 8c14fbd6370..762989e6a03 100644
--- a/src/devices/video/ef9365.h
+++ b/src/devices/video/ef9365.h
@@ -25,7 +25,7 @@
downcast<ef9365_device &>(*device).set_display_mode((ef9365_device::display_mode));
#define MCFG_EF936X_IRQ_HANDLER(cb) \
- devcb = &downcast<ef9365_device &>(*device).set_irq_handler((DEVCB_##cb));
+ downcast<ef9365_device &>(*device).set_irq_handler((DEVCB_##cb));
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/video/gba_lcd.h b/src/devices/video/gba_lcd.h
index 9272b8faba6..0fe017a6b93 100644
--- a/src/devices/video/gba_lcd.h
+++ b/src/devices/video/gba_lcd.h
@@ -34,19 +34,19 @@ DECLARE_DEVICE_TYPE(GBA_LCD, gba_lcd_device)
MCFG_DEVICE_ADD(_tag, GBA_LCD, 0)
#define MCFG_GBA_LCD_INT_HBLANK(_devcb) \
- devcb = &downcast<gba_lcd_device &>(*device).set_int_hblank_callback(DEVCB_##_devcb);
+ downcast<gba_lcd_device &>(*device).set_int_hblank_callback(DEVCB_##_devcb);
#define MCFG_GBA_LCD_INT_VBLANK(_devcb) \
- devcb = &downcast<gba_lcd_device &>(*device).set_int_vblank_callback(DEVCB_##_devcb);
+ downcast<gba_lcd_device &>(*device).set_int_vblank_callback(DEVCB_##_devcb);
#define MCFG_GBA_LCD_INT_VCOUNT(_devcb) \
- devcb = &downcast<gba_lcd_device &>(*device).set_int_vcount_callback(DEVCB_##_devcb);
+ downcast<gba_lcd_device &>(*device).set_int_vcount_callback(DEVCB_##_devcb);
#define MCFG_GBA_LCD_DMA_HBLANK(_devcb) \
- devcb = &downcast<gba_lcd_device &>(*device).set_dma_hblank_callback(DEVCB_##_devcb);
+ downcast<gba_lcd_device &>(*device).set_dma_hblank_callback(DEVCB_##_devcb);
#define MCFG_GBA_LCD_DMA_VBLANK(_devcb) \
- devcb = &downcast<gba_lcd_device &>(*device).set_dma_vblank_callback(DEVCB_##_devcb);
+ downcast<gba_lcd_device &>(*device).set_dma_vblank_callback(DEVCB_##_devcb);
//**************************************************************************
diff --git a/src/devices/video/hd44352.h b/src/devices/video/hd44352.h
index ce12d9bc1cb..1dc67eca7f5 100644
--- a/src/devices/video/hd44352.h
+++ b/src/devices/video/hd44352.h
@@ -13,7 +13,7 @@
#define MCFG_HD44352_ON_CB(_devcb) \
- devcb = &downcast<hd44352_device &>(*device).set_on_callback(DEVCB_##_devcb);
+ downcast<hd44352_device &>(*device).set_on_callback(DEVCB_##_devcb);
//**************************************************************************
diff --git a/src/devices/video/hd61830.h b/src/devices/video/hd61830.h
index 0c14b9f8482..ab4278f9d89 100644
--- a/src/devices/video/hd61830.h
+++ b/src/devices/video/hd61830.h
@@ -19,7 +19,7 @@
//**************************************************************************
#define MCFG_HD61830_RD_CALLBACK(_read) \
- devcb = &downcast<hd61830_device &>(*device).set_rd_rd_callback(DEVCB_##_read);
+ downcast<hd61830_device &>(*device).set_rd_rd_callback(DEVCB_##_read);
diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h
index 0f4e1444a93..898cf93ab1e 100644
--- a/src/devices/video/hlcd0515.h
+++ b/src/devices/video/hlcd0515.h
@@ -43,11 +43,11 @@
// COL/ROW pins (offset for ROW)
#define MCFG_HLCD0515_WRITE_COLS_CB(_devcb) \
- devcb = &downcast<hlcd0515_device &>(*device).set_write_cols_callback(DEVCB_##_devcb);
+ downcast<hlcd0515_device &>(*device).set_write_cols_callback(DEVCB_##_devcb);
// DATA OUT pin, don't use on HLCD0569
#define MCFG_HLCD0515_WRITE_DATA_CB(_devcb) \
- devcb = &downcast<hlcd0515_device &>(*device).set_write_data_callback(DEVCB_##_devcb);
+ downcast<hlcd0515_device &>(*device).set_write_data_callback(DEVCB_##_devcb);
class hlcd0515_device : public device_t
diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h
index e84a5387e22..8751020860f 100644
--- a/src/devices/video/hlcd0538.h
+++ b/src/devices/video/hlcd0538.h
@@ -42,11 +42,11 @@
// C/R pins (0538: d0-d7 for rows)
#define MCFG_HLCD0538_WRITE_COLS_CB(_devcb) \
- devcb = &downcast<hlcd0538_device &>(*device).set_write_cols_callback(DEVCB_##_devcb);
+ downcast<hlcd0538_device &>(*device).set_write_cols_callback(DEVCB_##_devcb);
// INTERRUPT pin
#define MCFG_HLCD0538_INTERRUPT_CB(_devcb) \
- devcb = &downcast<hlcd0538_device &>(*device).set_write_interrupt_callback(DEVCB_##_devcb);
+ downcast<hlcd0538_device &>(*device).set_write_interrupt_callback(DEVCB_##_devcb);
class hlcd0538_device : public device_t
diff --git a/src/devices/video/huc6202.h b/src/devices/video/huc6202.h
index cc086350647..a3e1a47b519 100644
--- a/src/devices/video/huc6202.h
+++ b/src/devices/video/huc6202.h
@@ -13,40 +13,40 @@
#define MCFG_HUC6202_NEXT_PIXEL_0_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_next_pixel_0_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_next_pixel_0_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_TIME_TIL_NEXT_EVENT_0_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_time_til_next_event_0_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_time_til_next_event_0_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_VSYNC_CHANGED_0_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_vsync_changed_0_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_vsync_changed_0_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_HSYNC_CHANGED_0_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_hsync_changed_0_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_hsync_changed_0_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_READ_0_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_read_0_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_read_0_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_WRITE_0_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_write_0_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_write_0_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_NEXT_PIXEL_1_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_next_pixel_1_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_next_pixel_1_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_TIME_TIL_NEXT_EVENT_1_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_time_til_next_event_1_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_time_til_next_event_1_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_VSYNC_CHANGED_1_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_vsync_changed_1_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_vsync_changed_1_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_HSYNC_CHANGED_1_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_hsync_changed_1_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_hsync_changed_1_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_READ_1_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_read_1_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_read_1_callback(DEVCB_##_devcb);
#define MCFG_HUC6202_WRITE_1_CB(_devcb) \
- devcb = &downcast<huc6202_device &>(*device).set_write_1_callback(DEVCB_##_devcb);
+ downcast<huc6202_device &>(*device).set_write_1_callback(DEVCB_##_devcb);
class huc6202_device : public device_t
diff --git a/src/devices/video/huc6260.h b/src/devices/video/huc6260.h
index c3c6159fec7..1e97e258146 100644
--- a/src/devices/video/huc6260.h
+++ b/src/devices/video/huc6260.h
@@ -13,16 +13,16 @@
#define MCFG_HUC6260_NEXT_PIXEL_DATA_CB(_devcb) \
- devcb = &downcast<huc6260_device &>(*device).set_next_pixel_data_callback(DEVCB_##_devcb);
+ downcast<huc6260_device &>(*device).set_next_pixel_data_callback(DEVCB_##_devcb);
#define MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(_devcb) \
- devcb = &downcast<huc6260_device &>(*device).set_time_til_next_event_callback(DEVCB_##_devcb);
+ downcast<huc6260_device &>(*device).set_time_til_next_event_callback(DEVCB_##_devcb);
#define MCFG_HUC6260_VSYNC_CHANGED_CB(_devcb) \
- devcb = &downcast<huc6260_device &>(*device).set_vsync_changed_callback(DEVCB_##_devcb);
+ downcast<huc6260_device &>(*device).set_vsync_changed_callback(DEVCB_##_devcb);
#define MCFG_HUC6260_HSYNC_CHANGED_CB(_devcb) \
- devcb = &downcast<huc6260_device &>(*device).set_hsync_changed_callback(DEVCB_##_devcb);
+ downcast<huc6260_device &>(*device).set_hsync_changed_callback(DEVCB_##_devcb);
class huc6260_device : public device_t,
diff --git a/src/devices/video/huc6270.h b/src/devices/video/huc6270.h
index 5d933129bba..77c15515175 100644
--- a/src/devices/video/huc6270.h
+++ b/src/devices/video/huc6270.h
@@ -16,7 +16,7 @@
downcast<huc6270_device &>(*device).set_vram_size(_size);
#define MCFG_HUC6270_IRQ_CHANGED_CB(_devcb) \
- devcb = &downcast<huc6270_device &>(*device).set_irq_changed_callback(DEVCB_##_devcb);
+ downcast<huc6270_device &>(*device).set_irq_changed_callback(DEVCB_##_devcb);
class huc6270_device : public device_t
{
diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h
index 0ceaeb18b9e..474c424373b 100644
--- a/src/devices/video/huc6272.h
+++ b/src/devices/video/huc6272.h
@@ -21,7 +21,7 @@
//**************************************************************************
#define MCFG_HUC6272_IRQ_CHANGED_CB(cb) \
- devcb = &downcast<huc6272_device &>(*device).set_irq_changed_callback((DEVCB_##cb));
+ downcast<huc6272_device &>(*device).set_irq_changed_callback((DEVCB_##cb));
#define MCFG_HUC6272_RAINBOW(tag) \
downcast<huc6272_device &>(*device).set_rainbow_tag((tag));
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index f1583129cc2..0e8fd60159e 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -26,9 +26,9 @@
MCFG_I8244_IRQ_CB(_irq_cb) \
MCFG_I8244_POSTPROCESS_CB(_postprocess_cb)
#define MCFG_I8244_IRQ_CB(_devcb) \
- devcb = &downcast<i8244_device &>(*device).set_irq_cb(DEVCB_##_devcb);
+ downcast<i8244_device &>(*device).set_irq_cb(DEVCB_##_devcb);
#define MCFG_I8244_POSTPROCESS_CB(_devcb) \
- devcb = &downcast<i8244_device &>(*device).set_postprocess_cb(DEVCB_##_devcb);
+ downcast<i8244_device &>(*device).set_postprocess_cb(DEVCB_##_devcb);
#define MCFG_I8245_ADD(_tag, _clock, _screen_tag, _irq_cb, _postprocess_cb) \
MCFG_DEVICE_ADD(_tag, I8245, _clock) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
diff --git a/src/devices/video/i82730.h b/src/devices/video/i82730.h
index 033bd6dc79f..d52e6b1ddbf 100644
--- a/src/devices/video/i82730.h
+++ b/src/devices/video/i82730.h
@@ -24,7 +24,7 @@
downcast<i82730_device &>(*device).set_cpu_tag(_cpu_tag);
#define MCFG_I82730_SINT_HANDLER(_devcb) \
- devcb = &downcast<i82730_device &>(*device).set_sint_handler(DEVCB_##_devcb);
+ downcast<i82730_device &>(*device).set_sint_handler(DEVCB_##_devcb);
#define MCFG_I82730_UPDATE_ROW_CB(_class, _method) \
downcast<i82730_device &>(*device).set_update_row_callback(i82730_device::update_row_delegate(&_class::_method, #_class "::" #_method, this));
diff --git a/src/devices/video/i8275.h b/src/devices/video/i8275.h
index de273f425f4..eb67df2a9c3 100644
--- a/src/devices/video/i8275.h
+++ b/src/devices/video/i8275.h
@@ -48,19 +48,19 @@
downcast<i8275_device &>(*device).set_character_width(_value);
#define MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
- downcast<i8275_device &>(*device).set_display_callback(i8275_device::draw_character_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<i8275_device &>(*device).set_display_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_I8275_DRQ_CALLBACK(_write) \
- devcb = &downcast<i8275_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
+ downcast<i8275_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
#define MCFG_I8275_IRQ_CALLBACK(_write) \
- devcb = &downcast<i8275_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+ downcast<i8275_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
#define MCFG_I8275_HRTC_CALLBACK(_write) \
- devcb = &downcast<i8275_device &>(*device).set_hrtc_wr_callback(DEVCB_##_write);
+ downcast<i8275_device &>(*device).set_hrtc_wr_callback(DEVCB_##_write);
#define MCFG_I8275_VRTC_CALLBACK(_write) \
- devcb = &downcast<i8275_device &>(*device).set_vrtc_wr_callback(DEVCB_##_write);
+ downcast<i8275_device &>(*device).set_vrtc_wr_callback(DEVCB_##_write);
@@ -81,12 +81,16 @@ public:
i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_character_width(int value) { m_hpixels_per_column = value; }
- template <typename Object> void set_display_callback(Object &&cb) { m_display_cb = std::forward<Object>(cb); }
+ template <typename... T> void set_display_callback(T &&... args) { m_display_cb = draw_character_delegate(std::forward<T>(args)...); }
template <class Object> devcb_base &set_drq_wr_callback(Object &&cb) { return m_write_drq.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_hrtc_wr_callback(Object &&cb) { return m_write_hrtc.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_vrtc_wr_callback(Object &&cb) { return m_write_vrtc.set_callback(std::forward<Object>(cb)); }
+ auto drq_wr_callback() { return m_write_drq.bind(); }
+ auto irq_wr_callback() { return m_write_irq.bind(); }
+ auto hrtc_wr_callback() { return m_write_hrtc.bind(); }
+ auto vrtc_wr_callback() { return m_write_vrtc.bind(); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
diff --git a/src/devices/video/imagetek_i4100.h b/src/devices/video/imagetek_i4100.h
index 0394fe1fb32..a7feb88d756 100644
--- a/src/devices/video/imagetek_i4100.h
+++ b/src/devices/video/imagetek_i4100.h
@@ -23,7 +23,7 @@
downcast<imagetek_i4100_device &>(*device).set_gfxdecode_tag(gfxtag);
#define MCFG_I4100_BLITTER_END_CALLBACK(_devcb) \
- devcb = &downcast<imagetek_i4100_device &>(*device).set_blitter_irq_callback(DEVCB_##_devcb);
+ downcast<imagetek_i4100_device &>(*device).set_blitter_irq_callback(DEVCB_##_devcb);
#define MCFG_I4100_TILEMAP_XOFFSETS(_a, _b, _c) \
downcast<imagetek_i4100_device &>(*device).set_tmap_xoffsets(_a, _b, _c);
diff --git a/src/devices/video/mb88303.h b/src/devices/video/mb88303.h
index 058f58f212b..9c088d8d56b 100644
--- a/src/devices/video/mb88303.h
+++ b/src/devices/video/mb88303.h
@@ -32,13 +32,13 @@
//**************************************************************************
#define MCFG_MB88303_VOW_CALLBACK(_write) \
- devcb = &downcast<mb88303_device &>(*device).set_vow_callback(DEVCB_##_write);
+ downcast<mb88303_device &>(*device).set_vow_callback(DEVCB_##_write);
#define MCFG_MB88303_VOBN_CALLBACK(_write) \
- devcb = &downcast<mb88303_device &>(*device).set_vob_n_callback(DEVCB_##_write);
+ downcast<mb88303_device &>(*device).set_vob_n_callback(DEVCB_##_write);
#define MCFG_MB88303_DO_CALLBACK(_write) \
- devcb = &downcast<mb88303_device &>(*device).set_do_callback(DEVCB_##_write);
+ downcast<mb88303_device &>(*device).set_do_callback(DEVCB_##_write);
//**************************************************************************
diff --git a/src/devices/video/mc6845.h b/src/devices/video/mc6845.h
index d590141c102..20bfc24d53e 100644
--- a/src/devices/video/mc6845.h
+++ b/src/devices/video/mc6845.h
@@ -37,31 +37,31 @@
downcast<mc6845_device &>(*device).set_char_width(_pixels);
#define MCFG_MC6845_RECONFIGURE_CB(_class, _method) \
- downcast<mc6845_device &>(*device).set_reconfigure_callback(mc6845_device::reconfigure_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<mc6845_device &>(*device).set_reconfigure_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_MC6845_BEGIN_UPDATE_CB(_class, _method) \
- downcast<mc6845_device &>(*device).set_begin_update_callback(mc6845_device::begin_update_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<mc6845_device &>(*device).set_begin_update_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_MC6845_UPDATE_ROW_CB(_class, _method) \
- downcast<mc6845_device &>(*device).set_update_row_callback(mc6845_device::update_row_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<mc6845_device &>(*device).set_update_row_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_MC6845_END_UPDATE_CB(_class, _method) \
- downcast<mc6845_device &>(*device).set_end_update_callback(mc6845_device::end_update_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<mc6845_device &>(*device).set_end_update_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_MC6845_ADDR_CHANGED_CB(_class, _method) \
- downcast<mc6845_device &>(*device).set_on_update_addr_change_callback(mc6845_device::on_update_addr_changed_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<mc6845_device &>(*device).set_on_update_addr_change_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_MC6845_OUT_DE_CB(_write) \
- devcb = &downcast<mc6845_device &>(*device).set_out_de_callback(DEVCB_##_write);
+ downcast<mc6845_device &>(*device).set_out_de_callback(DEVCB_##_write);
#define MCFG_MC6845_OUT_CUR_CB(_write) \
- devcb = &downcast<mc6845_device &>(*device).set_out_cur_callback(DEVCB_##_write);
+ downcast<mc6845_device &>(*device).set_out_cur_callback(DEVCB_##_write);
#define MCFG_MC6845_OUT_HSYNC_CB(_write) \
- devcb = &downcast<mc6845_device &>(*device).set_out_hsync_callback(DEVCB_##_write);
+ downcast<mc6845_device &>(*device).set_out_hsync_callback(DEVCB_##_write);
#define MCFG_MC6845_OUT_VSYNC_CB(_write) \
- devcb = &downcast<mc6845_device &>(*device).set_out_vsync_callback(DEVCB_##_write);
+ downcast<mc6845_device &>(*device).set_out_vsync_callback(DEVCB_##_write);
/* callback definitions */
@@ -101,16 +101,20 @@ public:
}
void set_char_width(int pixels) { m_hpixels_per_column = pixels; }
- template <typename Object> void set_reconfigure_callback(Object &&cb) { m_reconfigure_cb = std::forward<Object>(cb); }
- template <typename Object> void set_begin_update_callback(Object &&cb) { m_begin_update_cb = std::forward<Object>(cb); }
- template <typename Object> void set_update_row_callback(Object &&cb) { m_update_row_cb = std::forward<Object>(cb); }
- template <typename Object> void set_end_update_callback(Object &&cb) { m_end_update_cb = std::forward<Object>(cb); }
- template <typename Object> void set_on_update_addr_change_callback(Object &&cb) { m_on_update_addr_changed_cb = std::forward<Object>(cb); }
+ template <typename... T> void set_reconfigure_callback(T &&... args) { m_reconfigure_cb = reconfigure_delegate(std::forward<T>(args)...); }
+ template <typename... T> void set_begin_update_callback(T &&... args) { m_begin_update_cb = begin_update_delegate(std::forward<T>(args)...); }
+ template <typename... T> void set_update_row_callback(T &&... args) { m_update_row_cb = update_row_delegate(std::forward<T>(args)...); }
+ template <typename... T> void set_end_update_callback(T &&... args) { m_end_update_cb = end_update_delegate(std::forward<T>(args)...); }
+ template <typename... T> void set_on_update_addr_change_callback(T &&... args) { m_on_update_addr_changed_cb = on_update_addr_changed_delegate(std::forward<T>(args)...); }
template <class Object> devcb_base &set_out_de_callback(Object &&cb) { return m_out_de_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_cur_callback(Object &&cb) { return m_out_cur_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_hsync_callback(Object &&cb) { return m_out_hsync_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_vsync_callback(Object &&cb) { return m_out_vsync_cb.set_callback(std::forward<Object>(cb)); }
+ auto out_de_callback() { return m_out_de_cb.bind(); }
+ auto out_cur_callback() { return m_out_cur_cb.bind(); }
+ auto out_hsync_callback() { return m_out_hsync_cb.bind(); }
+ auto out_vsync_callback() { return m_out_vsync_cb.bind(); }
/* select one of the registers for reading or writing */
DECLARE_WRITE8_MEMBER( address_w ) { write_address(data); }
diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h
index 4cbe7be2e9e..763ef0c65f5 100644
--- a/src/devices/video/mc6847.h
+++ b/src/devices/video/mc6847.h
@@ -36,16 +36,16 @@
MCFG_SCREEN_VBLANK_TIME(0)
#define MCFG_MC6847_HSYNC_CALLBACK(_write) \
- devcb = &downcast<mc6847_friend_device &>(*device).set_hsync_wr_callback(DEVCB_##_write);
+ downcast<mc6847_friend_device &>(*device).set_hsync_wr_callback(DEVCB_##_write);
#define MCFG_MC6847_FSYNC_CALLBACK(_write) \
- devcb = &downcast<mc6847_friend_device &>(*device).set_fsync_wr_callback(DEVCB_##_write);
+ downcast<mc6847_friend_device &>(*device).set_fsync_wr_callback(DEVCB_##_write);
#define MCFG_MC6847_CHARROM_CALLBACK(_class, _method) \
downcast<mc6847_friend_device &>(*device).set_get_char_rom(mc6847_friend_device::get_char_rom_delegate(&_class::_method, #_class "::" #_method, this));
#define MCFG_MC6847_INPUT_CALLBACK(_read) \
- devcb = &downcast<mc6847_base_device &>(*device).set_input_callback(DEVCB_##_read);
+ downcast<mc6847_base_device &>(*device).set_input_callback(DEVCB_##_read);
#define MCFG_MC6847_FIXED_MODE(_mode) \
downcast<mc6847_base_device &>(*device).set_get_fixed_mode(_mode);
@@ -88,6 +88,8 @@ public:
template <class Object> devcb_base &set_hsync_wr_callback(Object &&cb) { return m_write_hsync.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_fsync_wr_callback(Object &&cb) { return m_write_fsync.set_callback(std::forward<Object>(cb)); }
+ auto hsync_wr_callback() { return m_write_hsync.bind(); }
+ auto fsync_wr_callback() { return m_write_fsync.bind(); }
template <typename Object> void set_get_char_rom(Object &&cb) { m_charrom_cb = std::forward<Object>(cb); }
@@ -512,6 +514,7 @@ class mc6847_base_device : public mc6847_friend_device
{
public:
template <class Object> devcb_base &set_input_callback(Object &&cb) { return m_input_cb.set_callback(std::forward<Object>(cb)); }
+ auto input_callback() { return m_input_cb.bind(); }
void set_get_fixed_mode(uint8_t mode) { m_fixed_mode = mode; }
void set_black_and_white(bool bw) { m_black_and_white = bw; }
diff --git a/src/devices/video/mos6566.h b/src/devices/video/mos6566.h
index 56e106022db..1cbeed1f759 100644
--- a/src/devices/video/mos6566.h
+++ b/src/devices/video/mos6566.h
@@ -93,16 +93,16 @@
downcast<mos6566_device &>(*device).set_cpu_tag(_tag);
#define MCFG_MOS6566_IRQ_CALLBACK(_write) \
- devcb = &downcast<mos6566_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+ downcast<mos6566_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
#define MCFG_MOS6566_BA_CALLBACK(_write) \
- devcb = &downcast<mos6566_device &>(*device).set_ba_wr_callback(DEVCB_##_write);
+ downcast<mos6566_device &>(*device).set_ba_wr_callback(DEVCB_##_write);
#define MCFG_MOS6566_AEC_CALLBACK(_write) \
- devcb = &downcast<mos6566_device &>(*device).set_aec_wr_callback(DEVCB_##_write);
+ downcast<mos6566_device &>(*device).set_aec_wr_callback(DEVCB_##_write);
#define MCFG_MOS8564_K_CALLBACK(_write) \
- devcb = &downcast<mos6566_device &>(*device).set_k_wr_callback(DEVCB_##_write);
+ downcast<mos6566_device &>(*device).set_k_wr_callback(DEVCB_##_write);
diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h
index 4160394bd32..2d12e243db6 100644
--- a/src/devices/video/ppu2c0x.h
+++ b/src/devices/video/ppu2c0x.h
@@ -107,6 +107,7 @@ public:
void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
template <typename Object> devcb_base &set_int_callback(Object &&cb) { return m_int_callback.set_callback(std::forward<Object>(cb)); }
+ auto int_callback() { return m_int_callback.bind(); }
/* routines */
virtual void init_palette();
diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h
index 15fe349ddcd..840b3b3449a 100644
--- a/src/devices/video/ppu2c0x_vt.h
+++ b/src/devices/video/ppu2c0x_vt.h
@@ -20,10 +20,10 @@
MCFG_PPU2C0X_ADD(_tag, PPU_VT03)
#define MCFG_PPU_VT03_READ_BG_CB(_devcb) \
- devcb = &downcast<ppu_vt03_device &>(*device).set_read_bg_callback(DEVCB_##_devcb);
+ downcast<ppu_vt03_device &>(*device).set_read_bg_callback(DEVCB_##_devcb);
#define MCFG_PPU_VT03_READ_SP_CB(_devcb) \
- devcb = &downcast<ppu_vt03_device &>(*device).set_read_sp_callback(DEVCB_##_devcb);
+ downcast<ppu_vt03_device &>(*device).set_read_sp_callback(DEVCB_##_devcb);
#define MCFG_PPU_VT03_MODIFY MCFG_DEVICE_MODIFY
diff --git a/src/devices/video/psx.h b/src/devices/video/psx.h
index 489f3508cfe..9693f390223 100644
--- a/src/devices/video/psx.h
+++ b/src/devices/video/psx.h
@@ -18,7 +18,7 @@
#define MCFG_PSX_GPU_VBLANK_HANDLER(_devcb) \
- devcb = &downcast<psxgpu_device &>(*device).set_vblank_handler(DEVCB_##_devcb);
+ downcast<psxgpu_device &>(*device).set_vblank_handler(DEVCB_##_devcb);
#define MCFG_PSXGPU_ADD( cputag, tag, type, _vramSize, clock ) \
MCFG_DEVICE_MODIFY( cputag ) \
diff --git a/src/devices/video/saa5050.h b/src/devices/video/saa5050.h
index a99183e5f04..532e715eeff 100644
--- a/src/devices/video/saa5050.h
+++ b/src/devices/video/saa5050.h
@@ -36,7 +36,7 @@
//**************************************************************************
#define MCFG_SAA5050_D_CALLBACK(_read) \
- devcb = &downcast<saa5050_device &>(*device).set_d_rd_callback(DEVCB_##_read);
+ downcast<saa5050_device &>(*device).set_d_rd_callback(DEVCB_##_read);
#define MCFG_SAA5050_SCREEN_SIZE(_cols, _rows, _size) \
diff --git a/src/devices/video/scn2674.h b/src/devices/video/scn2674.h
index 047381e5083..0b76532e4bc 100644
--- a/src/devices/video/scn2674.h
+++ b/src/devices/video/scn2674.h
@@ -7,7 +7,7 @@
#define MCFG_SCN2672_INTR_CALLBACK(_intr) \
- devcb = &downcast<scn2672_device &>(*device).set_intr_callback(DEVCB_##_intr);
+ downcast<scn2672_device &>(*device).set_intr_callback(DEVCB_##_intr);
#define MCFG_SCN2672_CHARACTER_WIDTH(_value) \
downcast<scn2672_device &>(*device).set_character_width(_value);
@@ -19,7 +19,7 @@
#define MCFG_SCN2674_INTR_CALLBACK(_intr) \
- devcb = &downcast<scn2674_device &>(*device).set_intr_callback(DEVCB_##_intr);
+ downcast<scn2674_device &>(*device).set_intr_callback(DEVCB_##_intr);
#define MCFG_SCN2674_CHARACTER_WIDTH(_value) \
downcast<scn2674_device &>(*device).set_character_width(_value);
diff --git a/src/devices/video/snes_ppu.h b/src/devices/video/snes_ppu.h
index 0fddff1a44f..baab1e264b1 100644
--- a/src/devices/video/snes_ppu.h
+++ b/src/devices/video/snes_ppu.h
@@ -44,7 +44,7 @@ public:
snes_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration helpers
- template <class Object> devcb_base &set_open_bus_callback(Object &&cb) { return m_openbus_cb.set_callback(std::forward<Object>(cb)); }
+ auto open_bus_callback() { return m_openbus_cb.bind(); }
void refresh_scanline(bitmap_rgb32 &bitmap, uint16_t curline);
@@ -314,11 +314,4 @@ private:
DECLARE_DEVICE_TYPE(SNES_PPU, snes_ppu_device)
-/***************************************************************************
- INTERFACE CONFIGURATION MACROS
- ***************************************************************************/
-
-#define MCFG_SNES_PPU_OPENBUS_CB(_read) \
- devcb = &downcast<snes_ppu_device &>(*device).set_open_bus_callback(DEVCB_##_read);
-
#endif // MAME_VIDEO_SNES_PPU_H
diff --git a/src/devices/video/tms34061.h b/src/devices/video/tms34061.h
index c00c8547965..f4f674b1083 100644
--- a/src/devices/video/tms34061.h
+++ b/src/devices/video/tms34061.h
@@ -22,7 +22,7 @@
downcast<tms34061_device &>(*device).set_vram_size(_size);
#define MCFG_TMS34061_INTERRUPT_CB(_devcb) \
- devcb = &downcast<tms34061_device &>(*device).set_interrupt_callback(DEVCB_##_devcb);
+ downcast<tms34061_device &>(*device).set_interrupt_callback(DEVCB_##_devcb);
diff --git a/src/devices/video/tms9927.h b/src/devices/video/tms9927.h
index 9ee746bc522..e373ae89ffe 100644
--- a/src/devices/video/tms9927.h
+++ b/src/devices/video/tms9927.h
@@ -11,10 +11,10 @@
#define MCFG_TMS9927_VSYN_CALLBACK(_write) \
- devcb = &downcast<tms9927_device &>(*device).set_vsyn_wr_callback(DEVCB_##_write);
+ downcast<tms9927_device &>(*device).set_vsyn_wr_callback(DEVCB_##_write);
#define MCFG_TMS9927_HSYN_CALLBACK(_write) \
- devcb = &downcast<tms9927_device &>(*device).set_hsyn_wr_callback(DEVCB_##_write);
+ downcast<tms9927_device &>(*device).set_hsyn_wr_callback(DEVCB_##_write);
#define MCFG_TMS9927_CHAR_WIDTH(_pixels) \
downcast<tms9927_device &>(*device).set_char_width(_pixels);
@@ -32,6 +32,8 @@ public:
template <class Object> devcb_base &set_vsyn_wr_callback(Object &&cb) { return m_write_vsyn.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_hsyn_wr_callback(Object &&cb) { return m_write_hsyn.set_callback(std::forward<Object>(cb)); }
+ auto vsyn_wr_callback() { return m_write_vsyn.bind(); }
+ auto hsyn_wr_callback() { return m_write_hsyn.bind(); }
void set_char_width(int pixels) { m_hpixels_per_column = pixels; }
void set_region_tag(const char *tag) { m_selfload.set_tag(tag); }
diff --git a/src/devices/video/tms9928a.h b/src/devices/video/tms9928a.h
index d5dcfca7347..455fce7fc90 100644
--- a/src/devices/video/tms9928a.h
+++ b/src/devices/video/tms9928a.h
@@ -37,12 +37,12 @@
downcast<tms9928a_device &>(*device).set_vram_size(_size);
#define MCFG_TMS9928A_OUT_INT_LINE_CB(_devcb) \
- devcb = &downcast<tms9928a_device &>(*device).set_out_int_line_callback(DEVCB_##_devcb);
+ downcast<tms9928a_device &>(*device).set_out_int_line_callback(DEVCB_##_devcb);
#define MCFG_TMS9928A_SET_SCREEN MCFG_VIDEO_SET_SCREEN
#define MCFG_TMS9928A_OUT_GROMCLK_CB(_devcb) \
- devcb = &downcast<tms9928a_device &>(*device).set_out_gromclk_callback(DEVCB_##_devcb);
+ downcast<tms9928a_device &>(*device).set_out_gromclk_callback(DEVCB_##_devcb);
#define MCFG_TMS9928A_SCREEN_ADD_NTSC(_screen_tag) \
@@ -92,6 +92,8 @@ public:
void set_vram_size(int vram_size) { m_vram_size = vram_size; }
template <class Object> devcb_base &set_out_int_line_callback(Object &&cb) { return m_out_int_line_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_gromclk_callback(Object &&cb) { return m_out_gromclk_cb.set_callback(std::forward<Object>(cb)); }
+ auto out_int_line_callback() { return m_out_int_line_cb.bind(); }
+ auto out_gromclk_callback() { return m_out_gromclk_cb.bind(); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
diff --git a/src/devices/video/upd3301.h b/src/devices/video/upd3301.h
index 40deb120e05..554df8189b5 100644
--- a/src/devices/video/upd3301.h
+++ b/src/devices/video/upd3301.h
@@ -47,19 +47,19 @@
downcast<upd3301_device &>(*device).set_character_width(_value);
#define MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
- downcast<upd3301_device &>(*device).set_display_callback(upd3301_device::draw_character_delegate(&_class::_method, #_class "::" #_method, this));
+ downcast<upd3301_device &>(*device).set_display_callback(&_class::_method, #_class "::" #_method, this);
#define MCFG_UPD3301_DRQ_CALLBACK(_write) \
- devcb = &downcast<upd3301_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
+ downcast<upd3301_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
#define MCFG_UPD3301_INT_CALLBACK(_write) \
- devcb = &downcast<upd3301_device &>(*device).set_int_wr_callback(DEVCB_##_write);
+ downcast<upd3301_device &>(*device).set_int_wr_callback(DEVCB_##_write);
#define MCFG_UPD3301_HRTC_CALLBACK(_write) \
- devcb = &downcast<upd3301_device &>(*device).set_hrtc_wr_callback(DEVCB_##_write);
+ downcast<upd3301_device &>(*device).set_hrtc_wr_callback(DEVCB_##_write);
#define MCFG_UPD3301_VRTC_CALLBACK(_write) \
- devcb = &downcast<upd3301_device &>(*device).set_vrtc_wr_callback(DEVCB_##_write);
+ downcast<upd3301_device &>(*device).set_vrtc_wr_callback(DEVCB_##_write);
@@ -80,12 +80,16 @@ public:
upd3301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_character_width(int value) { m_width = value; }
- template <typename Object> void set_display_callback(Object &&cb) { m_display_cb = std::forward<Object>(cb); }
+ template <typename... T> void set_display_callback(T &&... args) { m_display_cb = draw_character_delegate(std::forward<T>(args)...); }
template <class Object> devcb_base &set_drq_wr_callback(Object &&cb) { return m_write_drq.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_int_wr_callback(Object &&cb) { return m_write_int.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_hrtc_wr_callback(Object &&cb) { return m_write_hrtc.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_vrtc_wr_callback(Object &&cb) { return m_write_vrtc.set_callback(std::forward<Object>(cb)); }
+ auto drq_wr_callback() { return m_write_drq.bind(); }
+ auto int_wr_callback() { return m_write_int.bind(); }
+ auto hrtc_wr_callback() { return m_write_hrtc.bind(); }
+ auto vrtc_wr_callback() { return m_write_vrtc.bind(); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
diff --git a/src/devices/video/upd7220.h b/src/devices/video/upd7220.h
index 692aeb09024..4ea2706a22b 100644
--- a/src/devices/video/upd7220.h
+++ b/src/devices/video/upd7220.h
@@ -51,16 +51,16 @@
downcast<upd7220_device &>(*device).set_draw_text_callback(upd7220_device::draw_text_delegate(&_class::_method, #_class "::" #_method, this));
#define MCFG_UPD7220_DRQ_CALLBACK(_write) \
- devcb = &downcast<upd7220_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
+ downcast<upd7220_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
#define MCFG_UPD7220_HSYNC_CALLBACK(_write) \
- devcb = &downcast<upd7220_device &>(*device).set_hsync_wr_callback(DEVCB_##_write);
+ downcast<upd7220_device &>(*device).set_hsync_wr_callback(DEVCB_##_write);
#define MCFG_UPD7220_VSYNC_CALLBACK(_write) \
- devcb = &downcast<upd7220_device &>(*device).set_vsync_wr_callback(DEVCB_##_write);
+ downcast<upd7220_device &>(*device).set_vsync_wr_callback(DEVCB_##_write);
#define MCFG_UPD7220_BLANK_CALLBACK(_write) \
- devcb = &downcast<upd7220_device &>(*device).set_blank_wr_callback(DEVCB_##_write);
+ downcast<upd7220_device &>(*device).set_blank_wr_callback(DEVCB_##_write);
diff --git a/src/devices/video/v9938.h b/src/devices/video/v9938.h
index cbc5e0364a2..2b70f6948ac 100644
--- a/src/devices/video/v9938.h
+++ b/src/devices/video/v9938.h
@@ -50,7 +50,7 @@
MCFG_SCREEN_UPDATE_DEVICE(_v9938_tag, v9938_device, screen_update)
#define MCFG_V99X8_INTERRUPT_CALLBACK(_irq) \
- devcb = &downcast<v99x8_device *>(device)->set_interrupt_callback(DEVCB_##_irq);
+ downcast<v99x8_device *>(device)->set_interrupt_callback(DEVCB_##_irq);
//**************************************************************************
diff --git a/src/devices/video/vic4567.h b/src/devices/video/vic4567.h
index 1e357028eac..e680a3ff0cf 100644
--- a/src/devices/video/vic4567.h
+++ b/src/devices/video/vic4567.h
@@ -244,27 +244,27 @@ DECLARE_DEVICE_TYPE(VIC3, vic3_device)
downcast<vic3_device &>(*device).set_vic3_type((vic3_device::vic3_type::type));
#define MCFG_VIC3_DMA_READ_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_dma_read_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_dma_read_callback((DEVCB_##cb));
#define MCFG_VIC3_DMA_READ_COLOR_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_dma_read_color_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_dma_read_color_callback((DEVCB_##cb));
#define MCFG_VIC3_INTERRUPT_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_interrupt_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_interrupt_callback((DEVCB_##cb));
#define MCFG_VIC3_PORT_CHANGED_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_port_changed_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_port_changed_callback((DEVCB_##cb));
#define MCFG_VIC3_LIGHTPEN_BUTTON_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_lightpen_button_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_lightpen_button_callback((DEVCB_##cb));
#define MCFG_VIC3_LIGHTPEN_X_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_lightpen_x_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_lightpen_x_callback((DEVCB_##cb));
#define MCFG_VIC3_LIGHTPEN_Y_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_lightpen_y_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_lightpen_y_callback((DEVCB_##cb));
#define MCFG_VIC3_C64_MEM_R_CB(cb) \
- devcb = &downcast<vic3_device &>(*device).set_c64_mem_r_callback((DEVCB_##cb));
+ downcast<vic3_device &>(*device).set_c64_mem_r_callback((DEVCB_##cb));
#endif // MAME_VIDEO_VIC4567_H
diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h
index 87cb23b5ede..fff744bd671 100644
--- a/src/devices/video/voodoo.h
+++ b/src/devices/video/voodoo.h
@@ -1447,13 +1447,13 @@ enum
downcast<voodoo_device &>(*device).set_cpu_tag(_tag);
#define MCFG_VOODOO_VBLANK_CB(_devcb) \
- devcb = &downcast<voodoo_device &>(*device).set_vblank_callback(DEVCB_##_devcb);
+ downcast<voodoo_device &>(*device).set_vblank_callback(DEVCB_##_devcb);
#define MCFG_VOODOO_STALL_CB(_devcb) \
- devcb = &downcast<voodoo_device &>(*device).set_stall_callback(DEVCB_##_devcb);
+ downcast<voodoo_device &>(*device).set_stall_callback(DEVCB_##_devcb);
#define MCFG_VOODOO_PCIINT_CB(_devcb) \
- devcb = &downcast<voodoo_device &>(*device).set_pciint_callback(DEVCB_##_devcb);
+ downcast<voodoo_device &>(*device).set_pciint_callback(DEVCB_##_devcb);
/***************************************************************************
FUNCTION PROTOTYPES
diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h
index bfd2cb4cdc2..a699f02f18c 100644
--- a/src/devices/video/zeus2.h
+++ b/src/devices/video/zeus2.h
@@ -102,10 +102,10 @@ typedef zeus2_renderer::extent_t z2_poly_extent;
* Zeus2 Video Device
*************************************/
#define MCFG_ZEUS2_VBLANK_CB(_devcb) \
- devcb = &downcast<zeus2_device &>(*device).set_vblank_callback(DEVCB_##_devcb);
+ downcast<zeus2_device &>(*device).set_vblank_callback(DEVCB_##_devcb);
#define MCFG_ZEUS2_IRQ_CB(_devcb) \
- devcb = &downcast<zeus2_device &>(*device).set_irq_callback(DEVCB_##_devcb);
+ downcast<zeus2_device &>(*device).set_irq_callback(DEVCB_##_devcb);
#define MCFG_ZEUS2_FLOAT_MODE(_mode) \
downcast<zeus2_device *>(device)->set_float_mode(_mode);