diff options
74 files changed, 399 insertions, 412 deletions
diff --git a/src/devices/bus/cpc/playcity.cpp b/src/devices/bus/cpc/playcity.cpp index 433955b9ba7..160fc1a643b 100644 --- a/src/devices/bus/cpc/playcity.cpp +++ b/src/devices/bus/cpc/playcity.cpp @@ -25,10 +25,10 @@ DEFINE_DEVICE_TYPE(CPC_PLAYCITY, cpc_playcity_device, "cpc_playcity", "PlayCity" // device machine config MACHINE_CONFIG_START(cpc_playcity_device::device_add_mconfig) - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, cpc_playcity_device, ctc_zc1_cb)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("ctc",z80ctc_device, trg3)) - MCFG_Z80CTC_INTR_CB(WRITELINE(*this, cpc_playcity_device, ctc_intr_cb)) + Z80CTC(config, m_ctc, XTAL(4'000'000)); + m_ctc->zc_callback<1>().set(FUNC(cpc_playcity_device::ctc_zc1_cb)); + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); + m_ctc->intr_callback().set(FUNC(cpc_playcity_device::ctc_intr_cb)); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/devices/bus/imi7000/imi5000h.cpp b/src/devices/bus/imi7000/imi5000h.cpp index 26bde60c8ae..6ad104d7b2f 100644 --- a/src/devices/bus/imi7000/imi5000h.cpp +++ b/src/devices/bus/imi7000/imi5000h.cpp @@ -87,7 +87,7 @@ void imi5000h_device::imi5000h_io(address_map &map) map(0x10, 0x10).mirror(0x03); // BEGRDY map(0x14, 0x14).mirror(0x03); // HSXCLR map(0x18, 0x18).mirror(0x03); // XFERSTB - map(0x1c, 0x1f).rw(Z80CTC_TAG, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x1c, 0x1f).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); } @@ -342,17 +342,18 @@ WRITE8_MEMBER( imi5000h_device::pio3_pb_w ) // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(imi5000h_device::device_add_mconfig) +void imi5000h_device::device_add_mconfig(machine_config & config) +{ Z80(config, m_maincpu, XTAL(8'000'000)/2); m_maincpu->set_daisy_config(z80_daisy_chain); m_maincpu->set_addrmap(AS_PROGRAM, &imi5000h_device::imi5000h_mem); m_maincpu->set_addrmap(AS_IO, &imi5000h_device::imi5000h_io); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(8'000'000) / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, imi5000h_device, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, imi5000h_device, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, imi5000h_device, ctc_z2_w)) + Z80CTC(config, m_ctc, XTAL(8'000'000) / 2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(imi5000h_device::ctc_z0_w)); + m_ctc->zc_callback<1>().set(FUNC(imi5000h_device::ctc_z1_w)); + m_ctc->zc_callback<2>().set(FUNC(imi5000h_device::ctc_z2_w)); z80pio_device& pio0(Z80PIO(config, Z80PIO_0_TAG, XTAL(8'000'000)/2)); pio0.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); @@ -379,8 +380,8 @@ MACHINE_CONFIG_START(imi5000h_device::device_add_mconfig) pio3.out_pb_callback().set(FUNC(imi5000h_device::pio3_pb_w)); pio3.out_brdy_callback().set(Z80PIO_3_TAG, FUNC(z80pio_device::strobe_b)); - //MCFG_HARDDISK_ADD("harddisk1") -MACHINE_CONFIG_END + //HARDDISK(config, "harddisk1", 0); +} //------------------------------------------------- diff --git a/src/devices/bus/newbrain/eim.cpp b/src/devices/bus/newbrain/eim.cpp index 038ade80400..592b5c55432 100644 --- a/src/devices/bus/newbrain/eim.cpp +++ b/src/devices/bus/newbrain/eim.cpp @@ -69,10 +69,10 @@ const tiny_rom_entry *newbrain_eim_device::device_rom_region() const MACHINE_CONFIG_START(newbrain_eim_device::device_add_mconfig) // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(16'000'000)/8) - MCFG_Z80CTC_ZC0_CB(WRITELINE(MC6850_TAG, acia6850_device, write_rxc)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(MC6850_TAG, acia6850_device, write_txc)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, newbrain_eim_device, ctc_z2_w)) + Z80CTC(config, m_ctc, XTAL(16'000'000)/8); + m_ctc->zc_callback<0>().set(m_acia, FUNC(acia6850_device::write_rxc)); + m_ctc->zc_callback<1>().set(m_acia, FUNC(acia6850_device::write_txc)); + m_ctc->zc_callback<2>().set(FUNC(newbrain_eim_device::ctc_z2_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_device, ctc_c2_tick, attotime::from_hz(XTAL(16'000'000)/4/13)) diff --git a/src/devices/bus/wangpc/rtc.cpp b/src/devices/bus/wangpc/rtc.cpp index 0b563814726..bdf392f9bed 100644 --- a/src/devices/bus/wangpc/rtc.cpp +++ b/src/devices/bus/wangpc/rtc.cpp @@ -72,7 +72,7 @@ void wangpc_rtc_device::wangpc_rtc_io(address_map &map) map.global_mask(0xff); map(0x00, 0x03).rw(m_sio, FUNC(z80sio0_device::cd_ba_r), FUNC(z80sio0_device::cd_ba_w)); map(0x10, 0x1f).rw(AM9517A_TAG, FUNC(am9517a_device::read), FUNC(am9517a_device::write)); - map(0x20, 0x23).rw(Z80CTC_0_TAG, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x20, 0x23).rw(m_ctc0, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x30, 0x30); //AM_WRITE(clear_char_w) map(0x31, 0x31); //AM_WRITE(set_char_w) map(0x40, 0x40).portr("SW1"); //AM_WRITE(control_w) @@ -83,7 +83,7 @@ void wangpc_rtc_device::wangpc_rtc_io(address_map &map) map(0x51, 0x52); //AM_WRITE(status_w) map(0x54, 0x54); //AM_WRITE(enable_inbound_data_w) map(0x51, 0x52); //AM_WRITE(inbound_data_w) - map(0x60, 0x63).rw(Z80CTC_1_TAG, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x60, 0x63).rw(m_ctc1, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x70, 0x70); //AM_READWRITE(led_toggle_r, odd_parity_w) map(0x71, 0x71); //AM_WRITE(even_parity_w) } @@ -102,10 +102,11 @@ static const z80_daisy_config wangpc_rtc_daisy_chain[] = }; //------------------------------------------------- -// MACHINE_CONFIG_START( wangpc_rtc ) +// device_add_mconfig //------------------------------------------------- -MACHINE_CONFIG_START(wangpc_rtc_device::device_add_mconfig) +void wangpc_rtc_device::device_add_mconfig(machine_config &config) +{ Z80(config, m_maincpu, 2000000); m_maincpu->set_daisy_config(wangpc_rtc_daisy_chain); m_maincpu->set_addrmap(AS_PROGRAM, &wangpc_rtc_device::wangpc_rtc_mem); @@ -113,15 +114,15 @@ MACHINE_CONFIG_START(wangpc_rtc_device::device_add_mconfig) AM9517A(config, m_dmac, 2000000); - MCFG_DEVICE_ADD(Z80CTC_0_TAG, Z80CTC, 2000000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc0, 2000000); + m_ctc0->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(Z80CTC_1_TAG, Z80CTC, 2000000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc1, 2000000); + m_ctc1->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); Z80SIO0(config, m_sio, 2000000); m_sio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); -MACHINE_CONFIG_END +} //------------------------------------------------- diff --git a/src/devices/bus/wangpc/wdc.cpp b/src/devices/bus/wangpc/wdc.cpp index 353d8a1fc62..6dd36b7d545 100644 --- a/src/devices/bus/wangpc/wdc.cpp +++ b/src/devices/bus/wangpc/wdc.cpp @@ -92,17 +92,18 @@ void wangpc_wdc_device::wangpc_wdc_io(address_map &map) // MACHINE_CONFIG_START( wangpc_wdc ) //------------------------------------------------- -MACHINE_CONFIG_START(wangpc_wdc_device::device_add_mconfig) +void wangpc_wdc_device::device_add_mconfig(machine_config &config) +{ Z80(config, m_maincpu, 2000000); // XTAL(10'000'000) / ? //m_maincpu->set_daisy_config(wangpc_wdc_daisy_chain); m_maincpu->set_addrmap(AS_PROGRAM, &wangpc_wdc_device::wangpc_wdc_mem); m_maincpu->set_addrmap(AS_IO, &wangpc_wdc_device::wangpc_wdc_io); - MCFG_DEVICE_ADD(MK3882_TAG, Z80CTC, 2000000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 2000000); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); SCSIHD(config, "harddisk0", 0); -MACHINE_CONFIG_END +} diff --git a/src/devices/cpu/z80/tmpz84c011.cpp b/src/devices/cpu/z80/tmpz84c011.cpp index 3ee07017330..5dd354a1f19 100644 --- a/src/devices/cpu/z80/tmpz84c011.cpp +++ b/src/devices/cpu/z80/tmpz84c011.cpp @@ -17,7 +17,7 @@ DEFINE_DEVICE_TYPE(TMPZ84C011, tmpz84c011_device, "tmpz84c011", "Toshiba TMPZ84C void tmpz84c011_device::tmpz84c011_internal_io_map(address_map &map) { - map(0x10, 0x13).mirror(0xff00).rw("tmpz84c011_ctc", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x10, 0x13).mirror(0xff00).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x50, 0x50).mirror(0xff00).rw(FUNC(tmpz84c011_device::tmpz84c011_pa_r), FUNC(tmpz84c011_device::tmpz84c011_pa_w)); map(0x51, 0x51).mirror(0xff00).rw(FUNC(tmpz84c011_device::tmpz84c011_pb_r), FUNC(tmpz84c011_device::tmpz84c011_pb_w)); @@ -118,10 +118,11 @@ void tmpz84c011_device::device_reset() /* CPU interface */ -MACHINE_CONFIG_START(tmpz84c011_device::device_add_mconfig) - MCFG_DEVICE_ADD("tmpz84c011_ctc", Z80CTC, DERIVED_CLOCK(1,1) ) - MCFG_Z80CTC_INTR_CB(INPUTLINE(DEVICE_SELF, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, tmpz84c011_device, zc0_cb_trampoline_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, tmpz84c011_device, zc1_cb_trampoline_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, tmpz84c011_device, zc2_cb_trampoline_w)) -MACHINE_CONFIG_END +void tmpz84c011_device::device_add_mconfig(machine_config &config) +{ + Z80CTC(config, m_ctc, DERIVED_CLOCK(1,1)); + m_ctc->intr_callback().set_inputline(DEVICE_SELF, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(tmpz84c011_device::zc0_cb_trampoline_w)); + m_ctc->zc_callback<1>().set(FUNC(tmpz84c011_device::zc1_cb_trampoline_w)); + m_ctc->zc_callback<2>().set(FUNC(tmpz84c011_device::zc2_cb_trampoline_w)); +} diff --git a/src/devices/cpu/z80/tmpz84c015.cpp b/src/devices/cpu/z80/tmpz84c015.cpp index 894cf5d7ad8..80dc417e171 100644 --- a/src/devices/cpu/z80/tmpz84c015.cpp +++ b/src/devices/cpu/z80/tmpz84c015.cpp @@ -177,8 +177,8 @@ WRITE8_MEMBER(tmpz84c015_device::irq_priority_w) } } -MACHINE_CONFIG_START(tmpz84c015_device::device_add_mconfig) - +void tmpz84c015_device::device_add_mconfig(machine_config &config) +{ /* basic machine hardware */ Z80SIO0(config, m_sio, DERIVED_CLOCK(1,1)); m_sio->out_int_callback().set_inputline(DEVICE_SELF, INPUT_LINE_IRQ0); @@ -200,13 +200,13 @@ MACHINE_CONFIG_START(tmpz84c015_device::device_add_mconfig) m_sio->out_rxdrqb_callback().set(FUNC(tmpz84c015_device::out_rxdrqb_cb_trampoline_w)); m_sio->out_txdrqb_callback().set(FUNC(tmpz84c015_device::out_txdrqb_cb_trampoline_w)); - MCFG_DEVICE_ADD("tmpz84c015_ctc", Z80CTC, DERIVED_CLOCK(1,1) ) - MCFG_Z80CTC_INTR_CB(INPUTLINE(DEVICE_SELF, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, DERIVED_CLOCK(1,1)); + m_ctc->intr_callback().set_inputline(DEVICE_SELF, INPUT_LINE_IRQ0); - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, tmpz84c015_device, zc_cb_trampoline_w<0>)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, tmpz84c015_device, zc_cb_trampoline_w<1>)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, tmpz84c015_device, zc_cb_trampoline_w<2>)) - MCFG_Z80CTC_ZC3_CB(WRITELINE(*this, tmpz84c015_device, zc_cb_trampoline_w<3>)) + m_ctc->zc_callback<0>().set(FUNC(tmpz84c015_device::zc_cb_trampoline_w<0>)); + m_ctc->zc_callback<1>().set(FUNC(tmpz84c015_device::zc_cb_trampoline_w<1>)); + m_ctc->zc_callback<2>().set(FUNC(tmpz84c015_device::zc_cb_trampoline_w<2>)); + m_ctc->zc_callback<3>().set(FUNC(tmpz84c015_device::zc_cb_trampoline_w<3>)); Z80PIO(config, m_pio, DERIVED_CLOCK(1,1)); m_pio->out_int_callback().set_inputline(DEVICE_SELF, INPUT_LINE_IRQ0); @@ -218,4 +218,4 @@ MACHINE_CONFIG_START(tmpz84c015_device::device_add_mconfig) m_pio->in_pb_callback().set(FUNC(tmpz84c015_device::in_pb_cb_trampoline_r)); m_pio->out_pb_callback().set(FUNC(tmpz84c015_device::out_pb_cb_trampoline_w)); m_pio->out_brdy_callback().set(FUNC(tmpz84c015_device::out_brdy_cb_trampoline_w)); -MACHINE_CONFIG_END +} diff --git a/src/devices/machine/ldv1000.cpp b/src/devices/machine/ldv1000.cpp index d7e1ba4789e..e0724381c98 100644 --- a/src/devices/machine/ldv1000.cpp +++ b/src/devices/machine/ldv1000.cpp @@ -75,7 +75,7 @@ void pioneer_ldv1000_device::ldv1000_portmap(address_map &map) map(0x00, 0x07).mirror(0x38).rw(FUNC(pioneer_ldv1000_device::z80_decoder_display_port_r), FUNC(pioneer_ldv1000_device::z80_decoder_display_port_w)); map(0x40, 0x40).mirror(0x3f).r(FUNC(pioneer_ldv1000_device::z80_controller_r)); map(0x80, 0x80).mirror(0x3f).w(FUNC(pioneer_ldv1000_device::z80_controller_w)); - map(0xc0, 0xc3).mirror(0x3c).rw("ldvctc", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0xc0, 0xc3).mirror(0x3c).rw(m_z80_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); } @@ -278,8 +278,8 @@ MACHINE_CONFIG_START(pioneer_ldv1000_device::device_add_mconfig) m_z80_cpu->set_addrmap(AS_PROGRAM, &pioneer_ldv1000_device::ldv1000_map); m_z80_cpu->set_addrmap(AS_IO, &pioneer_ldv1000_device::ldv1000_portmap); - MCFG_DEVICE_ADD("ldvctc", Z80CTC, XTAL(5'000'000)/2) - MCFG_Z80CTC_INTR_CB(WRITELINE(*this, pioneer_ldv1000_device, ctc_interrupt)) + Z80CTC(config, m_z80_ctc, XTAL(5'000'000)/2); + m_z80_ctc->intr_callback().set(FUNC(pioneer_ldv1000_device::ctc_interrupt)); MCFG_DEVICE_ADD("ldvppi0", I8255, 0) MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, pioneer_ldv1000_device, ppi0_porta_w)) diff --git a/src/devices/machine/z80ctc.h b/src/devices/machine/z80ctc.h index ce07fd9cf61..3a3234cf698 100644 --- a/src/devices/machine/z80ctc.h +++ b/src/devices/machine/z80ctc.h @@ -32,27 +32,6 @@ //************************************************************************** -// DEVICE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_Z80CTC_INTR_CB(_devcb) \ - downcast<z80ctc_device &>(*device).set_intr_callback(DEVCB_##_devcb); - -#define MCFG_Z80CTC_ZC0_CB(_devcb) \ - downcast<z80ctc_device &>(*device).set_zc_callback<0>(DEVCB_##_devcb); - -#define MCFG_Z80CTC_ZC1_CB(_devcb) \ - downcast<z80ctc_device &>(*device).set_zc_callback<1>(DEVCB_##_devcb); - -#define MCFG_Z80CTC_ZC2_CB(_devcb) \ - downcast<z80ctc_device &>(*device).set_zc_callback<2>(DEVCB_##_devcb); - -// not supported on a standard ctc, only used for the tmpz84c015 -#define MCFG_Z80CTC_ZC3_CB(_devcb) \ - downcast<z80ctc_device &>(*device).set_zc_callback<3>(DEVCB_##_devcb); - - -//************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -103,10 +82,8 @@ public: // construction/destruction z80ctc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - template <class Object> devcb_base &set_intr_callback(Object &&cb) { return m_intr_cb.set_callback(std::forward<Object>(cb)); } - template <int Channel, class Object> devcb_base &set_zc_callback(Object &&cb) { return m_zc_cb[Channel].set_callback(std::forward<Object>(cb)); } auto intr_callback() { return m_intr_cb.bind(); } - template <int Channel> auto zc_callback() { return m_zc_cb[Channel].bind(); } + template <int Channel> auto zc_callback() { return m_zc_cb[Channel].bind(); } // m_zc_cb[3] not supported on a standard ctc, only used for the tmpz84c015 // read/write handlers DECLARE_READ8_MEMBER( read ); diff --git a/src/mame/audio/cinemat.cpp b/src/mame/audio/cinemat.cpp index e522219264c..45f203c63f6 100644 --- a/src/mame/audio/cinemat.cpp +++ b/src/mame/audio/cinemat.cpp @@ -1400,8 +1400,8 @@ MACHINE_CONFIG_START(demon_state::demon_sound) audiocpu.set_addrmap(AS_PROGRAM, &demon_state::demon_sound_map); audiocpu.set_addrmap(AS_IO, &demon_state::demon_sound_ports); - MCFG_DEVICE_ADD("ctc", Z80CTC, 3579545 /* same as "audiocpu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", 3579545 /* same as "audiocpu" */)); + ctc.intr_callback().set_inputline("audiocpu", INPUT_LINE_IRQ0); m_outlatch->q_out_cb<4>().set(FUNC(demon_state::demon_sound4_w)); @@ -1418,8 +1418,6 @@ MACHINE_CONFIG_START(demon_state::demon_sound) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MCFG_DEVICE_ADD("ay3", AY8910, 3579545) - - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(*this, demon_state, sound_output_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END diff --git a/src/mame/audio/efo_zsu.cpp b/src/mame/audio/efo_zsu.cpp index 4e05805236f..04f840b0b79 100644 --- a/src/mame/audio/efo_zsu.cpp +++ b/src/mame/audio/efo_zsu.cpp @@ -100,8 +100,8 @@ void efo_zsu_device::zsu_io(address_map &map) map.global_mask(0xff); map.unmap_value_high(); - map(0x00, 0x03).rw("ctc0", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); - map(0x04, 0x07).rw("ctc1", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x00, 0x03).rw(m_ctc0, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x04, 0x07).rw(m_ctc1, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x08, 0x08).w(FUNC(efo_zsu_device::adpcm_fifo_w)); @@ -111,7 +111,7 @@ void efo_zsu_device::zsu_io(address_map &map) map(0x10, 0x10).w("aysnd1", FUNC(ay8910_device::address_w)); map(0x11, 0x11).w("aysnd1", FUNC(ay8910_device::data_w)); - map(0x14, 0x14).r("soundlatch", FUNC(generic_latch_8_device::read)); + map(0x14, 0x14).r(m_soundlatch, FUNC(generic_latch_8_device::read)); } @@ -196,17 +196,17 @@ MACHINE_CONFIG_START(efo_zsu_device::device_add_mconfig) soundcpu.set_addrmap(AS_IO, &efo_zsu_device::zsu_io); soundcpu.set_daisy_config(daisy_chain); - MCFG_DEVICE_ADD("ctc0", Z80CTC, 4000000) - MCFG_Z80CTC_INTR_CB(WRITELINE("soundirq", input_merger_device, in_w<0>)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, efo_zsu_device, ctc0_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, efo_zsu_device, ctc0_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, efo_zsu_device, ctc0_z2_w)) + Z80CTC(config, m_ctc0, 4000000); + m_ctc0->intr_callback().set("soundirq", FUNC(input_merger_device::in_w<0>)); + m_ctc0->zc_callback<0>().set(FUNC(efo_zsu_device::ctc0_z0_w)); + m_ctc0->zc_callback<1>().set(FUNC(efo_zsu_device::ctc0_z1_w)); + m_ctc0->zc_callback<2>().set(FUNC(efo_zsu_device::ctc0_z2_w)); - MCFG_DEVICE_ADD("ctc1", Z80CTC, 4000000) - MCFG_Z80CTC_INTR_CB(WRITELINE("soundirq", input_merger_device, in_w<1>)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, efo_zsu_device, ctc1_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, efo_zsu_device, ctc1_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, efo_zsu_device, ctc1_z2_w)) + Z80CTC(config, m_ctc1, 4000000); + m_ctc1->intr_callback().set("soundirq", FUNC(input_merger_device::in_w<1>)); + m_ctc1->zc_callback<0>().set(FUNC(efo_zsu_device::ctc1_z0_w)); + m_ctc1->zc_callback<1>().set(FUNC(efo_zsu_device::ctc1_z1_w)); + m_ctc1->zc_callback<2>().set(FUNC(efo_zsu_device::ctc1_z2_w)); #if 0 // does nothing useful now clock_device &ck1mhz(CLOCK(config, "ck1mhz", 4000000/4); @@ -215,7 +215,7 @@ MACHINE_CONFIG_START(efo_zsu_device::device_add_mconfig) ck1mhz.signal_handler().append(m_ctc1, FUNC(z80ctc_device::trg2)); #endif - MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) MCFG_GENERIC_LATCH_DATA_PENDING_CB(WRITELINE("soundirq", input_merger_device, in_w<2>)) MCFG_INPUT_MERGER_ANY_HIGH("soundirq") // 74HC03 NAND gate @@ -231,11 +231,11 @@ MACHINE_CONFIG_START(efo_zsu_device::device_add_mconfig) aysnd1.port_a_write_callback().set(FUNC(efo_zsu_device::ay1_porta_w)); aysnd1.add_route(ALL_OUTPUTS, "mono", 0.5); - MCFG_DEVICE_ADD("fifo", CD40105, 0) + MCFG_DEVICE_ADD(m_fifo, CD40105, 0) MCFG_40105_DATA_OUT_READY_CB(WRITELINE(*this, efo_zsu_device, fifo_dor_w)) - MCFG_40105_DATA_OUT_CB(WRITE8("adpcm", msm5205_device, data_w)) + MCFG_40105_DATA_OUT_CB(WRITE8(m_adpcm, msm5205_device, data_w)) - MCFG_DEVICE_ADD("adpcm", MSM5205, 4000000/8) + MCFG_DEVICE_ADD(m_adpcm, MSM5205, 4000000/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/a5105.cpp b/src/mame/drivers/a5105.cpp index 41c90aa43de..93b6b34d7dc 100644 --- a/src/mame/drivers/a5105.cpp +++ b/src/mame/drivers/a5105.cpp @@ -598,10 +598,10 @@ MACHINE_CONFIG_START(a5105_state::a5105) MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(a5105_state, hgdc_display_pixels) MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(a5105_state, hgdc_draw_text) - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL(15'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("z80ctc", z80ctc_device, trg2)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("z80ctc", z80ctc_device, trg3)) + z80ctc_device& ctc(Z80CTC(config, "z80ctc", XTAL(15'000'000) / 4)); + ctc.intr_callback().set_inputline(m_maincpu, 0); + ctc.zc_callback<0>().set("z80ctc", FUNC(z80ctc_device::trg2)); + ctc.zc_callback<2>().set("z80ctc", FUNC(z80ctc_device::trg3)); z80pio_device& pio(Z80PIO(config, "z80pio", XTAL(15'000'000) / 4)); pio.out_int_callback().set_inputline(m_maincpu, 0); diff --git a/src/mame/drivers/apricotf.cpp b/src/mame/drivers/apricotf.cpp index a917824c7a0..924dcc76594 100644 --- a/src/mame/drivers/apricotf.cpp +++ b/src/mame/drivers/apricotf.cpp @@ -372,10 +372,10 @@ MACHINE_CONFIG_START(f1_state::act_f1) Z80SIO(config, m_sio, 2500000); m_sio->out_int_callback().set("irqs", FUNC(input_merger_device::in_w<0>)); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 2500000) - MCFG_Z80CTC_INTR_CB(WRITELINE("irqs", input_merger_device, in_w<1>)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, f1_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, f1_state, ctc_z2_w)) + Z80CTC(config, m_ctc, 2500000); + m_ctc->intr_callback().set("irqs", FUNC(input_merger_device::in_w<1>)); + m_ctc->zc_callback<1>().set(FUNC(f1_state::ctc_z1_w)); + m_ctc->zc_callback<2>().set(FUNC(f1_state::ctc_z2_w)); MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(m_sio, z80sio_device, ctsa_w)) diff --git a/src/mame/drivers/astrocde.cpp b/src/mame/drivers/astrocde.cpp index a6b0e3f0630..ecae79593b5 100644 --- a/src/mame/drivers/astrocde.cpp +++ b/src/mame/drivers/astrocde.cpp @@ -1517,8 +1517,8 @@ MACHINE_CONFIG_START(tenpindx_state::tenpindx) m_subcpu->set_addrmap(AS_PROGRAM, &tenpindx_state::sub_map); m_subcpu->set_addrmap(AS_IO, &tenpindx_state::sub_io_map); - MCFG_DEVICE_ADD("ctc", Z80CTC, ASTROCADE_CLOCK/4 /* same as "sub" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("sub", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", ASTROCADE_CLOCK/4 /* same as "sub" */)); + ctc.intr_callback().set_inputline(m_subcpu, INPUT_LINE_IRQ0); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/att4425.cpp b/src/mame/drivers/att4425.cpp index d1d038361bb..11cdf80bf5d 100644 --- a/src/mame/drivers/att4425.cpp +++ b/src/mame/drivers/att4425.cpp @@ -257,12 +257,12 @@ MACHINE_CONFIG_START(att4425_state::att4425) MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette") // ch.3 -- timer? - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(32'000'000)) // XXX - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, XTAL(32'000'000))); // XXX; + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); #ifdef notdef - MCFG_Z80CTC_ZC0_CB(WRITELINE(m_sio, z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(m_sio, z80sio_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(m_sio, z80sio_device, rxtxcb_w)) + ctc.zc_callback<0>().set(m_sio, FUNC(z80sio_device::rxca_w)); + ctc.zc_callback<0>().append(m_sio, FUNC(z80sio_device::txca_w)); + ctc.zc_callback<2>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); #endif Z80SIO(config, m_sio, 4800); // XXX diff --git a/src/mame/drivers/avt.cpp b/src/mame/drivers/avt.cpp index 27d5f3664f3..74322f7195b 100644 --- a/src/mame/drivers/avt.cpp +++ b/src/mame/drivers/avt.cpp @@ -994,9 +994,9 @@ MACHINE_CONFIG_START(avt_state::avt) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) // device never addressed by cpu - MCFG_DEVICE_ADD("ctc0", Z80CTC, CPU_CLOCK) // U27 - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("ctc0", z80ctc_device, trg1)) + z80ctc_device& ctc(Z80CTC(config, "ctc0", CPU_CLOCK)); // U27 + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("ctc0", FUNC(z80ctc_device::trg1)); // ZC1 not connected // TRG2 to TP18; ZC2 to TP9; TRG3 to VSYNC; TRG0 to cpu_clock/4 diff --git a/src/mame/drivers/babbage.cpp b/src/mame/drivers/babbage.cpp index 82bf3cd55ee..6b03aa0f27c 100644 --- a/src/mame/drivers/babbage.cpp +++ b/src/mame/drivers/babbage.cpp @@ -230,9 +230,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback) ***************************************************************************/ -MACHINE_CONFIG_START(babbage_state::babbage) +void babbage_state::babbage(machine_config &config) +{ /* basic machine hardware */ - Z80(config, m_maincpu, MAIN_CLOCK); //2.5MHz m_maincpu->set_addrmap(AS_PROGRAM, &babbage_state::babbage_map); m_maincpu->set_addrmap(AS_IO, &babbage_state::babbage_io); @@ -242,11 +242,11 @@ MACHINE_CONFIG_START(babbage_state::babbage) config.set_default_layout(layout_babbage); /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, MAIN_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, babbage_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, babbage_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, babbage_state, ctc_z2_w)) + Z80CTC(config, m_ctc, MAIN_CLOCK); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(babbage_state::ctc_z0_w)); + m_ctc->zc_callback<1>().set(FUNC(babbage_state::ctc_z1_w)); + m_ctc->zc_callback<2>().set(FUNC(babbage_state::ctc_z2_w)); Z80PIO(config, m_pio_1, MAIN_CLOCK); m_pio_1->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); @@ -257,8 +257,8 @@ MACHINE_CONFIG_START(babbage_state::babbage) m_pio_2->in_pa_callback().set(FUNC(babbage_state::pio2_a_r)); m_pio_2->out_pb_callback().set(FUNC(babbage_state::pio2_b_w)); - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", babbage_state, keyboard_callback, attotime::from_hz(30)) -MACHINE_CONFIG_END + TIMER(config, "keyboard_timer", 0).configure_periodic(timer_device::expired_delegate(FUNC(babbage_state::keyboard_callback), this), attotime::from_hz(30)); +} /*************************************************************************** diff --git a/src/mame/drivers/bcs3.cpp b/src/mame/drivers/bcs3.cpp index 8b06aa5ea64..a26837128f7 100644 --- a/src/mame/drivers/bcs3.cpp +++ b/src/mame/drivers/bcs3.cpp @@ -403,10 +403,10 @@ MACHINE_CONFIG_START(bcs3_state::bcs3) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bcs3) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(5'000'000) / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, bcs3_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, bcs3_state, ctc_z1_w)) + Z80CTC(config, m_ctc, XTAL(5'000'000) / 2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(bcs3_state::ctc_z0_w)); + m_ctc->zc_callback<1>().set(FUNC(bcs3_state::ctc_z1_w)); MCFG_CASSETTE_ADD( "cassette" ) MACHINE_CONFIG_END @@ -430,10 +430,10 @@ MACHINE_CONFIG_START(bcs3_state::bcs3a) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bcs3) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(7'000'000) / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, bcs3_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, bcs3_state, ctc_z1_w)) + Z80CTC(config, m_ctc, XTAL(7'000'000) / 2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(bcs3_state::ctc_z0_w)); + m_ctc->zc_callback<1>().set(FUNC(bcs3_state::ctc_z1_w)); MCFG_CASSETTE_ADD( "cassette" ) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp index 72c9747cfd6..117ff5448f2 100644 --- a/src/mame/drivers/bigbord2.cpp +++ b/src/mame/drivers/bigbord2.cpp @@ -575,18 +575,18 @@ MACHINE_CONFIG_START(bigbord2_state::bigbord2) Z80SIO(config, m_sio, MAIN_CLOCK); m_sio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - m_sio->out_synca_callback().set("ctc1", FUNC(z80ctc_device::trg2)); + m_sio->out_synca_callback().set(m_ctc1, FUNC(z80ctc_device::trg2)); m_sio->out_wrdya_callback().set(FUNC(bigbord2_state::sio_wrdya_w)); m_sio->out_wrdyb_callback().set(FUNC(bigbord2_state::sio_wrdyb_w)); - MCFG_DEVICE_ADD("ctc1", Z80CTC, MAIN_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc1, MAIN_CLOCK); + m_ctc1->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("ctc2", Z80CTC, MAIN_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(m_sio, z80sio_device, rxtxcb_w)) // to SIO Ch B - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, bigbord2_state, ctc_z1_w)) // to SIO Ch A - MCFG_Z80CTC_ZC2_CB(WRITELINE("ctc2", z80ctc_device, trg3)) + Z80CTC(config, m_ctc2, MAIN_CLOCK); + m_ctc2->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc2->zc_callback<0>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); // to SIO Ch B + m_ctc2->zc_callback<1>().set(FUNC(bigbord2_state::ctc_z1_w)); // to SIO Ch A + m_ctc2->zc_callback<2>().set(m_ctc2, FUNC(z80ctc_device::trg3)); MCFG_DEVICE_ADD("fdc", MB8877, 16_MHz_XTAL / 8) // 2MHz for 8 inch, or 1MHz otherwise (jumper-selectable) //MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE("maincpu", ??)) // info missing from schematic @@ -599,7 +599,7 @@ MACHINE_CONFIG_START(bigbord2_state::bigbord2) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(bigbord2_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE("ctc1", z80ctc_device, trg3)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(m_ctc1, z80ctc_device, trg3)) ls259_device &proglatch(LS259(config, "proglatch")); // U41 proglatch.q_out_cb<6>().set("outlatch1", FUNC(ls259_device::clear_w)); // FCRST - also resets the 8877 diff --git a/src/mame/drivers/binbug.cpp b/src/mame/drivers/binbug.cpp index 59995610b0c..b0fe4b8efe8 100644 --- a/src/mame/drivers/binbug.cpp +++ b/src/mame/drivers/binbug.cpp @@ -564,9 +564,9 @@ MACHINE_CONFIG_START(dg680_state::dg680) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL(8'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("z80ctc", z80ctc_device, trg1)) + z80ctc_device& ctc(Z80CTC(config, "z80ctc", XTAL(8'000'000) / 4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("z80ctc", FUNC(z80ctc_device::trg1)); z80pio_device& pio(Z80PIO(config, "z80pio", XTAL(8'000'000) / 4)); pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/bullet.cpp b/src/mame/drivers/bullet.cpp index 87f8a9a262b..3d047fddc81 100644 --- a/src/mame/drivers/bullet.cpp +++ b/src/mame/drivers/bullet.cpp @@ -1114,11 +1114,11 @@ MACHINE_CONFIG_START(bullet_state::bullet) m_maincpu->set_daisy_config(daisy_chain); // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 16_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, bullet_state, dart_rxtxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(m_dart, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + Z80CTC(config, m_ctc, 16_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(bullet_state::dart_rxtxca_w)); + m_ctc->zc_callback<1>().set(m_dart, FUNC(z80dart_device::rxtxcb_w)); + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(4.9152_MHz_XTAL /4)) @@ -1193,11 +1193,11 @@ MACHINE_CONFIG_START(bulletf_state::bulletf) m_maincpu->set_daisy_config(daisy_chain); // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 16_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, bullet_state, dart_rxtxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(m_dart, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + Z80CTC(config, m_ctc, 16_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(bullet_state::dart_rxtxca_w)); + m_ctc->zc_callback<1>().set(m_dart, FUNC(z80dart_device::rxtxcb_w)); + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(4.9152_MHz_XTAL / 4)) diff --git a/src/mame/drivers/cchasm.cpp b/src/mame/drivers/cchasm.cpp index 4d26b868371..332f943e7a1 100644 --- a/src/mame/drivers/cchasm.cpp +++ b/src/mame/drivers/cchasm.cpp @@ -157,10 +157,10 @@ MACHINE_CONFIG_START(cchasm_state::cchasm) m_audiocpu->set_addrmap(AS_PROGRAM, &cchasm_state::sound_memmap); m_audiocpu->set_addrmap(AS_IO, &cchasm_state::sound_portmap); - MCFG_DEVICE_ADD("ctc", Z80CTC, 3584229 /* same as "audiocpu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, cchasm_state, ctc_timer_1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, cchasm_state, ctc_timer_2_w)) + Z80CTC(config, m_ctc, 3584229 /* same as "audiocpu" */); + m_ctc->intr_callback().set_inputline(m_audiocpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<1>().set(FUNC(cchasm_state::ctc_timer_1_w)); + m_ctc->zc_callback<2>().set(FUNC(cchasm_state::ctc_timer_2_w)); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/ccs300.cpp b/src/mame/drivers/ccs300.cpp index e27a7ed6e0d..917d133b669 100644 --- a/src/mame/drivers/ccs300.cpp +++ b/src/mame/drivers/ccs300.cpp @@ -36,15 +36,19 @@ public: , m_maincpu(*this, "maincpu") { } - void init_ccs300(); - DECLARE_MACHINE_RESET(ccs300); - DECLARE_WRITE8_MEMBER(port40_w); - void ccs300(machine_config &config); - void ccs300_io(address_map &map); - void ccs300_mem(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: required_device<z80_device> m_maincpu; + + void ccs300_io(address_map &map); + void ccs300_mem(address_map &map); + + DECLARE_WRITE8_MEMBER(port40_w); }; void ccs300_state::ccs300_mem(address_map &map) @@ -90,13 +94,13 @@ WRITE8_MEMBER( ccs300_state::port40_w ) membank("bankr0")->set_entry( (data) ? 1 : 0); } -MACHINE_RESET_MEMBER( ccs300_state, ccs300 ) +void ccs300_state::machine_reset() { membank("bankr0")->set_entry(0); // point at rom membank("bankw0")->set_entry(0); // always write to ram } -void ccs300_state::init_ccs300() +void ccs300_state::machine_start() { uint8_t *main = memregion("maincpu")->base(); @@ -114,15 +118,14 @@ static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) DEVICE_INPUT_DEFAULTS_END -MACHINE_CONFIG_START(ccs300_state::ccs300) +void ccs300_state::ccs300(machine_config & config) +{ /* basic machine hardware */ Z80(config, m_maincpu, XTAL(4'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &ccs300_state::ccs300_mem); m_maincpu->set_addrmap(AS_IO, &ccs300_state::ccs300_io); m_maincpu->set_daisy_config(daisy_chain); - MCFG_MACHINE_RESET_OVERRIDE(ccs300_state, ccs300) - /* video hardware */ clock_device &uart_clock(CLOCK(config, "uart_clock", 153'600)); uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txca_w)); @@ -135,17 +138,17 @@ MACHINE_CONFIG_START(ccs300_state::ccs300) sio.out_dtra_callback().set("rs232", FUNC(rs232_port_device::write_dtr)); sio.out_rtsa_callback().set("rs232", FUNC(rs232_port_device::write_rts)); - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) // must be exactly here + rs232_port_device& rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set("sio", FUNC(z80sio_device::rxa_w)); + rs232.cts_handler().set("sio", FUNC(z80sio_device::ctsa_w)); + rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); // must be exactly here - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(4'000'000))); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); z80pio_device& pio(Z80PIO(config, "pio", XTAL(4'000'000))); pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); -MACHINE_CONFIG_END +} /* ROM definition */ ROM_START( ccs300 ) @@ -156,4 +159,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, ccs300, ccs2810, 0, ccs300, ccs300, ccs300_state, init_ccs300, "California Computer Systems", "CCS Model 300", MACHINE_IS_SKELETON ) +COMP( 19??, ccs300, ccs2810, 0, ccs300, ccs300, ccs300_state, empty_init, "California Computer Systems", "CCS Model 300", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/cdc721.cpp b/src/mame/drivers/cdc721.cpp index 0548bb21756..775f9b3ea83 100644 --- a/src/mame/drivers/cdc721.cpp +++ b/src/mame/drivers/cdc721.cpp @@ -329,10 +329,10 @@ MACHINE_CONFIG_START(cdc721_state::cdc721) MCFG_DEVICE_ADD("crtc", CRT5037, 12.936_MHz_XTAL / 8) MCFG_TMS9927_CHAR_WIDTH(8) - MCFG_DEVICE_ADD("ctc", Z80CTC, 6_MHz_XTAL) // Zilog Z8430B (M1 pulled up) - MCFG_Z80CTC_INTR_CB(WRITELINE(*this, cdc721_state, int_w<6>)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("ctc", z80ctc_device, trg2)) - //MCFG_Z80CTC_ZC2_CB(WRITELINE("comuart", ins8250_device, rclk_w)) + z80ctc_device& ctc(Z80CTC(config, "ctc", 6_MHz_XTAL)); // Zilog Z8430B (M1 pulled up) + ctc.intr_callback().set(FUNC(cdc721_state::int_w<6>)); + ctc.zc_callback<1>().set("ctc", FUNC(z80ctc_device::trg2)); + //ctc.zc_callback<2>().set("comuart", FUNC(ins8250_device::rclk_w)); MCFG_DEVICE_ADD("ppi", I8255A, 0) MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, cdc721_state, interrupt_mask_w)) diff --git a/src/mame/drivers/czk80.cpp b/src/mame/drivers/czk80.cpp index 55fe855a3b6..fcedf34fb1a 100644 --- a/src/mame/drivers/czk80.cpp +++ b/src/mame/drivers/czk80.cpp @@ -198,11 +198,11 @@ MACHINE_CONFIG_START(czk80_state::czk80) MCFG_UPD765A_ADD("fdc", true, true) MCFG_FLOPPY_DRIVE_ADD("fdc:0", czk80_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, czk80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, czk80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, czk80_state, ctc_z2_w)) + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(16'000'000) / 4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(czk80_state::ctc_z0_w)); + ctc.zc_callback<1>().set(FUNC(czk80_state::ctc_z1_w)); + ctc.zc_callback<2>().set(FUNC(czk80_state::ctc_z2_w)); z80dart_device& dart(Z80DART(config, "dart", XTAL(16'000'000) / 4)); //dart.out_txda_callback().set("rs232", FUNC(rs232_port_device::write_txd)); diff --git a/src/mame/drivers/dlair.cpp b/src/mame/drivers/dlair.cpp index 70dadf8d65c..d65fc7e71b0 100644 --- a/src/mame/drivers/dlair.cpp +++ b/src/mame/drivers/dlair.cpp @@ -773,9 +773,9 @@ MACHINE_CONFIG_START(dlair_state::dleuro) m_maincpu->set_addrmap(AS_PROGRAM, &dlair_state::dleuro_map); m_maincpu->set_addrmap(AS_IO, &dlair_state::dleuro_io_map); - MCFG_DEVICE_ADD("ctc", Z80CTC, MASTER_CLOCK_EURO/4 /* same as "maincpu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, dlair_state, write_speaker)) + z80ctc_device& ctc(Z80CTC(config, "ctc", MASTER_CLOCK_EURO/4 /* same as "maincpu" */)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(dlair_state::write_speaker)); z80sio_device& sio(Z80SIO(config, "sio", MASTER_CLOCK_EURO/4 /* same as "maincpu" */)); sio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/einstein.cpp b/src/mame/drivers/einstein.cpp index a39a104cb79..8556fc63486 100644 --- a/src/mame/drivers/einstein.cpp +++ b/src/mame/drivers/einstein.cpp @@ -596,11 +596,11 @@ MACHINE_CONFIG_START(einstein_state::einstein) pio.out_pb_callback().set("user", FUNC(einstein_userport_device::write)); pio.out_brdy_callback().set("user", FUNC(einstein_userport_device::brdy_w)); - MCFG_DEVICE_ADD(IC_I058, Z80CTC, XTAL_X002 / 2) - MCFG_Z80CTC_INTR_CB(WRITELINE(*this, einstein_state, int_w<1>)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(IC_I060, i8251_device, write_txc)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(IC_I060, i8251_device, write_rxc)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(IC_I058, z80ctc_device, trg3)) + z80ctc_device& ctc(Z80CTC(config, IC_I058, XTAL_X002 / 2)); + ctc.intr_callback().set(FUNC(einstein_state::int_w<1>)); + ctc.zc_callback<0>().set(IC_I060, FUNC(i8251_device::write_txc)); + ctc.zc_callback<1>().set(IC_I060, FUNC(i8251_device::write_rxc)); + ctc.zc_callback<2>().set(IC_I058, FUNC(z80ctc_device::trg3)); clock_device &ctc_trigger(CLOCK(config, "ctc_trigger", XTAL_X002 / 4)); ctc_trigger.signal_handler().set(IC_I058, FUNC(z80ctc_device::trg0)); diff --git a/src/mame/drivers/gp_1.cpp b/src/mame/drivers/gp_1.cpp index b649163982d..a2c3a71cfcc 100644 --- a/src/mame/drivers/gp_1.cpp +++ b/src/mame/drivers/gp_1.cpp @@ -454,8 +454,8 @@ MACHINE_CONFIG_START(gp_1_state::gp_1) MCFG_I8255_IN_PORTB_CB(READ8(*this, gp_1_state, portb_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, gp_1_state, portc_w)) - MCFG_DEVICE_ADD("ctc", Z80CTC, 2457600 ) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // Todo: absence of ints will cause a watchdog reset + Z80CTC(config, m_ctc, 2457600); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // Todo: absence of ints will cause a watchdog reset MCFG_TIMER_DRIVER_ADD_PERIODIC("gp1", gp_1_state, zero_timer, attotime::from_hz(120)) // mains freq*2 MACHINE_CONFIG_END diff --git a/src/mame/drivers/gp_2.cpp b/src/mame/drivers/gp_2.cpp index 85986796ccd..4c7cdbb2a5d 100644 --- a/src/mame/drivers/gp_2.cpp +++ b/src/mame/drivers/gp_2.cpp @@ -603,8 +603,8 @@ MACHINE_CONFIG_START(gp_2_state::gp_2) MCFG_I8255_IN_PORTB_CB(READ8(*this, gp_2_state, portb_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, gp_2_state, portc_w)) - MCFG_DEVICE_ADD("ctc", Z80CTC, 2457600 ) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // Todo: absence of ints will cause a watchdog reset + Z80CTC(config, m_ctc, 2457600); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // Todo: absence of ints will cause a watchdog reset MCFG_TIMER_DRIVER_ADD_PERIODIC("gp1", gp_2_state, zero_timer, attotime::from_hz(120)) // mains freq*2 MACHINE_CONFIG_END diff --git a/src/mame/drivers/hazelgr.cpp b/src/mame/drivers/hazelgr.cpp index 46141b86cce..419fb7b355c 100644 --- a/src/mame/drivers/hazelgr.cpp +++ b/src/mame/drivers/hazelgr.cpp @@ -72,7 +72,8 @@ static const z80_daisy_config daisy_chain[] = }; // All frequencies are guesswork, in an effort to get something to happen -MACHINE_CONFIG_START(haze_state::haze) +void haze_state::haze(machine_config &config) +{ /* basic machine hardware */ Z80(config, m_maincpu, 2000000); /* ? MHz */ m_maincpu->set_addrmap(AS_PROGRAM, &haze_state::mem_map); @@ -88,14 +89,14 @@ MACHINE_CONFIG_START(haze_state::haze) ctc_clock.signal_handler().append("ctc3", FUNC(z80ctc_device::trg0)); ctc_clock.signal_handler().append("ctc3", FUNC(z80ctc_device::trg1)); - MCFG_DEVICE_ADD("ctc1", Z80CTC, 1'000'000 ) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc1(Z80CTC(config, "ctc1", 1'000'000)); + ctc1.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("ctc2", Z80CTC, 1'000'000 ) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc2(Z80CTC(config, "ctc2", 1'000'000)); + ctc2.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("ctc3", Z80CTC, 1'000'000 ) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc3(Z80CTC(config, "ctc3", 1'000'000)); + ctc3.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); z80pio_device& pio1(Z80PIO(config, "pio1", 1'000'000)); pio1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); @@ -106,7 +107,7 @@ MACHINE_CONFIG_START(haze_state::haze) Z80PIO(config, "pio3", 1'000'000); Z80PIO(config, "pio4", 1'000'000); -MACHINE_CONFIG_END +} ROM_START( hg_frd ) ROM_REGION( 0x10000, "maincpu", 0 ) diff --git a/src/mame/drivers/huebler.cpp b/src/mame/drivers/huebler.cpp index ac7aacc2a0b..a6bae8e6903 100644 --- a/src/mame/drivers/huebler.cpp +++ b/src/mame/drivers/huebler.cpp @@ -329,11 +329,11 @@ MACHINE_CONFIG_START(amu880_state::amu880) MCFG_PALETTE_ADD_MONOCHROME("palette") /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(10'000'000)/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, amu880_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(m_z80sio, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, amu880_state, ctc_z2_w)) + z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, XTAL(10'000'000)/4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(amu880_state::ctc_z0_w)); + ctc.zc_callback<1>().set(m_z80sio, FUNC(z80dart_device::rxtxcb_w)); + ctc.zc_callback<2>().set(FUNC(amu880_state::ctc_z2_w)); z80pio_device& pio1(Z80PIO(config, Z80PIO1_TAG, XTAL(10'000'000)/4)); pio1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/jankenmn.cpp b/src/mame/drivers/jankenmn.cpp index 6f7ead86d88..d3d451b697a 100644 --- a/src/mame/drivers/jankenmn.cpp +++ b/src/mame/drivers/jankenmn.cpp @@ -402,8 +402,8 @@ MACHINE_CONFIG_START(jankenmn_state::jankenmn) MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, jankenmn_state, lamps1_w)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, jankenmn_state, lamps2_w)) - MCFG_DEVICE_ADD("ctc", Z80CTC, MASTER_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", MASTER_CLOCK)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); /* NO VIDEO */ diff --git a/src/mame/drivers/joctronic.cpp b/src/mame/drivers/joctronic.cpp index 9d73efba2aa..1132ff95d38 100644 --- a/src/mame/drivers/joctronic.cpp +++ b/src/mame/drivers/joctronic.cpp @@ -349,13 +349,13 @@ MACHINE_CONFIG_START(joctronic_state::joctronic) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 5516 LS259(config, m_mainlatch); // IC4 - exact type unknown - //m_mainlatch->parallel_out_cb().set(FUNC(joctronic_state::display_select_w)); MCFG_DEVCB_MASK(0x07) - //MCFG_DEVCB_CHAIN_OUTPUT(WRITE8(*this, joctronic_state, ls145_w)) MCFG_DEVCB_RSHIFT(4) + //m_mainlatch->parallel_out_cb().set(FUNC(joctronic_state::display_select_w)).mask(0x07); + //m_mainlatch->parallel_out_cb().append(FUNC(joctronic_state::ls145_w)).rshift(4); //m_mainlatch->q_out_cb<3>().set(FUNC(joctronic_state::display_reset_w)); - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(12'000'000)/4) // 3 MHz - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(ASSERTLINE("soundcpu", INPUT_LINE_IRQ0)) // SINT + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(12'000'000)/4)); // 3 MHz + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set_inputline(m_soundcpu, INPUT_LINE_IRQ0); //SINT MCFG_DEVICE_ADD("drivers1", LS259, 0) // IC4 MCFG_DEVICE_ADD("drivers2", LS259, 0) // IC3 @@ -396,12 +396,12 @@ MACHINE_CONFIG_START(joctronic_state::slalom03) LS259(config, m_mainlatch); // IC6 - exact type unknown //m_mainlatch->q_out_cb<0>().set(FUNC(joctronic_state::cont_w)); - //m_mainlatch->parallel_out_cb().set(FUNC(joctronic_state::ls145_w)); MCFG_DEVCB_RSHIFT(3) MCFG_DEVCB_MASK(0x38) + //m_mainlatch->parallel_out_cb().set(FUNC(joctronic_state::ls145_w)).rshift(3).mask(0x38); //m_mainlatch->q_out_cb<7>().set(FUNC(joctronic_state::slalom03_reset_w)); - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(12'000'000)/2) // 6 MHz - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - //MCFG_Z80CTC_ZC0_CB(ASSERTLINE("soundcpu", INPUT_LINE_IRQ0)) // SINT + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(12'000'000)/2)); // 6 MHz + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + //ctc.zc_callback<0>().set_inputline(m_soundcpu, INPUT_LINE_IRQ0); //SINT MCFG_DEVICE_ADD("drivers1", HC259, 0) // IC1 MCFG_DEVICE_ADD("drivers2", HC259, 0) // IC2 diff --git a/src/mame/drivers/k8915.cpp b/src/mame/drivers/k8915.cpp index d0c16e2f3be..cbafad2ef75 100644 --- a/src/mame/drivers/k8915.cpp +++ b/src/mame/drivers/k8915.cpp @@ -155,8 +155,8 @@ MACHINE_CONFIG_START(k8915_state::k8915) MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL(4'915'200) / 2) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg2)) - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(4'915'200) / 2) - MCFG_Z80CTC_ZC2_CB(WRITELINE("sio", z80sio_device, rxtxcb_w)) + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(4'915'200) / 2)); + ctc.zc_callback<2>().set("sio", FUNC(z80sio_device::rxtxcb_w)); z80sio_device& sio(Z80SIO(config, "sio", XTAL(4'915'200) / 2)); sio.out_txdb_callback().set("rs232", FUNC(rs232_port_device::write_txd)); diff --git a/src/mame/drivers/kc.cpp b/src/mame/drivers/kc.cpp index ad0a5b6291e..f438a29259d 100644 --- a/src/mame/drivers/kc.cpp +++ b/src/mame/drivers/kc.cpp @@ -114,11 +114,11 @@ MACHINE_CONFIG_START(kc_state::kc85_3) m_z80pio->out_pb_callback().set(FUNC(kc_state::pio_portb_w)); m_z80pio->out_brdy_callback().set(FUNC(kc_state::pio_brdy_cb)); - MCFG_DEVICE_ADD("z80ctc", Z80CTC, KC85_3_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, kc_state, ctc_zc0_callback)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, kc_state, ctc_zc1_callback)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, kc_state, video_toggle_blink_state)) + Z80CTC(config, m_z80ctc, KC85_3_CLOCK); + m_z80ctc->intr_callback().set_inputline(m_maincpu, 0); + m_z80ctc->zc_callback<0>().set(FUNC(kc_state::ctc_zc0_callback)); + m_z80ctc->zc_callback<1>().set(FUNC(kc_state::ctc_zc1_callback)); + m_z80ctc->zc_callback<2>().set(FUNC(kc_state::video_toggle_blink_state)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -195,11 +195,11 @@ MACHINE_CONFIG_START(kc85_4_state::kc85_4) m_z80pio->out_pb_callback().set(FUNC(kc_state::pio_portb_w)); m_z80pio->out_brdy_callback().set(FUNC(kc_state::pio_brdy_cb)); - MCFG_DEVICE_ADD("z80ctc", Z80CTC, KC85_4_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, kc_state, ctc_zc0_callback)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, kc_state, ctc_zc1_callback)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, kc_state, video_toggle_blink_state)) + Z80CTC(config, m_z80ctc, 0); + m_z80ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_z80ctc->zc_callback<0>().set(FUNC(kc_state::ctc_zc0_callback)); + m_z80ctc->zc_callback<1>().set(FUNC(kc_state::ctc_zc1_callback)); + m_z80ctc->zc_callback<2>().set(FUNC(kc_state::video_toggle_blink_state)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/lc80.cpp b/src/mame/drivers/lc80.cpp index 03723b879ee..be5c78464ca 100644 --- a/src/mame/drivers/lc80.cpp +++ b/src/mame/drivers/lc80.cpp @@ -345,11 +345,11 @@ MACHINE_CONFIG_START(lc80_state::lc80) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 900000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, lc80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, lc80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, lc80_state, ctc_z2_w)) + z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, 900000)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(lc80_state::ctc_z0_w)); + ctc.zc_callback<1>().set(FUNC(lc80_state::ctc_z1_w)); + ctc.zc_callback<2>().set(FUNC(lc80_state::ctc_z2_w)); z80pio_device& pio1(Z80PIO(config, Z80PIO1_TAG, 900000)); pio1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); @@ -382,11 +382,11 @@ MACHINE_CONFIG_START(lc80_state::lc80_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 900000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, lc80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, lc80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, lc80_state, ctc_z2_w)) + z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, 900000)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(lc80_state::ctc_z0_w)); + ctc.zc_callback<1>().set(FUNC(lc80_state::ctc_z1_w)); + ctc.zc_callback<2>().set(FUNC(lc80_state::ctc_z2_w)); z80pio_device& pio1(Z80PIO(config, Z80PIO1_TAG, 900000)); pio1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/llc.cpp b/src/mame/drivers/llc.cpp index 4f7aa987a50..516eb7f7d3a 100644 --- a/src/mame/drivers/llc.cpp +++ b/src/mame/drivers/llc.cpp @@ -232,13 +232,13 @@ MACHINE_CONFIG_START(llc_state::llc1) pio2.in_pa_callback().set(FUNC(llc_state::llc1_port2_a_r)); pio2.in_pb_callback().set(FUNC(llc_state::llc1_port2_b_r)); - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL(3'000'000)) + z80ctc_device& ctc(Z80CTC(config, "z80ctc", XTAL(3'000'000))); // timer 0 irq does digit display, and timer 3 irq does scan of the // monitor keyboard. // No idea how the CTC is connected, so guessed. - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("z80ctc", z80ctc_device, trg3)) + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("z80ctc", FUNC(z80ctc_device::trg1)); + ctc.zc_callback<1>().set("z80ctc", FUNC(z80ctc_device::trg3)); MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(PUT(llc_state, kbd_put)) diff --git a/src/mame/drivers/m5.cpp b/src/mame/drivers/m5.cpp index add6b9017af..2ca3d4818f0 100644 --- a/src/mame/drivers/m5.cpp +++ b/src/mame/drivers/m5.cpp @@ -1421,8 +1421,8 @@ MACHINE_CONFIG_START(m5_state::m5) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 14.318181_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 14.318181_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // CK0 = EXINT, CK1 = GND, CK2 = TCK, CK3 = VDP INT // ZC2 = EXCLK diff --git a/src/mame/drivers/mc8030.cpp b/src/mame/drivers/mc8030.cpp index 219c0ce6880..d8a349c14af 100644 --- a/src/mame/drivers/mc8030.cpp +++ b/src/mame/drivers/mc8030.cpp @@ -210,8 +210,8 @@ MACHINE_CONFIG_START(mc8030_state::mc8030) zve_pio.in_pb_callback().set(FUNC(mc8030_state::zve_port_b_r)); //zve_pio.out_pb_callback().set(FUNC(mc8030_state::zve_port_b_w)); - MCFG_DEVICE_ADD("zve_ctc", Z80CTC, XTAL(2'457'600)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& zve_ctc(Z80CTC(config, "zve_ctc", XTAL(2'457'600))); + zve_ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // ZC0, ZC1, ZC2 for user z80pio_device& asp_pio(Z80PIO(config, "asp_pio", XTAL(2'457'600))); @@ -221,8 +221,8 @@ MACHINE_CONFIG_START(mc8030_state::mc8030) asp_pio.in_pb_callback().set(FUNC(mc8030_state::asp_port_b_r)); //asp_pio.out_pb_callback().set(FUNC(mc8030_state::asp_port_b_w)); - MCFG_DEVICE_ADD("asp_ctc", Z80CTC, XTAL(2'457'600)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& asp_ctc(Z80CTC(config, "asp_ctc", XTAL(2'457'600))); + asp_ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // ZC0: to SIO CLK CH A // ZC1: to SIO CLK CH B // ZC2: KMBG (??) diff --git a/src/mame/drivers/mcr.cpp b/src/mame/drivers/mcr.cpp index 2829eaa061b..614c211a93f 100644 --- a/src/mame/drivers/mcr.cpp +++ b/src/mame/drivers/mcr.cpp @@ -1759,9 +1759,9 @@ MACHINE_CONFIG_START(mcr_state::mcr_90009) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mcr_state, mcr_interrupt, "screen", 0, 1) - MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_OSC_MCR_I/8 /* same as "maincpu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("ctc", z80ctc_device, trg1)) + Z80CTC(config, m_ctc, MAIN_OSC_MCR_I/8 /* same as "maincpu" */); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 16) @@ -1848,7 +1848,8 @@ MACHINE_CONFIG_END /* 91490 CPU board plus 90908/90913/91483 sound board */ -MACHINE_CONFIG_START(mcr_state::mcr_91490) +void mcr_state::mcr_91490(machine_config & config) +{ mcr_90010(config); /* basic machine hardware */ @@ -1856,9 +1857,8 @@ MACHINE_CONFIG_START(mcr_state::mcr_91490) m_maincpu->set_addrmap(AS_PROGRAM, &mcr_state::cpu_91490_map); m_maincpu->set_addrmap(AS_IO, &mcr_state::cpu_91490_portmap); - MCFG_DEVICE_MODIFY("ctc") - MCFG_DEVICE_CLOCK(5000000 /* same as "maincpu" */) -MACHINE_CONFIG_END + m_ctc->set_clock(5000000 /* same as "maincpu" */); +} /* 91490 CPU board plus 90908/90913/91483 sound board plus Squawk n' Talk sound board */ @@ -1885,8 +1885,8 @@ MACHINE_CONFIG_START(mcr_nflfoot_state::mcr_91490_ipu) MCFG_TIMER_MODIFY("scantimer") MCFG_TIMER_DRIVER_CALLBACK(mcr_nflfoot_state, ipu_interrupt) - MCFG_DEVICE_ADD("ipu_ctc", Z80CTC, 7372800/2 /* same as "ipu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("ipu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_ipu_ctc, 7372800/2 /* same as "ipu" */); + m_ipu_ctc->intr_callback().set_inputline(m_ipu, INPUT_LINE_IRQ0); Z80PIO(config, m_ipu_pio0, 7372800/2); m_ipu_pio0->out_int_callback().set_inputline(m_ipu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/mcr3.cpp b/src/mame/drivers/mcr3.cpp index 1f8f0c0affc..d6a2862828e 100644 --- a/src/mame/drivers/mcr3.cpp +++ b/src/mame/drivers/mcr3.cpp @@ -1088,9 +1088,9 @@ MACHINE_CONFIG_START(mcr3_state::mcrmono) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mcr3_state, mcr_interrupt, "screen", 0, 1) - MCFG_DEVICE_ADD("ctc", Z80CTC, MASTER_CLOCK/4 /* same as "maincpu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("ctc", z80ctc_device, trg1)) + Z80CTC(config, m_ctc, MASTER_CLOCK/4 /* same as "maincpu" */); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 16) diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp index f29aa84e7c9..0e5521ed97f 100644 --- a/src/mame/drivers/mlanding.cpp +++ b/src/mame/drivers/mlanding.cpp @@ -950,8 +950,8 @@ MACHINE_CONFIG_START(mlanding_state::mlanding) MCFG_TMS32025_HOLD_IN_CB(READ16(*this, mlanding_state, dsp_hold_signal_r)) MCFG_TMS32025_HOLD_ACK_OUT_CB(NOOP) - MCFG_DEVICE_ADD("ctc", Z80CTC, 4000000) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, mlanding_state, z80ctc_to0)) + Z80CTC(config, m_ctc, 4000000); + m_ctc->zc_callback<0>().set(FUNC(mlanding_state::z80ctc_to0)); MCFG_DEVICE_ADD("ciu", PC060HA, 0) MCFG_PC060HA_MASTER_CPU("maincpu") diff --git a/src/mame/drivers/mmm.cpp b/src/mame/drivers/mmm.cpp index 8da2f58f904..0f077d6d761 100644 --- a/src/mame/drivers/mmm.cpp +++ b/src/mame/drivers/mmm.cpp @@ -173,22 +173,23 @@ static const z80_daisy_config mmm_daisy_chain[] = }; -MACHINE_CONFIG_START(mmm_state::mmm) +void mmm_state::mmm(machine_config &config) +{ /* basic machine hardware */ Z80(config, m_maincpu, 2000000); /* ? MHz */ m_maincpu->set_addrmap(AS_PROGRAM, &mmm_state::mem_map); m_maincpu->set_addrmap(AS_IO, &mmm_state::io_map); m_maincpu->set_daisy_config(mmm_daisy_chain); - MCFG_DEVICE_ADD("ctc", Z80CTC, 2000000) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 2000000); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("aysnd", AY8910, 1000000) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(*this, mmm_state, ay_porta_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END + ay8910_device& ay(AY8910(config, "aysnd", 1000000)); + ay.port_a_write_callback().set(FUNC(mmm_state::ay_porta_w)); + ay.add_route(ALL_OUTPUTS, "mono", 0.30); +} ROM_START( mmm_ldip ) diff --git a/src/mame/drivers/mpf1.cpp b/src/mame/drivers/mpf1.cpp index 8ad13164092..59c6690000b 100644 --- a/src/mame/drivers/mpf1.cpp +++ b/src/mame/drivers/mpf1.cpp @@ -368,8 +368,8 @@ MACHINE_CONFIG_START(mpf1_state::mpf1) z80pio_device& pio(Z80PIO(config, Z80PIO_TAG, XTAL(3'579'545)/2)); pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(3'579'545)/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, XTAL(3'579'545)/2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) MCFG_I8255_IN_PORTA_CB(READ8(*this, mpf1_state, ppi_pa_r)) @@ -402,8 +402,8 @@ MACHINE_CONFIG_START(mpf1_state::mpf1b) z80pio_device& pio(Z80PIO(config, Z80PIO_TAG, XTAL(3'579'545)/2)); pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(3'579'545)/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, XTAL(3'579'545)/2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) MCFG_I8255_IN_PORTA_CB(READ8(*this, mpf1_state, ppi_pa_r)) @@ -442,8 +442,8 @@ MACHINE_CONFIG_START(mpf1_state::mpf1p) z80pio_device& pio(Z80PIO(config, Z80PIO_TAG, 2500000)); pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 2500000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 2500000); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) MCFG_I8255_IN_PORTA_CB(READ8(*this, mpf1_state, ppi_pa_r)) diff --git a/src/mame/drivers/mtx.cpp b/src/mame/drivers/mtx.cpp index c7d0cc45913..72b4d4f84b9 100644 --- a/src/mame/drivers/mtx.cpp +++ b/src/mame/drivers/mtx.cpp @@ -307,10 +307,10 @@ MACHINE_CONFIG_START(mtx_state::mtx512) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, mtx_state, ctc_trg1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, mtx_state, ctc_trg2_w)) + Z80CTC(config, m_z80ctc, XTAL(4'000'000)); + m_z80ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_z80ctc->zc_callback<1>().set(FUNC(mtx_state::ctc_trg1_w)); + m_z80ctc->zc_callback<2>().set(FUNC(mtx_state::ctc_trg2_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_timer", mtx_state, ctc_tick, attotime::from_hz(XTAL(4'000'000)/13)) diff --git a/src/mame/drivers/nanos.cpp b/src/mame/drivers/nanos.cpp index d39fadf3797..decc7342ede 100644 --- a/src/mame/drivers/nanos.cpp +++ b/src/mame/drivers/nanos.cpp @@ -485,17 +485,17 @@ MACHINE_CONFIG_START(nanos_state::nanos) MCFG_PALETTE_ADD_MONOCHROME("palette") /* devices */ - MCFG_DEVICE_ADD(m_ctc_0, Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, nanos_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, nanos_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, nanos_state, ctc_z2_w)) - - MCFG_DEVICE_ADD(m_ctc_1, Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, nanos_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, nanos_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, nanos_state, ctc_z2_w)) + Z80CTC(config, m_ctc_0, XTAL(4'000'000)); + m_ctc_0->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc_0->zc_callback<0>().set(FUNC(nanos_state::ctc_z0_w)); + m_ctc_0->zc_callback<1>().set(FUNC(nanos_state::ctc_z1_w)); + m_ctc_0->zc_callback<2>().set(FUNC(nanos_state::ctc_z2_w)); + + Z80CTC(config, m_ctc_1, XTAL(4'000'000)); + m_ctc_1->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc_1->zc_callback<0>().set(FUNC(nanos_state::ctc_z0_w)); + m_ctc_1->zc_callback<1>().set(FUNC(nanos_state::ctc_z1_w)); + m_ctc_1->zc_callback<2>().set(FUNC(nanos_state::ctc_z2_w)); Z80PIO(config, m_pio_0, XTAL(4'000'000)); m_pio_0->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/p8k.cpp b/src/mame/drivers/p8k.cpp index 8b8997c6382..24b4c33c7eb 100644 --- a/src/mame/drivers/p8k.cpp +++ b/src/mame/drivers/p8k.cpp @@ -437,17 +437,17 @@ MACHINE_CONFIG_START(p8k_state::p8k) uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txcb_w)); uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxcb_w)); - MCFG_DEVICE_ADD("ctc0", Z80CTC, 1229000) /* 1.22MHz clock */ + z80ctc_device& ctc0(Z80CTC(config, "ctc0", 1229000)); /* 1.22MHz clock */ // to implement: callbacks! // manual states the callbacks should go to // Baud Gen 3, FDC, System-Kanal - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + ctc0.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("ctc1", Z80CTC, 1229000) /* 1.22MHz clock */ + z80ctc_device& ctc1(Z80CTC(config, "ctc1", 1229000)); /* 1.22MHz clock */ // to implement: callbacks! // manual states the callbacks should go to // Baud Gen 0, Baud Gen 1, Baud Gen 2, - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + ctc1.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); z80sio_device& sio(Z80SIO(config, "sio", XTAL(4'000'000))); sio.out_txdb_callback().set("rs232", FUNC(rs232_port_device::write_txd)); @@ -500,11 +500,11 @@ MACHINE_CONFIG_START(p8k_state::p8k_16) uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxcb_w)); /* peripheral hardware */ - MCFG_DEVICE_ADD("ctc0", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(WRITELINE(*this, p8k_state, p8k_16_daisy_interrupt)) + z80ctc_device& ctc0(Z80CTC(config, "ctc0", XTAL(4'000'000))); + ctc0.intr_callback().set(FUNC(p8k_state::p8k_16_daisy_interrupt)); - MCFG_DEVICE_ADD("ctc1", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(WRITELINE(*this, p8k_state, p8k_16_daisy_interrupt)) + z80ctc_device& ctc1(Z80CTC(config, "ctc1", XTAL(4'000'000))); + ctc1.intr_callback().set(FUNC(p8k_state::p8k_16_daisy_interrupt)); z80sio_device& sio(Z80SIO(config, "sio", XTAL(4'000'000))); sio.out_txdb_callback().set("rs232", FUNC(rs232_port_device::write_txd)); diff --git a/src/mame/drivers/pasopia.cpp b/src/mame/drivers/pasopia.cpp index cf9fcca69ea..c8d41b05797 100644 --- a/src/mame/drivers/pasopia.cpp +++ b/src/mame/drivers/pasopia.cpp @@ -323,11 +323,11 @@ MACHINE_CONFIG_START(pasopia_state::pasopia) MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) MCFG_I8255_IN_PORTC_CB(READ8(*this, pasopia_state, rombank_r)) - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("z80ctc", z80ctc_device, trg2)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("z80ctc", z80ctc_device, trg3)) + Z80CTC(config, m_ctc, XTAL(4'000'000)); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); + m_ctc->zc_callback<1>().set(m_ctc, FUNC(z80ctc_device::trg2)); + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); Z80PIO(config, m_pio, XTAL(4'000'000)); m_pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp index 0c9ba749f85..e2b4780d3a9 100644 --- a/src/mame/drivers/pasopia7.cpp +++ b/src/mame/drivers/pasopia7.cpp @@ -938,11 +938,11 @@ MACHINE_CONFIG_START(pasopia7_state::p7_base) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("z80ctc", z80ctc_device, trg2)) // beep interface - MCFG_Z80CTC_ZC2_CB(WRITELINE("z80ctc", z80ctc_device, trg3)) + Z80CTC(config, m_ctc, XTAL(4'000'000)); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); + m_ctc->zc_callback<1>().set(m_ctc, FUNC(z80ctc_device::trg2)); // beep interface + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); Z80PIO(config, m_pio, XTAL(4'000'000)); m_pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/pbaction.cpp b/src/mame/drivers/pbaction.cpp index f0fa82c58aa..1edca6bc038 100644 --- a/src/mame/drivers/pbaction.cpp +++ b/src/mame/drivers/pbaction.cpp @@ -150,7 +150,7 @@ void pbaction_state::pbaction2_sound_map(address_map &map) void pbaction_state::pbaction_sound_io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x03).rw("ctc", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x00, 0x03).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x10, 0x11).w("ay1", FUNC(ay8910_device::address_data_w)); map(0x20, 0x21).w("ay2", FUNC(ay8910_device::address_data_w)); map(0x30, 0x31).w("ay3", FUNC(ay8910_device::address_data_w)); @@ -331,8 +331,8 @@ MACHINE_CONFIG_START(pbaction_state::pbaction) m_audiocpu->set_addrmap(AS_IO, &pbaction_state::pbaction_sound_io_map); m_audiocpu->set_daisy_config(daisy_chain); - MCFG_DEVICE_ADD("ctc", Z80CTC, 3072000) - MCFG_Z80CTC_INTR_CB(ASSERTLINE("audiocpu", 0)) + Z80CTC(config, m_ctc, 3072000); + m_ctc->intr_callback().set_inputline(m_audiocpu, 0); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/pipeline.cpp b/src/mame/drivers/pipeline.cpp index a7a58ce0928..405f30a04c3 100644 --- a/src/mame/drivers/pipeline.cpp +++ b/src/mame/drivers/pipeline.cpp @@ -373,8 +373,8 @@ MACHINE_CONFIG_START(pipeline_state::pipeline) MCFG_DEVICE_ADD("mcu", M68705R3, 7372800/2) MCFG_M68705_PORTA_W_CB(WRITE8(*this, pipeline_state, mcu_portA_w)) - MCFG_DEVICE_ADD("ctc", Z80CTC, 7372800/2 /* same as "audiocpu" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", 7372800/2 /* same as "audiocpu" */)); + ctc.intr_callback().set_inputline("audiocpu", INPUT_LINE_IRQ0); MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) MCFG_I8255_IN_PORTA_CB(IOPORT("P1")) diff --git a/src/mame/drivers/poly880.cpp b/src/mame/drivers/poly880.cpp index 75a8e30aeb3..30b9b44df64 100644 --- a/src/mame/drivers/poly880.cpp +++ b/src/mame/drivers/poly880.cpp @@ -255,11 +255,11 @@ MACHINE_CONFIG_START(poly880_state::poly880) config.set_default_layout(layout_poly880); /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(7'372'800)/16) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, poly880_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, poly880_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, XTAL(7'372'800)/16)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(poly880_state::ctc_z0_w)); + ctc.zc_callback<1>().set(FUNC(poly880_state::ctc_z1_w)); + ctc.zc_callback<2>().set(Z80CTC_TAG, FUNC(z80ctc_device::trg3)); z80pio_device& pio1(Z80PIO(config, Z80PIO1_TAG, XTAL(7'372'800)/16)); pio1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 46d04b71828..d41a2cced96 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -285,11 +285,11 @@ MACHINE_CONFIG_START(polyplay_state::polyplay_zre) m_maincpu->set_periodic_int(FUNC(polyplay_state::nmi_handler), attotime::from_hz(100)); /* A302 - zero cross detection from AC (50Hz) */ /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, POLYPLAY_MAIN_CLOCK / 4) /* UB857D */ - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80CPU_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, polyplay_state, ctc_zc0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, polyplay_state, ctc_zc1_w)) - //MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, polyplay_state, ctc_zc2_w)) + Z80CTC(config, m_z80ctc, POLYPLAY_MAIN_CLOCK / 4); /* UB857D */ + m_z80ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_z80ctc->zc_callback<0>().set(FUNC(polyplay_state::ctc_zc0_w)); + m_z80ctc->zc_callback<1>().set(FUNC(polyplay_state::ctc_zc1_w)); + //m_z80ctc->zc_callback<2>().set(FUNC(polyplay_state::ctc_zc2_w)); Z80PIO(config, m_z80pio, POLYPLAY_MAIN_CLOCK / 4); /* UB855D */ m_z80pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/proconn.cpp b/src/mame/drivers/proconn.cpp index 2872ee91d0c..fc1a9c7cb35 100644 --- a/src/mame/drivers/proconn.cpp +++ b/src/mame/drivers/proconn.cpp @@ -318,8 +318,8 @@ MACHINE_CONFIG_START(proconn_state::proconn) m_z80pio[4]->out_pb_callback().set(FUNC(proconn_state::pio_5_m_out_pb_w)); m_z80pio[4]->out_brdy_callback().set(FUNC(proconn_state::pio_5_m_out_brdy_w)); - MCFG_DEVICE_ADD("z80ctc", Z80CTC, 4000000) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_z80ctc, 4000000); + m_z80ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); Z80SIO(config, m_z80sio, 4000000); /* ?? Mhz */ diff --git a/src/mame/drivers/pve500.cpp b/src/mame/drivers/pve500.cpp index 36ef29b6d1c..fd5e7d285db 100644 --- a/src/mame/drivers/pve500.cpp +++ b/src/mame/drivers/pve500.cpp @@ -371,8 +371,8 @@ MACHINE_CONFIG_START(pve500_state::pve500) m_maincpu->out_txda_callback().set("recorder", FUNC(rs232_port_device::write_txd)); m_maincpu->out_txdb_callback().set("player1", FUNC(rs232_port_device::write_txd)); - MCFG_DEVICE_ADD("external_ctc", Z80CTC, 12_MHz_XTAL / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "external_ctc", 12_MHz_XTAL / 2)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); z80sio0_device& sio(Z80SIO0(config, "external_sio", 12_MHz_XTAL / 2)); sio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/drivers/qvt103.cpp b/src/mame/drivers/qvt103.cpp index 71621eeb96b..9c33b8ffaac 100644 --- a/src/mame/drivers/qvt103.cpp +++ b/src/mame/drivers/qvt103.cpp @@ -67,25 +67,26 @@ static const z80_daisy_config daisy_chain[] = { nullptr } }; -MACHINE_CONFIG_START(qvt103_state::qvt103) +void qvt103_state::qvt103(machine_config &config) +{ Z80(config, m_maincpu, XTAL(29'376'000) / 9); // divider guessed m_maincpu->set_addrmap(AS_PROGRAM, &qvt103_state::mem_map); m_maincpu->set_addrmap(AS_IO, &qvt103_state::io_map); m_maincpu->set_daisy_config(daisy_chain); - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(29'376'000) / 9) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(29'376'000) / 9)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); z80dart_device& dart(Z80DART(config, "dart", XTAL(29'376'000) / 9)); dart.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL(29'376'000) * 2 / 3, 102 * 10, 0, 80 * 10, 320, 0, 300) - //MCFG_SCREEN_RAW_PARAMS(XTAL(29'376'000), 170 * 9, 0, 132 * 9, 320, 0, 300) - MCFG_SCREEN_UPDATE_DRIVER(qvt103_state, screen_update) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(29'376'000) * 2 / 3, 102 * 10, 0, 80 * 10, 320, 0, 300); + //screen.set_raw(XTAL(29'376'000), 170 * 9, 0, 132 * 9, 320, 0, 300); + screen.set_screen_update(FUNC(qvt103_state::screen_update)); - MCFG_DEVICE_ADD("kbdmcu", I8741, XTAL(6'000'000)) -MACHINE_CONFIG_END + I8741(config, "kbdmcu", XTAL(6'000'000)); +} /************************************************************************************************************** diff --git a/src/mame/drivers/qvt6800.cpp b/src/mame/drivers/qvt6800.cpp index 8c0758a8e3c..38bc5578e40 100644 --- a/src/mame/drivers/qvt6800.cpp +++ b/src/mame/drivers/qvt6800.cpp @@ -79,9 +79,9 @@ MACHINE_CONFIG_START(qvt6800_state::qvt102) MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(16'669'800) / 9) - MCFG_Z80CTC_ZC0_CB(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("acia", acia6850_device, write_rxc)) + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(16'669'800) / 9)); + ctc.zc_callback<0>().set("acia", FUNC(acia6850_device::write_txc)); + ctc.zc_callback<1>().set("acia", FUNC(acia6850_device::write_rxc)); clock_device &ctcclk(CLOCK(config, "ctcclk", 16.6698_MHz_XTAL / 18)); // OR of CRTC CLK and ϕ1 ctcclk.signal_handler().set("ctc", FUNC(z80ctc_device::trg0)); diff --git a/src/mame/drivers/rt1715.cpp b/src/mame/drivers/rt1715.cpp index bdeebb7197c..7b8b9b5ed84 100644 --- a/src/mame/drivers/rt1715.cpp +++ b/src/mame/drivers/rt1715.cpp @@ -309,9 +309,9 @@ MACHINE_CONFIG_START(rt1715_state::rt1715) MCFG_I8275_CHARACTER_WIDTH(8) MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(rt1715_state, crtc_display_pixels) - MCFG_DEVICE_ADD("a30", Z80CTC, 9.832_MHz_XTAL / 4) - MCFG_Z80CTC_ZC0_CB(WRITELINE("a29", z80sio_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("a29", z80sio_device, rxtxcb_w)) + z80ctc_device& ctc(Z80CTC(config, "a30", 9.832_MHz_XTAL / 4)); + ctc.zc_callback<0>().set("a29", FUNC(z80sio_device::txca_w)); + ctc.zc_callback<2>().set("a29", FUNC(z80sio_device::rxtxcb_w)); Z80SIO(config, "a29", 9.832_MHz_XTAL / 4); diff --git a/src/mame/drivers/senjyo.cpp b/src/mame/drivers/senjyo.cpp index 00ea6ef9df6..0b12a9eefab 100644 --- a/src/mame/drivers/senjyo.cpp +++ b/src/mame/drivers/senjyo.cpp @@ -564,10 +564,10 @@ MACHINE_CONFIG_START(senjyo_state::senjyo) m_pio->out_int_callback().set_inputline("sub", INPUT_LINE_IRQ0); m_pio->in_pa_callback().set(FUNC(senjyo_state::pio_pa_r)); - MCFG_DEVICE_ADD("z80ctc", Z80CTC, 2000000 /* same as "sub" */) - MCFG_Z80CTC_INTR_CB(INPUTLINE("sub", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, senjyo_state, sound_line_clock)) + z80ctc_device& ctc(Z80CTC(config, "z80ctc", 2000000 /* same as "sub" */)); + ctc.intr_callback().set_inputline("sub", INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("z80ctc", FUNC(z80ctc_device::trg1)); + ctc.zc_callback<2>().set(FUNC(senjyo_state::sound_line_clock)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/stargame.cpp b/src/mame/drivers/stargame.cpp index 40a10142284..3556438e508 100644 --- a/src/mame/drivers/stargame.cpp +++ b/src/mame/drivers/stargame.cpp @@ -119,9 +119,9 @@ MACHINE_CONFIG_START(stargame_state::stargame) /* video hardware */ //MCFG_DEFAULT_LAYOUT() - MCFG_DEVICE_ADD("ctc", Z80CTC, 15000000 / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) // SINT - turn on interrupt of the audiocpu + Z80CTC(config, m_ctc, 15000000 / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set_inputline(m_audiocpu, INPUT_LINE_IRQ0); // SINT - turn on interrupt of the audiocpu /* sound hardware */ genpin_audio(config); diff --git a/src/mame/drivers/super6.cpp b/src/mame/drivers/super6.cpp index 282b426ef76..45c6f55c79f 100644 --- a/src/mame/drivers/super6.cpp +++ b/src/mame/drivers/super6.cpp @@ -451,9 +451,9 @@ MACHINE_CONFIG_START(super6_state::super6) //m_maincpu->set_daisy_config(super6_daisy_chain); // devices - MCFG_DEVICE_ADD(m_ctc, Z80CTC, 24_MHz_XTAL / 4) - MCFG_Z80CTC_ZC0_CB(WRITELINE(m_ctc, z80ctc_device, trg1)) // J6 pin 2-3 - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 24_MHz_XTAL / 4); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); // J6 pin 2-3 + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); clock_device &ctc_tick(CLOCK(config, "ctc_tick", 24_MHz_XTAL / 16)); ctc_tick.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); // J6 pin 1-14 (1.5MHz) diff --git a/src/mame/drivers/tiki100.cpp b/src/mame/drivers/tiki100.cpp index 5cac074c004..4a5818adafa 100644 --- a/src/mame/drivers/tiki100.cpp +++ b/src/mame/drivers/tiki100.cpp @@ -740,11 +740,11 @@ MACHINE_CONFIG_START(tiki100_state::tiki100) m_pio->in_pb_callback().set(FUNC(tiki100_state::pio_pb_r)); m_pio->out_pb_callback().set(FUNC(tiki100_state::pio_pb_w)); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 8_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, tiki100_state, bar0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(m_dart, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, tiki100_state, bar2_w)) + Z80CTC(config, m_ctc, 8_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(tiki100_state::bar0_w)); + m_ctc->zc_callback<1>().set(m_dart, FUNC(z80dart_device::rxtxcb_w)); + m_ctc->zc_callback<2>().set(FUNC(tiki100_state::bar2_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", tiki100_state, ctc_tick, attotime::from_hz(8_MHz_XTAL / 4)) diff --git a/src/mame/drivers/topspeed.cpp b/src/mame/drivers/topspeed.cpp index b467e67453a..625952c3149 100644 --- a/src/mame/drivers/topspeed.cpp +++ b/src/mame/drivers/topspeed.cpp @@ -582,8 +582,8 @@ MACHINE_CONFIG_START(topspeed_state::topspeed) MCFG_DEVICE_PROGRAM_MAP(z80_prg) MCFG_DEVICE_IO_MAP(z80_io) - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, topspeed_state, z80ctc_to0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(16'000'000) / 4)); + ctc.intr_callback().set(FUNC(topspeed_state::z80ctc_to0)); MCFG_DEVICE_ADD("pc080sn_1", PC080SN, 0) MCFG_PC080SN_GFX_REGION(1) diff --git a/src/mame/drivers/tranz330.cpp b/src/mame/drivers/tranz330.cpp index df6c2b1ab58..cb89d0f5704 100644 --- a/src/mame/drivers/tranz330.cpp +++ b/src/mame/drivers/tranz330.cpp @@ -169,8 +169,8 @@ void tranz330_state::tranz330(machine_config &config) m_dart->out_int_callback().set("irq", FUNC(input_merger_device::in_w<1>)); Z80CTC(config, m_ctc, XTAL(7'159'090)/2); //* - m_ctc->set_zc_callback<2>(DEVCB_WRITELINE(*this, tranz330_state, sound_w)); - m_ctc->set_intr_callback(DEVCB_WRITELINE("irq", input_merger_device, in_w<2>)); + m_ctc->zc_callback<2>().set(FUNC(tranz330_state::sound_w)); + m_ctc->intr_callback().set("irq", FUNC(input_merger_device::in_w<2>)); RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); m_rs232->rxd_handler().set(m_dart, FUNC(z80dart_device::rxb_w)); diff --git a/src/mame/drivers/trs80m2.cpp b/src/mame/drivers/trs80m2.cpp index e608f00bcd9..f5c85f5d3e0 100644 --- a/src/mame/drivers/trs80m2.cpp +++ b/src/mame/drivers/trs80m2.cpp @@ -740,11 +740,11 @@ MACHINE_CONFIG_START(trs80m2_state::trs80m2) MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, nullptr, floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, nullptr, floppy_image_device::default_floppy_formats) - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 8_MHz_XTAL / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(Z80SIO_TAG, z80dart_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + Z80CTC(config, m_ctc, 8_MHz_XTAL / 2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(Z80SIO_TAG, FUNC(z80dart_device::rxca_w)); + m_ctc->zc_callback<1>().set(Z80SIO_TAG, FUNC(z80dart_device::txca_w)); + m_ctc->zc_callback<2>().set(Z80SIO_TAG, FUNC(z80dart_device::rxtxcb_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(8_MHz_XTAL / 2 / 2)) @@ -828,11 +828,11 @@ MACHINE_CONFIG_START(trs80m16_state::trs80m16) MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, nullptr, floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, nullptr, floppy_image_device::default_floppy_formats) - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 8_MHz_XTAL / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(Z80SIO_TAG, z80dart_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + Z80CTC(config, m_ctc, 8_MHz_XTAL / 2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(Z80SIO_TAG, FUNC(z80dart_device::rxca_w)); + m_ctc->zc_callback<1>().set(Z80SIO_TAG, FUNC(z80dart_device::txca_w)); + m_ctc->zc_callback<2>().set(Z80SIO_TAG, FUNC(z80dart_device::rxtxcb_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(8_MHz_XTAL / 2 / 2)) diff --git a/src/mame/drivers/ts802.cpp b/src/mame/drivers/ts802.cpp index 459c2e06aad..16a2b28c4ef 100644 --- a/src/mame/drivers/ts802.cpp +++ b/src/mame/drivers/ts802.cpp @@ -215,8 +215,8 @@ MACHINE_CONFIG_START(ts802_state::ts802) z80dart_device& dart2(Z80DART(config, "dart2", 16_MHz_XTAL / 4)); dart2.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("ctc", Z80CTC, 16_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc(Z80CTC(config, "ctc", 16_MHz_XTAL / 4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); MCFG_DEVICE_ADD("fdc", FD1793, 4'000'000 / 2) // unknown clock MCFG_FLOPPY_DRIVE_ADD("fdc:0", ts802_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/ts816.cpp b/src/mame/drivers/ts816.cpp index 27d26ce2e21..62f2070594c 100644 --- a/src/mame/drivers/ts816.cpp +++ b/src/mame/drivers/ts816.cpp @@ -301,10 +301,11 @@ MACHINE_CONFIG_START(ts816_state::ts816) //pio.in_pb_callback().set(FUNC(ts816_state::portb_r)); //pio.out_pb_callback().set(FUNC(ts816_state::portb_w)); - MCFG_DEVICE_ADD("ctc1", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD("ctc2", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + z80ctc_device& ctc1(Z80CTC(config, "ctc1", XTAL(16'000'000) / 4)); + ctc1.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + + z80ctc_device& ctc2(Z80CTC(config, "ctc2", XTAL(16'000'000) / 4)); + ctc2.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); z80dma_device& dma(Z80DMA(config, "dma", XTAL(16'000'000) / 4)); //dma.out_busreq_callback().set(FUNC(ts816_state::busreq_w)); diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp index 54388a6e522..232e6651bbb 100644 --- a/src/mame/drivers/x1.cpp +++ b/src/mame/drivers/x1.cpp @@ -2208,11 +2208,11 @@ MACHINE_CONFIG_START(x1_state::x1) ADDRESS_MAP_BANK(config, "iobank").set_map(&x1_state::x1_io_banks).set_options(ENDIANNESS_LITTLE, 8, 17, 0x10000); - MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_CLOCK/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("ctc", z80ctc_device, trg3)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("ctc", z80ctc_device, trg2)) + z80ctc_device& ctc(Z80CTC(config, "ctc", MAIN_CLOCK/4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("ctc", FUNC(z80ctc_device::trg3)); + ctc.zc_callback<1>().set("ctc", FUNC(z80ctc_device::trg1)); + ctc.zc_callback<2>().set("ctc", FUNC(z80ctc_device::trg2)); MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) diff --git a/src/mame/drivers/x1twin.cpp b/src/mame/drivers/x1twin.cpp index 3ac4ef6a51c..8e0ebffe984 100644 --- a/src/mame/drivers/x1twin.cpp +++ b/src/mame/drivers/x1twin.cpp @@ -419,11 +419,11 @@ MACHINE_CONFIG_START(x1twin_state::x1twin) ADDRESS_MAP_BANK(config, "iobank").set_map(&x1_state::x1_io_banks).set_options(ENDIANNESS_LITTLE, 8, 17, 0x10000); - MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_CLOCK/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("ctc", z80ctc_device, trg3)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("ctc", z80ctc_device, trg2)) + z80ctc_device& ctc(Z80CTC(config, "ctc", MAIN_CLOCK/4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("ctc", FUNC(z80ctc_device::trg3)); + ctc.zc_callback<1>().set("ctc", FUNC(z80ctc_device::trg1)); + ctc.zc_callback<2>().set("ctc", FUNC(z80ctc_device::trg2)); MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp index 17c3190a190..f8c6237481f 100644 --- a/src/mame/drivers/xerox820.cpp +++ b/src/mame/drivers/xerox820.cpp @@ -620,10 +620,10 @@ MACHINE_CONFIG_START(xerox820_state::xerox820) z80pio_device& pio_gp(Z80PIO(config, Z80PIO_GP_TAG, 20_MHz_XTAL / 8)); pio_gp.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 20_MHz_XTAL / 8) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + Z80CTC(config, m_ctc, 20_MHz_XTAL / 8); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(20_MHz_XTAL / 8)) MCFG_DEVICE_ADD(FD1771_TAG, FD1771, 20_MHz_XTAL / 20) @@ -709,10 +709,10 @@ MACHINE_CONFIG_START(xerox820ii_state::xerox820ii) pio_rd.in_pb_callback().set("sasi_ctrl_in", FUNC(input_buffer_device::bus_r)); pio_rd.out_pb_callback().set(FUNC(xerox820ii_state::rdpio_pb_w)); - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 16_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + Z80CTC(config, m_ctc, 16_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(m_ctc, FUNC(z80ctc_device::trg1)); + m_ctc->zc_callback<2>().set(m_ctc, FUNC(z80ctc_device::trg3)); //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(16_MHz_XTAL / 4)) MCFG_DEVICE_ADD(FD1797_TAG, FD1797, 16_MHz_XTAL / 8) diff --git a/src/mame/drivers/xor100.cpp b/src/mame/drivers/xor100.cpp index 3bfebda64f9..d120acd7c56 100644 --- a/src/mame/drivers/xor100.cpp +++ b/src/mame/drivers/xor100.cpp @@ -516,11 +516,11 @@ MACHINE_CONFIG_START(xor100_state::xor100) MCFG_I8255_OUT_PORTB_CB(WRITELINE(m_centronics, centronics_device, write_strobe)) MCFG_I8255_IN_PORTC_CB(READ8(*this, xor100_state, i8255_pc_r)) - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 8_MHz_XTAL / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, xor100_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, xor100_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, xor100_state, ctc_z2_w)) + Z80CTC(config, m_ctc, 8_MHz_XTAL / 2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(xor100_state::ctc_z0_w)); + m_ctc->zc_callback<1>().set(FUNC(xor100_state::ctc_z1_w)); + m_ctc->zc_callback<2>().set(FUNC(xor100_state::ctc_z2_w)); MCFG_DEVICE_ADD(WD1795_TAG, FD1795, 8_MHz_XTAL / 4) MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":0", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/z9001.cpp b/src/mame/drivers/z9001.cpp index 49cc04b3457..35a1e69c4b0 100644 --- a/src/mame/drivers/z9001.cpp +++ b/src/mame/drivers/z9001.cpp @@ -242,10 +242,10 @@ MACHINE_CONFIG_START(z9001_state::z9001) z80pio_device& pio2(Z80PIO(config, "z80pio2", XTAL(9'830'400) / 4)); // keyboard PIO pio2.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL(9'830'400) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, z9001_state, cass_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("z80ctc", z80ctc_device, trg3)) + z80ctc_device& ctc(Z80CTC(config, "z80ctc", XTAL(9'830'400) / 4)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set(FUNC(z9001_state::cass_w)); + ctc.zc_callback<2>().set("z80ctc", FUNC(z80ctc_device::trg3)); MCFG_CASSETTE_ADD( "cassette" ) MACHINE_CONFIG_END diff --git a/src/mame/drivers/zsbc3.cpp b/src/mame/drivers/zsbc3.cpp index c2be544d29d..00fc9822a93 100644 --- a/src/mame/drivers/zsbc3.cpp +++ b/src/mame/drivers/zsbc3.cpp @@ -83,7 +83,8 @@ static INPUT_PORTS_START( zsbc3 ) INPUT_PORTS_END -MACHINE_CONFIG_START(zsbc3_state::zsbc3) +void zsbc3_state::zsbc3(machine_config &config) +{ /* basic machine hardware */ Z80(config, m_maincpu, 16_MHz_XTAL / 4); m_maincpu->set_addrmap(AS_PROGRAM, &zsbc3_state::zsbc3_mem); @@ -111,7 +112,7 @@ MACHINE_CONFIG_START(zsbc3_state::zsbc3) /*z80pio_device &pio(*/Z80PIO(config, "pio", 16_MHz_XTAL / 4)/*)*/; //pio.out_int_callback.set_inputline(m_maincpu, INPUT_LINE_IRQ0); -MACHINE_CONFIG_END +} /* ROM definition */ ROM_START( zsbc3 ) diff --git a/src/mame/machine/inder_sb.cpp b/src/mame/machine/inder_sb.cpp index 1548fba99fb..0149c180291 100644 --- a/src/mame/machine/inder_sb.cpp +++ b/src/mame/machine/inder_sb.cpp @@ -156,9 +156,9 @@ MACHINE_CONFIG_START(inder_sb_device::device_add_mconfig) m_audiocpu->set_addrmap(AS_PROGRAM, &inder_sb_device::sound_map); m_audiocpu->set_addrmap(AS_IO, &inder_sb_device::sound_io); - MCFG_DEVICE_ADD("ctc", Z80CTC, 4000000) // unk freq + Z80CTC(config, m_ctc, 4000000); // unk freq // runs in IM2 , vector set to 0x20 , values there are 0xCC, 0x02, 0xE6, 0x02, 0x09, 0x03, 0x23, 0x03 (so 02cc, 02e6, 0309, 0323, all of which are valid irq handlers) - MCFG_Z80CTC_INTR_CB(INPUTLINE("audiocpu", 0)) + m_ctc->intr_callback().set_inputline(m_audiocpu, 0); SPEAKER(config, "speaker").front_center(); MCFG_DEVICE_ADD("dac0", DAC_8BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC |