diff --git a/src/devices/machine/tms9914.h b/src/devices/machine/tms9914.h index 08b413af2d9..14df9d80647 100644 --- a/src/devices/machine/tms9914.h +++ b/src/devices/machine/tms9914.h @@ -35,44 +35,6 @@ #pragma once -// Set read and write callbacks to access DIO bus on IEEE-488 -#define MCFG_TMS9914_DIO_READWRITE_CB(_read , _write) \ - downcast(*device).set_dio_read_cb(DEVCB_##_read); \ - downcast(*device).set_dio_write_cb(DEVCB_##_write); - -// Set write callbacks to access uniline signals on IEEE-488 -#define MCFG_TMS9914_EOI_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_EOI , DEVCB_##_write); - -#define MCFG_TMS9914_DAV_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_DAV , DEVCB_##_write); - -#define MCFG_TMS9914_NRFD_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_NRFD , DEVCB_##_write); - -#define MCFG_TMS9914_NDAC_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_NDAC , DEVCB_##_write); - -#define MCFG_TMS9914_IFC_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_IFC , DEVCB_##_write); - -#define MCFG_TMS9914_SRQ_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_SRQ , DEVCB_##_write); - -#define MCFG_TMS9914_ATN_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_ATN , DEVCB_##_write); - -#define MCFG_TMS9914_REN_WRITE_CB(_write) \ - downcast(*device).set_488_signal_write_cb(tms9914_device::IEEE_488_REN , DEVCB_##_write); - -// Set write callback for INT signal -#define MCFG_TMS9914_INT_WRITE_CB(_write) \ - downcast(*device).set_int_write_cb(DEVCB_##_write); - -// Set write callback for ACCRQ signal -#define MCFG_TMS9914_ACCRQ_WRITE_CB(_write) \ - downcast(*device).set_accrq_write_cb(DEVCB_##_write); - class tms9914_device : public device_t { public: @@ -92,23 +54,11 @@ public: IEEE_488_SIGNAL_COUNT }; - template devcb_base& set_dio_read_cb(Object &&cb) - { return m_dio_read_func.set_callback(std::forward(cb)); } - - template devcb_base& set_dio_write_cb(Object &&cb) - { return m_dio_write_func.set_callback(std::forward(cb)); } - - template devcb_base& set_488_signal_write_cb(ieee_488_signal_t signal , Object &&cb) - { return m_signal_wr_fns[ signal ].set_callback(std::forward(cb)); } - - template devcb_base& set_int_write_cb(Object &&cb) - { return m_int_write_func.set_callback(std::forward(cb)); } - - template devcb_base& set_accrq_write_cb(Object &&cb) - { return m_accrq_write_func.set_callback(std::forward(cb)); } - + // Set read and write callbacks to access DIO bus on IEEE-488 auto dio_read_cb() { return m_dio_read_func.bind(); } auto dio_write_cb() { return m_dio_write_func.bind(); } + + // Set write callbacks to access uniline signals on IEEE-488 auto eoi_write_cb() { return m_signal_wr_fns[IEEE_488_EOI].bind(); } auto dav_write_cb() { return m_signal_wr_fns[IEEE_488_DAV].bind(); } auto nrfd_write_cb() { return m_signal_wr_fns[IEEE_488_NRFD].bind(); } @@ -118,7 +68,10 @@ public: auto atn_write_cb() { return m_signal_wr_fns[IEEE_488_ATN].bind(); } auto ren_write_cb() { return m_signal_wr_fns[IEEE_488_REN].bind(); } + // Set write callback for INT signal auto int_write_cb() { return m_int_write_func.bind(); } + + // Set write callback for ACCRQ signal auto accrq_write_cb() { return m_accrq_write_func.bind(); } DECLARE_WRITE_LINE_MEMBER(eoi_w); diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp index 02a19f116fa..8d1d2e12889 100644 --- a/src/mame/drivers/gridcomp.cpp +++ b/src/mame/drivers/gridcomp.cpp @@ -399,17 +399,18 @@ MACHINE_CONFIG_START(gridcomp_state::grid1101) i7220.irq_callback().set(I80130_TAG, FUNC(i80130_device::ir1_w)); i7220.drq_callback().set(I80130_TAG, FUNC(i80130_device::ir1_w)); - MCFG_DEVICE_ADD("hpib", TMS9914, XTAL(4'000'000)) - MCFG_TMS9914_INT_WRITE_CB(WRITELINE(I80130_TAG, i80130_device, ir5_w)) - MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG, ieee488_device, dio_r), WRITE8(IEEE488_TAG, ieee488_device, host_dio_w)) - MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_eoi_w)) - MCFG_TMS9914_DAV_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_dav_w)) - MCFG_TMS9914_NRFD_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_nrfd_w)) - MCFG_TMS9914_NDAC_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ndac_w)) - MCFG_TMS9914_IFC_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ifc_w)) - MCFG_TMS9914_SRQ_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_srq_w)) - MCFG_TMS9914_ATN_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_atn_w)) - MCFG_TMS9914_REN_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ren_w)) + tms9914_device &hpib(TMS9914(config, "hpib", XTAL(4'000'000))); + hpib.int_write_cb().set(I80130_TAG, FUNC(i80130_device::ir5_w)); + hpib.dio_read_cb().set(IEEE488_TAG, FUNC(ieee488_device::dio_r)); + hpib.dio_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dio_w)); + hpib.eoi_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_eoi_w)); + hpib.dav_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dav_w)); + hpib.nrfd_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_nrfd_w)); + hpib.ndac_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ndac_w)); + hpib.ifc_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ifc_w)); + hpib.srq_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_srq_w)); + hpib.atn_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_atn_w)); + hpib.ren_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ren_w)); MCFG_IEEE488_BUS_ADD() MCFG_IEEE488_EOI_CALLBACK(WRITELINE("hpib", tms9914_device, eoi_w)) MCFG_IEEE488_DAV_CALLBACK(WRITELINE("hpib", tms9914_device, dav_w)) diff --git a/src/mame/drivers/hp_ipc.cpp b/src/mame/drivers/hp_ipc.cpp index a4cb3238067..1f67ed30a59 100644 --- a/src/mame/drivers/hp_ipc.cpp +++ b/src/mame/drivers/hp_ipc.cpp @@ -767,17 +767,18 @@ MACHINE_CONFIG_START(hp_ipc_state::hp_ipc_base) mouse.set_default_option("hp_46060b"); mouse.set_hp_hil_slot(this, "mlc"); - MCFG_DEVICE_ADD("hpib", TMS9914, 4_MHz_XTAL) - MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, hp_ipc_state, irq_3)) - MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG , ieee488_device , dio_r) , WRITE8(IEEE488_TAG , ieee488_device , host_dio_w)) - MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_eoi_w)) - MCFG_TMS9914_DAV_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_dav_w)) - MCFG_TMS9914_NRFD_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_nrfd_w)) - MCFG_TMS9914_NDAC_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_ndac_w)) - MCFG_TMS9914_IFC_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_ifc_w)) - MCFG_TMS9914_SRQ_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_srq_w)) - MCFG_TMS9914_ATN_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_atn_w)) - MCFG_TMS9914_REN_WRITE_CB(WRITELINE(IEEE488_TAG , ieee488_device , host_ren_w)) + tms9914_device &hpib(TMS9914(config, "hpib", 4_MHz_XTAL)); + hpib.int_write_cb().set(FUNC(hp_ipc_state::irq_3)); + hpib.dio_read_cb().set(IEEE488_TAG, FUNC(ieee488_device::dio_r)); + hpib.dio_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dio_w)); + hpib.eoi_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_eoi_w)); + hpib.dav_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dav_w)); + hpib.nrfd_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_nrfd_w)); + hpib.ndac_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ndac_w)); + hpib.ifc_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ifc_w)); + hpib.srq_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_srq_w)); + hpib.atn_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_atn_w)); + hpib.ren_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ren_w)); MCFG_IEEE488_BUS_ADD() MCFG_IEEE488_EOI_CALLBACK(WRITELINE("hpib" , tms9914_device , eoi_w)) MCFG_IEEE488_DAV_CALLBACK(WRITELINE("hpib" , tms9914_device , dav_w))