diff options
author | 2018-10-30 18:04:42 +0100 | |
---|---|---|
committer | 2018-10-30 18:04:42 +0100 | |
commit | f3a0f0dffb59955222cd69811e114cd89fd321ad (patch) | |
tree | 57daf8a15bc552fdba917f26cd2f54d9f868a305 | |
parent | 711efa4a9006623a8245d6ec31ff868d9bcdb8cb (diff) |
pit8253.h: removed MCFG macros (nw)
69 files changed, 703 insertions, 790 deletions
diff --git a/src/devices/bus/cpc/cpc_rs232.cpp b/src/devices/bus/cpc/cpc_rs232.cpp index 603e5e64625..cedbc6bfaf3 100644 --- a/src/devices/bus/cpc/cpc_rs232.cpp +++ b/src/devices/bus/cpc/cpc_rs232.cpp @@ -34,13 +34,13 @@ ROM_END // device machine config MACHINE_CONFIG_START(cpc_rs232_device::device_add_mconfig) - MCFG_DEVICE_ADD(m_pit, PIT8253, 0) - MCFG_PIT8253_CLK0(2000000) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, cpc_rs232_device, pit_out0_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, cpc_rs232_device, pit_out1_w)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, cpc_rs232_device, pit_out2_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(2000000); + m_pit->set_clk<1>(2000000); + m_pit->set_clk<2>(2000000); + m_pit->out_handler<0>().set(FUNC(cpc_rs232_device::pit_out0_w)); + m_pit->out_handler<1>().set(FUNC(cpc_rs232_device::pit_out1_w)); + m_pit->out_handler<2>().set(FUNC(cpc_rs232_device::pit_out2_w)); Z80DART(config, m_dart, XTAL(4'000'000)); m_dart->out_txda_callback().set(m_rs232, FUNC(rs232_port_device::write_txd)); diff --git a/src/devices/bus/dmv/k220.cpp b/src/devices/bus/dmv/k220.cpp index 8776ae629d5..4fff4f5b2bf 100644 --- a/src/devices/bus/dmv/k220.cpp +++ b/src/devices/bus/dmv/k220.cpp @@ -158,18 +158,19 @@ void dmv_k220_device::device_reset() // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(dmv_k220_device::device_add_mconfig) +void dmv_k220_device::device_add_mconfig(machine_config &config) +{ I8255(config, m_ppi); m_ppi->out_pa_callback().set(FUNC(dmv_k220_device::porta_w)); m_ppi->in_pb_callback().set_ioport("SWITCH"); m_ppi->out_pc_callback().set(FUNC(dmv_k220_device::portc_w)); - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(1'000'000)) // CLK1 - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, dmv_k220_device, write_out0)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, dmv_k220_device, write_out1)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, dmv_k220_device, write_out2)) -MACHINE_CONFIG_END + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(XTAL(1'000'000)); // CLK1 + m_pit->out_handler<0>().set(FUNC(dmv_k220_device::write_out0)); + m_pit->out_handler<1>().set(FUNC(dmv_k220_device::write_out1)); + m_pit->out_handler<2>().set(FUNC(dmv_k220_device::write_out2)); +} //------------------------------------------------- // input_ports - device-specific input ports diff --git a/src/devices/bus/isa/ibm_mfc.cpp b/src/devices/bus/isa/ibm_mfc.cpp index 6ffed8dd904..d6c5c4a98ce 100644 --- a/src/devices/bus/isa/ibm_mfc.cpp +++ b/src/devices/bus/isa/ibm_mfc.cpp @@ -395,13 +395,13 @@ MACHINE_CONFIG_START(isa8_ibm_mfc_device::device_add_mconfig) MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL(4'000'000) / 8) // 500KHz MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, isa8_ibm_mfc_device, write_usart_clock)) - MCFG_DEVICE_ADD("d8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(4'000'000) / 8) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, isa8_ibm_mfc_device, d8253_out0)) - MCFG_PIT8253_CLK1(0) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, isa8_ibm_mfc_device, d8253_out1)) - MCFG_PIT8253_CLK2(XTAL(4'000'000) / 2) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("d8253", pit8253_device, write_clk1)) + PIT8253(config, m_d8253, 0); + m_d8253->set_clk<0>(XTAL(4'000'000) / 8); + m_d8253->out_handler<0>().set(FUNC(isa8_ibm_mfc_device::d8253_out0)); + m_d8253->set_clk<1>(0); + m_d8253->out_handler<1>().set(FUNC(isa8_ibm_mfc_device::d8253_out1)); + m_d8253->set_clk<2>(XTAL(4'000'000) / 2); + m_d8253->out_handler<2>().set(m_d8253, FUNC(pit8253_device::write_clk1)); SPEAKER(config, "ymleft").front_left(); SPEAKER(config, "ymright").front_right(); diff --git a/src/devices/bus/isa/myb3k_com.cpp b/src/devices/bus/isa/myb3k_com.cpp index a3f2fd79879..88987e87e41 100644 --- a/src/devices/bus/isa/myb3k_com.cpp +++ b/src/devices/bus/isa/myb3k_com.cpp @@ -31,7 +31,8 @@ DEFINE_DEVICE_TYPE(ISA8_MYB3K_COM, isa8_myb3k_com_device, "isa8_myb3k_com", "ADP //------------------------------------------------- // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(isa8_myb3k_com_device::device_add_mconfig) +void isa8_myb3k_com_device::device_add_mconfig(machine_config &config) +{ I8251( config, m_usart, XTAL(15'974'400) / 8 ); m_usart->txd_handler().set("com1", FUNC(rs232_port_device::write_txd)); m_usart->dtr_handler().set("com1", FUNC(rs232_port_device::write_dtr)); @@ -48,13 +49,13 @@ MACHINE_CONFIG_START(isa8_myb3k_com_device::device_add_mconfig) // TODO: configure RxC and TxC from RS232 connector when these are defined is rs232.h /* Timer chip */ - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(15'974'400) / 8 ) /* TxC */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, isa8_myb3k_com_device, pit_txc)) - MCFG_PIT8253_CLK1(XTAL(15'974'400) / 8 ) /* RxC */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, isa8_myb3k_com_device, pit_rxc)) + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(XTAL(15'974'400) / 8); /* TxC */ + pit.out_handler<0>().set(FUNC(isa8_myb3k_com_device::pit_txc)); + pit.set_clk<1>(XTAL(15'974'400) / 8); /* RxC */ + pit.out_handler<1>().set(FUNC(isa8_myb3k_com_device::pit_rxc)); // Timer 2 is not used/connected to anything on the schematics -MACHINE_CONFIG_END +} // PORT definitions moved to the end of this file as it became very long diff --git a/src/devices/bus/isa/p1_sound.cpp b/src/devices/bus/isa/p1_sound.cpp index 4d24328395f..485dca5205e 100644 --- a/src/devices/bus/isa/p1_sound.cpp +++ b/src/devices/bus/isa/p1_sound.cpp @@ -39,30 +39,30 @@ MACHINE_CONFIG_START(p1_sound_device::device_add_mconfig) MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - MCFG_DEVICE_ADD("d14", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(12'500'000)/10) + PIT8253(config, m_d14, 0); + m_d14->set_clk<0>(XTAL(12'500'000)/10); // sampler at 10 KHz - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, p1_sound_device, sampler_sync)) - MCFG_PIT8253_CLK1(XTAL(12'500'000)/10) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("midi", i8251_device, write_txc)) - MCFG_PIT8253_CLK2(XTAL(12'500'000)/10) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("midi", i8251_device, write_rxc)) - - MCFG_DEVICE_ADD("d16", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(12'500'000)/10) -// MCFG_PIT8253_OUT0_HANDLER(XXX) - MCFG_PIT8253_CLK1(XTAL(12'500'000)/10) -// MCFG_PIT8253_OUT1_HANDLER(XXX) - MCFG_PIT8253_CLK2(XTAL(12'500'000)/10) -// MCFG_PIT8253_OUT2_HANDLER(XXX) - - MCFG_DEVICE_ADD("d17", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(12'500'000)/10) -// MCFG_PIT8253_OUT0_HANDLER(XXX) - MCFG_PIT8253_CLK1(XTAL(12'500'000)/10) -// MCFG_PIT8253_OUT1_HANDLER(XXX) - MCFG_PIT8253_CLK2(XTAL(12'500'000)/10) -// MCFG_PIT8253_OUT2_HANDLER(XXX) + m_d14->out_handler<0>().set(FUNC(p1_sound_device::sampler_sync)); + m_d14->set_clk<1>(XTAL(12'500'000)/10); + m_d14->out_handler<1>().set(m_midi, FUNC(i8251_device::write_txc)); + m_d14->set_clk<2>(XTAL(12'500'000)/10); + m_d14->out_handler<2>().set(m_midi, FUNC(i8251_device::write_rxc)); + + PIT8253(config, m_d16, 0); + m_d16->set_clk<0>(XTAL(12'500'000)/10); +// m_d16->out_handler<0>().set(FUNC(XXX)); + m_d16->set_clk<1>(XTAL(12'500'000)/10); +// m_d16->out_handler<1>().set(FUNC(XXX)); + m_d16->set_clk<2>(XTAL(12'500'000)/10); +// m_d16->out_handler<2>().set(FUNC(XXX)); + + PIT8253(config, m_d17, 0); + m_d17->set_clk<0>(XTAL(12'500'000)/10); +// m_d17->out_handler<0>().set(FUNC(XXX)); + m_d17->set_clk<1>(XTAL(12'500'000)/10); +// m_d17->out_handler<1>().set(FUNC(XXX)); + m_d17->set_clk<2>(XTAL(12'500'000)/10); +// m_d17->out_handler<2>().set(FUNC(XXX)); SPEAKER(config, "speaker").front_center(); MCFG_DEVICE_ADD("filter", FILTER_RC) diff --git a/src/devices/machine/i80130.cpp b/src/devices/machine/i80130.cpp index 5f974cb532f..7242e783592 100644 --- a/src/devices/machine/i80130.cpp +++ b/src/devices/machine/i80130.cpp @@ -100,18 +100,19 @@ const tiny_rom_entry *i80130_device::device_rom_region() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(i80130_device::device_add_mconfig) - MCFG_DEVICE_ADD("pic", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, i80130_device, irq_w)) - - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, i80130_device, systick_w)) - MCFG_PIT8253_CLK1(0) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, i80130_device, delay_w)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, i80130_device, baud_w)) -MACHINE_CONFIG_END +void i80130_device::device_add_mconfig(machine_config &config) +{ + PIC8259(config, m_pic, 0); + m_pic->out_int_callback().set(FUNC(i80130_device::irq_w)); + + PIT8254(config, m_pit, 0); + m_pit->set_clk<0>(0); + m_pit->out_handler<0>().set(FUNC(i80130_device::systick_w)); + m_pit->set_clk<1>(0); + m_pit->out_handler<1>().set(FUNC(i80130_device::delay_w)); + m_pit->set_clk<2>(0); + m_pit->out_handler<2>().set(FUNC(i80130_device::baud_w)); +} diff --git a/src/devices/machine/pit8253.h b/src/devices/machine/pit8253.h index 722cfa5233d..eebee4edbb3 100644 --- a/src/devices/machine/pit8253.h +++ b/src/devices/machine/pit8253.h @@ -30,29 +30,6 @@ #pragma once -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_PIT8253_CLK0(_clk) \ - downcast<pit8253_device &>(*device).set_clk<0>(_clk); - -#define MCFG_PIT8253_CLK1(_clk) \ - downcast<pit8253_device &>(*device).set_clk<1>(_clk); - -#define MCFG_PIT8253_CLK2(_clk) \ - downcast<pit8253_device &>(*device).set_clk<2>(_clk); - -#define MCFG_PIT8253_OUT0_HANDLER(_devcb) \ - downcast<pit8253_device &>(*device).set_out_handler<0>(DEVCB_##_devcb); - -#define MCFG_PIT8253_OUT1_HANDLER(_devcb) \ - downcast<pit8253_device &>(*device).set_out_handler<1>(DEVCB_##_devcb); - -#define MCFG_PIT8253_OUT2_HANDLER(_devcb) \ - downcast<pit8253_device &>(*device).set_out_handler<2>(DEVCB_##_devcb); - - enum class pit_type { I8254, @@ -132,7 +109,6 @@ public: // configuration helpers template <unsigned N> void set_clk(double clk) { m_clk[N] = clk; } template <unsigned N> void set_clk(const XTAL &xtal) { set_clk<N>(xtal.dvalue()); } - template <unsigned N, class Object> devcb_base &set_out_handler(Object &&cb) { return m_out_handler[N].set_callback(std::forward<Object>(cb)); } template <unsigned N> auto out_handler() { return m_out_handler[N].bind(); } uint8_t read(offs_t offset); diff --git a/src/mame/audio/leland.cpp b/src/mame/audio/leland.cpp index 8019b0c514e..f686e7c6b5f 100644 --- a/src/mame/audio/leland.cpp +++ b/src/mame/audio/leland.cpp @@ -163,21 +163,21 @@ MACHINE_CONFIG_START(leland_80186_sound_device::device_add_mconfig) MCFG_SOUND_ROUTE(0, "dac6vol", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac9", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac9", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("pit0", PIT8254, 0) - MCFG_PIT8253_CLK0(4000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq0_w)) - MCFG_PIT8253_CLK1(4000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq1_w)) - MCFG_PIT8253_CLK2(4000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit0_2_w)) - - MCFG_DEVICE_ADD("pit1", PIT8254, 0) - MCFG_PIT8253_CLK0(4000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit1_0_w)) - MCFG_PIT8253_CLK1(4000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit1_1_w)) - MCFG_PIT8253_CLK2(4000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit1_2_w)) + PIT8254(config, m_pit[0], 0); + m_pit[0]->set_clk<0>(4000000); + m_pit[0]->out_handler<0>().set(m_audiocpu, FUNC(i80186_cpu_device::drq0_w)); + m_pit[0]->set_clk<1>(4000000); + m_pit[0]->out_handler<1>().set(m_audiocpu, FUNC(i80186_cpu_device::drq1_w)); + m_pit[0]->set_clk<2>(4000000); + m_pit[0]->out_handler<2>().set(FUNC(leland_80186_sound_device::pit0_2_w)); + + PIT8254(config, m_pit[1], 0); + m_pit[1]->set_clk<0>(4000000); + m_pit[1]->out_handler<0>().set(FUNC(leland_80186_sound_device::pit1_0_w)); + m_pit[1]->set_clk<1>(4000000); + m_pit[1]->out_handler<1>().set(FUNC(leland_80186_sound_device::pit1_1_w)); + m_pit[1]->set_clk<2>(4000000); + m_pit[1]->out_handler<2>().set(FUNC(leland_80186_sound_device::pit1_2_w)); MCFG_GENERIC_LATCH_16_ADD("soundlatch") MACHINE_CONFIG_END @@ -215,26 +215,26 @@ MACHINE_CONFIG_START(redline_80186_sound_device::device_add_mconfig) MCFG_SOUND_ROUTE(0, "dac7vol", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac8vol", 1.0, DAC_VREF_POS_INPUT) - MCFG_DEVICE_ADD("pit0", PIT8254, 0) - MCFG_PIT8253_CLK0(7000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq0_w)) - MCFG_PIT8253_CLK1(7000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq1_w)) - MCFG_PIT8253_CLK2(7000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit0_2_w)) - - MCFG_DEVICE_ADD("pit1", PIT8254, 0) - MCFG_PIT8253_CLK0(7000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit1_0_w)) - MCFG_PIT8253_CLK1(7000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit1_1_w)) - MCFG_PIT8253_CLK2(7000000) - - MCFG_DEVICE_ADD("pit2", PIT8254, 0) - MCFG_PIT8253_CLK0(7000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit1_2_w)) - MCFG_PIT8253_CLK1(7000000) - MCFG_PIT8253_CLK2(7000000) + PIT8254(config, m_pit[0], 0); + m_pit[0]->set_clk<0>(7000000); + m_pit[0]->out_handler<0>().set(m_audiocpu, FUNC(i80186_cpu_device::drq0_w)); + m_pit[0]->set_clk<1>(7000000); + m_pit[0]->out_handler<1>().set(m_audiocpu, FUNC(i80186_cpu_device::drq1_w)); + m_pit[0]->set_clk<2>(7000000); + m_pit[0]->out_handler<2>().set(FUNC(leland_80186_sound_device::pit0_2_w)); + + PIT8254(config, m_pit[1], 0); + m_pit[1]->set_clk<0>(7000000); + m_pit[1]->out_handler<0>().set(FUNC(leland_80186_sound_device::pit1_0_w)); + m_pit[1]->set_clk<1>(7000000); + m_pit[1]->out_handler<1>().set(FUNC(leland_80186_sound_device::pit1_1_w)); + m_pit[1]->set_clk<2>(7000000); + + PIT8254(config, m_pit[2], 0); + m_pit[2]->set_clk<0>(7000000); + m_pit[2]->out_handler<0>().set(FUNC(leland_80186_sound_device::pit1_2_w)); + m_pit[2]->set_clk<1>(7000000); + m_pit[2]->set_clk<2>(7000000); MCFG_GENERIC_LATCH_16_ADD("soundlatch") MACHINE_CONFIG_END @@ -263,13 +263,13 @@ MACHINE_CONFIG_START(ataxx_80186_sound_device::device_add_mconfig) MCFG_SOUND_ROUTE(0, "dac4vol", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac9", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac9", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("pit0", PIT8254, 0) - MCFG_PIT8253_CLK0(4000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq0_w)) - MCFG_PIT8253_CLK1(4000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq1_w)) - MCFG_PIT8253_CLK2(4000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit0_2_w)) + PIT8254(config, m_pit[0], 0); + m_pit[0]->set_clk<0>(4000000); + m_pit[0]->out_handler<0>().set(m_audiocpu, FUNC(i80186_cpu_device::drq0_w)); + m_pit[0]->set_clk<1>(4000000); + m_pit[0]->out_handler<1>().set(m_audiocpu, FUNC(i80186_cpu_device::drq1_w)); + m_pit[0]->set_clk<2>(4000000); + m_pit[0]->out_handler<2>().set(FUNC(leland_80186_sound_device::pit0_2_w)); MCFG_GENERIC_LATCH_16_ADD("soundlatch") MACHINE_CONFIG_END @@ -304,13 +304,13 @@ MACHINE_CONFIG_START(wsf_80186_sound_device::device_add_mconfig) MCFG_SOUND_ROUTE(0, "speaker", 0.40) MCFG_SOUND_ROUTE(1, "speaker", 0.40) - MCFG_DEVICE_ADD("pit0", PIT8254, 0) - MCFG_PIT8253_CLK0(4000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq0_w)) - MCFG_PIT8253_CLK1(4000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("audiocpu", i80186_cpu_device, drq1_w)) - MCFG_PIT8253_CLK2(4000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, leland_80186_sound_device, pit0_2_w)) + PIT8254(config, m_pit[0], 0); + m_pit[0]->set_clk<0>(4000000); + m_pit[0]->out_handler<0>().set(m_audiocpu, FUNC(i80186_cpu_device::drq0_w)); + m_pit[0]->set_clk<1>(4000000); + m_pit[0]->out_handler<1>().set(m_audiocpu, FUNC(i80186_cpu_device::drq1_w)); + m_pit[0]->set_clk<2>(4000000); + m_pit[0]->out_handler<2>().set(FUNC(leland_80186_sound_device::pit0_2_w)); MCFG_GENERIC_LATCH_16_ADD("soundlatch") MACHINE_CONFIG_END @@ -398,8 +398,8 @@ leland_80186_sound_device::leland_80186_sound_device(const machine_config &mconf , m_dac9(*this, "dac9") , m_dacvol(*this, "dac%uvol", 1U) , m_pit(*this, "pit%u", 0U) - , m_ymsnd(*this, "ymsnd") , m_audiocpu(*this, "audiocpu") + , m_ymsnd(*this, "ymsnd") , m_master(*this, ":master") { } diff --git a/src/mame/audio/leland.h b/src/mame/audio/leland.h index f532521a03e..bf660b6eeed 100644 --- a/src/mame/audio/leland.h +++ b/src/mame/audio/leland.h @@ -60,6 +60,8 @@ protected: optional_device_array<dac_byte_interface, 8> m_dac; optional_device<dac_word_interface> m_dac9; optional_device_array<dac_byte_interface, 8> m_dacvol; + optional_device_array<pit8254_device, 3> m_pit; + optional_device<i80186_cpu_device> m_audiocpu; void ataxx_80186_map_io(address_map &map); void leland_80186_map_io(address_map &map); @@ -81,9 +83,7 @@ private: uint8_t m_ext_active; uint8_t* m_ext_base; - optional_device_array<pit8254_device, 3> m_pit; optional_device<ym2151_device> m_ymsnd; - optional_device<i80186_cpu_device> m_audiocpu; required_device<cpu_device> m_master; }; diff --git a/src/mame/drivers/akaiax80.cpp b/src/mame/drivers/akaiax80.cpp index b3d2fdcbe95..7d26b54139c 100644 --- a/src/mame/drivers/akaiax80.cpp +++ b/src/mame/drivers/akaiax80.cpp @@ -92,20 +92,21 @@ void ax80_state::ax80_map(address_map &map) map(0xc000, 0xc7ff).mirror(0x3800).ram(); } -MACHINE_CONFIG_START(ax80_state::ax80) - MCFG_DEVICE_ADD("maincpu", UPD7810, XTAL(12'000'000)) - MCFG_DEVICE_PROGRAM_MAP(ax80_map) - //MCFG_DEVICE_IO_MAP(ax80_io) +void ax80_state::ax80(machine_config &config) +{ + UPD7810(config, m_maincpu, XTAL(12'000'000)); + m_maincpu->set_addrmap(AS_PROGRAM, &ax80_state::ax80_map); + //m_maincpu->set_addrmap(AS_IO, &ax80_state::ax80_io); - MCFG_DEVICE_ADD(PIT0_TAG, PIT8253, 0) - MCFG_DEVICE_ADD(PIT1_TAG, PIT8253, 0) - MCFG_DEVICE_ADD(PIT2_TAG, PIT8253, 0) - MCFG_DEVICE_ADD(PIT3_TAG, PIT8253, 0) - MCFG_DEVICE_ADD(PIT4_TAG, PIT8253, 0) - MCFG_DEVICE_ADD(PIT5_TAG, PIT8253, 0) + PIT8253(config, PIT0_TAG, 0); + PIT8253(config, PIT1_TAG, 0); + PIT8253(config, PIT2_TAG, 0); + PIT8253(config, PIT3_TAG, 0); + PIT8253(config, PIT4_TAG, 0); + PIT8253(config, PIT5_TAG, 0); - MCFG_DEVICE_ADD(PPI0_TAG, I8255A, 0) - MCFG_DEVICE_ADD(PPI1_TAG, I8255A, 0) + I8255A(config, PPI0_TAG); + I8255A(config, PPI1_TAG); I8279(config, "kdc", 6554800 / 8); // Keyboard/Display Controller //kdc.out_irq_calback().set_inputline("maincpu", UPD7810_INTF1); // irq @@ -114,7 +115,7 @@ MACHINE_CONFIG_START(ax80_state::ax80) //kdc.in_rl_callback().set(FUNC(ax80_state::kbd_r)) // kbd RL lines //kdc.in_shift_callback().set_constant(1); // not connected //kdc.in_ctrl_callback().set_constant(1); // not connected -MACHINE_CONFIG_END +} static INPUT_PORTS_START( ax80 ) INPUT_PORTS_END diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp index 6376b1b318a..51ea7690b0e 100644 --- a/src/mame/drivers/alphatpx.cpp +++ b/src/mame/drivers/alphatpx.cpp @@ -1337,11 +1337,11 @@ MACHINE_CONFIG_START(alphatp_34_state::alphatp30) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("i8088", 0)) MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(100000) // 15Mhz osc with unknown divisor - MCFG_PIT8253_CLK1(100000) - MCFG_PIT8253_CLK2(100000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir0_w)) + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(100000); // 15Mhz osc with unknown divisor + pit.set_clk<1>(100000); + pit.set_clk<2>(100000); + pit.out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); MACHINE_CONFIG_END //************************************************************************** diff --git a/src/mame/drivers/altos486.cpp b/src/mame/drivers/altos486.cpp index 01fbd01ebb0..5764c531423 100644 --- a/src/mame/drivers/altos486.cpp +++ b/src/mame/drivers/altos486.cpp @@ -131,15 +131,16 @@ void altos486_state::altos486_z80_io(address_map &map) //AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("sio2", z80sio0_device, read, write) } -MACHINE_CONFIG_START(altos486_state::altos486) - MCFG_DEVICE_ADD(m_maincpu, I80186, XTAL(8'000'000)) - MCFG_DEVICE_PROGRAM_MAP(altos486_mem) - MCFG_DEVICE_IO_MAP(altos486_io) - MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) // yes, really +void altos486_state::altos486(machine_config &config) +{ + I80186(config, m_maincpu, XTAL(8'000'000)); + m_maincpu->set_addrmap(AS_PROGRAM, &altos486_state::altos486_mem); + m_maincpu->set_addrmap(AS_IO, &altos486_state::altos486_io); + m_maincpu->set_irq_acknowledge_callback("pic8259", FUNC(pic8259_device::inta_cb)); // yes, really - MCFG_DEVICE_ADD("iocpu", Z80, XTAL(8'000'000) / 2) - MCFG_DEVICE_PROGRAM_MAP(altos486_z80_mem) - MCFG_DEVICE_IO_MAP(altos486_z80_io) + z80_device &iocpu(Z80(config, "iocpu", XTAL(8'000'000) / 2)); + iocpu.set_addrmap(AS_PROGRAM, &altos486_state::altos486_z80_mem); + iocpu.set_addrmap(AS_IO, &altos486_state::altos486_z80_io); pic8259_device &pic8259(PIC8259(config, "pic8259", 0)); pic8259.out_int_callback().set(m_maincpu, FUNC(i80186_cpu_device::int0_w)); @@ -149,8 +150,7 @@ MACHINE_CONFIG_START(altos486_state::altos486) I8255(config, "ppi8255"); UPD765A(config, "fdc", false, false); - MCFG_FLOPPY_DRIVE_ADD("fdc:0", altos486_floppies, "525qd", altos486_state::floppy_formats) - MCFG_SLOT_FIXED(true) + FLOPPY_CONNECTOR(config, "fdc:0", altos486_floppies, "525qd", altos486_state::floppy_formats).set_fixed(true); z80sio0_device& sio0(Z80SIO0(config, "sio0", 4000000)); sio0.out_txda_callback().set("rs232a", FUNC(rs232_port_device::write_txd)); @@ -213,15 +213,16 @@ MACHINE_CONFIG_START(altos486_state::altos486) rs422_wn.dcd_handler().set("i8274", FUNC(z80dart_device::dcda_w)); rs422_wn.cts_handler().set("i8274", FUNC(z80dart_device::ctsa_w)); - MCFG_DEVICE_ADD("pit0", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(22'118'400)/18) - MCFG_PIT8253_CLK1(XTAL(22'118'400)/144) - MCFG_PIT8253_CLK2(XTAL(22'118'400)/18) - MCFG_DEVICE_ADD("pit1", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(22'118'400)/18) - MCFG_PIT8253_CLK1(XTAL(22'118'400)/144) - MCFG_PIT8253_CLK2(XTAL(22'118'400)/18) -MACHINE_CONFIG_END + pit8253_device &pit0(PIT8253(config, "pit0", 0)); + pit0.set_clk<0>(XTAL(22'118'400)/18); + pit0.set_clk<1>(XTAL(22'118'400)/144); + pit0.set_clk<2>(XTAL(22'118'400)/18); + + pit8253_device &pit1(PIT8253(config, "pit1", 0)); + pit1.set_clk<0>(XTAL(22'118'400)/18); + pit1.set_clk<1>(XTAL(22'118'400)/144); + pit1.set_clk<2>(XTAL(22'118'400)/18); +} ROM_START( altos486 ) diff --git a/src/mame/drivers/amusco.cpp b/src/mame/drivers/amusco.cpp index ca7a0a4b692..ff4e5a2d3fa 100644 --- a/src/mame/drivers/amusco.cpp +++ b/src/mame/drivers/amusco.cpp @@ -542,11 +542,11 @@ MACHINE_CONFIG_START(amusco_state::amusco) MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(PIT_CLOCK0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(PIT_CLOCK1) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pic8259", pic8259_device, ir2_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(PIT_CLOCK0); + m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); + m_pit->set_clk<1>(PIT_CLOCK1); + m_pit->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir2_w)); i8255_device &ppi_outputs(I8255(config, "ppi_outputs")); ppi_outputs.out_pa_callback().set(FUNC(amusco_state::output_a_w)); diff --git a/src/mame/drivers/apogee.cpp b/src/mame/drivers/apogee.cpp index 5ee10d36367..02fad5ec953 100644 --- a/src/mame/drivers/apogee.cpp +++ b/src/mame/drivers/apogee.cpp @@ -220,13 +220,13 @@ MACHINE_CONFIG_START(apogee_state::apogee) MCFG_DEVICE_ADD("maincpu", I8080, XTAL(16'000'000) / 9) MCFG_DEVICE_PROGRAM_MAP(apogee_mem) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'000'000)/9) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, apogee_state,pit8253_out0_changed)) - MCFG_PIT8253_CLK1(XTAL(16'000'000)/9) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, apogee_state,pit8253_out1_changed)) - MCFG_PIT8253_CLK2(XTAL(16'000'000)/9) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, apogee_state,pit8253_out2_changed)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(XTAL(16'000'000)/9); + pit8253.out_handler<0>().set(FUNC(apogee_state::pit8253_out0_changed)); + pit8253.set_clk<1>(XTAL(16'000'000)/9); + pit8253.out_handler<1>().set(FUNC(apogee_state::pit8253_out1_changed)); + pit8253.set_clk<2>(XTAL(16'000'000)/9); + pit8253.out_handler<2>().set(FUNC(apogee_state::pit8253_out2_changed)); I8255(config, m_ppi8255_1); m_ppi8255_1->out_pa_callback().set(FUNC(radio86_state::radio86_8255_porta_w2)); diff --git a/src/mame/drivers/b2m.cpp b/src/mame/drivers/b2m.cpp index f3c7b2ab6a6..7773a138845 100644 --- a/src/mame/drivers/b2m.cpp +++ b/src/mame/drivers/b2m.cpp @@ -207,13 +207,13 @@ MACHINE_CONFIG_START(b2m_state::b2m) MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(b2m_state, b2m) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, b2m_state,bm2_pit_out1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pit8253", pit8253_device, write_clk0)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(0); + m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir1_w)); + m_pit->set_clk<1>(2000000); + m_pit->out_handler<1>().set(FUNC(b2m_state::bm2_pit_out1)); + m_pit->set_clk<2>(2000000); + m_pit->out_handler<2>().set(m_pit, FUNC(pit8253_device::write_clk0)); i8255_device &ppi1(I8255(config, "ppi8255_1")); ppi1.out_pa_callback().set(FUNC(b2m_state::b2m_8255_porta_w)); diff --git a/src/mame/drivers/balsente.cpp b/src/mame/drivers/balsente.cpp index b21aad77268..b61a38e502f 100644 --- a/src/mame/drivers/balsente.cpp +++ b/src/mame/drivers/balsente.cpp @@ -304,7 +304,7 @@ void balsente_state::cpu2_map(address_map &map) void balsente_state::cpu2_io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x03).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write)); + map(0x00, 0x03).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)); map(0x08, 0x0f).r(FUNC(balsente_state::counter_state_r)); map(0x08, 0x09).w(FUNC(balsente_state::counter_control_w)); map(0x0a, 0x0b).w(FUNC(balsente_state::dac_data_w)); @@ -1338,11 +1338,11 @@ MACHINE_CONFIG_START(balsente_state::balsente) MCFG_TIMER_DRIVER_ADD("scan_timer", balsente_state, interrupt_timer) MCFG_TIMER_DRIVER_ADD("8253_0_timer", balsente_state, clock_counter_0_ff) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, balsente_state, counter_0_set_out)) - MCFG_PIT8253_OUT2_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) - MCFG_PIT8253_CLK1(8_MHz_XTAL / 4) - MCFG_PIT8253_CLK2(8_MHz_XTAL / 4) + PIT8253(config, m_pit, 0); + m_pit->out_handler<0>().set(FUNC(balsente_state::counter_0_set_out)); + m_pit->out_handler<2>().set_inputline(m_audiocpu, INPUT_LINE_IRQ0); + m_pit->set_clk<1>(8_MHz_XTAL / 4); + m_pit->set_clk<2>(8_MHz_XTAL / 4); LS259(config, m_outlatch); // U9H // these outputs are generally used to control the various lamps diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index dc4b8ad955e..e362d85f1ac 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -598,13 +598,13 @@ MACHINE_CONFIG_START(bw12_state::common) m_sio->out_rtsb_callback().set(RS232_B_TAG, FUNC(rs232_port_device::write_rts)); m_sio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(PIT8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(1'843'200)) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, bw12_state, pit_out0_w)) - MCFG_PIT8253_CLK1(XTAL(1'843'200)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_sio, z80dart_device, rxtxcb_w)) - MCFG_PIT8253_CLK2(XTAL(1'843'200)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, bw12_state, pit_out2_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(XTAL(1'843'200)); + m_pit->out_handler<0>().set(FUNC(bw12_state::pit_out0_w)); + m_pit->set_clk<1>(XTAL(1'843'200)); + m_pit->out_handler<1>().set(m_sio, FUNC(z80dart_device::rxtxcb_w)); + m_pit->set_clk<2>(XTAL(1'843'200)); + m_pit->out_handler<2>().set(FUNC(bw12_state::pit_out2_w)); AY3600(config, m_kbc, 0); m_kbc->x0().set_ioport("X0"); diff --git a/src/mame/drivers/compc.cpp b/src/mame/drivers/compc.cpp index 68a80da6c4b..0f77f7e78db 100644 --- a/src/mame/drivers/compc.cpp +++ b/src/mame/drivers/compc.cpp @@ -200,13 +200,13 @@ MACHINE_CONFIG_START(compc_state::compc) MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") MCFG_DEVICE_REMOVE("mb:pit8253") - MCFG_DEVICE_ADD("mb:pit8253", FE2010_PIT, 0) - MCFG_PIT8253_CLK0(XTAL(14'318'181)/12.0) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("mb:pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(14'318'181)/12.0) /* dram refresh */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("mb", ibm5160_mb_device, pc_pit8253_out1_changed)) - MCFG_PIT8253_CLK2(XTAL(14'318'181)/12.0) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("mb", ibm5160_mb_device, pc_pit8253_out2_changed)) + fe2010_pit_device &pit(FE2010_PIT(config, "mb:pit8253", 0)); + pit.set_clk<0>(XTAL(14'318'181)/12.0); /* heartbeat IRQ */ + pit.out_handler<0>().set("mb:pic8259", FUNC(pic8259_device::ir0_w)); + pit.set_clk<1>(XTAL(14'318'181)/12.0); /* dram refresh */ + pit.out_handler<1>().set(m_mb, FUNC(ibm5160_mb_device::pc_pit8253_out1_changed)); + pit.set_clk<2>(XTAL(14'318'181)/12.0); /* pio port c pin 4, and speaker polling enough */ + pit.out_handler<2>().set(m_mb, FUNC(ibm5160_mb_device::pc_pit8253_out2_changed)); // FIXME: determine ISA bus clock MCFG_DEVICE_ADD("isa1", ISA8_SLOT, 0, "mb:isa", pc_isa8_cards, "mda", false) diff --git a/src/mame/drivers/compis.cpp b/src/mame/drivers/compis.cpp index ce6b4accee4..e69b66244d9 100644 --- a/src/mame/drivers/compis.cpp +++ b/src/mame/drivers/compis.cpp @@ -408,7 +408,7 @@ void compis_state::compis_io(address_map &map) { map.unmap_value_high(); map(0x0000, 0x0007) /* PCS0 */ .mirror(0x78).rw(m_ppi, FUNC(i8255_device::read), FUNC(i8255_device::write)).umask16(0xff00); - map(0x0080, 0x0087) /* PCS1 */ .mirror(0x78).rw(I8253_TAG, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); + map(0x0080, 0x0087) /* PCS1 */ .mirror(0x78).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); map(0x0100, 0x011f) /* PCS2 */ .mirror(0x60).rw(MM58174A_TAG, FUNC(mm58274c_device::read), FUNC(mm58274c_device::write)).umask16(0x00ff); map(0x0180, 0x01ff) /* PCS3 */ .rw(GRAPHICS_TAG, FUNC(compis_graphics_slot_device::pcs3_r), FUNC(compis_graphics_slot_device::pcs3_w)); //map(0x0200, 0x0201) /* PCS4 */ .mirror(0x7e); @@ -753,12 +753,12 @@ MACHINE_CONFIG_START(compis_state::compis) m_osp->delay().set(I80130_TAG, FUNC(i80130_device::ir7_w)); m_osp->baud().set(FUNC(compis_state::tmr2_w)); - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(15.36_MHz_XTAL/8) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m_mpsc, i8274_device, rxtxcb_w)) - MCFG_PIT8253_CLK1(15.36_MHz_XTAL/8) - MCFG_PIT8253_CLK2(15.36_MHz_XTAL/8) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, compis_state, tmr5_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(15.36_MHz_XTAL/8); + m_pit->out_handler<0>().set(m_mpsc, FUNC(i8274_device::rxtxcb_w)); + m_pit->set_clk<1>(15.36_MHz_XTAL/8); + m_pit->set_clk<2>(15.36_MHz_XTAL/8); + m_pit->out_handler<2>().set(FUNC(compis_state::tmr5_w)); I8255(config, m_ppi); m_ppi->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::bus_w)); diff --git a/src/mame/drivers/dai.cpp b/src/mame/drivers/dai.cpp index 27c4c73df38..2c08f556e9f 100644 --- a/src/mame/drivers/dai.cpp +++ b/src/mame/drivers/dai.cpp @@ -195,15 +195,15 @@ MACHINE_CONFIG_START(dai_state::dai) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(dai_state,int_ack) MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(2000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("custom", dai_sound_device, set_input_ch0)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("custom", dai_sound_device, set_input_ch1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("custom", dai_sound_device, set_input_ch2)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(2000000); + m_pit->out_handler<0>().set(m_sound, FUNC(dai_sound_device::set_input_ch0)); + m_pit->set_clk<1>(2000000); + m_pit->out_handler<1>().set(m_sound, FUNC(dai_sound_device::set_input_ch1)); + m_pit->set_clk<2>(2000000); + m_pit->out_handler<2>().set(m_sound, FUNC(dai_sound_device::set_input_ch2)); - MCFG_DEVICE_ADD("ppi8255", I8255, 0) + I8255(config, "ppi8255"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -224,7 +224,7 @@ MACHINE_CONFIG_START(dai_state::dai) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - DAI_SOUND(config, "custom").add_route(0, "lspeaker", 0.50).add_route(1, "rspeaker", 0.50); + DAI_SOUND(config, m_sound).add_route(0, "lspeaker", 0.50).add_route(1, "rspeaker", 0.50); /* cassette */ MCFG_CASSETTE_ADD( "cassette" ) diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index 23a5c3ead87..0fd7dc22a84 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -827,11 +827,11 @@ MACHINE_CONFIG_START(dmv_state::dmv) MCFG_FLOPPY_DRIVE_ADD("i8272:0", dmv_floppies, "525dd", dmv_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("i8272:1", dmv_floppies, "525dd", dmv_state::floppy_formats) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(50) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, dmv_state, pit_out0)) - MCFG_PIT8253_CLK2(XTAL(24'000'000) / 3 / 16) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, dmv_state, timint_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(50); + m_pit->out_handler<0>().set(FUNC(dmv_state::pit_out0)); + m_pit->set_clk<2>(XTAL(24'000'000) / 3 / 16); + m_pit->out_handler<2>().set(FUNC(dmv_state::timint_w)); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp index 8111dc96b40..fc4e8851594 100644 --- a/src/mame/drivers/excali64.cpp +++ b/src/mame/drivers/excali64.cpp @@ -563,12 +563,12 @@ MACHINE_CONFIG_START(excali64_state::excali64) //uart.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); //uart.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(16_MHz_XTAL / 16) /* Timer 0: tone gen for speaker */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("speaker", speaker_sound_device, level_w)) - //MCFG_PIT8253_CLK1(16_MHz_XTAL / 16) /* Timer 1: baud rate gen for 8251 */ - //MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, excali64_state, write_uart_clock)) - //MCFG_PIT8253_CLK2(16_MHz_XTAL / 16) /* Timer 2: not used */ + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(16_MHz_XTAL / 16); /* Timer 0: tone gen for speaker */ + pit.out_handler<0>().set("speaker", FUNC(speaker_sound_device::level_w)); + //pit.set_clk<1>(16_MHz_XTAL / 16); /* Timer 1: baud rate gen for 8251 */ + //pit.out_handler<1>().set(FUNC(excali64_state::write_uart_clock)); + //pit.set_clk<2>(16_MHz_XTAL / 16); /* Timer 2: not used */ i8255_device &ppi(I8255A(config, "ppi")); ppi.out_pa_callback().set("cent_data_out", FUNC(output_latch_device::bus_w)); // parallel port diff --git a/src/mame/drivers/fanucspmg.cpp b/src/mame/drivers/fanucspmg.cpp index 9733705191d..0f49a3f5ca5 100644 --- a/src/mame/drivers/fanucspmg.cpp +++ b/src/mame/drivers/fanucspmg.cpp @@ -548,14 +548,6 @@ the keypad symbols seem to use a different matrix pattern from the rest? #define MAINCPU_TAG "maincpu" #define SUBCPU_TAG "subcpu" -#define USART0_TAG "usart0" -#define USART1_TAG "usart1" -#define USART2_TAG "usart2" -#define USART3_TAG "usart3" -#define PIT0_TAG "pit0" -#define PIT1_TAG "pit1" -#define PIC0_TAG "pic0" -#define PIC1_TAG "pic1" #define DMAC_TAG "dmac" #define CRTC_TAG "crtc" #define FDC_TAG "fdc" @@ -570,14 +562,9 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, MAINCPU_TAG) , m_subcpu(*this, SUBCPU_TAG) - , m_usart0(*this, USART0_TAG) - , m_usart1(*this, USART1_TAG) - , m_usart2(*this, USART2_TAG) - , m_usart3(*this, USART3_TAG) - , m_pit0(*this, PIT0_TAG) - , m_pit1(*this, PIT1_TAG) - , m_pic0(*this, PIC0_TAG) - , m_pic1(*this, PIC1_TAG) + , m_usart(*this, "usart%u", 0U) + , m_pit(*this, "pit%u", 0U) + , m_pic(*this, "pic%u", 0U) , m_dmac(*this, DMAC_TAG) , m_crtc(*this, CRTC_TAG) , m_fdc(*this, FDC_TAG) @@ -593,14 +580,9 @@ public: private: required_device<i8086_cpu_device> m_maincpu; required_device<i8085a_cpu_device> m_subcpu; - required_device<i8251_device> m_usart0; - required_device<i8251_device> m_usart1; - required_device<i8251_device> m_usart2; - required_device<i8251_device> m_usart3; - required_device<pit8253_device> m_pit0; - required_device<pit8253_device> m_pit1; - required_device<pic8259_device> m_pic0; - required_device<pic8259_device> m_pic1; + required_device_array<i8251_device, 4> m_usart; + required_device_array<pit8253_device, 2> m_pit; + required_device_array<pic8259_device, 2> m_pic; required_device<i8257_device> m_dmac; required_device<mc6845_device> m_crtc; required_device<upd765a_device> m_fdc; @@ -676,7 +658,7 @@ WRITE8_MEMBER(fanucspmg_state::shared_w) READ8_MEMBER(fanucspmg_state::get_slave_ack) { if(offset == 7) - return m_pic1->acknowledge(); + return m_pic[1]->acknowledge(); return 0x00; } @@ -725,18 +707,18 @@ void fanucspmg_state::maincpu_mem(address_map &map) map(0x80000, 0x81fff).ram(); // believed to be shared RAM with a CPU inside the Program File map(0x88000, 0x88001).noprw(); // Program File "ready" bit - map(0xf0000, 0xf0003).rw(m_pic0, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff); + map(0xf0000, 0xf0003).rw(m_pic[0], FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff); map(0xf0004, 0xf0007).m(m_fdc, FUNC(upd765a_device::map)).umask16(0x00ff); - map(0xf0008, 0xf000f).rw(m_pit0, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); - map(0xf0010, 0xf0013).rw(m_usart0, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); - map(0xf0014, 0xf0017).rw(m_usart1, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); - map(0xf0018, 0xf001b).rw(m_usart2, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); - map(0xf001c, 0xf001f).rw(m_usart3, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); + map(0xf0008, 0xf000f).rw(m_pit[0], FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); + map(0xf0010, 0xf0013).rw(m_usart[0], FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); + map(0xf0014, 0xf0017).rw(m_usart[1], FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); + map(0xf0018, 0xf001b).rw(m_usart[2], FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); + map(0xf001c, 0xf001f).rw(m_usart[3], FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); map(0xf0020, 0xf0029).rw(m_dmac, FUNC(i8257_device::read), FUNC(i8257_device::write)); map(0xf0042, 0xf0043).r(FUNC(fanucspmg_state::magic_r)); map(0xf0046, 0xf0046).w(FUNC(fanucspmg_state::dma_page_w)); - map(0xf0048, 0xf004f).rw(m_pit1, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); - map(0xf2000, 0xf2003).rw(m_pic1, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff); + map(0xf0048, 0xf004f).rw(m_pit[1], FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); + map(0xf2000, 0xf2003).rw(m_pic[1], FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff); map(0xf8000, 0xf9fff).rw(FUNC(fanucspmg_state::shared_r), FUNC(fanucspmg_state::shared_w)); map(0xfc000, 0xfffff).rom().region(MAINCPU_TAG, 0); @@ -967,7 +949,7 @@ MACHINE_CONFIG_START(fanucspmg_state::fanucspmg) MCFG_DEVICE_ADD(MAINCPU_TAG, I8086, XTAL(15'000'000)/3) MCFG_DEVICE_PROGRAM_MAP(maincpu_mem) MCFG_DEVICE_IO_MAP(maincpu_io) - MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE(PIC0_TAG, pic8259_device, inta_cb) + MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic0", pic8259_device, inta_cb) MCFG_I8086_ESC_OPCODE_HANDLER(WRITE32("i8087", i8087_device, insn_w)) MCFG_I8086_ESC_DATA_HANDLER(WRITE32("i8087", i8087_device, addr_w)) @@ -980,19 +962,20 @@ MACHINE_CONFIG_START(fanucspmg_state::fanucspmg) MCFG_DEVICE_ADD(SUBCPU_TAG, I8085A, XTAL(16'000'000)/2/2) MCFG_DEVICE_PROGRAM_MAP(subcpu_mem) - MCFG_DEVICE_ADD(USART0_TAG, I8251, 0) - MCFG_DEVICE_ADD(USART1_TAG, I8251, 0) - MCFG_DEVICE_ADD(USART2_TAG, I8251, 0) - MCFG_DEVICE_ADD(USART3_TAG, I8251, 0) + I8251(config, m_usart[0], 0); + I8251(config, m_usart[1], 0); + I8251(config, m_usart[2], 0); + I8251(config, m_usart[3], 0); - MCFG_DEVICE_ADD(PIT0_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(15'000'000)/12) - MCFG_PIT8253_CLK1(XTAL(15'000'000)/12) - MCFG_PIT8253_CLK2(XTAL(15'000'000)/12) - MCFG_DEVICE_ADD(PIT1_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(15'000'000)/12) - MCFG_PIT8253_CLK1(XTAL(15'000'000)/12) - MCFG_PIT8253_CLK2(XTAL(15'000'000)/12) + PIT8253(config, m_pit[0], 0); + m_pit[0]->set_clk<0>(XTAL(15'000'000)/12); + m_pit[0]->set_clk<1>(XTAL(15'000'000)/12); + m_pit[0]->set_clk<2>(XTAL(15'000'000)/12); + + PIT8253(config, m_pit[1], 0); + m_pit[1]->set_clk<0>(XTAL(15'000'000)/12); + m_pit[1]->set_clk<1>(XTAL(15'000'000)/12); + m_pit[1]->set_clk<2>(XTAL(15'000'000)/12); I8257(config, m_dmac, XTAL(15'000'000) / 5); m_dmac->out_hrq_cb().set(FUNC(fanucspmg_state::hrq_w)); @@ -1002,17 +985,17 @@ MACHINE_CONFIG_START(fanucspmg_state::fanucspmg) m_dmac->in_ior_cb<0>().set(FUNC(fanucspmg_state::fdcdma_r)); m_dmac->out_iow_cb<0>().set(FUNC(fanucspmg_state::fdcdma_w)); - MCFG_DEVICE_ADD(PIC0_TAG, PIC8259, 0) + MCFG_DEVICE_ADD(m_pic[0], PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, fanucspmg_state, get_slave_ack)) - MCFG_DEVICE_ADD(PIC1_TAG, PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(PIC0_TAG, pic8259_device, ir7_w)) + MCFG_DEVICE_ADD(m_pic[1], PIC8259, 0) + MCFG_PIC8259_OUT_INT_CB(WRITELINE(m_pic[0], pic8259_device, ir7_w)) MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) UPD765A(config, m_fdc, true, true); - m_fdc->intrq_wr_callback().set(m_pic0, FUNC(pic8259_device::ir3_w)); + m_fdc->intrq_wr_callback().set(m_pic[0], FUNC(pic8259_device::ir3_w)); m_fdc->drq_wr_callback().set(m_dmac, FUNC(i8257_device::dreq0_w)); MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":0", fanuc_floppies, "525dd", fanucspmg_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":1", fanuc_floppies, "525dd", fanucspmg_state::floppy_formats) diff --git a/src/mame/drivers/fk1.cpp b/src/mame/drivers/fk1.cpp index 982f5155c43..e24b4e2a819 100644 --- a/src/mame/drivers/fk1.cpp +++ b/src/mame/drivers/fk1.cpp @@ -430,13 +430,13 @@ MACHINE_CONFIG_START(fk1_state::fk1) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(50) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, fk1_state, fk1_pit_out0)) - MCFG_PIT8253_CLK1(1000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, fk1_state, fk1_pit_out1)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, fk1_state, fk1_pit_out2)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(50); + pit8253.out_handler<0>().set(FUNC(fk1_state::fk1_pit_out0)); + pit8253.set_clk<1>(1000000); + pit8253.out_handler<1>().set(FUNC(fk1_state::fk1_pit_out1)); + pit8253.set_clk<2>(0); + pit8253.out_handler<2>().set(FUNC(fk1_state::fk1_pit_out2)); i8255_device &ppi1(I8255(config, "ppi8255_1")); ppi1.in_pa_callback().set(FUNC(fk1_state::fk1_ppi_1_a_r)); @@ -461,7 +461,7 @@ MACHINE_CONFIG_START(fk1_state::fk1) ppi3.out_pc_callback().set(FUNC(fk1_state::fk1_ppi_3_c_w)); /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) + I8251(config, "uart", 0); /* internal ram */ RAM(config, RAM_TAG).set_default_size("80K"); // 64 + 16 diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp index 4d4c470d875..270f5679c49 100644 --- a/src/mame/drivers/fmtowns.cpp +++ b/src/mame/drivers/fmtowns.cpp @@ -2793,19 +2793,19 @@ MACHINE_CONFIG_START(towns_state::towns_base) MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "lspeaker", 0.50).add_route(ALL_OUTPUTS, "rspeaker", 0.50); - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(307200) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, towns_state, towns_pit_out0_changed)) - MCFG_PIT8253_CLK1(307200) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, towns_state, towns_pit_out1_changed)) - MCFG_PIT8253_CLK2(307200) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, towns_state, pit_out2_changed)) - - MCFG_DEVICE_ADD("pit2", PIT8253, 0) - MCFG_PIT8253_CLK0(307200) // reserved - MCFG_PIT8253_CLK1(1228800) // RS-232 - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, towns_state, pit2_out1_changed)) - MCFG_PIT8253_CLK2(307200) // reserved + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(307200); + m_pit->out_handler<0>().set(FUNC(towns_state::towns_pit_out0_changed)); + m_pit->set_clk<1>(307200); + m_pit->out_handler<1>().set(FUNC(towns_state::towns_pit_out1_changed)); + m_pit->set_clk<2>(307200); + m_pit->out_handler<2>().set(FUNC(towns_state::pit_out2_changed)); + + pit8253_device &pit2(PIT8253(config, "pit2", 0)); + pit2.set_clk<0>(307200); // reserved + pit2.set_clk<1>(1228800); // RS-232 + pit2.out_handler<1>().set(FUNC(towns_state::pit2_out1_changed)); + pit2.set_clk<2>(307200); // reserved MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) diff --git a/src/mame/drivers/i7000.cpp b/src/mame/drivers/i7000.cpp index 20a6a684eaa..f80420d8a4f 100644 --- a/src/mame/drivers/i7000.cpp +++ b/src/mame/drivers/i7000.cpp @@ -367,17 +367,16 @@ MACHINE_CONFIG_START(i7000_state::i7000) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* Programmable timer */ - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) -// MCFG_PIT8253_CLK0(XTAL(4'000'000) / 2) /* TODO: verify on PCB */ -// MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, i7000_state,i7000_pit_out0)) -// MCFG_PIT8253_CLK1(XTAL(4'000'000) / 2) /* TODO: verify on PCB */ -// MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, i7000_state,i7000_pit_out1)) - MCFG_PIT8253_CLK2(XTAL(4'000'000) / 2) /* TODO: verify on PCB */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("speaker", speaker_sound_device, level_w)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); +// pit8253.set_clk<0>(XTAL(4'000'000) / 2); /* TODO: verify on PCB */ +// pit8253.out_handler<0>().set(FUNC(i7000_state::i7000_pit_out0)); +// pit8253.set_clk<1>(XTAL(4'000'000) / 2); /* TODO: verify on PCB */ +// pit8253.out_handler<1>().set(FUNC(i7000_state::i7000_pit_out1)); + pit8253.set_clk<2>(XTAL(4'000'000) / 2); /* TODO: verify on PCB */ + pit8253.out_handler<2>().set("speaker", FUNC(speaker_sound_device::level_w)); /* Keyboard interface */ i8279_device &kbdc(I8279(config, "i8279", 4000000)); /* guessed value. TODO: verify on PCB */ diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index 7e5f16ed9c0..65f3af17206 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -609,12 +609,12 @@ MACHINE_CONFIG_START(pcjr_state::ibmpcjr) based on bit 4(/5?) written to output port A0h. This is not supported yet. */ - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(14'318'181)/12) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m_pic8259, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(14'318'181)/12) - MCFG_PIT8253_CLK2(XTAL(14'318'181)/12) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, pcjr_state, out2_changed)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(XTAL(14'318'181)/12); + m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w)); + m_pit8253->set_clk<1>(XTAL(14'318'181)/12); + m_pit8253->set_clk<2>(XTAL(14'318'181)/12); + m_pit8253->out_handler<2>().set(FUNC(pcjr_state::out2_changed)); MCFG_DEVICE_ADD(m_pic8259, PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, pcjr_state, pic8259_set_int_line)) diff --git a/src/mame/drivers/isbc.cpp b/src/mame/drivers/isbc.cpp index aeef4555fb9..0e4394a1862 100644 --- a/src/mame/drivers/isbc.cpp +++ b/src/mame/drivers/isbc.cpp @@ -331,12 +331,12 @@ MACHINE_CONFIG_START(isbc_state::isbc86) PIC8259(config, m_pic_0, 0); m_pic_0->out_int_callback().set_inputline(m_maincpu, 0); - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(22'118'400)/18) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic_0", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(22'118'400)/18) - MCFG_PIT8253_CLK2(XTAL(22'118'400)/18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, isbc_state, isbc86_tmr2_w)) + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(XTAL(22'118'400)/18); + pit.out_handler<0>().set(m_pic_0, FUNC(pic8259_device::ir0_w)); + pit.set_clk<1>(XTAL(22'118'400)/18); + pit.set_clk<2>(XTAL(22'118'400)/18); + pit.out_handler<2>().set(FUNC(isbc_state::isbc86_tmr2_w)); I8255A(config, "ppi"); @@ -364,12 +364,12 @@ MACHINE_CONFIG_START(isbc_state::rpc86) PIC8259(config, m_pic_0, 0); m_pic_0->out_int_callback().set_inputline(m_maincpu, 0); - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(22'118'400)/18) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic_0", pic8259_device, ir2_w)) - MCFG_PIT8253_CLK1(XTAL(22'118'400)/144) - MCFG_PIT8253_CLK2(XTAL(22'118'400)/18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, isbc_state, isbc86_tmr2_w)) + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(XTAL(22'118'400)/18); + pit.out_handler<0>().set(m_pic_0, FUNC(pic8259_device::ir2_w)); + pit.set_clk<1>(XTAL(22'118'400)/144); + pit.set_clk<2>(XTAL(22'118'400)/18); + pit.out_handler<2>().set(FUNC(isbc_state::isbc86_tmr2_w)); I8255A(config, "ppi"); @@ -440,26 +440,26 @@ MACHINE_CONFIG_START(isbc_state::isbc286) m_pic_1->out_int_callback().set(m_pic_0, FUNC(pic8259_device::ir7_w)); m_pic_1->in_sp_callback().set_constant(0); - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(XTAL(22'118'400)/18) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic_0", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(22'118'400)/18) -// MCFG_PIT8253_OUT1_HANDLER(WRITELINE("uart8274", z80dart_device, rxtxcb_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_uart8274, i8274_new_device, rxtxcb_w)) - MCFG_PIT8253_CLK2(XTAL(22'118'400)/18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, isbc_state, isbc286_tmr2_w)) + pit8254_device &pit(PIT8254(config, "pit", 0)); + pit.set_clk<0>(XTAL(22'118'400)/18); + pit.out_handler<0>().set(m_pic_0, FUNC(pic8259_device::ir0_w)); + pit.set_clk<1>(XTAL(22'118'400)/18); +// pit.out_handler<1>().set(m_uart8274, FUNC(z80dart_device::rxtxcb_w)); + pit.out_handler<1>().set(m_uart8274, FUNC(i8274_new_device::rxtxcb_w)); + pit.set_clk<2>(XTAL(22'118'400)/18); + pit.out_handler<2>().set(FUNC(isbc_state::isbc286_tmr2_w)); i8255_device &ppi(I8255A(config, "ppi")); ppi.out_pa_callback().set("cent_data_out", FUNC(output_latch_device::bus_w)); - ppi.in_pb_callback().set("cent_status_in", FUNC(input_buffer_device::bus_r)); + ppi.in_pb_callback().set(m_cent_status_in, FUNC(input_buffer_device::bus_r)); ppi.out_pc_callback().set(FUNC(isbc_state::ppi_c_w)); MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(*this, isbc_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit7)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit6)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(m_cent_status_in, input_buffer_device, write_bit7)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(m_cent_status_in, input_buffer_device, write_bit6)) - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + INPUT_BUFFER(config, m_cent_status_in, 0); MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") diff --git a/src/mame/drivers/laserbas.cpp b/src/mame/drivers/laserbas.cpp index a40e0af7211..5ff58f9cbef 100644 --- a/src/mame/drivers/laserbas.cpp +++ b/src/mame/drivers/laserbas.cpp @@ -77,12 +77,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_palette(*this, "palette"), - m_dac1(*this, "dac1"), - m_dac2(*this, "dac2"), - m_dac3(*this, "dac3"), - m_dac4(*this, "dac4"), - m_dac5(*this, "dac5"), - m_dac6(*this, "dac6") + m_dac(*this, "dac%u", 1U) { } void laserbas(machine_config &config); @@ -101,7 +96,6 @@ private: int m_scl; bool m_flipscreen; uint64_t m_z1data; - void write_pit_out(int num, int state); DECLARE_READ8_MEMBER(vram_r); DECLARE_WRITE8_MEMBER(vram_w); DECLARE_WRITE8_MEMBER(videoctrl_w); @@ -109,12 +103,7 @@ private: DECLARE_READ8_MEMBER(track_lo_r); DECLARE_READ8_MEMBER(track_hi_r); DECLARE_WRITE8_MEMBER(out_w); - DECLARE_WRITE_LINE_MEMBER(pit_out_0_w); - DECLARE_WRITE_LINE_MEMBER(pit_out_1_w); - DECLARE_WRITE_LINE_MEMBER(pit_out_2_w); - DECLARE_WRITE_LINE_MEMBER(pit_out_3_w); - DECLARE_WRITE_LINE_MEMBER(pit_out_4_w); - DECLARE_WRITE_LINE_MEMBER(pit_out_5_w); + template<uint8_t Which> DECLARE_WRITE_LINE_MEMBER(pit_out_w); TIMER_DEVICE_CALLBACK_MEMBER(laserbas_scanline); MC6845_UPDATE_ROW(crtc_update_row); @@ -123,12 +112,7 @@ private: required_device<cpu_device> m_maincpu; required_device<palette_device> m_palette; - required_device<dac_byte_interface> m_dac1; - required_device<dac_byte_interface> m_dac2; - required_device<dac_byte_interface> m_dac3; - required_device<dac_byte_interface> m_dac4; - required_device<dac_byte_interface> m_dac5; - required_device<dac_byte_interface> m_dac6; + required_device_array<dac_byte_interface, 6> m_dac; void laserbas_io(address_map &map); void laserbas_memory(address_map &map); }; @@ -286,51 +270,19 @@ void laserbas_state::machine_reset() m_scl = 0; } -void laserbas_state::write_pit_out(int num, int state) +template<uint8_t Which> +WRITE_LINE_MEMBER(laserbas_state::pit_out_w) { state^=1; // 7404 (6G) - if((!state)& m_cnt_out[num]){ // 0->1 rising edge CLK - m_counter[num] = (m_counter[num]+1)&0x0f; // 4 bit counters 74393 + if((!state)& m_cnt_out[Which]){ // 0->1 rising edge CLK + m_counter[Which] = (m_counter[Which]+1)&0x0f; // 4 bit counters 74393 } - int data =(state) | ((m_counter[num]&7)<<1); // combine output from 8253 with counter bits 0-3 + int data =(state) | ((m_counter[Which]&7)<<1); // combine output from 8253 with counter bits 0-3 data<<=4; - if(m_counter[num]&8) data^=0x0f; // counter bit 4 xors the data ( 7486 x 6) - switch(num){ - case 0: m_dac1->write(data);break; // 4 resistor packs : 47k, 100k, 220k, 470k - case 1: m_dac2->write(data);break; - case 2: m_dac3->write(data);break; - case 3: m_dac4->write(data);break; - case 4: m_dac5->write(data);break; - case 5: m_dac6->write(data);break; - } - - m_cnt_out[num]=state; -} - -WRITE_LINE_MEMBER(laserbas_state::pit_out_0_w) -{ - write_pit_out(0,state); -} + if(m_counter[Which]&8) data^=0x0f; // counter bit 4 xors the data ( 7486 x 6) + m_dac[Which]->write(data); // 4 resistor packs : 47k, 100k, 220k, 470k -WRITE_LINE_MEMBER(laserbas_state::pit_out_1_w) -{ - write_pit_out(1,state); -} -WRITE_LINE_MEMBER(laserbas_state::pit_out_2_w) -{ - write_pit_out(2,state); -} -WRITE_LINE_MEMBER(laserbas_state::pit_out_3_w) -{ - write_pit_out(3,state); -} -WRITE_LINE_MEMBER(laserbas_state::pit_out_4_w) -{ - write_pit_out(4,state); -} -WRITE_LINE_MEMBER(laserbas_state::pit_out_5_w) -{ - write_pit_out(5,state); + m_cnt_out[Which]=state; } void laserbas_state::laserbas_memory(address_map &map) @@ -421,21 +373,21 @@ MACHINE_CONFIG_START(laserbas_state::laserbas) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", laserbas_state, laserbas_scanline, "screen", 0, 1) /* TODO: clocks aren't known */ - MCFG_DEVICE_ADD("pit0", PIT8253, 0) - MCFG_PIT8253_CLK0(PIT_CLOCK) - MCFG_PIT8253_CLK1(PIT_CLOCK) - MCFG_PIT8253_CLK2(PIT_CLOCK) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, laserbas_state, pit_out_0_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, laserbas_state, pit_out_1_w)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, laserbas_state, pit_out_2_w)) - - MCFG_DEVICE_ADD("pit1", PIT8253, 0) - MCFG_PIT8253_CLK0(PIT_CLOCK) - MCFG_PIT8253_CLK1(PIT_CLOCK) - MCFG_PIT8253_CLK2(PIT_CLOCK) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, laserbas_state, pit_out_3_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, laserbas_state, pit_out_4_w)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, laserbas_state, pit_out_5_w)) + pit8253_device &pit0(PIT8253(config, "pit0", 0)); + pit0.set_clk<0>(PIT_CLOCK); + pit0.set_clk<1>(PIT_CLOCK); + pit0.set_clk<2>(PIT_CLOCK); + pit0.out_handler<0>().set(FUNC(laserbas_state::pit_out_w<0>)); + pit0.out_handler<1>().set(FUNC(laserbas_state::pit_out_w<1>)); + pit0.out_handler<2>().set(FUNC(laserbas_state::pit_out_w<2>)); + + pit8253_device &pit1(PIT8253(config, "pit1", 0)); + pit1.set_clk<0>(PIT_CLOCK); + pit1.set_clk<1>(PIT_CLOCK); + pit1.set_clk<2>(PIT_CLOCK); + pit1.out_handler<0>().set(FUNC(laserbas_state::pit_out_w<3>)); + pit1.out_handler<1>().set(FUNC(laserbas_state::pit_out_w<4>)); + pit1.out_handler<2>().set(FUNC(laserbas_state::pit_out_w<5>)); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(4000000, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */ @@ -451,12 +403,12 @@ MACHINE_CONFIG_START(laserbas_state::laserbas) /* sound hardware */ SPEAKER(config, "speaker").front_center(); - MCFG_DEVICE_ADD("dac1", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) - MCFG_DEVICE_ADD("dac2", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) - MCFG_DEVICE_ADD("dac3", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) - MCFG_DEVICE_ADD("dac4", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) - MCFG_DEVICE_ADD("dac5", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) - MCFG_DEVICE_ADD("dac6", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD(m_dac[0], DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD(m_dac[1], DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD(m_dac[2], DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD(m_dac[3], DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD(m_dac[4], DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD(m_dac[5], DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac1", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac1", -1.0, DAC_VREF_NEG_INPUT) MCFG_SOUND_ROUTE(0, "dac2", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac2", -1.0, DAC_VREF_NEG_INPUT) diff --git a/src/mame/drivers/m20.cpp b/src/mame/drivers/m20.cpp index 06888db0a48..7dd7c26b95e 100644 --- a/src/mame/drivers/m20.cpp +++ b/src/mame/drivers/m20.cpp @@ -819,7 +819,7 @@ MACHINE_CONFIG_START(m20_state::m20) MCFG_MC6845_CHAR_WIDTH(16) MCFG_MC6845_UPDATE_ROW_CB(m20_state, update_row) - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + I8255A(config, m_i8255, 0); I8251(config, m_kbdi8251, 0); m_kbdi8251->txd_handler().set("kbd", FUNC(rs232_port_device::write_txd)); @@ -830,13 +830,13 @@ MACHINE_CONFIG_START(m20_state::m20) m_ttyi8251->rxrdy_handler().set(m_i8259, FUNC(pic8259_device::ir3_w)); m_ttyi8251->txrdy_handler().set(m_i8259, FUNC(pic8259_device::ir5_w)); - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(1230782) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, m20_state, tty_clock_tick_w)) - MCFG_PIT8253_CLK1(1230782) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, m20_state, kbd_clock_tick_w)) - MCFG_PIT8253_CLK2(1230782) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, m20_state, timer_tick_w)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(1230782); + pit8253.out_handler<0>().set(FUNC(m20_state::tty_clock_tick_w)); + pit8253.set_clk<1>(1230782); + pit8253.out_handler<1>().set(FUNC(m20_state::kbd_clock_tick_w)); + pit8253.set_clk<2>(1230782); + pit8253.out_handler<2>().set(FUNC(m20_state::timer_tick_w)); MCFG_DEVICE_ADD(m_i8259, PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, m20_state, int_w)) diff --git a/src/mame/drivers/mbc55x.cpp b/src/mame/drivers/mbc55x.cpp index c12bdf9e0e1..b2445aa59d7 100644 --- a/src/mame/drivers/mbc55x.cpp +++ b/src/mame/drivers/mbc55x.cpp @@ -269,13 +269,13 @@ MACHINE_CONFIG_START(mbc55x_state::mbc55x) I8251(config, m_kb_uart, 0); m_kb_uart->rxrdy_handler().set(PIC8259_TAG, FUNC(pic8259_device::ir3_w)); - MCFG_DEVICE_ADD(PIT8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(PIT_C0_CLOCK) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(PIC8259_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(PIT_C1_CLOCK) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(PIC8259_TAG, pic8259_device, ir1_w)) - MCFG_PIT8253_CLK2(PIT_C2_CLOCK) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, mbc55x_state, pit8253_t2)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(PIT_C0_CLOCK); + m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); + m_pit->set_clk<1>(PIT_C1_CLOCK); + m_pit->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir1_w)); + m_pit->set_clk<2>(PIT_C2_CLOCK); + m_pit->out_handler<2>().set(FUNC(mbc55x_state::pit8253_t2)); MCFG_DEVICE_ADD(PIC8259_TAG, PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/mc1502.cpp b/src/mame/drivers/mc1502.cpp index 2b377058b87..094aeb1e590 100644 --- a/src/mame/drivers/mc1502.cpp +++ b/src/mame/drivers/mc1502.cpp @@ -2,7 +2,7 @@ // copyright-holders:Sergey Svishchev /*************************************************************************** - drivers/mc1502.c + drivers/mc1502.cpp Driver file for Elektronika MS 1502 @@ -238,13 +238,13 @@ MACHINE_CONFIG_START(mc1502_state::mc1502) MCFG_MACHINE_START_OVERRIDE( mc1502_state, mc1502 ) MCFG_MACHINE_RESET_OVERRIDE( mc1502_state, mc1502 ) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'000'000)/12) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(16'000'000)/12) /* serial port */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, mc1502_state, mc1502_pit8253_out1_changed)) - MCFG_PIT8253_CLK2(XTAL(16'000'000)/12) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, mc1502_state, mc1502_pit8253_out2_changed)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(XTAL(16'000'000)/12); /* heartbeat IRQ */ + m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w)); + m_pit8253->set_clk<1>(XTAL(16'000'000)/12); /* serial port */ + m_pit8253->out_handler<1>().set(FUNC(mc1502_state::mc1502_pit8253_out1_changed)); + m_pit8253->set_clk<2>(XTAL(16'000'000)/12); /* pio port c pin 4, and speaker polling enough */ + m_pit8253->out_handler<2>().set(FUNC(mc1502_state::mc1502_pit8253_out2_changed)); MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) diff --git a/src/mame/drivers/mikrosha.cpp b/src/mame/drivers/mikrosha.cpp index 81e899688c6..fa810323ace 100644 --- a/src/mame/drivers/mikrosha.cpp +++ b/src/mame/drivers/mikrosha.cpp @@ -225,11 +225,11 @@ MACHINE_CONFIG_START(mikrosha_state::mikrosha) MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mikrosha_state, display_pixels) MCFG_I8275_DRQ_CALLBACK(WRITELINE(m_dma8257,i8257_device, dreq2_w)) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_CLK1(0) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, mikrosha_state, mikrosha_pit_out2)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(0); + pit8253.set_clk<1>(0); + pit8253.set_clk<2>(2000000); + pit8253.out_handler<2>().set(FUNC(mikrosha_state::mikrosha_pit_out2)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/ms0515.cpp b/src/mame/drivers/ms0515.cpp index e583f0839c8..ee0c2878ea7 100644 --- a/src/mame/drivers/ms0515.cpp +++ b/src/mame/drivers/ms0515.cpp @@ -576,17 +576,16 @@ MACHINE_CONFIG_START(ms0515_state::ms0515) MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4960*16) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, ms0515_state, write_keyboard_clock)) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(2'000'000)) -// MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, ms0515_state, write_keyboard_clock)) - MCFG_PIT8253_CLK1(XTAL(2'000'000)) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, ms0515_state, write_line_clock)) - MCFG_PIT8253_CLK2(XTAL(2'000'000)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, ms0515_state, pit8253_out2_changed)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(XTAL(2'000'000)); +// m_pit8253->out_handler<0>().set(FUNC(ms0515_state::write_keyboard_clock)); + m_pit8253->set_clk<1>(XTAL(2'000'000)); + m_pit8253->out_handler<0>().set(FUNC(ms0515_state::write_line_clock)); + m_pit8253->set_clk<2>(XTAL(2'000'000)); + m_pit8253->out_handler<2>().set(FUNC(ms0515_state::pit8253_out2_changed)); SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.45) + SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.45); /* internal ram */ RAM(config, RAM_TAG).set_default_size("128K"); diff --git a/src/mame/drivers/ms6102.cpp b/src/mame/drivers/ms6102.cpp index 622a52318f1..173205a0dc0 100644 --- a/src/mame/drivers/ms6102.cpp +++ b/src/mame/drivers/ms6102.cpp @@ -314,7 +314,7 @@ MACHINE_CONFIG_START(ms6102_state::ms6102) I8214(config, m_pic, XTAL(18'432'000) / 9); m_pic->int_wr_callback().set(FUNC(ms6102_state::irq_w)); - MCFG_DEVICE_ADD("earom", KR1601RR1, 0) + KR1601RR1(config, m_earom, 0); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -359,11 +359,11 @@ MACHINE_CONFIG_START(ms6102_state::ms6102) RS232_PORT(config, m_rs232, default_rs232_devices, "null_modem"); m_rs232->rxd_handler().set(m_i8251, FUNC(i8251_device::write_rxd)); - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'400'000) / 9) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("i8251", i8251_device, write_txc)) - MCFG_PIT8253_CLK1(XTAL(16'400'000) / 9) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("i8251", i8251_device, write_rxc)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(XTAL(16'400'000) / 9); + pit8253.out_handler<0>().set(m_i8251, FUNC(i8251_device::write_txc)); + pit8253.set_clk<1>(XTAL(16'400'000) / 9); + pit8253.out_handler<1>().set(m_i8251, FUNC(i8251_device::write_rxc)); MACHINE_CONFIG_END ROM_START( ms6102 ) diff --git a/src/mame/drivers/multi8.cpp b/src/mame/drivers/multi8.cpp index 5d78a6e795e..716086febab 100644 --- a/src/mame/drivers/multi8.cpp +++ b/src/mame/drivers/multi8.cpp @@ -608,9 +608,9 @@ MACHINE_CONFIG_START(multi8_state::multi8) uart_clock.signal_handler().set("uart", FUNC(i8251_device::write_txc)); uart_clock.signal_handler().append("uart", FUNC(i8251_device::write_rxc)); - MCFG_DEVICE_ADD("uart", I8251, 0) // for cassette - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_DEVICE_ADD("pic", PIC8259, 0) + I8251(config, "uart", 0); // for cassette + PIT8253(config, "pit", 0); + PIC8259(config, "pic", 0); //UPD765A(config, "fdc", false, true); //MCFG_FLOPPY_DRIVE_ADD("fdc:0", multi8_floppies, "525hd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/myb3k.cpp b/src/mame/drivers/myb3k.cpp index bf2e81f6bcb..863f6d9a7da 100644 --- a/src/mame/drivers/myb3k.cpp +++ b/src/mame/drivers/myb3k.cpp @@ -970,13 +970,13 @@ MACHINE_CONFIG_START(myb3k_state::myb3k) m_dma8257->out_dack_cb<3>().set(FUNC(myb3k_state::dack3_w)); /* Timer */ - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(14'318'181) / 12.0) /* TIMINT straight into IRQ0 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(14'318'181) / 12.0) /* speaker if port c bit 5 is low */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, myb3k_state, pit_out1_changed)) - // MCFG_PIT8253_CLK2(XTAL(14'318'181) / 12.0) /* ANDed with port c bit 6 but marked as "not use"*/ - // MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, myb3k_state, pit_out2_changed)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(XTAL(14'318'181) / 12.0); /* TIMINT straight into IRQ0 */ + m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w)); + m_pit8253->set_clk<1>(XTAL(14'318'181) / 12.0); /* speaker if port c bit 5 is low */ + m_pit8253->out_handler<1>().set(FUNC(myb3k_state::pit_out1_changed)); + // m_pit8253->set_clk<2>(XTAL(14'318'181) / 12.0); /* ANDed with port c bit 6 but marked as "not use"*/ + // m_pit8253->out_handler<2>().set(FUNC(myb3k_state::pit_out2_changed)); /* Video controller */ MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL(14'318'181) / 16) /* Main crystal divided by 16 through a 74163 4 bit counter */ diff --git a/src/mame/drivers/mz2000.cpp b/src/mame/drivers/mz2000.cpp index a3c5a4336cc..0b4fa35810c 100644 --- a/src/mame/drivers/mz2000.cpp +++ b/src/mame/drivers/mz2000.cpp @@ -895,10 +895,10 @@ MACHINE_CONFIG_START(mz2000_state::mz2000) pio.in_pb_callback().set(FUNC(mz2000_state::mz2000_pio1_portb_r)); /* TODO: clocks aren't known */ - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(31250) - MCFG_PIT8253_CLK1(31250) /* needed by "Art Magic" to boot */ - MCFG_PIT8253_CLK2(31250) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(31250); + m_pit8253->set_clk<1>(31250); /* needed by "Art Magic" to boot */ + m_pit8253->set_clk<2>(31250); MB8877(config, m_mb8877a, 1_MHz_XTAL); diff --git a/src/mame/drivers/mz2500.cpp b/src/mame/drivers/mz2500.cpp index 78abc032239..a1851236ed8 100644 --- a/src/mame/drivers/mz2500.cpp +++ b/src/mame/drivers/mz2500.cpp @@ -1824,13 +1824,13 @@ MACHINE_CONFIG_START(mz2500_state::mz2500) RP5C15(config, m_rtc, 32.768_kHz_XTAL); m_rtc->alarm().set(FUNC(mz2500_state::mz2500_rtc_alarm_irq)); - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(31250) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, mz2500_state, pit8253_clk0_irq)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(31250); + m_pit->out_handler<0>().set(FUNC(mz2500_state::pit8253_clk0_irq)); // TODO: is this really right? - MCFG_PIT8253_CLK1(0) - MCFG_PIT8253_CLK2(16) //CH2, used by Super MZ demo / The Black Onyx and a few others (TODO: timing of this) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pit", pit8253_device, write_clk1)) + m_pit->set_clk<1>(0); + m_pit->set_clk<2>(16); //CH2, used by Super MZ demo / The Black Onyx and a few others (TODO: timing of this) + m_pit->out_handler<2>().set(m_pit, FUNC(pit8253_device::write_clk1)); MB8877(config, m_fdc, 1_MHz_XTAL); diff --git a/src/mame/drivers/mz700.cpp b/src/mame/drivers/mz700.cpp index 603c11e7395..490b89a7e88 100644 --- a/src/mame/drivers/mz700.cpp +++ b/src/mame/drivers/mz700.cpp @@ -401,13 +401,13 @@ MACHINE_CONFIG_START(mz_state::mz700) MCFG_TIMER_DRIVER_ADD_PERIODIC("other", mz_state, ne556_other_callback, attotime::from_hz(34.5)) /* devices */ - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(17'734'470)/20) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, mz_state, pit_out0_changed)) - MCFG_PIT8253_CLK1(15611.0) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pit8253", pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, mz_state, pit_irq_2)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(XTAL(17'734'470)/20); + m_pit->out_handler<0>().set(FUNC(mz_state::pit_out0_changed)); + m_pit->set_clk<1>(15611.0); + m_pit->out_handler<1>().set(m_pit, FUNC(pit8253_device::write_clk2)); + m_pit->set_clk<2>(0); + m_pit->out_handler<2>().set(FUNC(mz_state::pit_irq_2)); I8255(config, m_ppi); m_ppi->out_pa_callback().set(FUNC(mz_state::pio_port_a_w)); @@ -453,8 +453,7 @@ MACHINE_CONFIG_START(mz_state::mz800) MCFG_SOFTWARE_LIST_ADD("cass_list","mz800_cass") /* devices */ - MCFG_DEVICE_MODIFY("pit8253") - MCFG_PIT8253_CLK0(XTAL(17'734'470)/16) + m_pit->set_clk<0>(XTAL(17'734'470)/16); z80pio_device& pio(Z80PIO(config, "z80pio", XTAL(17'734'470)/5)); pio.out_int_callback().set(FUNC(mz_state::mz800_z80pio_irq)); diff --git a/src/mame/drivers/mz80.cpp b/src/mame/drivers/mz80.cpp index 301af9c970e..dec43e3b58c 100644 --- a/src/mame/drivers/mz80.cpp +++ b/src/mame/drivers/mz80.cpp @@ -309,13 +309,13 @@ MACHINE_CONFIG_START(mz80_state::mz80k) m_ppi->in_pc_callback().set(FUNC(mz80_state::mz80k_8255_portc_r)); m_ppi->out_pc_callback().set(FUNC(mz80_state::mz80k_8255_portc_w)); - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(8'000'000)/4) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, mz80_state, pit_out0_changed)) - MCFG_PIT8253_CLK1(XTAL(8'000'000)/256) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pit8253", pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, mz80_state, pit_out2_changed)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(XTAL(8'000'000)/4); + m_pit->out_handler<0>().set(FUNC(mz80_state::pit_out0_changed)); + m_pit->set_clk<1>(XTAL(8'000'000)/256); + m_pit->out_handler<1>().set(m_pit, FUNC(pit8253_device::write_clk2)); + m_pit->set_clk<2>(0); + m_pit->out_handler<2>().set(FUNC(mz80_state::pit_out2_changed)); MCFG_TIMER_DRIVER_ADD_PERIODIC("tempo", mz80_state, ne555_tempo_callback, attotime::from_hz(34)) MCFG_CASSETTE_ADD( "cassette" ) diff --git a/src/mame/drivers/ngen.cpp b/src/mame/drivers/ngen.cpp index 20c207bc365..9c92197f184 100644 --- a/src/mame/drivers/ngen.cpp +++ b/src/mame/drivers/ngen.cpp @@ -94,10 +94,10 @@ public: m_pit(*this,"pit"), m_hdc(*this,"hdc"), m_fdc(*this,"fdc"), - m_disk_rom(*this,"disk"), - m_fd0(*this,"fdc:0"), m_fdc_timer(*this,"fdc_timer"), m_hdc_timer(*this,"hdc_timer"), + m_disk_rom(*this,"disk"), + m_fd0(*this,"fdc:0"), m_hd_buffer(*this,"hd_buffer_ram") { } @@ -150,6 +150,8 @@ protected: required_device<pit8254_device> m_pit; optional_device<wd2010_device> m_hdc; optional_device<wd2797_device> m_fdc; + optional_device<pit8253_device> m_fdc_timer; + optional_device<pit8253_device> m_hdc_timer; private: DECLARE_WRITE16_MEMBER(cpu_peripheral_cb); @@ -182,8 +184,6 @@ private: memory_array m_vram; memory_array m_fontram; optional_device<floppy_connector> m_fd0; - optional_device<pit8253_device> m_fdc_timer; - optional_device<pit8253_device> m_hdc_timer; optional_shared_ptr<uint8_t> m_hd_buffer; void set_dma_channel(int channel, int state); @@ -1015,13 +1015,14 @@ MACHINE_CONFIG_START(ngen_state::ngen) m_fdc->intrq_wr_callback().set(FUNC(ngen_state::fdc_irq_w)); m_fdc->drq_wr_callback().set(m_maincpu, FUNC(i80186_cpu_device::drq1_w)); m_fdc->set_force_ready(true); - MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m_pic,pic8259_device,ir5_w)) // clocked on FDC data register access - MCFG_PIT8253_CLK1(20_MHz_XTAL / 20) -// MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_pic,pic8259_device,ir5_w)) // 1MHz - MCFG_PIT8253_CLK2(20_MHz_XTAL / 20) -// MCFG_PIT8253_OUT2_HANDLER(WRITELINE(m_pic,pic8259_device,ir5_w)) + + PIT8253(config, m_fdc_timer, 0); + m_fdc_timer->set_clk<0>(0); + m_fdc_timer->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir5_w)); // clocked on FDC data register access + m_fdc_timer->set_clk<1>(20_MHz_XTAL / 20); +// m_fdc_timer->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir5_w)); // 1MHz + m_fdc_timer->set_clk<2>(20_MHz_XTAL / 20); +// m_fdc_timer->out_handler<2>().set(m_pic, FUNC(pic8259_device::ir5_w)); // TODO: WD1010 HDC (not implemented), use WD2010 for now WD2010(config, m_hdc, 20_MHz_XTAL / 4); @@ -1034,8 +1035,9 @@ MACHINE_CONFIG_START(ngen_state::ngen) m_hdc->in_tk000_callback().set_constant(1); m_hdc->in_sc_callback().set_constant(1); - MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK2(20_MHz_XTAL / 10) // 2MHz + PIT8253(config, m_hdc_timer, 0); + m_hdc_timer->set_clk<2>(20_MHz_XTAL / 10); // 2MHz + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_HARDDISK_ADD("hard0") @@ -1127,13 +1129,14 @@ MACHINE_CONFIG_START(ngen386_state::ngen386) m_fdc->intrq_wr_callback().set(FUNC(ngen386_state::fdc_irq_w)); //m_fdc->drq_wr_callback().set(m_i386cpu, FUNC(i80186_cpu_device_device::drq1_w)); m_fdc->set_force_ready(true); - MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic",pic8259_device,ir5_w)) // clocked on FDC data register access - MCFG_PIT8253_CLK1(20_MHz_XTAL / 20) -// MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pic",pic8259_device,ir5_w)) // 1MHz - MCFG_PIT8253_CLK2(20_MHz_XTAL / 20) -// MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pic",pic8259_device,ir5_w)) + + PIT8253(config, m_fdc_timer, 0); + m_fdc_timer->set_clk<0>(0); + m_fdc_timer->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir5_w)); // clocked on FDC data register access + m_fdc_timer->set_clk<1>(20_MHz_XTAL / 20); +// m_fdc_timer->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir5_w)); // 1MHz + m_fdc_timer->set_clk<2>(20_MHz_XTAL / 20); +// m_fdc_timer->out_handler<2>().set(m_pic, FUNC(pic8259_device::ir5_w)); // TODO: WD1010 HDC (not implemented), use WD2010 for now WD2010(config, m_hdc, 20_MHz_XTAL / 4); @@ -1146,8 +1149,9 @@ MACHINE_CONFIG_START(ngen386_state::ngen386) m_hdc->in_tk000_callback().set_constant(1); m_hdc->in_sc_callback().set_constant(1); - MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK2(20_MHz_XTAL / 10) // 2MHz + PIT8253(config, m_hdc_timer, 0); + m_hdc_timer->set_clk<2>(20_MHz_XTAL / 10); // 2MHz + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_HARDDISK_ADD("hard0") MACHINE_CONFIG_END diff --git a/src/mame/drivers/octopus.cpp b/src/mame/drivers/octopus.cpp index 536dc880d30..ce0d1e97811 100644 --- a/src/mame/drivers/octopus.cpp +++ b/src/mame/drivers/octopus.cpp @@ -980,13 +980,13 @@ MACHINE_CONFIG_START(octopus_state::octopus) MCFG_FLOPPY_DRIVE_ADD("fdc:1", octopus_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_SOFTWARE_LIST_ADD("fd_list","octopus") - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(4.9152_MHz_XTAL / 2) // DART channel A - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, octopus_state,serial_clock_w)) // being able to write both Rx and Tx clocks at one time would be nice - MCFG_PIT8253_CLK1(4.9152_MHz_XTAL / 2) // DART channel B - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_serial,z80sio_device,rxtxcb_w)) - MCFG_PIT8253_CLK2(4.9152_MHz_XTAL / 2) // speaker frequency - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, octopus_state,spk_freq_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(4.9152_MHz_XTAL / 2); // DART channel A + m_pit->out_handler<0>().set(FUNC(octopus_state::serial_clock_w)); // being able to write both Rx and Tx clocks at one time would be nice + m_pit->set_clk<1>(4.9152_MHz_XTAL / 2); // DART channel B + m_pit->out_handler<1>().set(m_serial, FUNC(z80sio_device::rxtxcb_w)); + m_pit->set_clk<2>(4.9152_MHz_XTAL / 2); // speaker frequency + m_pit->out_handler<2>().set(FUNC(octopus_state::spk_freq_w)); SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp index 6629ceac625..ca108352322 100644 --- a/src/mame/drivers/okean240.cpp +++ b/src/mame/drivers/okean240.cpp @@ -563,8 +563,7 @@ MACHINE_CONFIG_START(okean240_state::okean240a) m_ppikbd->in_pb_callback().set(FUNC(okean240_state::okean240a_port41_r)); m_ppikbd->in_pc_callback().set(FUNC(okean240_state::okean240a_port42_r)); - MCFG_DEVICE_MODIFY("pit") - MCFG_PIT8253_CLK1(1536000) // artificial rate + subdevice<pit8253_device>("pit")->set_clk<1>(1536000); // artificial rate MACHINE_CONFIG_END MACHINE_CONFIG_START(okean240_state::okean240) @@ -574,8 +573,7 @@ MACHINE_CONFIG_START(okean240_state::okean240) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_okean240) MCFG_DEVICE_REMOVE("uart") MCFG_DEVICE_REMOVE("rs232") - MCFG_DEVICE_MODIFY("pit") - MCFG_PIT8253_OUT1_HANDLER(NOOP) + subdevice<pit8253_device>("pit")->out_handler<1>().set_nop(); MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(PUT(okean240_state, kbd_put)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/pc1512.cpp b/src/mame/drivers/pc1512.cpp index 1a7140bb8ce..4f034d7a4e1 100644 --- a/src/mame/drivers/pc1512.cpp +++ b/src/mame/drivers/pc1512.cpp @@ -1199,16 +1199,16 @@ MACHINE_CONFIG_START(pc1512_state::pc1512) PIC8259(config, m_pic, 0); m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(28.636363_MHz_XTAL / 24) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(I8259A2_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(28.636363_MHz_XTAL / 24) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, pc1512_state, pit1_w)) - MCFG_PIT8253_CLK2(28.636363_MHz_XTAL / 24) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, pc1512_state, pit2_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(28.636363_MHz_XTAL / 24); + m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); + m_pit->set_clk<1>(28.636363_MHz_XTAL / 24); + m_pit->out_handler<1>().set(FUNC(pc1512_state::pit1_w)); + m_pit->set_clk<2>(28.636363_MHz_XTAL / 24); + m_pit->out_handler<2>().set(FUNC(pc1512_state::pit2_w)); MC146818(config, m_rtc, 32.768_kHz_XTAL); - m_rtc->irq().set(I8259A2_TAG, FUNC(pic8259_device::ir2_w)); + m_rtc->irq().set(m_pic, FUNC(pic8259_device::ir2_w)); MCFG_PC_FDC_XT_ADD(PC_FDC_XT_TAG) MCFG_PC_FDC_INTRQ_CALLBACK(WRITELINE(*this, pc1512_state, fdc_int_w)) @@ -1220,7 +1220,7 @@ MACHINE_CONFIG_START(pc1512_state::pc1512) m_uart->out_tx_callback().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); m_uart->out_dtr_callback().set(RS232_TAG, FUNC(rs232_port_device::write_dtr)); m_uart->out_rts_callback().set(RS232_TAG, FUNC(rs232_port_device::write_rts)); - m_uart->out_int_callback().set(I8259A2_TAG, FUNC(pic8259_device::ir4_w)); + m_uart->out_int_callback().set(m_pic, FUNC(pic8259_device::ir4_w)); MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(*this, pc1512_state, write_centronics_ack)) @@ -1240,12 +1240,12 @@ MACHINE_CONFIG_START(pc1512_state::pc1512) // ISA8 bus MCFG_DEVICE_ADD(ISA_BUS_TAG, ISA8, 0) MCFG_ISA8_CPU(I8086_TAG) - MCFG_ISA_OUT_IRQ2_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir7_w)) + MCFG_ISA_OUT_IRQ2_CB(WRITELINE(m_pic, pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(WRITELINE(m_pic, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(WRITELINE(m_pic, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(WRITELINE(m_pic, pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(WRITELINE(m_pic, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(WRITELINE(m_pic, pic8259_device, ir7_w)) MCFG_ISA_OUT_DRQ1_CB(WRITELINE(I8237A5_TAG, am9517a_device, dreq1_w)) MCFG_ISA_OUT_DRQ2_CB(WRITELINE(I8237A5_TAG, am9517a_device, dreq2_w)) MCFG_ISA_OUT_DRQ3_CB(WRITELINE(I8237A5_TAG, am9517a_device, dreq3_w)) @@ -1330,16 +1330,16 @@ MACHINE_CONFIG_START(pc1640_state::pc1640) PIC8259(config, m_pic, 0); m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(28.636363_MHz_XTAL / 24) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(I8259A2_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(28.636363_MHz_XTAL / 24) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, pc1512_base_state, pit1_w)) - MCFG_PIT8253_CLK2(28.636363_MHz_XTAL / 24) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, pc1512_base_state, pit2_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(28.636363_MHz_XTAL / 24); + m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); + m_pit->set_clk<1>(28.636363_MHz_XTAL / 24); + m_pit->out_handler<1>().set(FUNC(pc1512_base_state::pit1_w)); + m_pit->set_clk<2>(28.636363_MHz_XTAL / 24); + m_pit->out_handler<2>().set(FUNC(pc1512_base_state::pit2_w)); MC146818(config, m_rtc, 32.768_kHz_XTAL); - m_rtc->irq().set(I8259A2_TAG, FUNC(pic8259_device::ir2_w)); + m_rtc->irq().set(m_pic, FUNC(pic8259_device::ir2_w)); MCFG_PC_FDC_XT_ADD(PC_FDC_XT_TAG) MCFG_PC_FDC_INTRQ_CALLBACK(WRITELINE(*this, pc1512_base_state, fdc_int_w)) @@ -1351,7 +1351,7 @@ MACHINE_CONFIG_START(pc1640_state::pc1640) m_uart->out_tx_callback().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); m_uart->out_dtr_callback().set(RS232_TAG, FUNC(rs232_port_device::write_dtr)); m_uart->out_rts_callback().set(RS232_TAG, FUNC(rs232_port_device::write_rts)); - m_uart->out_int_callback().set(I8259A2_TAG, FUNC(pic8259_device::ir4_w)); + m_uart->out_int_callback().set(m_pic, FUNC(pic8259_device::ir4_w)); MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(*this, pc1512_base_state, write_centronics_ack)) @@ -1371,12 +1371,12 @@ MACHINE_CONFIG_START(pc1640_state::pc1640) // ISA8 bus MCFG_DEVICE_ADD(ISA_BUS_TAG, ISA8, 0) MCFG_ISA8_CPU(I8086_TAG) - MCFG_ISA_OUT_IRQ2_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(WRITELINE(I8259A2_TAG, pic8259_device, ir7_w)) + MCFG_ISA_OUT_IRQ2_CB(WRITELINE(m_pic, pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(WRITELINE(m_pic, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(WRITELINE(m_pic, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(WRITELINE(m_pic, pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(WRITELINE(m_pic, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(WRITELINE(m_pic, pic8259_device, ir7_w)) MCFG_ISA_OUT_DRQ1_CB(WRITELINE(I8237A5_TAG, am9517a_device, dreq1_w)) MCFG_ISA_OUT_DRQ2_CB(WRITELINE(I8237A5_TAG, am9517a_device, dreq2_w)) MCFG_ISA_OUT_DRQ3_CB(WRITELINE(I8237A5_TAG, am9517a_device, dreq3_w)) diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp index 6753c89381d..2c2b67d2ca1 100644 --- a/src/mame/drivers/pc88va.cpp +++ b/src/mame/drivers/pc88va.cpp @@ -1655,11 +1655,11 @@ MACHINE_CONFIG_START(pc88va_state::pc88va) FLOPPY_CONNECTOR(config, m_fdd[1], pc88va_floppies, "525hd", pc88va_state::floppy_formats); MCFG_SOFTWARE_LIST_ADD("disk_list","pc88va") - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(8000000) /* general purpose timer 1 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, pc88va_state, pc88va_pit_out0_changed)) - MCFG_PIT8253_CLK1(8000000) /* BEEP frequency setting */ - MCFG_PIT8253_CLK2(8000000) /* RS232C baud rate setting */ + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(8000000); /* general purpose timer 1 */ + pit8253.out_handler<0>().set(FUNC(pc88va_state::pc88va_pit_out0_changed)); + pit8253.set_clk<1>(8000000); /* BEEP frequency setting */ + pit8253.set_clk<2>(8000000); /* RS232C baud rate setting */ ADDRESS_MAP_BANK(config, "sysbank").set_map(&pc88va_state::sysbank_map).set_options(ENDIANNESS_LITTLE, 16, 18+4, 0x40000); diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 640a0338eed..980d1d596a3 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -2485,10 +2485,9 @@ MACHINE_CONFIG_START(pc9801_state::pc9821) MCFG_DEVICE_IO_MAP(pc9821_io) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_DEVICE_MODIFY("pit8253") - MCFG_PIT8253_CLK0(MAIN_CLOCK_X2) - MCFG_PIT8253_CLK1(MAIN_CLOCK_X2) - MCFG_PIT8253_CLK2(MAIN_CLOCK_X2) + m_pit8253->set_clk<0>(MAIN_CLOCK_X2); + m_pit8253->set_clk<1>(MAIN_CLOCK_X2); + m_pit8253->set_clk<2>(MAIN_CLOCK_X2); MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821) MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9821) diff --git a/src/mame/drivers/peoplepc.cpp b/src/mame/drivers/peoplepc.cpp index 100d6df6b3b..f3734d2523f 100644 --- a/src/mame/drivers/peoplepc.cpp +++ b/src/mame/drivers/peoplepc.cpp @@ -249,13 +249,13 @@ MACHINE_CONFIG_START(peoplepc_state::olypeopl) MCFG_DEVICE_IO_MAP(peoplepc_io) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic8259_0", pic8259_device, inta_cb) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(14'745'600)/6) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, peoplepc_state, kbd_clock_tick_w)) - MCFG_PIT8253_CLK1(XTAL(14'745'600)/6) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, peoplepc_state, tty_clock_tick_w)) - MCFG_PIT8253_CLK2(XTAL(14'745'600)/6) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pic8259_0", pic8259_device, ir0_w)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(XTAL(14'745'600)/6); + pit8253.out_handler<0>().set(FUNC(peoplepc_state::kbd_clock_tick_w)); + pit8253.set_clk<1>(XTAL(14'745'600)/6); + pit8253.out_handler<1>().set(FUNC(peoplepc_state::tty_clock_tick_w)); + pit8253.set_clk<2>(XTAL(14'745'600)/6); + pit8253.out_handler<2>().set("pic8259_0", FUNC(pic8259_device::ir0_w)); MCFG_DEVICE_ADD("pic8259_0", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index 177fadb2ca4..e2e847b740f 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -185,7 +185,7 @@ void pg685_state::pg685_mem(address_map &map) { map.unmap_value_high(); pg675_mem(map); - map(0xf9f34, 0xf9f37).rw("bppit", FUNC(pit8253_device::read), FUNC(pit8253_device::write)); + map(0xf9f34, 0xf9f37).rw(m_bppit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)); map(0xf9f38, 0xf9f3b).rw("bpuart", FUNC(mc2661_device::read), FUNC(mc2661_device::write)); map(0xf9f3c, 0xf9f3d).rw("bppic", FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0xf9f3e, 0xf9f3e).w(FUNC(pg685_state::f9f3e_w)); @@ -211,7 +211,7 @@ void pg685_state::pg685oua12_mem(address_map &map) map(0xf9f30, 0xf9f31).rw("moduart", FUNC(i8251_device::read), FUNC(i8251_device::write)); map(0xf9f32, 0xf9f32).w(FUNC(pg685_state::f9f32_w)); map(0xf9f33, 0xf9f33).r(FUNC(pg685_state::f9f33_r)); - map(0xf9f34, 0xf9f37).rw("bppit", FUNC(pit8253_device::read), FUNC(pit8253_device::write)); + map(0xf9f34, 0xf9f37).rw(m_bppit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)); map(0xf9f38, 0xf9f3b).rw("bpuart", FUNC(mc2661_device::read), FUNC(mc2661_device::write)); map(0xf9f3c, 0xf9f3d).rw("bppic", FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0xf9f3e, 0xf9f3e).w(FUNC(pg685_state::f9f3e_w)); @@ -395,30 +395,31 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) // MACHINE DRIVERS //************************************************************************** -MACHINE_CONFIG_START(pg685_state::pg685_backplane) - MCFG_DEVICE_ADD("bppit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(12'288'000) / 10) // same input clock as for PC16-11? - MCFG_PIT8253_CLK1(XTAL(12'288'000) / 10) - MCFG_PIT8253_CLK2(XTAL(12'288'000) / 10) +void pg685_state::pg685_backplane(machine_config &config) +{ + PIT8253(config, m_bppit, 0); + m_bppit->set_clk<0>(XTAL(12'288'000) / 10); // same input clock as for PC16-11? + m_bppit->set_clk<1>(XTAL(12'288'000) / 10); + m_bppit->set_clk<2>(XTAL(12'288'000) / 10); - MCFG_DEVICE_ADD("bppic", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(NOOP) // configured in single 8086 mode? + pic8259_device &bppic(PIC8259(config, "bppic", 0)); + bppic.out_int_callback().set_nop(); // configured in single 8086 mode? - MCFG_DEVICE_ADD("bpuart", MC2661, 4915200) -MACHINE_CONFIG_END + MC2661(config, "bpuart", 4915200); +} -MACHINE_CONFIG_START(pg685_state::pg685_module) +void pg685_state::pg685_module(machine_config &config) +{ FD1797(config, m_fdc, XTAL(4'000'000) / 2); // divider guessed m_fdc->intrq_wr_callback().set("mainpic", FUNC(pic8259_device::ir4_w)); - MCFG_DEVICE_ADD("modppi1", I8255, 0) - MCFG_DEVICE_ADD("modppi2", I8255, 0) + I8255(config, "modppi1", 0); + I8255(config, "modppi2", 0); - MCFG_DEVICE_ADD("moduart", I8251, XTAL(4'000'000) / 2) // divider guessed + I8251(config, "moduart", XTAL(4'000'000) / 2); // divider guessed - MCFG_DEVICE_ADD("rtc", MM58167, XTAL(32'768)) - -MACHINE_CONFIG_END + MM58167(config, "rtc", XTAL(32'768)); +} MACHINE_CONFIG_START(pg685_state::pg675) // main cpu diff --git a/src/mame/drivers/pk8020.cpp b/src/mame/drivers/pk8020.cpp index df4816d16db..06de7275dcf 100644 --- a/src/mame/drivers/pk8020.cpp +++ b/src/mame/drivers/pk8020.cpp @@ -222,13 +222,13 @@ MACHINE_CONFIG_START(pk8020_state::pk8020) I8255(config, m_ppi8255_3); - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(20_MHz_XTAL / 10) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, pk8020_state,pk8020_pit_out0)) - MCFG_PIT8253_CLK1(20_MHz_XTAL / 10) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, pk8020_state,pk8020_pit_out1)) - MCFG_PIT8253_CLK2((20_MHz_XTAL / 8) / 164) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pic8259", pic8259_device, ir5_w)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(20_MHz_XTAL / 10); + m_pit8253->out_handler<0>().set(FUNC(pk8020_state::pk8020_pit_out0)); + m_pit8253->set_clk<1>(20_MHz_XTAL / 10); + m_pit8253->out_handler<1>().set(FUNC(pk8020_state::pk8020_pit_out1)); + m_pit8253->set_clk<2>((20_MHz_XTAL / 8) / 164); + m_pit8253->out_handler<2>().set(m_pic8259, FUNC(pic8259_device::ir5_w)); MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp index 9b2894fad13..82c135a88fc 100644 --- a/src/mame/drivers/poisk1.cpp +++ b/src/mame/drivers/poisk1.cpp @@ -655,13 +655,13 @@ MACHINE_CONFIG_START(p1_state::poisk1) MCFG_MACHINE_START_OVERRIDE( p1_state, poisk1 ) MCFG_MACHINE_RESET_OVERRIDE( p1_state, poisk1 ) - MCFG_DEVICE_ADD( "pit8253", PIT8253 ,0) - MCFG_PIT8253_CLK0(XTAL(15'000'000)/12) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(15'000'000)/12) /* keyboard poll -- XXX edge or level triggered? */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pic8259", pic8259_device, ir6_w)) - MCFG_PIT8253_CLK2(XTAL(15'000'000)/12) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, p1_state, p1_pit8253_out2_changed)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(XTAL(15'000'000)/12); /* heartbeat IRQ */ + m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w)); + m_pit8253->set_clk<1>(XTAL(15'000'000)/12); /* keyboard poll -- XXX edge or level triggered? */ + m_pit8253->out_handler<1>().set(m_pic8259, FUNC(pic8259_device::ir6_w)); + m_pit8253->set_clk<2>(XTAL(15'000'000)/12); /* pio port c pin 4, and speaker polling enough */ + m_pit8253->out_handler<2>().set(FUNC(p1_state::p1_pit8253_out2_changed)); MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) diff --git a/src/mame/drivers/pp01.cpp b/src/mame/drivers/pp01.cpp index 3263cf7f740..e1fa74061ff 100644 --- a/src/mame/drivers/pp01.cpp +++ b/src/mame/drivers/pp01.cpp @@ -226,13 +226,13 @@ MACHINE_CONFIG_START(pp01_state::pp01) MCFG_DEVICE_ADD("uart", I8251, 0) // when rts and dtr are both high, the uart is being used for cassette operations - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, pp01_state,pp01_pit_out0)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, pp01_state,pp01_pit_out1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pit8253", pit8253_device, write_clk0)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(0); + m_pit->out_handler<0>().set(FUNC(pp01_state::pp01_pit_out0)); + m_pit->set_clk<1>(2000000); + m_pit->out_handler<1>().set(FUNC(pp01_state::pp01_pit_out1)); + m_pit->set_clk<2>(2000000); + m_pit->out_handler<2>().set(m_pit, FUNC(pit8253_device::write_clk0)); i8255_device &ppi(I8255A(config, "ppi8255")); ppi.in_pa_callback().set(FUNC(pp01_state::pp01_8255_porta_r)); diff --git a/src/mame/drivers/prophet600.cpp b/src/mame/drivers/prophet600.cpp index 6c67d59fca7..d4b8201f856 100644 --- a/src/mame/drivers/prophet600.cpp +++ b/src/mame/drivers/prophet600.cpp @@ -278,12 +278,12 @@ MACHINE_CONFIG_START(prophet600_state::prophet600) config.set_default_layout(layout_prophet600); - MCFG_DEVICE_ADD(PIT_TAG, PIT8253, XTAL(8'000'000)/4) - MCFG_PIT8253_CLK0(XTAL(8'000'000)/4) - MCFG_PIT8253_CLK1(XTAL(8'000'000)/4) - MCFG_PIT8253_CLK2(XTAL(8'000'000)/4) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, prophet600_state, pit_ch0_tick_w)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, prophet600_state, pit_ch2_tick_w)) + pit8253_device &pit8253(PIT8253(config, PIT_TAG, XTAL(8'000'000)/4)); + pit8253.set_clk<0>(XTAL(8'000'000)/4); + pit8253.set_clk<1>(XTAL(8'000'000)/4); + pit8253.set_clk<2>(XTAL(8'000'000)/4); + pit8253.out_handler<0>().set(FUNC(prophet600_state::pit_ch0_tick_w)); + pit8253.out_handler<2>().set(FUNC(prophet600_state::pit_ch2_tick_w)); ACIA6850(config, m_acia, 0); m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd)); diff --git a/src/mame/drivers/pwrview.cpp b/src/mame/drivers/pwrview.cpp index 4a8cb3ebe54..25d2b355d06 100644 --- a/src/mame/drivers/pwrview.cpp +++ b/src/mame/drivers/pwrview.cpp @@ -413,10 +413,10 @@ MACHINE_CONFIG_START(pwrview_state::pwrview) MCFG_SCREEN_RAW_PARAMS(XTAL(64'000'000)/8, 480, 0, 384, 1040, 0, 960) // clock unknown MCFG_SCREEN_UPDATE_DEVICE("crtc", hd6845_device, screen_update) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'000'000)/16) // clocks unknown, fix above when found - MCFG_PIT8253_CLK1(XTAL(16'000'000)/16) - MCFG_PIT8253_CLK2(XTAL(16'000'000)/16) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(XTAL(16'000'000)/16); // clocks unknown, fix above when found + m_pit->set_clk<1>(XTAL(16'000'000)/16); + m_pit->set_clk<2>(XTAL(16'000'000)/16); // floppy disk controller UPD765A(config, "fdc", true, true); // Rockwell R7675P @@ -425,7 +425,7 @@ MACHINE_CONFIG_START(pwrview_state::pwrview) MCFG_FLOPPY_DRIVE_ADD("fdc:0", pwrview_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", pwrview_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_DEVICE_ADD("uart", I8251, 0) + I8251(config, "uart", 0); Z80SIO2(config, "sio", 4000000); diff --git a/src/mame/drivers/sage2.cpp b/src/mame/drivers/sage2.cpp index 2beb04fe575..120d9012f14 100644 --- a/src/mame/drivers/sage2.cpp +++ b/src/mame/drivers/sage2.cpp @@ -427,21 +427,21 @@ MACHINE_CONFIG_START(sage2_state::sage2) ppi1.in_pb_callback().set(FUNC(sage2_state::ppi1_pb_r)); ppi1.out_pc_callback().set(FUNC(sage2_state::ppi1_pc_w)); - MCFG_DEVICE_ADD(I8253_0_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(0) // from U75 OUT0 - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(I8259_TAG, pic8259_device, ir6_w)) - MCFG_PIT8253_CLK1(XTAL(16'000'000)/2/125) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(I8253_0_TAG, pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) // from OUT2 - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(I8259_TAG, pic8259_device, ir0_w)) - - MCFG_DEVICE_ADD(I8253_1_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'000'000)/2/125) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(I8253_0_TAG, pit8253_device, write_clk0)) - MCFG_PIT8253_CLK1(XTAL(16'000'000)/2/13) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, sage2_state, br1_w)) - MCFG_PIT8253_CLK2(XTAL(16'000'000)/2/13) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, sage2_state, br2_w)) + pit8253_device &i8253_0(PIT8253(config, I8253_0_TAG, 0)); + i8253_0.set_clk<0>(0); // from U75 OUT0 + i8253_0.out_handler<0>().set(m_pic, FUNC(pic8259_device::ir6_w)); + i8253_0.set_clk<1>(XTAL(16'000'000)/2/125); + i8253_0.out_handler<1>().set(I8253_0_TAG, FUNC(pit8253_device::write_clk2)); + i8253_0.set_clk<2>(0); // from OUT2 + i8253_0.out_handler<2>().set(m_pic, FUNC(pic8259_device::ir0_w)); + + pit8253_device &i8253_1(PIT8253(config, I8253_1_TAG, 0)); + i8253_1.set_clk<0>(XTAL(16'000'000)/2/125); + i8253_1.out_handler<0>().set(I8253_0_TAG, FUNC(pit8253_device::write_clk0)); + i8253_1.set_clk<1>(XTAL(16'000'000)/2/13); + i8253_1.out_handler<1>().set(FUNC(sage2_state::br1_w)); + i8253_1.set_clk<2>(XTAL(16'000'000)/2/13); + i8253_1.out_handler<2>().set(FUNC(sage2_state::br2_w)); I8251(config, m_usart0, 0); m_usart0->txd_handler().set(RS232_A_TAG, FUNC(rs232_port_device::write_txd)); diff --git a/src/mame/drivers/segacoin.cpp b/src/mame/drivers/segacoin.cpp index 6f26d1569ea..3418ee08f27 100644 --- a/src/mame/drivers/segacoin.cpp +++ b/src/mame/drivers/segacoin.cpp @@ -124,39 +124,39 @@ INPUT_PORTS_END ***************************************************************************/ -MACHINE_CONFIG_START(segacoin_state::westdrm) - +void segacoin_state::westdrm(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, 8000000) // clock frequency unknown - MCFG_DEVICE_PROGRAM_MAP(main_map) - MCFG_DEVICE_IO_MAP(main_portmap) + Z80(config, m_maincpu, 8000000); // clock frequency unknown + m_maincpu->set_addrmap(AS_PROGRAM, &segacoin_state::main_map); + m_maincpu->set_addrmap(AS_IO, &segacoin_state::main_portmap); - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK2(1000000) // clock frequency unknown + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<2>(1000000); // clock frequency unknown - MCFG_DEVICE_ADD("io", SEGA_315_5338A, 0) + SEGA_315_5338A(config, "io", 0); - MCFG_DEVICE_ADD("audiocpu", Z80, 8000000) // clock frequency unknown - MCFG_DEVICE_PROGRAM_MAP(sound_map) - MCFG_DEVICE_IO_MAP(sound_portmap) + Z80(config, m_audiocpu, 8000000); // clock frequency unknown + m_audiocpu->set_addrmap(AS_PROGRAM, &segacoin_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &segacoin_state::sound_portmap); /* no video! */ /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ym0", YM3438, 8000000) // clock frequency unknown - MCFG_SOUND_ROUTE(0, "mono", 0.40) - MCFG_SOUND_ROUTE(1, "mono", 0.40) + ym3438_device &ym0(YM3438(config, "ym0", 8000000)); // clock frequency unknown + ym0.add_route(0, "mono", 0.40); + ym0.add_route(1, "mono", 0.40); - MCFG_DEVICE_ADD("ym1", YM3438, 8000000) // clock frequency unknown - MCFG_SOUND_ROUTE(0, "mono", 0.40) - MCFG_SOUND_ROUTE(1, "mono", 0.40) + ym3438_device &ym1(YM3438(config, "ym1", 8000000)); // clock frequency unknown + ym1.add_route(0, "mono", 0.40); + ym1.add_route(1, "mono", 0.40); - MCFG_DEVICE_ADD("ym2", YM3438, 8000000) // clock frequency unknown - MCFG_SOUND_ROUTE(0, "mono", 0.40) - MCFG_SOUND_ROUTE(1, "mono", 0.40) -MACHINE_CONFIG_END + ym3438_device &ym2(YM3438(config, "ym2", 8000000)); // clock frequency unknown + ym2.add_route(0, "mono", 0.40); + ym2.add_route(1, "mono", 0.40); +} diff --git a/src/mame/drivers/segaufo.cpp b/src/mame/drivers/segaufo.cpp index 5b3a66a9085..078d778842c 100644 --- a/src/mame/drivers/segaufo.cpp +++ b/src/mame/drivers/segaufo.cpp @@ -806,13 +806,13 @@ MACHINE_CONFIG_START(ufo_state::newufo) m_io2->out_pf_callback().set(FUNC(ufo_state::crane_xyz_w)); m_io2->out_pg_callback().set(FUNC(ufo_state::ufo_lamps_w)); - MCFG_DEVICE_ADD("pit", PIT8254, XTAL(16'000'000)/2) // uPD71054C, configuration is unknown - MCFG_PIT8253_CLK0(XTAL(16'000'000)/2/256) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, ufo_state, pit_out0)) - MCFG_PIT8253_CLK1(XTAL(16'000'000)/2/256) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, ufo_state, pit_out1)) - MCFG_PIT8253_CLK2(XTAL(16'000'000)/2/256) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, ufo_state, pit_out2)) + pit8254_device &pit(PIT8254(config, "pit", XTAL(16'000'000)/2)); // uPD71054C, configuration is unknown + pit.set_clk<0>(XTAL(16'000'000)/2/256); + pit.out_handler<0>().set(FUNC(ufo_state::pit_out0)); + pit.set_clk<1>(XTAL(16'000'000)/2/256); + pit.out_handler<1>().set(FUNC(ufo_state::pit_out1)); + pit.set_clk<2>(XTAL(16'000'000)/2/256); + pit.out_handler<2>().set(FUNC(ufo_state::pit_out2)); /* no video! */ diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index 8777d9b3f41..9edde5eb618 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -8870,9 +8870,9 @@ MACHINE_CONFIG_START(seta_state::kamenrid) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", seta_state, irq2_line_assert) WATCHDOG_TIMER(config, "watchdog"); - MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C - MCFG_PIT8253_CLK0(16000000/2/8) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, seta_state, pit_out0)) + pit8254_device &pit(PIT8254(config, "pit", 0)); // uPD71054C + pit.set_clk<0>(16000000/2/8); + pit.out_handler<0>().set(FUNC(seta_state::pit_out0)); MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") @@ -9044,9 +9044,9 @@ MACHINE_CONFIG_START(seta_state::madshark) MCFG_DEVICE_PROGRAM_MAP(madshark_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", seta_state, irq2_line_assert) - MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C - MCFG_PIT8253_CLK0(16000000/2/8) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, seta_state, pit_out0)) + pit8254_device &pit(PIT8254(config, "pit", 0)); // uPD71054C + pit.set_clk<0>(16000000/2/8); + pit.out_handler<0>().set(FUNC(seta_state::pit_out0)); MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") @@ -9096,9 +9096,9 @@ MACHINE_CONFIG_START(seta_state::magspeed) MCFG_MACHINE_START_OVERRIDE(seta_state, magspeed) - MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C - MCFG_PIT8253_CLK0(16000000/2/8) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, seta_state, pit_out0)) + pit8254_device &pit(PIT8254(config, "pit", 0)); // uPD71054C + pit.set_clk<0>(16000000/2/8); + pit.out_handler<0>().set(FUNC(seta_state::pit_out0)); MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") @@ -9139,9 +9139,9 @@ MACHINE_CONFIG_START(seta_state::msgundam) MCFG_DEVICE_PROGRAM_MAP(msgundam_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", seta_state, irq2_line_assert) - MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C - MCFG_PIT8253_CLK0(16000000/2/8) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, seta_state, pit_out0)) + pit8254_device &pit(PIT8254(config, "pit", 0)); // uPD71054C + pit.set_clk<0>(16000000/2/8); + pit.out_handler<0>().set(FUNC(seta_state::pit_out0)); MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") diff --git a/src/mame/drivers/sm7238.cpp b/src/mame/drivers/sm7238.cpp index 38170e09129..69509997570 100644 --- a/src/mame/drivers/sm7238.cpp +++ b/src/mame/drivers/sm7238.cpp @@ -383,21 +383,21 @@ MACHINE_CONFIG_START(sm7238_state::sm7238) MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_DEVICE_ADD("t_hblank", PIT8253, 0) - MCFG_PIT8253_CLK1(16.384_MHz_XTAL/9) // XXX workaround -- keyboard is slower and doesn't sync otherwise - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, sm7238_state, write_keyboard_clock)) + PIT8253(config, m_t_hblank, 0); + m_t_hblank->set_clk<1>(16.384_MHz_XTAL/9); // XXX workaround -- keyboard is slower and doesn't sync otherwise + m_t_hblank->out_handler<1>().set(FUNC(sm7238_state::write_keyboard_clock)); - MCFG_DEVICE_ADD("t_vblank", PIT8253, 0) - MCFG_PIT8253_CLK2(16.5888_MHz_XTAL/9) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, sm7238_state, write_printer_clock)) + PIT8253(config, m_t_vblank, 0); + m_t_vblank->set_clk<2>(16.5888_MHz_XTAL/9); + m_t_vblank->out_handler<2>().set(FUNC(sm7238_state::write_printer_clock)); - MCFG_DEVICE_ADD("t_color", PIT8253, 0) + PIT8253(config, m_t_color, 0); - MCFG_DEVICE_ADD("t_iface", PIT8253, 0) - MCFG_PIT8253_CLK1(16.5888_MHz_XTAL/9) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("i8251line", i8251_device, write_txc)) - MCFG_PIT8253_CLK2(16.5888_MHz_XTAL/9) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("i8251line", i8251_device, write_rxc)) + PIT8253(config, m_t_iface, 0); + m_t_iface->set_clk<1>(16.5888_MHz_XTAL/9); + m_t_iface->out_handler<1>().set(m_i8251line, FUNC(i8251_device::write_txc)); + m_t_iface->set_clk<2>(16.5888_MHz_XTAL/9); + m_t_iface->out_handler<2>().set(m_i8251line, FUNC(i8251_device::write_rxc)); // serial connection to host I8251(config, m_i8251line, 0); diff --git a/src/mame/drivers/special.cpp b/src/mame/drivers/special.cpp index dced843e63e..677f90c8703 100644 --- a/src/mame/drivers/special.cpp +++ b/src/mame/drivers/special.cpp @@ -453,13 +453,13 @@ MACHINE_CONFIG_START(special_state::specimx) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) /* Devices */ - MCFG_DEVICE_ADD( "pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(2000000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("custom", specimx_sound_device, set_input_ch0)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("custom", specimx_sound_device, set_input_ch1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("custom", specimx_sound_device, set_input_ch2)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(2000000); + m_pit->out_handler<0>().set("custom", FUNC(specimx_sound_device::set_input_ch0)); + m_pit->set_clk<1>(2000000); + m_pit->out_handler<1>().set("custom", FUNC(specimx_sound_device::set_input_ch1)); + m_pit->set_clk<2>(2000000); + m_pit->out_handler<2>().set("custom", FUNC(specimx_sound_device::set_input_ch2)); m_ppi->in_pa_callback().set(FUNC(special_state::specialist_8255_porta_r)); m_ppi->out_pa_callback().set(FUNC(special_state::specialist_8255_porta_w)); diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp index 7aa830a52b3..926ccc43370 100644 --- a/src/mame/drivers/tandy2k.cpp +++ b/src/mame/drivers/tandy2k.cpp @@ -837,13 +837,13 @@ MACHINE_CONFIG_START(tandy2k_state::tandy2k) // TODO pin 15 external transmit clock // TODO pin 17 external receiver clock - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(16_MHz_XTAL / 16) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, tandy2k_state, outspkr_w)) - MCFG_PIT8253_CLK1(16_MHz_XTAL / 8) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, tandy2k_state, intbrclk_w)) - //MCFG_PIT8253_CLK2(16_MHz_XTAL / 8) - //MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, tandy2k_state, rfrqpulse_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(16_MHz_XTAL / 16); + m_pit->out_handler<0>().set(FUNC(tandy2k_state::outspkr_w)); + m_pit->set_clk<1>(16_MHz_XTAL / 8); + m_pit->out_handler<1>().set(FUNC(tandy2k_state::intbrclk_w)); + //m_pit->set_clk<2>(16_MHz_XTAL / 8); + //m_pit->out_handler<2>().set(FUNC(tandy2k_state::rfrqpulse_w)); MCFG_DEVICE_ADD(I8259A_0_TAG, PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE(I80186_TAG, i80186_cpu_device, int0_w)) diff --git a/src/mame/drivers/tdv2324.cpp b/src/mame/drivers/tdv2324.cpp index 55004c681f9..3864743ee6b 100644 --- a/src/mame/drivers/tdv2324.cpp +++ b/src/mame/drivers/tdv2324.cpp @@ -289,11 +289,11 @@ MACHINE_CONFIG_START(tdv2324_state::tdv2324) TMS9927(config, m_tms, 25.39836_MHz_XTAL / 8).set_char_width(8); // devices - MCFG_DEVICE_ADD(P8259A_TAG, PIC8259, 0) + PIC8259(config, m_pic, 0); - MCFG_DEVICE_ADD(P8253_5_0_TAG, PIT8253, 0) + PIT8253(config, m_pit0, 0); - MCFG_DEVICE_ADD(P8253_5_1_TAG, PIT8253, 0) + PIT8253(config, m_pit1, 0); Z80SIO2(config, MK3887N4_TAG, 8000000/2); diff --git a/src/mame/drivers/tiamc1.cpp b/src/mame/drivers/tiamc1.cpp index 20dcb203f5e..46cf544749b 100644 --- a/src/mame/drivers/tiamc1.cpp +++ b/src/mame/drivers/tiamc1.cpp @@ -372,10 +372,10 @@ MACHINE_CONFIG_START(tiamc1_state::kot) MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(PIXEL_CLOCK / 4) - MCFG_PIT8253_CLK2(SND_CLOCK) // guess - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, tiamc1_state, pit8253_2_w)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(PIXEL_CLOCK / 4); + pit8253.set_clk<2>(SND_CLOCK); // guess + pit8253.out_handler<2>().set(FUNC(tiamc1_state::pit8253_2_w)); MACHINE_CONFIG_END diff --git a/src/mame/drivers/vector06.cpp b/src/mame/drivers/vector06.cpp index 31a70bfdd08..2c3a529ea90 100644 --- a/src/mame/drivers/vector06.cpp +++ b/src/mame/drivers/vector06.cpp @@ -217,13 +217,13 @@ MACHINE_CONFIG_START(vector06_state::vector06) MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(1500000) - MCFG_PIT8253_CLK1(1500000) - MCFG_PIT8253_CLK2(1500000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, vector06_state, speaker_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, vector06_state, speaker_w)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, vector06_state, speaker_w)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(1500000); + m_pit8253->set_clk<1>(1500000); + m_pit8253->set_clk<2>(1500000); + m_pit8253->out_handler<0>().set(FUNC(vector06_state::speaker_w)); + m_pit8253->out_handler<1>().set(FUNC(vector06_state::speaker_w)); + m_pit8253->out_handler<2>().set(FUNC(vector06_state::speaker_w)); // optional MCFG_DEVICE_ADD("aysnd", AY8910, 1773400) diff --git a/src/mame/drivers/vertigo.cpp b/src/mame/drivers/vertigo.cpp index e86dd8999bc..1dd61368b7a 100644 --- a/src/mame/drivers/vertigo.cpp +++ b/src/mame/drivers/vertigo.cpp @@ -127,18 +127,18 @@ MACHINE_CONFIG_START(vertigo_state::vertigo) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(24_MHz_XTAL / 100) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, vertigo_state, v_irq4_w)) - MCFG_PIT8253_CLK1(24_MHz_XTAL / 100) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, vertigo_state, v_irq3_w)) - MCFG_PIT8253_CLK2(24_MHz_XTAL / 100) + pit8254_device &pit(PIT8254(config, "pit", 0)); + pit.set_clk<0>(24_MHz_XTAL / 100); + pit.out_handler<0>().set(FUNC(vertigo_state::v_irq4_w)); + pit.set_clk<1>(24_MHz_XTAL / 100); + pit.out_handler<1>().set(FUNC(vertigo_state::v_irq3_w)); + pit.set_clk<2>(24_MHz_XTAL / 100); TTL74148(config, m_ttl74148, 0); m_ttl74148->out_cb().set(FUNC(vertigo_state::update_irq)); /* motor controller */ - MCFG_DEVICE_ADD("motorcpu", M68705P3, 24_MHz_XTAL / 6) + M68705P3(config, "motorcpu", 24_MHz_XTAL / 6); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); diff --git a/src/mame/drivers/wacky_gator.cpp b/src/mame/drivers/wacky_gator.cpp index 158aa458af8..9b5939616f9 100644 --- a/src/mame/drivers/wacky_gator.cpp +++ b/src/mame/drivers/wacky_gator.cpp @@ -36,8 +36,7 @@ public: driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_msm(*this, "msm"), - m_pit8253_0(*this, "pit8253_0"), - m_pit8253_1(*this, "pit8253_1"), + m_pit8253(*this, "pit8253%u", 0U), m_ticket(*this, "ticket"), m_samples(*this, "oki"), m_alligator(*this, "alligator%u", 0U), @@ -78,8 +77,7 @@ private: required_device<cpu_device> m_maincpu; required_device<msm5205_device> m_msm; - required_device<pit8253_device> m_pit8253_0; - required_device<pit8253_device> m_pit8253_1; + required_device_array<pit8253_device, 2> m_pit8253; required_device<ticket_dispenser_device> m_ticket; required_memory_region m_samples; output_finder<5> m_alligator; @@ -126,11 +124,11 @@ WRITE8_MEMBER(wackygtr_state::sample_ctrl_w) WRITE8_MEMBER(wackygtr_state::alligators_ctrl1_w) { - m_pit8253_0->write_gate0(BIT(data, 0)); - m_pit8253_0->write_gate1(BIT(data, 1)); - m_pit8253_0->write_gate2(BIT(data, 2)); - m_pit8253_1->write_gate1(BIT(data, 3)); - m_pit8253_1->write_gate2(BIT(data, 4)); + m_pit8253[0]->write_gate0(BIT(data, 0)); + m_pit8253[0]->write_gate1(BIT(data, 1)); + m_pit8253[0]->write_gate2(BIT(data, 2)); + m_pit8253[1]->write_gate1(BIT(data, 3)); + m_pit8253[1]->write_gate2(BIT(data, 4)); machine().bookkeeping().coin_lockout_w(0, data & 0x40 ? 0 : 1); } @@ -272,8 +270,8 @@ void wackygtr_state::program_map(address_map &map) map(0x1000, 0x1001).w("ymsnd", FUNC(ym2413_device::write)); - map(0x2000, 0x2003).rw(m_pit8253_0, FUNC(pit8253_device::read), FUNC(pit8253_device::write)); - map(0x3000, 0x3003).rw(m_pit8253_1, FUNC(pit8253_device::read), FUNC(pit8253_device::write)); + map(0x2000, 0x2003).rw(m_pit8253[0], FUNC(pit8253_device::read), FUNC(pit8253_device::write)); + map(0x3000, 0x3003).rw(m_pit8253[1], FUNC(pit8253_device::read), FUNC(pit8253_device::write)); map(0x4000, 0x4003).rw("i8255_0", FUNC(i8255_device::read), FUNC(i8255_device::write)); map(0x5000, 0x5003).rw("i8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write)); @@ -319,21 +317,21 @@ MACHINE_CONFIG_START(wackygtr_state::wackygtr) ppi2.in_pb_callback().set_ioport("IN1"); ppi2.in_pc_callback().set_ioport("IN2"); - MCFG_DEVICE_ADD("pit8253_0", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(3'579'545)/16) // this is a guess - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, wackygtr_state, alligator_ck<0>)) - MCFG_PIT8253_CLK1(XTAL(3'579'545)/16) // this is a guess - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, wackygtr_state, alligator_ck<1>)) - MCFG_PIT8253_CLK2(XTAL(3'579'545)/16) // this is a guess - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, wackygtr_state, alligator_ck<2>)) - - MCFG_DEVICE_ADD("pit8253_1", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(3'579'545)/16) // this is a guess - MCFG_PIT8253_OUT0_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) - MCFG_PIT8253_CLK1(XTAL(3'579'545)/16) // this is a guess - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, wackygtr_state, alligator_ck<3>)) - MCFG_PIT8253_CLK2(XTAL(3'579'545)/16) // this is a guess - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, wackygtr_state, alligator_ck<4>)) + PIT8253(config, m_pit8253[0], 0); + m_pit8253[0]->set_clk<0>(XTAL(3'579'545)/16); // this is a guess + m_pit8253[0]->out_handler<0>().set(FUNC(wackygtr_state::alligator_ck<0>)); + m_pit8253[0]->set_clk<1>(XTAL(3'579'545)/16); // this is a guess + m_pit8253[0]->out_handler<1>().set(FUNC(wackygtr_state::alligator_ck<1>)); + m_pit8253[0]->set_clk<2>(XTAL(3'579'545)/16); // this is a guess + m_pit8253[0]->out_handler<2>().set(FUNC(wackygtr_state::alligator_ck<2>)); + + PIT8253(config, m_pit8253[1], 0); + m_pit8253[1]->set_clk<0>(XTAL(3'579'545)/16); // this is a guess + m_pit8253[1]->out_handler<0>().set_inputline(m_maincpu, M6809_FIRQ_LINE); + m_pit8253[1]->set_clk<1>(XTAL(3'579'545)/16); // this is a guess + m_pit8253[1]->out_handler<1>().set(FUNC(wackygtr_state::alligator_ck<3>)); + m_pit8253[1]->set_clk<2>(XTAL(3'579'545)/16); // this is a guess + m_pit8253[1]->out_handler<2>().set(FUNC(wackygtr_state::alligator_ck<4>)); MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH) MACHINE_CONFIG_END diff --git a/src/mame/machine/at.cpp b/src/mame/machine/at.cpp index 3554832896e..26d37c0b3b3 100644 --- a/src/mame/machine/at.cpp +++ b/src/mame/machine/at.cpp @@ -54,12 +54,12 @@ MACHINE_CONFIG_START(at_mb_device::at_softlists) MACHINE_CONFIG_END MACHINE_CONFIG_START(at_mb_device::device_add_mconfig) - MCFG_DEVICE_ADD("pit8254", PIT8254, 0) - MCFG_PIT8253_CLK0(4772720/4) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259_master", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(4772720/4) /* dram refresh */ - MCFG_PIT8253_CLK2(4772720/4) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, at_mb_device, pit8254_out2_changed)) + PIT8254(config, m_pit8254, 0); + m_pit8254->set_clk<0>(4772720/4); /* heartbeat IRQ */ + m_pit8254->out_handler<0>().set("pic8259_master", FUNC(pic8259_device::ir0_w)); + m_pit8254->set_clk<1>(4772720/4); /* dram refresh */ + m_pit8254->set_clk<2>(4772720/4); /* pio port c pin 4, and speaker polling enough */ + m_pit8254->out_handler<2>().set(FUNC(at_mb_device::pit8254_out2_changed)); AM9517A(config, m_dma8237_1, 14.318181_MHz_XTAL / 3); m_dma8237_1->out_hreq_callback().set(m_dma8237_2, FUNC(am9517a_device::dreq0_w)); @@ -151,7 +151,7 @@ void at_mb_device::map(address_map &map) { map(0x0000, 0x001f).rw("dma8237_1", FUNC(am9517a_device::read), FUNC(am9517a_device::write)).umask16(0xffff); map(0x0020, 0x003f).rw("pic8259_master", FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0xffff); - map(0x0040, 0x005f).rw("pit8254", FUNC(pit8254_device::read), FUNC(pit8254_device::write)).umask16(0xffff); + map(0x0040, 0x005f).rw(m_pit8254, FUNC(pit8254_device::read), FUNC(pit8254_device::write)).umask16(0xffff); map(0x0061, 0x0061).rw(FUNC(at_mb_device::portb_r), FUNC(at_mb_device::portb_w)); map(0x0060, 0x0060).rw("keybc", FUNC(at_keyboard_controller_device::data_r), FUNC(at_keyboard_controller_device::data_w)); map(0x0064, 0x0064).rw("keybc", FUNC(at_keyboard_controller_device::status_r), FUNC(at_keyboard_controller_device::command_w)); diff --git a/src/mame/machine/m24_z8000.cpp b/src/mame/machine/m24_z8000.cpp index 4e67d664736..1a89c3d9943 100644 --- a/src/mame/machine/m24_z8000.cpp +++ b/src/mame/machine/m24_z8000.cpp @@ -76,15 +76,15 @@ MACHINE_CONFIG_START(m24_z8000_device::device_add_mconfig) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(m24_z8000_device, int_cb) MCFG_Z8000_MO(WRITELINE(*this, m24_z8000_device, mo_w)) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(19660000/15) - MCFG_PIT8253_OUT0_HANDLER(NOOP) //8251 - MCFG_PIT8253_CLK1(19660000/15) - MCFG_PIT8253_OUT1_HANDLER(NOOP) - MCFG_PIT8253_CLK2(19660000/15) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, m24_z8000_device, timer_irq_w)) - - MCFG_DEVICE_ADD("i8251", I8251, 0) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(19660000/15); //8251 + pit8253.out_handler<0>().set_nop(); + pit8253.set_clk<1>(19660000/15); + pit8253.out_handler<1>().set_nop(); + pit8253.set_clk<2>(19660000/15); + pit8253.out_handler<2>().set(FUNC(m24_z8000_device::timer_irq_w)); + + I8251(config, "i8251", 0); MACHINE_CONFIG_END const uint8_t m24_z8000_device::pmem_table[16][4] = diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index 83fa5549c52..98dd0b323c0 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -950,12 +950,12 @@ MACHINE_CONFIG_START(xbox_base_state::xbox_base) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_1", pic8259_device, ir2_w)) MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) - MCFG_DEVICE_ADD("pit8254", PIT8254, 0) - MCFG_PIT8253_CLK0(1125000) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, xbox_base_state, xbox_pit8254_out0_changed)) - MCFG_PIT8253_CLK1(1125000) /* (unused) dram refresh */ - MCFG_PIT8253_CLK2(1125000) /* (unused) pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, xbox_base_state, xbox_pit8254_out2_changed)) + pit8254_device &pit8254(PIT8254(config, "pit8254", 0)); + pit8254.set_clk<0>(1125000); /* heartbeat IRQ */ + pit8254.out_handler<0>().set(FUNC(xbox_base_state::xbox_pit8254_out0_changed)); + pit8254.set_clk<1>(1125000); /* (unused) dram refresh */ + pit8254.set_clk<2>(1125000); /* (unused) pio port c pin 4, and speaker polling enough */ + pit8254.out_handler<2>().set(FUNC(xbox_base_state::xbox_pit8254_out2_changed)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) |