diff options
author | 2018-08-20 18:44:59 -0400 | |
---|---|---|
committer | 2018-08-20 18:44:59 -0400 | |
commit | 179e5b84f6ba50b0bd230ac25a68e54f57254d2e (patch) | |
tree | 802b8fc6f31c63684c6fa8af6521197b7a7b7bf8 | |
parent | 9065be185598c817ea544540ab13eb8e2c299c40 (diff) |
mos6551: Eliminate MCFG_ macros (nw)
a2232: Add input merger device to handle IRQs (nw)
superpet: 6809 type identification (nw)
27 files changed, 386 insertions, 613 deletions
diff --git a/src/devices/bus/a2bus/a2ssc.cpp b/src/devices/bus/a2bus/a2ssc.cpp index da5fa5ce49f..0261835e1d7 100644 --- a/src/devices/bus/a2bus/a2ssc.cpp +++ b/src/devices/bus/a2bus/a2ssc.cpp @@ -96,18 +96,19 @@ ioport_constructor a2bus_ssc_device::device_input_ports() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(a2bus_ssc_device::device_add_mconfig) - MCFG_DEVICE_ADD(SSC_ACIA_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2bus_ssc_device, acia_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(SSC_RS232_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(SSC_RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(SSC_ACIA_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(SSC_ACIA_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(SSC_ACIA_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(SSC_ACIA_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END +void a2bus_ssc_device::device_add_mconfig(machine_config &config) +{ + MOS6551(config, m_acia, 0); + m_acia->set_xtal(1.8432_MHz_XTAL); + m_acia->irq_handler().set(FUNC(a2bus_ssc_device::acia_irq_w)); + m_acia->txd_handler().set(SSC_RS232_TAG, FUNC(rs232_port_device::write_txd)); + + rs232_port_device &rs232(RS232_PORT(config, SSC_RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); +} //------------------------------------------------- // rom_region - device-specific ROM region diff --git a/src/devices/bus/amiga/zorro/a2232.cpp b/src/devices/bus/amiga/zorro/a2232.cpp index bf4e33b74fe..41334067412 100644 --- a/src/devices/bus/amiga/zorro/a2232.cpp +++ b/src/devices/bus/amiga/zorro/a2232.cpp @@ -30,113 +30,83 @@ DEFINE_DEVICE_TYPE(A2232, a2232_device, "a2232", "CBM A2232 Serial Card") // device_add_mconfig - add device configuration //------------------------------------------------- -void a2232_device::iocpu_map(address_map &map) +void a2232_device::device_add_mconfig(machine_config &config) { - map(0x0000, 0x3fff).ram().share("shared"); - map(0x4000, 0x47ff).rw(FUNC(a2232_device::acia_0_r), FUNC(a2232_device::acia_0_w)); - map(0x4800, 0x4fff).rw(FUNC(a2232_device::acia_1_r), FUNC(a2232_device::acia_1_w)); - map(0x5000, 0x57ff).rw(FUNC(a2232_device::acia_2_r), FUNC(a2232_device::acia_2_w)); - map(0x5800, 0x5fff).rw(FUNC(a2232_device::acia_3_r), FUNC(a2232_device::acia_3_w)); - map(0x6000, 0x67ff).rw(FUNC(a2232_device::acia_4_r), FUNC(a2232_device::acia_4_w)); - map(0x6800, 0x6fff).rw(FUNC(a2232_device::acia_5_r), FUNC(a2232_device::acia_5_w)); - map(0x7000, 0x73ff).w(FUNC(a2232_device::int2_w)); - map(0x7400, 0x77ff).rw(FUNC(a2232_device::acia_6_r), FUNC(a2232_device::acia_6_w)); - map(0x7800, 0x7fff).rw(FUNC(a2232_device::cia_r), FUNC(a2232_device::cia_w)); - map(0x8000, 0x8000).w(FUNC(a2232_device::irq_ack8_w)); - map(0xc000, 0xffff).ram().share("shared"); -} - -MACHINE_CONFIG_START(a2232_device::device_add_mconfig) // main cpu - MCFG_DEVICE_ADD("iocpu", M65CE02, XTAL(28'375'160) / 8) // should run at Amiga clock 7M / 2 - MCFG_DEVICE_PROGRAM_MAP(iocpu_map) + M65CE02(config, m_iocpu, 28.37516_MHz_XTAL / 8); // should run at Amiga clock 7M / 2 + m_iocpu->set_addrmap(AS_PROGRAM, &a2232_device::iocpu_map); + + INPUT_MERGER_ANY_HIGH(config, m_ioirq); + m_ioirq->output_handler().set_inputline(m_iocpu, m65ce02_device::IRQ_LINE); // acia - MCFG_DEVICE_ADD("acia_0", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_1", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_0_irq_w)) - - MCFG_DEVICE_ADD("acia_1", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_2", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_1_irq_w)) - - MCFG_DEVICE_ADD("acia_2", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_3", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_2_irq_w)) - - MCFG_DEVICE_ADD("acia_3", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_4", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_3_irq_w)) - - MCFG_DEVICE_ADD("acia_4", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_5", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_4_irq_w)) - - MCFG_DEVICE_ADD("acia_5", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_6", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_5_irq_w)) - - MCFG_DEVICE_ADD("acia_6", MOS6551, XTAL(28'375'160) / 8) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232_7", rs232_port_device, write_txd)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, a2232_device, acia_6_irq_w)) + for (auto &acia : m_acia) + MOS6551(config, acia, 28.37516_MHz_XTAL / 8).set_xtal(1.8432_MHz_XTAL); + m_acia[0]->txd_handler().set("rs232_1", FUNC(rs232_port_device::write_txd)); + m_acia[0]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<0>)); + m_acia[1]->txd_handler().set("rs232_2", FUNC(rs232_port_device::write_txd)); + m_acia[1]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<1>)); + m_acia[2]->txd_handler().set("rs232_3", FUNC(rs232_port_device::write_txd)); + m_acia[2]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<2>)); + m_acia[3]->txd_handler().set("rs232_4", FUNC(rs232_port_device::write_txd)); + m_acia[3]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<3>)); + m_acia[4]->txd_handler().set("rs232_5", FUNC(rs232_port_device::write_txd)); + m_acia[4]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<4>)); + m_acia[5]->txd_handler().set("rs232_6", FUNC(rs232_port_device::write_txd)); + m_acia[5]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<5>)); + m_acia[6]->txd_handler().set("rs232_7", FUNC(rs232_port_device::write_txd)); + m_acia[6]->irq_handler().set(m_ioirq, FUNC(input_merger_device::in_w<6>)); // cia - MCFG_DEVICE_ADD("cia", MOS8520, XTAL(1'843'200)) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, a2232_device, cia_irq_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, a2232_device, cia_port_a_r)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(*this, a2232_device, cia_port_b_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(*this, a2232_device, cia_port_b_w)) + MOS8520(config, m_cia, 1.8432_MHz_XTAL); + m_cia->irq_wr_callback().set(m_ioirq, FUNC(input_merger_device::in_w<7>)); + m_cia->pa_rd_callback().set(FUNC(a2232_device::cia_port_a_r)); + m_cia->pb_rd_callback().set(FUNC(a2232_device::cia_port_b_r)); + m_cia->pb_wr_callback().set(FUNC(a2232_device::cia_port_b_w)); // rs232 ports - MCFG_DEVICE_ADD("rs232_1", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(*this, a2232_device, rs232_1_rxd_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_1_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_0", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_1_cts_w)) - - MCFG_DEVICE_ADD("rs232_2", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia_1", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_2_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_1", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_2_cts_w)) - - MCFG_DEVICE_ADD("rs232_3", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia_2", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_3_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_2", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_3_cts_w)) - - MCFG_DEVICE_ADD("rs232_4", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia_3", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_4_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_3", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_4_cts_w)) - - MCFG_DEVICE_ADD("rs232_5", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia_4", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_5_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_4", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_5_cts_w)) - - MCFG_DEVICE_ADD("rs232_6", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia_5", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_6_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_5", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_6_cts_w)) - - MCFG_DEVICE_ADD("rs232_7", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia_6", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(*this, a2232_device, rs232_7_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia_6", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(*this, a2232_device, rs232_7_cts_w)) -MACHINE_CONFIG_END + rs232_port_device &rs232_1(RS232_PORT(config, "rs232_1", default_rs232_devices, nullptr)); + rs232_1.rxd_handler().set(FUNC(a2232_device::rs232_1_rxd_w)); + rs232_1.dcd_handler().set(FUNC(a2232_device::rs232_1_dcd_w)); + rs232_1.dsr_handler().set(m_acia[0], FUNC(mos6551_device::write_dsr)); + rs232_1.cts_handler().set(FUNC(a2232_device::rs232_1_cts_w)); + + rs232_port_device &rs232_2(RS232_PORT(config, "rs232_2", default_rs232_devices, nullptr)); + rs232_2.rxd_handler().set(m_acia[1], FUNC(mos6551_device::write_rxd)); + rs232_2.dcd_handler().set(FUNC(a2232_device::rs232_2_dcd_w)); + rs232_2.dsr_handler().set(m_acia[1], FUNC(mos6551_device::write_dsr)); + rs232_2.cts_handler().set(FUNC(a2232_device::rs232_2_cts_w)); + + rs232_port_device &rs232_3(RS232_PORT(config, "rs232_3", default_rs232_devices, nullptr)); + rs232_3.rxd_handler().set(m_acia[2], FUNC(mos6551_device::write_rxd)); + rs232_3.dcd_handler().set(FUNC(a2232_device::rs232_3_dcd_w)); + rs232_3.dsr_handler().set(m_acia[2], FUNC(mos6551_device::write_dsr)); + rs232_3.cts_handler().set(FUNC(a2232_device::rs232_3_cts_w)); + + rs232_port_device &rs232_4(RS232_PORT(config, "rs232_4", default_rs232_devices, nullptr)); + rs232_4.rxd_handler().set(m_acia[3], FUNC(mos6551_device::write_rxd)); + rs232_4.dcd_handler().set(FUNC(a2232_device::rs232_4_dcd_w)); + rs232_4.dsr_handler().set(m_acia[3], FUNC(mos6551_device::write_dsr)); + rs232_4.cts_handler().set(FUNC(a2232_device::rs232_4_cts_w)); + + rs232_port_device &rs232_5(RS232_PORT(config, "rs232_5", default_rs232_devices, nullptr)); + rs232_5.rxd_handler().set(m_acia[4], FUNC(mos6551_device::write_rxd)); + rs232_5.dcd_handler().set(FUNC(a2232_device::rs232_5_dcd_w)); + rs232_5.dsr_handler().set(m_acia[4], FUNC(mos6551_device::write_dsr)); + rs232_5.cts_handler().set(FUNC(a2232_device::rs232_5_cts_w)); + + rs232_port_device &rs232_6(RS232_PORT(config, "rs232_6", default_rs232_devices, nullptr)); + rs232_6.rxd_handler().set(m_acia[5], FUNC(mos6551_device::write_rxd)); + rs232_6.dcd_handler().set(FUNC(a2232_device::rs232_6_dcd_w)); + rs232_6.dsr_handler().set(m_acia[5], FUNC(mos6551_device::write_dsr)); + rs232_6.cts_handler().set(FUNC(a2232_device::rs232_6_cts_w)); + + rs232_port_device &rs232_7(RS232_PORT(config, "rs232_7", default_rs232_devices, nullptr)); + rs232_7.rxd_handler().set(m_acia[6], FUNC(mos6551_device::write_rxd)); + rs232_7.dcd_handler().set(FUNC(a2232_device::rs232_7_dcd_w)); + rs232_7.dsr_handler().set(m_acia[6], FUNC(mos6551_device::write_dsr)); + rs232_7.cts_handler().set(FUNC(a2232_device::rs232_7_cts_w)); +} //************************************************************************** @@ -151,13 +121,8 @@ a2232_device::a2232_device(const machine_config &mconfig, const char *tag, devic device_t(mconfig, A2232, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_iocpu(*this, "iocpu"), - m_acia_0(*this, "acia_0"), - m_acia_1(*this, "acia_1"), - m_acia_2(*this, "acia_2"), - m_acia_3(*this, "acia_3"), - m_acia_4(*this, "acia_4"), - m_acia_5(*this, "acia_5"), - m_acia_6(*this, "acia_6"), + m_ioirq(*this, "ioirq"), + m_acia(*this, "acia_%u", 0U), m_cia(*this, "cia"), m_shared_ram(*this, "shared"), m_cia_port_a(0xff), @@ -172,7 +137,6 @@ a2232_device::a2232_device(const machine_config &mconfig, const char *tag, devic void a2232_device::device_start() { set_zorro_device(); - memset(m_irqs, 0, sizeof(m_irqs)); } //------------------------------------------------- @@ -185,13 +149,8 @@ void a2232_device::device_reset_after_children() m_iocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // cts connected to gnd - m_acia_0->write_cts(0); - m_acia_1->write_cts(0); - m_acia_2->write_cts(0); - m_acia_3->write_cts(0); - m_acia_4->write_cts(0); - m_acia_5->write_cts(0); - m_acia_6->write_cts(0); + for (auto &acia : m_acia) + acia->write_cts(0); } @@ -199,22 +158,6 @@ void a2232_device::device_reset_after_children() // IMPLEMENTATION //************************************************************************** -void a2232_device::update_irqs() -{ - // look for any active irq - for (auto & elem : m_irqs) - { - if (elem) - { - m_iocpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); - return; - } - } - - // if we get here no irqs are pending - m_iocpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -} - WRITE8_MEMBER( a2232_device::int2_w ) { if (VERBOSE) @@ -228,8 +171,7 @@ WRITE8_MEMBER( a2232_device::irq_ack8_w ) if (VERBOSE) logerror("%s('%s'): irq_ack_w %04x\n", shortname(), basetag(), data); - m_irqs[IRQ_AMIGA] = CLEAR_LINE; - update_irqs(); + m_ioirq->in_w<8>(CLEAR_LINE); } @@ -363,16 +305,15 @@ WRITE16_MEMBER( a2232_device::reset_low_w ) READ16_MEMBER( a2232_device::irq_r ) { - m_irqs[IRQ_AMIGA] = ASSERT_LINE; - update_irqs(); + if (!machine().side_effects_disabled()) + m_ioirq->in_w<8>(ASSERT_LINE); return 0xffff; } WRITE16_MEMBER( a2232_device::irq_w ) { - m_irqs[IRQ_AMIGA] = ASSERT_LINE; - update_irqs(); + m_ioirq->in_w<8>(ASSERT_LINE); } READ16_MEMBER( a2232_device::reset_high_r ) @@ -400,116 +341,16 @@ WRITE16_MEMBER( a2232_device::reset_high_w ) // ACIA //************************************************************************** -READ8_MEMBER( a2232_device::acia_0_r ) -{ - return m_acia_0->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_0_w ) -{ - m_acia_0->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_0_irq_w ) +template<int N> +READ8_MEMBER( a2232_device::acia_r ) { - m_irqs[IRQ_ACIA_0] = state; - update_irqs(); + return m_acia[N]->read(space, offset >> 1); } -READ8_MEMBER( a2232_device::acia_1_r ) +template<int N> +WRITE8_MEMBER( a2232_device::acia_w ) { - return m_acia_1->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_1_w ) -{ - m_acia_1->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_1_irq_w ) -{ - m_irqs[IRQ_ACIA_1] = state; - update_irqs(); -} - -READ8_MEMBER( a2232_device::acia_2_r ) -{ - return m_acia_2->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_2_w ) -{ - m_acia_2->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_2_irq_w ) -{ - m_irqs[IRQ_ACIA_2] = state; - update_irqs(); -} - -READ8_MEMBER( a2232_device::acia_3_r ) -{ - return m_acia_3->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_3_w ) -{ - m_acia_3->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_3_irq_w ) -{ - m_irqs[IRQ_ACIA_3] = state; - update_irqs(); -} - -READ8_MEMBER( a2232_device::acia_4_r ) -{ - return m_acia_4->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_4_w ) -{ - m_acia_4->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_4_irq_w ) -{ - m_irqs[IRQ_ACIA_4] = state; - update_irqs(); -} - -READ8_MEMBER( a2232_device::acia_5_r ) -{ - return m_acia_5->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_5_w ) -{ - m_acia_5->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_5_irq_w ) -{ - m_irqs[IRQ_ACIA_5] = state; - update_irqs(); -} - -READ8_MEMBER( a2232_device::acia_6_r ) -{ - return m_acia_6->read(space, offset >> 1); -} - -WRITE8_MEMBER( a2232_device::acia_6_w ) -{ - m_acia_6->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( a2232_device::acia_6_irq_w ) -{ - m_irqs[IRQ_ACIA_6] = state; - update_irqs(); + m_acia[N]->write(space, offset >> 1, data); } @@ -527,12 +368,6 @@ WRITE8_MEMBER( a2232_device::cia_w ) m_cia->write(space, offset >> 1, data); } -WRITE_LINE_MEMBER( a2232_device::cia_irq_w ) -{ - m_irqs[IRQ_CIA] = state; - update_irqs(); -} - READ8_MEMBER( a2232_device::cia_port_a_r ) { return m_cia_port_a; @@ -556,7 +391,7 @@ WRITE8_MEMBER( a2232_device::cia_port_b_w ) WRITE_LINE_MEMBER( a2232_device::rs232_1_rxd_w ) { - m_acia_0->write_rxd(state); + m_acia[0]->write_rxd(state); m_cia->sp_w(state); } @@ -645,3 +480,21 @@ WRITE_LINE_MEMBER( a2232_device::rs232_7_cts_w ) m_cia_port_b &= ~0x40; m_cia_port_b |= state << 6; } + + + +void a2232_device::iocpu_map(address_map &map) +{ + map(0x0000, 0x3fff).ram().share("shared"); + map(0x4000, 0x47ff).rw(FUNC(a2232_device::acia_r<0>), FUNC(a2232_device::acia_w<0>)); + map(0x4800, 0x4fff).rw(FUNC(a2232_device::acia_r<1>), FUNC(a2232_device::acia_w<1>)); + map(0x5000, 0x57ff).rw(FUNC(a2232_device::acia_r<2>), FUNC(a2232_device::acia_w<2>)); + map(0x5800, 0x5fff).rw(FUNC(a2232_device::acia_r<3>), FUNC(a2232_device::acia_w<3>)); + map(0x6000, 0x67ff).rw(FUNC(a2232_device::acia_r<4>), FUNC(a2232_device::acia_w<4>)); + map(0x6800, 0x6fff).rw(FUNC(a2232_device::acia_r<5>), FUNC(a2232_device::acia_w<5>)); + map(0x7000, 0x73ff).w(FUNC(a2232_device::int2_w)); + map(0x7400, 0x77ff).rw(FUNC(a2232_device::acia_r<6>), FUNC(a2232_device::acia_w<6>)); + map(0x7800, 0x7fff).rw(FUNC(a2232_device::cia_r), FUNC(a2232_device::cia_w)); + map(0x8000, 0x8000).w(FUNC(a2232_device::irq_ack8_w)); + map(0xc000, 0xffff).ram().share("shared"); +} diff --git a/src/devices/bus/amiga/zorro/a2232.h b/src/devices/bus/amiga/zorro/a2232.h index efa6199aebf..31a0c368071 100644 --- a/src/devices/bus/amiga/zorro/a2232.h +++ b/src/devices/bus/amiga/zorro/a2232.h @@ -18,6 +18,7 @@ #include "zorro.h" #include "machine/autoconfig.h" #include "cpu/m6502/m65ce02.h" +#include "machine/input_merger.h" #include "machine/mos6551.h" #include "machine/mos6526.h" #include "bus/rs232/rs232.h" @@ -61,51 +62,15 @@ protected: virtual void autoconfig_base_address(offs_t address) override; private: - enum - { - IRQ_ACIA_0, - IRQ_ACIA_1, - IRQ_ACIA_2, - IRQ_ACIA_3, - IRQ_ACIA_4, - IRQ_ACIA_5, - IRQ_ACIA_6, - IRQ_CIA, - IRQ_AMIGA, - IRQ_SOURCE_COUNT - }; - - void update_irqs(); - // cpu WRITE8_MEMBER( int2_w ); WRITE8_MEMBER( irq_ack8_w ); // acia - DECLARE_WRITE_LINE_MEMBER( acia_0_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_2_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_3_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_4_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_5_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_6_irq_w ); - DECLARE_READ8_MEMBER( acia_0_r ); - DECLARE_WRITE8_MEMBER( acia_0_w ); - DECLARE_READ8_MEMBER( acia_1_r ); - DECLARE_WRITE8_MEMBER( acia_1_w ); - DECLARE_READ8_MEMBER( acia_2_r ); - DECLARE_WRITE8_MEMBER( acia_2_w ); - DECLARE_READ8_MEMBER( acia_3_r ); - DECLARE_WRITE8_MEMBER( acia_3_w ); - DECLARE_READ8_MEMBER( acia_4_r ); - DECLARE_WRITE8_MEMBER( acia_4_w ); - DECLARE_READ8_MEMBER( acia_5_r ); - DECLARE_WRITE8_MEMBER( acia_5_w ); - DECLARE_READ8_MEMBER( acia_6_r ); - DECLARE_WRITE8_MEMBER( acia_6_w ); + template<int N> DECLARE_READ8_MEMBER( acia_r ); + template<int N> DECLARE_WRITE8_MEMBER( acia_w ); // cia - DECLARE_WRITE_LINE_MEMBER( cia_irq_w ); DECLARE_READ8_MEMBER( cia_port_a_r ); DECLARE_READ8_MEMBER( cia_port_b_r ); DECLARE_WRITE8_MEMBER( cia_port_b_w ); @@ -130,18 +95,11 @@ private: DECLARE_WRITE_LINE_MEMBER( rs232_7_cts_w ); required_device<m65ce02_device> m_iocpu; - required_device<mos6551_device> m_acia_0; - required_device<mos6551_device> m_acia_1; - required_device<mos6551_device> m_acia_2; - required_device<mos6551_device> m_acia_3; - required_device<mos6551_device> m_acia_4; - required_device<mos6551_device> m_acia_5; - required_device<mos6551_device> m_acia_6; + required_device<input_merger_device> m_ioirq; + required_device_array<mos6551_device, 7> m_acia; required_device<mos8520_device> m_cia; required_shared_ptr<uint8_t> m_shared_ram; - int m_irqs[IRQ_SOURCE_COUNT]; - uint8_t m_cia_port_a; uint8_t m_cia_port_b; }; diff --git a/src/devices/bus/c64/swiftlink.cpp b/src/devices/bus/c64/swiftlink.cpp index b4a3f5658a1..3f807fb13dc 100644 --- a/src/devices/bus/c64/swiftlink.cpp +++ b/src/devices/bus/c64/swiftlink.cpp @@ -38,18 +38,19 @@ DEFINE_DEVICE_TYPE(C64_SWIFTLINK, c64_swiftlink_cartridge_device, "c64_swiftlink // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(c64_swiftlink_cartridge_device::device_add_mconfig) - MCFG_DEVICE_ADD(MOS6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(3'686'400)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, c64_swiftlink_cartridge_device, acia_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END +void c64_swiftlink_cartridge_device::device_add_mconfig(machine_config &config) +{ + MOS6551(config, m_acia, 0); + m_acia->set_xtal(3.6864_MHz_XTAL); + m_acia->irq_handler().set(FUNC(c64_swiftlink_cartridge_device::acia_irq_w)); + m_acia->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); + + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); +} //------------------------------------------------- diff --git a/src/devices/bus/c64/turbo232.cpp b/src/devices/bus/c64/turbo232.cpp index fb6d84a24c8..4c6e5f1ebdb 100644 --- a/src/devices/bus/c64/turbo232.cpp +++ b/src/devices/bus/c64/turbo232.cpp @@ -37,18 +37,19 @@ DEFINE_DEVICE_TYPE(C64_TURBO232, c64_turbo232_cartridge_device, "c64_turbo232", // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(c64_turbo232_cartridge_device::device_add_mconfig) - MCFG_DEVICE_ADD(MOS6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(3'686'400)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, c64_turbo232_cartridge_device, acia_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END +void c64_turbo232_cartridge_device::device_add_mconfig(machine_config &config) +{ + MOS6551(config, m_acia, 0); + m_acia->set_xtal(3.6864_MHz_XTAL); + m_acia->irq_handler().set(FUNC(c64_turbo232_cartridge_device::acia_irq_w)); + m_acia->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); + + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); +} //------------------------------------------------- diff --git a/src/devices/bus/coco/coco_dcmodem.cpp b/src/devices/bus/coco/coco_dcmodem.cpp index d1555215922..cad760775b7 100644 --- a/src/devices/bus/coco/coco_dcmodem.cpp +++ b/src/devices/bus/coco/coco_dcmodem.cpp @@ -81,18 +81,19 @@ namespace IMPLEMENTATION ***************************************************************************/ -MACHINE_CONFIG_START(coco_dc_modem_device::device_add_mconfig) - MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, coco_dc_modem_device, uart_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(PORT_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(PORT_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END +void coco_dc_modem_device::device_add_mconfig(machine_config &config) +{ + MOS6551(config, m_uart, 0); + m_uart->set_xtal(1.8432_MHz_XTAL); + m_uart->irq_handler().set(FUNC(coco_dc_modem_device::uart_irq_w)); + m_uart->txd_handler().set(PORT_TAG, FUNC(rs232_port_device::write_txd)); + + rs232_port_device &rs232(RS232_PORT(config, PORT_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_uart, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_uart, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_uart, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_uart, FUNC(mos6551_device::write_cts)); +} ROM_START(coco_dcmodem) diff --git a/src/devices/bus/coco/coco_rs232.cpp b/src/devices/bus/coco/coco_rs232.cpp index 774ab1a98ff..802d46251ad 100644 --- a/src/devices/bus/coco/coco_rs232.cpp +++ b/src/devices/bus/coco/coco_rs232.cpp @@ -79,19 +79,19 @@ namespace IMPLEMENTATION ***************************************************************************/ -MACHINE_CONFIG_START(coco_rs232_device::device_add_mconfig) - MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, coco_rs232_device, uart_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(PORT_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(PORT_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(UART_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END +void coco_rs232_device::device_add_mconfig(machine_config &config) +{ + MOS6551(config, m_uart, 0); + m_uart->set_xtal(1.8432_MHz_XTAL); + m_uart->irq_handler().set(FUNC(coco_rs232_device::uart_irq_w)); + m_uart->txd_handler().set(PORT_TAG, FUNC(rs232_port_device::write_txd)); + + rs232_port_device &rs232(RS232_PORT(config, PORT_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_uart, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_uart, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_uart, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_uart, FUNC(mos6551_device::write_cts)); +} ROM_START(coco_rs232_device) ROM_REGION(0x1000, "eprom", ROMREGION_ERASE00) diff --git a/src/devices/bus/pet/superpet.cpp b/src/devices/bus/pet/superpet.cpp index a4e6855a85a..1aa3ed05014 100644 --- a/src/devices/bus/pet/superpet.cpp +++ b/src/devices/bus/pet/superpet.cpp @@ -70,23 +70,24 @@ void superpet_device::superpet_mem(address_map &map) // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(superpet_device::device_add_mconfig) - MCFG_DEVICE_ADD(M6809_TAG, M6809, XTAL(16'000'000)/16) - MCFG_DEVICE_PROGRAM_MAP(superpet_mem) - - MCFG_MOS6702_ADD(MOS6702_TAG, XTAL(16'000'000)/16) - - MCFG_DEVICE_ADD(MOS6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, superpet_device, acia_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MOS6551_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END +void superpet_device::device_add_mconfig(machine_config &config) +{ + MC6809E(config, m_maincpu, 16_MHz_XTAL / 16); + m_maincpu->set_addrmap(AS_PROGRAM, &superpet_device::superpet_mem); + + MOS6702(config, m_dongle, 16_MHz_XTAL / 16); + + MOS6551(config, m_acia, 0); + m_acia->set_xtal(1.8432_MHz_XTAL); + m_acia->irq_handler().set(FUNC(superpet_device::acia_irq_w)); + m_acia->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); + + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); +} //------------------------------------------------- diff --git a/src/devices/machine/mos6551.h b/src/devices/machine/mos6551.h index 319f00e803d..626c17fd0b2 100644 --- a/src/devices/machine/mos6551.h +++ b/src/devices/machine/mos6551.h @@ -30,34 +30,11 @@ #include "machine/clock.h" -#define MCFG_MOS6551_XTAL(_xtal) \ - downcast<mos6551_device &>(*device).set_xtal(_xtal); - -#define MCFG_MOS6551_IRQ_HANDLER(_devcb) \ - downcast<mos6551_device &>(*device).set_irq_handler(DEVCB_##_devcb); - -#define MCFG_MOS6551_TXD_HANDLER(_devcb) \ - downcast<mos6551_device &>(*device).set_txd_handler(DEVCB_##_devcb); - -#define MCFG_MOS6551_RXC_HANDLER(_devcb) \ - downcast<mos6551_device &>(*device).set_rxc_handler(DEVCB_##_devcb); - -#define MCFG_MOS6551_RTS_HANDLER(_devcb) \ - downcast<mos6551_device &>(*device).set_rts_handler(DEVCB_##_devcb); - -#define MCFG_MOS6551_DTR_HANDLER(_devcb) \ - downcast<mos6551_device &>(*device).set_dtr_handler(DEVCB_##_devcb); - class mos6551_device : public device_t { public: mos6551_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_txd_handler(Object &&cb) { return m_txd_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_rxc_handler(Object &&cb) { return m_rxc_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_rts_handler(Object &&cb) { return m_rts_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_dtr_handler(Object &&cb) { return m_dtr_handler.set_callback(std::forward<Object>(cb)); } auto irq_handler() { return m_irq_handler.bind(); } auto txd_handler() { return m_txd_handler.bind(); } auto rxc_handler() { return m_rxc_handler.bind(); } diff --git a/src/mame/drivers/aim65_40.cpp b/src/mame/drivers/aim65_40.cpp index 43a94f841fb..00a9bdee5be 100644 --- a/src/mame/drivers/aim65_40.cpp +++ b/src/mame/drivers/aim65_40.cpp @@ -79,7 +79,7 @@ public: void aim65_40(machine_config &config); private: - void aim65_40_mem(address_map &map); + void mem_map(address_map &map); // devices //device_t *m_via0; //device_t *m_via1; @@ -93,7 +93,7 @@ private: ADDRESS MAPS ***************************************************************************/ -void aim65_40_state::aim65_40_mem(address_map &map) +void aim65_40_state::mem_map(address_map &map) { map(0x0000, 0x3fff).ram(); map(0xa000, 0xcfff).rom().region("roms", 0); @@ -116,10 +116,11 @@ INPUT_PORTS_END MACHINE DRIVERS ***************************************************************************/ -MACHINE_CONFIG_START(aim65_40_state::aim65_40) +void aim65_40_state::aim65_40(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD(M6502_TAG, M6502, 1000000) - MCFG_DEVICE_PROGRAM_MAP(aim65_40_mem) + m6502_device &cpu(M6502(config, M6502_TAG, 1000000)); + cpu.set_addrmap(AS_PROGRAM, &aim65_40_state::mem_map); /* video hardware */ config.set_default_layout(layout_aim65_40); @@ -127,21 +128,22 @@ MACHINE_CONFIG_START(aim65_40_state::aim65_40) /* sound hardware */ /* devices */ - MCFG_DEVICE_ADD(M6522_0_TAG, VIA6522, 1000000) - MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, 1000000) - MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, 1000000) - MCFG_DEVICE_ADD(M6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MOS6551_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE(M6551_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(M6551_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(M6551_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(M6551_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END + VIA6522(config, M6522_0_TAG, 1000000); + VIA6522(config, M6522_1_TAG, 1000000); + VIA6522(config, M6522_2_TAG, 1000000); + + mos6551_device &acia(MOS6551(config, M6551_TAG, 0)); + acia.set_xtal(1.8432_MHz_XTAL); + acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + acia.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + acia.dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set(M6551_TAG, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(M6551_TAG, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(M6551_TAG, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(M6551_TAG, FUNC(mos6551_device::write_cts)); +} /*************************************************************************** ROM DEFINITIONS diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index bf141a7cc99..47df7c50b2e 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -4134,25 +4134,25 @@ MACHINE_CONFIG_START(apple2e_state::apple2c) MCFG_DEVICE_REMOVE("sl6") MCFG_DEVICE_REMOVE("sl7") - MCFG_DEVICE_ADD(IIC_ACIA1_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(14'318'181) / 8) // ~1.789 MHz - MCFG_MOS6551_TXD_HANDLER(WRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(IIC_ACIA2_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) // matches SSC so modem software is compatible - MCFG_MOS6551_TXD_HANDLER(WRITELINE("modem", rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(PRINTER_PORT_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(IIC_ACIA1_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(IIC_ACIA1_TAG, mos6551_device, write_cts)) - - MCFG_DEVICE_ADD(MODEM_PORT_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(IIC_ACIA2_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(IIC_ACIA2_TAG, mos6551_device, write_cts)) + MOS6551(config, m_acia1, 0); + m_acia1->set_xtal(XTAL(14'318'181) / 8); // ~1.789 MHz + m_acia1->txd_handler().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_txd)); + + MOS6551(config, m_acia2, 0); + m_acia2->set_xtal(XTAL(1'843'200)); // matches SSC so modem software is compatible + m_acia2->txd_handler().set("modem", FUNC(rs232_port_device::write_txd)); + + rs232_port_device &printer(RS232_PORT(config, PRINTER_PORT_TAG, default_rs232_devices, nullptr)); + printer.rxd_handler().set(m_acia1, FUNC(mos6551_device::write_rxd)); + printer.dcd_handler().set(m_acia1, FUNC(mos6551_device::write_dcd)); + printer.dsr_handler().set(m_acia1, FUNC(mos6551_device::write_dsr)); + printer.cts_handler().set(m_acia1, FUNC(mos6551_device::write_cts)); + + rs232_port_device &modem(RS232_PORT(config, MODEM_PORT_TAG, default_rs232_devices, nullptr)); + modem.rxd_handler().set(m_acia2, FUNC(mos6551_device::write_rxd)); + modem.dcd_handler().set(m_acia2, FUNC(mos6551_device::write_dcd)); + modem.dsr_handler().set(m_acia2, FUNC(mos6551_device::write_dsr)); + modem.cts_handler().set(m_acia2, FUNC(mos6551_device::write_cts)); // TODO: populate the IIc's other virtual slots with ONBOARD_ADD A2BUS_MOCKINGBOARD(config, "sl4", A2BUS_7M_CLOCK).set_onboard(m_a2bus); // Mockingboard 4C diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp index 3097aa1fd67..a269635cb87 100644 --- a/src/mame/drivers/cbm2.cpp +++ b/src/mame/drivers/cbm2.cpp @@ -2294,13 +2294,13 @@ MACHINE_CONFIG_START(p500_state::p500_ntsc) m_tpi2->in_pc_cb().set(FUNC(p500_state::tpi2_pc_r)); m_tpi2->out_pc_cb().set(FUNC(p500_state::tpi2_pc_w)); - MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, VIC6567_CLOCK) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_MOS6551_DTR_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_MOS6551_RXC_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_etc)) + MOS6551(config, m_acia, VIC6567_CLOCK); + m_acia->set_xtal(XTAL(1'843'200)); + m_acia->irq_handler().set(m_tpi1, FUNC(tpi6525_device::i4_w)); + m_acia->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); + m_acia->dtr_handler().set(RS232_TAG, FUNC(rs232_port_device::write_dtr)); + m_acia->rts_handler().set(RS232_TAG, FUNC(rs232_port_device::write_rts)); + m_acia->rxc_handler().set(RS232_TAG, FUNC(rs232_port_device::write_etc)); MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL(14'318'181)/14) MCFG_MOS6526_TOD(60) @@ -2350,11 +2350,11 @@ MACHINE_CONFIG_START(p500_state::p500_ntsc) m_user->cnt_callback().set(MOS6526_TAG, FUNC(mos6526_device::cnt_w)); m_user->flag_callback().set(MOS6526_TAG, FUNC(mos6526_device::flag_w)); - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); MCFG_QUICKLOAD_ADD("quickload", p500_state, p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) @@ -2425,10 +2425,10 @@ MACHINE_CONFIG_START(p500_state::p500_pal) m_tpi2->in_pc_cb().set(FUNC(p500_state::tpi2_pc_r)); m_tpi2->out_pc_cb().set(FUNC(p500_state::tpi2_pc_w)); - MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MOS6551(config, m_acia, 0); + m_acia->set_xtal(XTAL(1'843'200)); + m_acia->irq_handler().set(m_tpi1, FUNC(tpi6525_device::i4_w)); + m_acia->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL(17'734'472)/18) MCFG_MOS6526_TOD(50) @@ -2477,11 +2477,11 @@ MACHINE_CONFIG_START(p500_state::p500_pal) m_user->cnt_callback().set(MOS6526_TAG, FUNC(mos6526_device::cnt_w)); m_user->flag_callback().set(MOS6526_TAG, FUNC(mos6526_device::flag_w)); - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); MCFG_QUICKLOAD_ADD("quickload", p500_state, p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) @@ -2551,10 +2551,10 @@ MACHINE_CONFIG_START(cbm2_state::cbm2lp_ntsc) m_tpi2->out_pb_cb().set(FUNC(cbm2_state::tpi2_pb_w)); m_tpi2->in_pc_cb().set(FUNC(cbm2_state::tpi2_pc_r)); - MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MOS6551(config, m_acia, 0); + m_acia->set_xtal(XTAL(1'843'200)); + m_acia->irq_handler().set(m_tpi1, FUNC(tpi6525_device::i4_w)); + m_acia->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL(18'000'000)/9) MCFG_MOS6526_TOD(60) @@ -2602,11 +2602,11 @@ MACHINE_CONFIG_START(cbm2_state::cbm2lp_ntsc) m_user->cnt_callback().set(MOS6526_TAG, FUNC(mos6526_device::cnt_w)); m_user->flag_callback().set(MOS6526_TAG, FUNC(mos6526_device::flag_w)); - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); MCFG_QUICKLOAD_ADD("quickload", cbm2_state, cbmb, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index e59a8531a0b..4f197fcdfff 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -223,18 +223,13 @@ public: , m_i8214_0(*this, "i8214_1") , m_i8214_1(*this, "i8214_2") , m_i8214_2(*this, "i8214_3") - , m_q133_pia_0(*this, "q133_pia_1") - , m_q133_pia_1(*this, "q133_pia_2") + , m_q133_pia(*this, "q133_pia_%u", 1U) , m_q133_ptm(*this, "q133_ptm") - , m_q133_acia_0(*this, "q133_acia_0") - , m_q133_acia_1(*this, "q133_acia_1") - , m_q133_acia_2(*this, "q133_acia_2") - , m_q133_acia_3(*this, "q133_acia_3") + , m_q133_acia(*this, "q133_acia_%u", 0U) , m_q133_region(*this, "q133") , m_q219_pia(*this, "q219_pia") , m_q219_ptm(*this, "q219_ptm") - , m_cmi02_pia_0(*this, "cmi02_pia_1") - , m_cmi02_pia_1(*this, "cmi02_pia_2") + , m_cmi02_pia(*this, "cmi02_pia_%u", 1U) , m_cmi02_ptm(*this, "cmi02_ptm") , m_ank_pia(*this, "ank_pia") , m_acia_mkbd_kbd(*this, "acia_mkbd_kbd") @@ -385,20 +380,15 @@ protected: required_device<i8214_device> m_i8214_0; required_device<i8214_device> m_i8214_1; required_device<i8214_device> m_i8214_2; - required_device<pia6821_device> m_q133_pia_0; - required_device<pia6821_device> m_q133_pia_1; + required_device_array<pia6821_device, 2> m_q133_pia; required_device<ptm6840_device> m_q133_ptm; - required_device<mos6551_device> m_q133_acia_0; - required_device<mos6551_device> m_q133_acia_1; - required_device<mos6551_device> m_q133_acia_2; - required_device<mos6551_device> m_q133_acia_3; + required_device_array<mos6551_device, 4> m_q133_acia; required_memory_region m_q133_region; required_device<pia6821_device> m_q219_pia; required_device<ptm6840_device> m_q219_ptm; - required_device<pia6821_device> m_cmi02_pia_0; - required_device<pia6821_device> m_cmi02_pia_1; + required_device_array<pia6821_device, 2> m_cmi02_pia; required_device<ptm6840_device> m_cmi02_ptm; required_device<pia6821_device> m_ank_pia; @@ -1526,7 +1516,7 @@ READ8_MEMBER( cmi_state::cmi02_r ) if (offset <= 0x1f) { - int ch_mask = m_cmi02_pia_0->a_output(); + int ch_mask = m_cmi02_pia[0]->a_output(); for (int i = 0; i < 8; ++i) { @@ -1543,7 +1533,7 @@ READ8_MEMBER( cmi_state::cmi02_r ) switch (offset) { case 0x20: case 0x21: case 0x22: case 0x23: - return m_cmi02_pia_0->read(space, offset & 3); + return m_cmi02_pia[0]->read(space, offset & 3); case 0x26: m_maincpu2->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); @@ -1556,7 +1546,7 @@ READ8_MEMBER( cmi_state::cmi02_r ) return 0xff; case 0x28: case 0x29: case 0x2a: case 0x2b: - return m_cmi02_pia_1->read(space, offset & 3); + return m_cmi02_pia[1]->read(space, offset & 3); case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: return m_cmi02_ptm->read(space, offset & 7); @@ -1572,7 +1562,7 @@ WRITE8_MEMBER( cmi_state::cmi02_w ) { if (offset <= 0x1f) { - int ch_mask = m_cmi02_pia_0->a_output(); + int ch_mask = m_cmi02_pia[0]->a_output(); for (int i = 0; i < 8; ++i) { @@ -1585,11 +1575,11 @@ WRITE8_MEMBER( cmi_state::cmi02_w ) switch (offset) { case 0x20: case 0x21: case 0x22: case 0x23: - m_cmi02_pia_0->write(space, offset & 3, data); + m_cmi02_pia[0]->write(space, offset & 3, data); break; case 0x28: case 0x29: case 0x2a: case 0x2b: - m_cmi02_pia_1->write(space, offset & 3, data); + m_cmi02_pia[1]->write(space, offset & 3, data); break; case 0x30: @@ -1687,10 +1677,10 @@ void cmi_state::install_peripherals(int cpunum) else space->install_readwrite_handler(0xfc5f, 0xfc5f, read8_delegate(FUNC(cmi_state::map_r<0>),this), write8_delegate(FUNC(cmi_state::map_w<0>),this)); - space->install_readwrite_handler(0xfc80, 0xfc83, read8_delegate(FUNC(mos6551_device::read),m_q133_acia_0.target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia_0.target())); - space->install_readwrite_handler(0xfc84, 0xfc87, read8_delegate(FUNC(mos6551_device::read),m_q133_acia_1.target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia_1.target())); - space->install_readwrite_handler(0xfc88, 0xfc8b, read8_delegate(FUNC(mos6551_device::read),m_q133_acia_2.target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia_2.target())); - space->install_readwrite_handler(0xfc8c, 0xfc8f, read8_delegate(FUNC(mos6551_device::read),m_q133_acia_3.target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia_3.target())); + space->install_readwrite_handler(0xfc80, 0xfc83, read8_delegate(FUNC(mos6551_device::read),m_q133_acia[0].target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia[0].target())); + space->install_readwrite_handler(0xfc84, 0xfc87, read8_delegate(FUNC(mos6551_device::read),m_q133_acia[1].target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia[1].target())); + space->install_readwrite_handler(0xfc88, 0xfc8b, read8_delegate(FUNC(mos6551_device::read),m_q133_acia[2].target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia[2].target())); + space->install_readwrite_handler(0xfc8c, 0xfc8f, read8_delegate(FUNC(mos6551_device::read),m_q133_acia[3].target()), write8_delegate(FUNC(mos6551_device::write),m_q133_acia[3].target())); space->install_readwrite_handler(0xfc90, 0xfc97, read8_delegate(FUNC(ptm6840_device::read),m_q133_ptm.target()), write8_delegate(FUNC(ptm6840_device::write),m_q133_ptm.target())); space->install_readwrite_handler(0xfcbc, 0xfcbc, read8_delegate(FUNC(cmi_state::cmi07_r),this), write8_delegate(FUNC(cmi_state::cmi07_w),this)); @@ -1701,8 +1691,8 @@ void cmi_state::install_peripherals(int cpunum) space->install_readwrite_handler(0xfcd0, 0xfcdc, read8_delegate(FUNC(cmi_state::video_r),this), write8_delegate(FUNC(cmi_state::video_w),this)); space->install_readwrite_handler(0xfce0, 0xfce1, read8_delegate(FUNC(cmi_state::fdc_r),this), write8_delegate(FUNC(cmi_state::fdc_w),this)); space->nop_readwrite(0xfce2, 0xfcef); // Monitor ROM will attempt to detect floppy disk controller cards in this entire range - space->install_readwrite_handler(0xfcf0, 0xfcf7, read8_delegate(FUNC(pia6821_device::read),m_q133_pia_0.target()), write8_delegate(FUNC(pia6821_device::write),m_q133_pia_0.target())); - space->install_readwrite_handler(0xfcf8, 0xfcff, read8_delegate(FUNC(pia6821_device::read),m_q133_pia_1.target()), write8_delegate(FUNC(pia6821_device::write),m_q133_pia_1.target())); + space->install_readwrite_handler(0xfcf0, 0xfcf7, read8_delegate(FUNC(pia6821_device::read),m_q133_pia[0].target()), write8_delegate(FUNC(pia6821_device::write),m_q133_pia[0].target())); + space->install_readwrite_handler(0xfcf8, 0xfcff, read8_delegate(FUNC(pia6821_device::read),m_q133_pia[1].target()), write8_delegate(FUNC(pia6821_device::write),m_q133_pia[1].target())); space->install_write_handler(0xfcfc, 0xfcfc, write8_delegate(FUNC(cmi_state::i8214_cpu1_w),this)); space->install_write_handler(0xfcfd, 0xfcfd, write8_delegate(FUNC(cmi_state::i8214_cpu2_w),this)); @@ -1842,7 +1832,7 @@ WRITE_LINE_MEMBER( cmi_state::pia_q219_irqb ) READ8_MEMBER( cmi_state::q133_1_porta_r ) { - if (BIT(m_q133_pia_0->b_output(), 1)) + if (BIT(m_q133_pia[0]->b_output(), 1)) { return m_msm5832->data_r(space, m_msm5832_addr) << 4; } @@ -2025,10 +2015,8 @@ WRITE_LINE_MEMBER( cmi_state::mkbd_acia_clock ) m_acia_mkbd_kbd->write_txc(state); m_acia_mkbd_cmi->write_rxc(state); m_acia_mkbd_cmi->write_txc(state); - m_q133_acia_0->write_rxc(state); - m_q133_acia_1->write_rxc(state); - m_q133_acia_2->write_rxc(state); - m_q133_acia_3->write_rxc(state); + for (auto &acia : m_q133_acia) + acia->write_rxc(state); } WRITE_LINE_MEMBER( cmi_state::msm5832_irq ) @@ -2223,12 +2211,12 @@ MACHINE_CONFIG_START(cmi_state::cmi2x) MCFG_I8214_INT_CALLBACK(WRITELINE(*this, cmi_state, i8214_3_int_w)) MCFG_I8214_ENLG_CALLBACK(WRITELINE(*this, cmi_state, i8214_3_enlg)) - PIA6821(config, m_q133_pia_0, 0); // pia_q133_1_config - m_q133_pia_0->readpa_handler().set(FUNC(cmi_state::q133_1_porta_r)); - m_q133_pia_0->writepa_handler().set(FUNC(cmi_state::q133_1_porta_w)); - m_q133_pia_0->writepb_handler().set(FUNC(cmi_state::q133_1_portb_w)); + PIA6821(config, m_q133_pia[0], 0); // pia_q133_1_config + m_q133_pia[0]->readpa_handler().set(FUNC(cmi_state::q133_1_porta_r)); + m_q133_pia[0]->writepa_handler().set(FUNC(cmi_state::q133_1_porta_w)); + m_q133_pia[0]->writepb_handler().set(FUNC(cmi_state::q133_1_portb_w)); - PIA6821(config, m_q133_pia_1, 0); // pia_q133_2_config + PIA6821(config, m_q133_pia[1], 0); // pia_q133_2_config PTM6840(config, m_q133_ptm, 2000000); // ptm_q133_config m_q133_ptm->set_external_clocks(1024, 1, 111); // Third is todo @@ -2244,10 +2232,10 @@ MACHINE_CONFIG_START(cmi_state::cmi2x) m_q219_ptm->set_external_clocks(HBLANK_FREQ.dvalue(), VBLANK_FREQ.dvalue(), 1'000'000); // TODO: does the third thing come from a crystal? m_q219_ptm->irq_callback().set(FUNC(cmi_state::ptm_q219_irq)); - PIA6821(config, m_cmi02_pia_0, 0); // pia_cmi02_1_config - m_cmi02_pia_0->writepb_handler().set(FUNC(cmi_state::master_tune_w)); + PIA6821(config, m_cmi02_pia[0], 0); // pia_cmi02_1_config + m_cmi02_pia[0]->writepb_handler().set(FUNC(cmi_state::master_tune_w)); - PIA6821(config, m_cmi02_pia_1, 0); // pia_cmi02_2_config + PIA6821(config, m_cmi02_pia[1], 0); // pia_cmi02_2_config PTM6840(config, m_cmi02_ptm, 2000000); // ptm_cmi02_config TODO m_cmi02_ptm->o2_callback().set(FUNC(cmi_state::cmi02_ptm_o2)); @@ -2256,32 +2244,21 @@ MACHINE_CONFIG_START(cmi_state::cmi2x) MCFG_DEVICE_ADD("mkbd_acia_clock", CLOCK, 1.8432_MHz_XTAL / 12) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, cmi_state, mkbd_acia_clock)) - MCFG_DEVICE_ADD("q133_acia_0", MOS6551, 1.8432_MHz_XTAL) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("q133_acia_irq", input_merger_device, in_w<0>)) + for (auto &acia : m_q133_acia) + MOS6551(config, acia, 1.8432_MHz_XTAL).set_xtal(1.8432_MHz_XTAL); + m_q133_acia[0]->irq_handler().set("q133_acia_irq", FUNC(input_merger_device::in_w<0>)); + m_q133_acia[1]->irq_handler().set("q133_acia_irq", FUNC(input_merger_device::in_w<1>)); + m_q133_acia[2]->irq_handler().set("q133_acia_irq", FUNC(input_merger_device::in_w<2>)); + m_q133_acia[3]->irq_handler().set("q133_acia_irq", FUNC(input_merger_device::in_w<3>)); - MCFG_DEVICE_ADD("q133_acia_1", MOS6551, 1.8432_MHz_XTAL) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("q133_acia_irq", input_merger_device, in_w<1>)) - - MCFG_DEVICE_ADD("q133_acia_2", MOS6551, 1.8432_MHz_XTAL) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("q133_acia_irq", input_merger_device, in_w<2>)) - - MCFG_DEVICE_ADD("q133_acia_3", MOS6551, 1.8432_MHz_XTAL) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("q133_acia_irq", input_merger_device, in_w<3>)) - - MCFG_INPUT_MERGER_ANY_HIGH("q133_acia_irq") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE(*this, cmi_state, q133_acia_irq)) + INPUT_MERGER_ANY_HIGH(config, "q133_acia_irq").output_handler().set(FUNC(cmi_state::q133_acia_irq)); ACIA6850(config, m_acia_mkbd_kbd, 1.8432_MHz_XTAL / 12); // acia_mkbd_kbd ACIA6850(config, m_acia_mkbd_cmi, 1.8432_MHz_XTAL / 12); // acia_mkbd_cmi PIA6821(config, m_ank_pia, 0); // pia_ank_config - MCFG_DEVICE_MODIFY("q133_acia_0") - MCFG_MOS6551_TXD_HANDLER(WRITELINE("acia_mkbd_cmi", acia6850_device, write_rxd)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE("acia_mkbd_cmi", acia6850_device, write_cts)) + m_q133_acia[0]->txd_handler().set(m_acia_mkbd_cmi, FUNC(acia6850_device::write_rxd)); + m_q133_acia[0]->rts_handler().set(m_acia_mkbd_cmi, FUNC(acia6850_device::write_cts)); m_acia_mkbd_cmi->txd_handler().set("q133_acia_0", FUNC(mos6551_device::write_rxd)); m_acia_mkbd_cmi->rts_handler().set("q133_acia_0", FUNC(mos6551_device::write_cts)); diff --git a/src/mame/drivers/digel804.cpp b/src/mame/drivers/digel804.cpp index 16705e82aff..044c123aa54 100644 --- a/src/mame/drivers/digel804.cpp +++ b/src/mame/drivers/digel804.cpp @@ -651,12 +651,12 @@ MACHINE_CONFIG_START(digel804_state::digel804) MCFG_MM74C922_X4_CALLBACK(IOPORT("LINE3")) /* acia */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(3.6864_MHz_XTAL/2) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, digel804_state, acia_irq_w)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MOS6551_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) + mos6551_device &acia(MOS6551(config, "acia", 0)); + acia.set_xtal(3.6864_MHz_XTAL/2); + acia.irq_handler().set(FUNC(digel804_state::acia_irq_w)); + acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + acia.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + acia.dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "null_modem") MCFG_RS232_RXD_HANDLER(WRITELINE("acia", mos6551_device, write_rxd)) @@ -681,8 +681,7 @@ MACHINE_CONFIG_START(ep804_state::ep804) MCFG_DEVICE_PROGRAM_MAP(z80_mem_804_1_2) MCFG_DEVICE_IO_MAP(z80_io_1_2) - MCFG_DEVICE_MODIFY("acia") - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, ep804_state, ep804_acia_irq_w)) + subdevice<mos6551_device>("acia")->irq_handler().set(FUNC(ep804_state::ep804_acia_irq_w)); m_ram->set_default_size("32K").set_extra_options("64K"); MACHINE_CONFIG_END diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp index 593bb8a594d..216fcacff33 100644 --- a/src/mame/drivers/dragon.cpp +++ b/src/mame/drivers/dragon.cpp @@ -268,8 +268,8 @@ MACHINE_CONFIG_START(dragon64_state::dragon64) cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); // acia - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) + mos6551_device &acia(MOS6551(config, "acia", 0)); + acia.set_xtal(1.8432_MHz_XTAL); // software lists MCFG_SOFTWARE_LIST_ADD("dragon_flex_list", "dragon_flex") @@ -321,8 +321,8 @@ MACHINE_CONFIG_START(dragon_alpha_state::dgnalpha) cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); // acia - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) + mos6551_device &acia(MOS6551(config, "acia", 0)); + acia.set_xtal(1.8432_MHz_XTAL); // floppy MCFG_DEVICE_ADD(WD2797_TAG, WD2797, 1_MHz_XTAL) diff --git a/src/mame/drivers/ec65.cpp b/src/mame/drivers/ec65.cpp index 107892edff8..9f1988407fd 100644 --- a/src/mame/drivers/ec65.cpp +++ b/src/mame/drivers/ec65.cpp @@ -202,8 +202,8 @@ MACHINE_CONFIG_START(ec65_state::ec65) MCFG_DEVICE_ADD(VIA6522_1_TAG, VIA6522, XTAL(4'000'000) / 4) - MCFG_DEVICE_ADD(ACIA6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) + mos6551_device &acia(MOS6551(config, ACIA6551_TAG, 0)); + acia.set_xtal(XTAL(1'843'200)); MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(PUT(ec65_state, kbd_put)) diff --git a/src/mame/drivers/hp2620.cpp b/src/mame/drivers/hp2620.cpp index 9e0276d3a69..0bf3e11c1c1 100644 --- a/src/mame/drivers/hp2620.cpp +++ b/src/mame/drivers/hp2620.cpp @@ -98,23 +98,24 @@ void hp2620_state::io_map(address_map &map) static INPUT_PORTS_START( hp2622 ) INPUT_PORTS_END -MACHINE_CONFIG_START(hp2620_state::hp2622) - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(25'771'500) / 7) // 3.68 MHz - MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_IO_MAP(io_map) +void hp2620_state::hp2622(machine_config &config) +{ + Z80(config, m_maincpu, 25.7715_MHz_XTAL / 7); // 3.68 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &hp2620_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &hp2620_state::io_map); - MCFG_NVRAM_ADD_0FILL("nvram") // 5101 (A7 tied to GND) + battery (+ wait states) + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 5101 (A7 tied to GND) + battery (+ wait states) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL(25'771'500), 1035, 0, 720, 415, 0, 390) // 498 total lines in 50 Hz mode - MCFG_SCREEN_UPDATE_DRIVER(hp2620_state, screen_update) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(25.7715_MHz_XTAL, 1035, 0, 720, 415, 0, 390); // 498 total lines in 50 Hz mode + screen.set_screen_update(FUNC(hp2620_state::screen_update)); - //MCFG_DEVICE_ADD("crtc", DP8367, XTAL(25'771'500)) + //DP8367(config, "crtc", 25.7715_MHz_XTAL).set_screen("screen"); - MCFG_DEVICE_ADD("acia", MOS6551, 0) // SY6551 - MCFG_MOS6551_XTAL(XTAL(25'771'500) / 14) // 1.84 MHz - MCFG_MOS6551_IRQ_HANDLER(INPUTLINE("maincpu", 0)) -MACHINE_CONFIG_END + mos6551_device &acia(MOS6551(config, "acia", 0)); // SY6551 + acia.set_xtal(25.7715_MHz_XTAL / 14); // 1.84 MHz + acia.irq_handler().set_inputline("maincpu", INPUT_LINE_IRQ0); +} /************************************************************************************************************** diff --git a/src/mame/drivers/microtan.cpp b/src/mame/drivers/microtan.cpp index 70badf7695d..57231a6fd30 100644 --- a/src/mame/drivers/microtan.cpp +++ b/src/mame/drivers/microtan.cpp @@ -209,7 +209,7 @@ GFXDECODE_END MACHINE_CONFIG_START(microtan_state::microtan) /* basic machine hardware */ - MCFG_DEVICE_ADD(m_maincpu, M6502, XTAL(6'000'000) / 8) // 750 kHz + MCFG_DEVICE_ADD(m_maincpu, M6502, 6_MHz_XTAL / 8) // 750 kHz MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", microtan_state, interrupt) @@ -245,8 +245,8 @@ MACHINE_CONFIG_START(microtan_state::microtan) MCFG_CASSETTE_ADD( m_cassette ) /* acia */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) + mos6551_device &acia(MOS6551(config, "acia", 0)); + acia.set_xtal(1.8432_MHz_XTAL); /* via */ VIA6522(config, m_via6522[0], 6_MHz_XTAL / 8); @@ -257,7 +257,7 @@ MACHINE_CONFIG_START(microtan_state::microtan) m_via6522[0]->cb2_handler().set(FUNC(microtan_state::via_0_out_cb2)); m_via6522[0]->irq_handler().set(m_irq_line, FUNC(input_merger_device::in_w<IRQ_VIA_0>)); - MCFG_DEVICE_ADD(m_via6522[1], VIA6522, XTAL(6'000'000) / 8) + MCFG_DEVICE_ADD(m_via6522[1], VIA6522, 6_MHz_XTAL / 8) m_via6522[1]->writepa_handler().set(FUNC(microtan_state::via_1_out_a)); m_via6522[1]->writepb_handler().set(FUNC(microtan_state::via_1_out_b)); m_via6522[1]->ca2_handler().set(FUNC(microtan_state::via_1_out_ca2)); diff --git a/src/mame/drivers/novag6502.cpp b/src/mame/drivers/novag6502.cpp index 45115665565..2a2bd38d9fb 100644 --- a/src/mame/drivers/novag6502.cpp +++ b/src/mame/drivers/novag6502.cpp @@ -922,15 +922,16 @@ MACHINE_CONFIG_START(novag6502_state::sexpert) MCFG_TIMER_START_DELAY(attotime::from_hz(32.768_kHz_XTAL/128) - attotime::from_nsec(21500)) // active for 21.5us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", novag6502_state, irq_off, attotime::from_hz(32.768_kHz_XTAL/128)) - MCFG_DEVICE_ADD("acia", MOS6551, 0) // R65C51P2 - RTS to CTS, DCD to GND - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) - MCFG_MOS6551_IRQ_HANDLER(INPUTLINE("maincpu", M6502_NMI_LINE)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE("acia", mos6551_device, write_cts)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MOS6551_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia", mos6551_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia", mos6551_device, write_dsr)) + mos6551_device &acia(MOS6551(config, "acia", 0)); // R65C51P2 - RTS to CTS, DCD to GND + acia.set_xtal(1.8432_MHz_XTAL); + acia.irq_handler().set_inputline("maincpu", m65c02_device::NMI_LINE); + acia.rts_handler().set("acia", FUNC(mos6551_device::write_cts)); + acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + acia.dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); + rs232.rxd_handler().set("acia", FUNC(mos6551_device::write_rxd)); + rs232.dsr_handler().set("acia", FUNC(mos6551_device::write_dsr)); MCFG_NVRAM_ADD_1FILL("nvram") diff --git a/src/mame/drivers/novag68k.cpp b/src/mame/drivers/novag68k.cpp index 1e553a78fd7..3c1ad078156 100644 --- a/src/mame/drivers/novag68k.cpp +++ b/src/mame/drivers/novag68k.cpp @@ -244,8 +244,8 @@ MACHINE_CONFIG_START(novag68k_state::diablo68k) MCFG_TIMER_START_DELAY(attotime::from_hz(32.768_kHz_XTAL/128) - attotime::from_nsec(1100)) // active for 1.1us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", novag68k_state, irq_off, attotime::from_hz(32.768_kHz_XTAL/128)) - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) + mos6551_device &acia(MOS6551(config, "acia", 0)); + acia.set_xtal(1.8432_MHz_XTAL); MCFG_NVRAM_ADD_0FILL("nvram") diff --git a/src/mame/drivers/rvoice.cpp b/src/mame/drivers/rvoice.cpp index 351ebde9d69..f2cabc9ed8c 100644 --- a/src/mame/drivers/rvoice.cpp +++ b/src/mame/drivers/rvoice.cpp @@ -377,8 +377,8 @@ MACHINE_CONFIG_START(rvoice_state::rvoicepc) //MCFG_DEVICE_IO_MAP(hd63701_slave_io) MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_DEVICE_ADD("acia65c51", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) + mos6551_device &acia(MOS6551(config, "acia65c51", 0)); + acia.set_xtal(1.8432_MHz_XTAL); /* video hardware */ diff --git a/src/mame/drivers/tek440x.cpp b/src/mame/drivers/tek440x.cpp index fda9931f5fc..187716c028e 100644 --- a/src/mame/drivers/tek440x.cpp +++ b/src/mame/drivers/tek440x.cpp @@ -196,7 +196,7 @@ INPUT_PORTS_END MACHINE_CONFIG_START(tek440x_state::tek4404) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68010, XTAL(40'000'000) / 4) // MC68010L10 + MCFG_DEVICE_ADD("maincpu", M68010, 40_MHz_XTAL / 4) // MC68010L10 MCFG_DEVICE_PROGRAM_MAP(maincpu_map) MCFG_DEVICE_ADD("fdccpu", M6502, 1000000) @@ -213,17 +213,17 @@ MACHINE_CONFIG_START(tek440x_state::tek4404) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("aica", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) + mos6551_device &aica(MOS6551(config, "aica", 0)); + aica.set_xtal(1.8432_MHz_XTAL); + aica.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); - MCFG_DEVICE_ADD("timer", AM9513, XTAL(40'000'000) / 4 / 10) // from CPU E output + AM9513(config, "timer", 40_MHz_XTAL / 4 / 10); // from CPU E output - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("aica", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE("aica", mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("aica", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("aica", mos6551_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); + rs232.rxd_handler().set("aica", FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set("aica", FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set("aica", FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set("aica", FUNC(mos6551_device::write_cts)); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp index 8a0da131b73..eaeffae616a 100644 --- a/src/mame/drivers/thomson.cpp +++ b/src/mame/drivers/thomson.cpp @@ -719,16 +719,16 @@ MACHINE_CONFIG_START(thomson_state::to7) m_pia_game->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); /* TODO: CONVERT THIS TO A SLOT DEVICE (RF 57-932) */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(1.8432_MHz_XTAL) - MCFG_MOS6551_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) + mos6551_device &acia(MOS6551(config, "acia", 0)); + acia.set_xtal(1.8432_MHz_XTAL); + acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); /// 2400 7N2 - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("acia", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE("acia", mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("acia", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("acia", mos6551_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); + rs232.rxd_handler().set("acia", FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set("acia", FUNC(mos6551_device::write_dcd)); + rs232.dsr_handler().set("acia", FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set("acia", FUNC(mos6551_device::write_cts)); /* TODO: CONVERT THIS TO A SLOT DEVICE (CC 90-232) */ diff --git a/src/mame/drivers/tv910.cpp b/src/mame/drivers/tv910.cpp index 3380f785186..42938bbd6a8 100644 --- a/src/mame/drivers/tv910.cpp +++ b/src/mame/drivers/tv910.cpp @@ -39,7 +39,7 @@ #define RS232_TAG "rs232" #define KBDC_TAG "ay3600" -#define MASTER_CLOCK XTAL(13'608'000) +#define MASTER_CLOCK 13.608_MHz_XTAL class tv910_state : public driver_device { @@ -543,16 +543,16 @@ MACHINE_CONFIG_START(tv910_state::tv910) MCFG_AY3600_DATA_READY_CB(WRITELINE(*this, tv910_state, ay3600_data_ready_w)) MCFG_AY3600_AKO_CB(WRITELINE(*this, tv910_state, ay3600_ako_w)) - MCFG_DEVICE_ADD(ACIA_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_rts)) + mos6551_device &acia(MOS6551(config, ACIA_TAG, 0)); + acia.set_xtal(1.8432_MHz_XTAL); + acia.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); + acia.txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); + acia.rts_handler().set(RS232_TAG, FUNC(rs232_port_device::write_rts)); - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(ACIA_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(ACIA_TAG, mos6551_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(WRITELINE(ACIA_TAG, mos6551_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr)); + rs232.rxd_handler().set(ACIA_TAG, FUNC(mos6551_device::write_rxd)); + rs232.dcd_handler().set(ACIA_TAG, FUNC(mos6551_device::write_dcd)); + rs232.cts_handler().set(ACIA_TAG, FUNC(mos6551_device::write_cts)); SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD("bell", BEEP, MASTER_CLOCK / 8400) // 1620 Hz (Row 10 signal) diff --git a/src/mame/drivers/tv912.cpp b/src/mame/drivers/tv912.cpp index 8c5c7bc34fa..4fada0f6ec3 100644 --- a/src/mame/drivers/tv912.cpp +++ b/src/mame/drivers/tv912.cpp @@ -255,7 +255,7 @@ void tv912_state::device_timer(emu_timer &timer, device_timer_id id, int param, if (!BIT(sel, b)) { unsigned divisor = 11 * (b < 9 ? 1 << b : 176); - m_baudgen_timer->adjust(attotime::from_hz(XTAL(23'814'000) / 3.5 / divisor), !param); + m_baudgen_timer->adjust(attotime::from_hz(23.814_MHz_XTAL / 3.5 / divisor), !param); break; } } diff --git a/src/mame/drivers/tv955.cpp b/src/mame/drivers/tv955.cpp index 5765a1771b0..3139ada09ff 100644 --- a/src/mame/drivers/tv955.cpp +++ b/src/mame/drivers/tv955.cpp @@ -106,17 +106,17 @@ MACHINE_CONFIG_START(tv955_state::tv955) MCFG_SCN2674_INTR_CALLBACK(INPUTLINE("maincpu", m6502_device::NMI_LINE)) MCFG_VIDEO_SET_SCREEN("screen") - MCFG_DEVICE_ADD("hostuart", MOS6551, 0) - MCFG_MOS6551_XTAL(3.6864_MHz_XTAL) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<0>)) + MOS6551(config, m_hostuart, 0); + m_hostuart->set_xtal(3.6864_MHz_XTAL); + m_hostuart->irq_handler().set("mainirq", FUNC(input_merger_device::in_w<0>)); - MCFG_DEVICE_ADD("printuart", MOS6551, 0) - MCFG_MOS6551_XTAL(3.6864_MHz_XTAL / 2) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) + mos6551_device &printuart(MOS6551(config, "printuart", 0)); + printuart.set_xtal(3.6864_MHz_XTAL / 2); + printuart.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); - MCFG_DEVICE_ADD("keybuart", MOS6551, 0) - MCFG_MOS6551_XTAL(3.6864_MHz_XTAL / 2) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<2>)) + mos6551_device &keybuart(MOS6551(config, "keybuart", 0)); + keybuart.set_xtal(3.6864_MHz_XTAL / 2); + keybuart.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<2>)); MACHINE_CONFIG_END /************************************************************************************************************** diff --git a/src/mame/drivers/tv965.cpp b/src/mame/drivers/tv965.cpp index 1d486003fa2..472dc633463 100644 --- a/src/mame/drivers/tv965.cpp +++ b/src/mame/drivers/tv965.cpp @@ -88,11 +88,11 @@ MACHINE_CONFIG_START(tv965_state::tv965) MCFG_SCN2672_INTR_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) MCFG_VIDEO_SET_SCREEN("screen") - MCFG_DEVICE_ADD("acia1", MOS6551, 0) - MCFG_MOS6551_XTAL(3.6864_MHz_XTAL / 2) // divider not verified, possibly even programmable + mos6551_device &acia1(MOS6551(config, "acia1", 0)); + acia1.set_xtal(3.6864_MHz_XTAL / 2); // divider not verified, possibly even programmable - MCFG_DEVICE_ADD("acia2", MOS6551, 0) - MCFG_MOS6551_XTAL(3.6864_MHz_XTAL / 2) // divider not verified, possibly even programmable + mos6551_device &acia2(MOS6551(config, "acia2", 0)); + acia2.set_xtal(3.6864_MHz_XTAL / 2); // divider not verified, possibly even programmable MACHINE_CONFIG_END /************************************************************************************************************** |