diff options
author | 2018-08-10 18:08:03 +0200 | |
---|---|---|
committer | 2018-08-10 18:08:03 +0200 | |
commit | 358ee652df3d7f2ff7e9f3e2b9e3bfc71832942b (patch) | |
tree | 5d98cfd52e6bf275090837831f4efe87c4703694 | |
parent | 0d4a4e5e95a58ca1cb821df1cf9afd8b559ccac2 (diff) |
-pia6821: Removed MCFG and old devcb. [Ryan Holtz]
105 files changed, 1924 insertions, 2008 deletions
diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp index 48e0e9b9c31..f09ff71c4ba 100644 --- a/src/devices/bus/a2bus/mouse.cpp +++ b/src/devices/bus/a2bus/mouse.cpp @@ -127,20 +127,21 @@ ioport_constructor a2bus_mouse_device::device_input_ports() const machine configurations -------------------------------------------------*/ -MACHINE_CONFIG_START(a2bus_mouse_device::device_add_mconfig) - MCFG_DEVICE_ADD(MOUSE_MCU_TAG, M68705P3, 2043600) - MCFG_M68705_PORTA_R_CB(READ8(*this, a2bus_mouse_device, mcu_port_a_r)) - MCFG_M68705_PORTB_R_CB(READ8(*this, a2bus_mouse_device, mcu_port_b_r)) - MCFG_M68705_PORTA_W_CB(WRITE8(*this, a2bus_mouse_device, mcu_port_a_w)) - MCFG_M68705_PORTB_W_CB(WRITE8(*this, a2bus_mouse_device, mcu_port_b_w)) - MCFG_M68705_PORTC_W_CB(WRITE8(*this, a2bus_mouse_device, mcu_port_c_w)) - - MCFG_DEVICE_ADD(MOUSE_PIA_TAG, PIA6821, 1021800) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, a2bus_mouse_device, pia_out_a)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, a2bus_mouse_device, pia_out_b)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, a2bus_mouse_device, pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, a2bus_mouse_device, pia_irqb_w)) -MACHINE_CONFIG_END +void a2bus_mouse_device::device_add_mconfig(machine_config &config) +{ + M68705P3(config, m_mcu, 2043600); + m_mcu->porta_r_cb().set(FUNC(a2bus_mouse_device::mcu_port_a_r)); + m_mcu->portb_r_cb().set(FUNC(a2bus_mouse_device::mcu_port_b_r)); + m_mcu->porta_w_cb().set(FUNC(a2bus_mouse_device::mcu_port_a_w)); + m_mcu->portb_w_cb().set(FUNC(a2bus_mouse_device::mcu_port_b_w)); + m_mcu->portc_w_cb().set(FUNC(a2bus_mouse_device::mcu_port_c_w)); + + PIA6821(config, m_pia, 1021800); + m_pia->writepa_handler().set(FUNC(a2bus_mouse_device::pia_out_a)); + m_pia->writepb_handler().set(FUNC(a2bus_mouse_device::pia_out_b)); + m_pia->irqa_handler().set(FUNC(a2bus_mouse_device::pia_irqa_w)); + m_pia->irqb_handler().set(FUNC(a2bus_mouse_device::pia_irqb_w)); +} /*------------------------------------------------- rom_region - device-specific ROM region diff --git a/src/devices/bus/a2bus/timemasterho.cpp b/src/devices/bus/a2bus/timemasterho.cpp index 4d0e2d62889..ad0e96f2ab3 100644 --- a/src/devices/bus/a2bus/timemasterho.cpp +++ b/src/devices/bus/a2bus/timemasterho.cpp @@ -93,15 +93,16 @@ ioport_constructor a2bus_timemasterho_device::device_input_ports() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(a2bus_timemasterho_device::device_add_mconfig) - MCFG_DEVICE_ADD(TIMEMASTER_PIA_TAG, PIA6821, 1021800) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, a2bus_timemasterho_device, pia_out_a)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, a2bus_timemasterho_device, pia_out_b)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, a2bus_timemasterho_device, pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, a2bus_timemasterho_device, pia_irqb_w)) - - MCFG_DEVICE_ADD(TIMEMASTER_M5832_TAG, MSM5832, 32768) -MACHINE_CONFIG_END +void a2bus_timemasterho_device::device_add_mconfig(machine_config &config) +{ + PIA6821(config, m_pia, 1021800); + m_pia->writepa_handler().set(FUNC(a2bus_timemasterho_device::pia_out_a)); + m_pia->writepb_handler().set(FUNC(a2bus_timemasterho_device::pia_out_b)); + m_pia->irqa_handler().set(FUNC(a2bus_timemasterho_device::pia_irqa_w)); + m_pia->irqb_handler().set(FUNC(a2bus_timemasterho_device::pia_irqb_w)); + + MSM5832(config, m_msm5832, 32768); +} //------------------------------------------------- // rom_region - device-specific ROM region diff --git a/src/devices/bus/c64/magic_formel.cpp b/src/devices/bus/c64/magic_formel.cpp index 23aa125ce46..7575320b765 100644 --- a/src/devices/bus/c64/magic_formel.cpp +++ b/src/devices/bus/c64/magic_formel.cpp @@ -96,12 +96,13 @@ WRITE_LINE_MEMBER( c64_magic_formel_cartridge_device::pia_cb2_w ) // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(c64_magic_formel_cartridge_device::device_add_mconfig) - MCFG_DEVICE_ADD(MC6821_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, c64_magic_formel_cartridge_device, pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, c64_magic_formel_cartridge_device, pia_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, c64_magic_formel_cartridge_device, pia_cb2_w)) -MACHINE_CONFIG_END +void c64_magic_formel_cartridge_device::device_add_mconfig(machine_config &config) +{ + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(c64_magic_formel_cartridge_device::pia_pa_w)); + m_pia->writepb_handler().set(FUNC(c64_magic_formel_cartridge_device::pia_pb_w)); + m_pia->cb2_handler().set(FUNC(c64_magic_formel_cartridge_device::pia_cb2_w)); +} //------------------------------------------------- diff --git a/src/devices/bus/coco/coco_t4426.cpp b/src/devices/bus/coco/coco_t4426.cpp index 988ddd0233a..be0b28e5a5b 100644 --- a/src/devices/bus/coco/coco_t4426.cpp +++ b/src/devices/bus/coco/coco_t4426.cpp @@ -149,8 +149,8 @@ namespace ***************************************************************************/ MACHINE_CONFIG_START(coco_t4426_device::device_add_mconfig) - MCFG_DEVICE_ADD(PIA_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_t4426_device, pia_A_w)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(coco_t4426_device::pia_A_w)); MCFG_DEVICE_ADD(UART_TAG, ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE(SERIAL_TAG, rs232_port_device, write_txd)) diff --git a/src/devices/cpu/m6805/m68705.h b/src/devices/cpu/m6805/m68705.h index ac9f4942db9..3966d5301ba 100644 --- a/src/devices/cpu/m6805/m68705.h +++ b/src/devices/cpu/m6805/m68705.h @@ -52,6 +52,13 @@ public: // configuration helpers template<std::size_t N, typename Object> devcb_base &set_port_cb_r(Object &&obj) { return m_port_cb_r[N].set_callback(std::forward<Object>(obj)); } template<std::size_t N, typename Object> devcb_base &set_port_cb_w(Object &&obj) { return m_port_cb_w[N].set_callback(std::forward<Object>(obj)); } + auto porta_r_cb() { return m_port_cb_r[0].bind(); } + auto portb_r_cb() { return m_port_cb_r[1].bind(); } + auto portc_r_cb() { return m_port_cb_r[2].bind(); } + auto portd_r_cb() { return m_port_cb_r[3].bind(); } + auto porta_w_cb() { return m_port_cb_w[0].bind(); } + auto portb_w_cb() { return m_port_cb_w[1].bind(); } + auto portc_w_cb() { return m_port_cb_w[2].bind(); } protected: // state index constants diff --git a/src/devices/machine/6821pia.h b/src/devices/machine/6821pia.h index 9f55e9b38a4..b31bf03183c 100644 --- a/src/devices/machine/6821pia.h +++ b/src/devices/machine/6821pia.h @@ -28,46 +28,6 @@ /*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -// TODO: REMOVE THESE -#define MCFG_PIA_READPA_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_readpa_handler(DEVCB_##_devcb); - -#define MCFG_PIA_READPB_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_readpb_handler(DEVCB_##_devcb); - -#define MCFG_PIA_READCA1_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_readca1_handler(DEVCB_##_devcb); - -#define MCFG_PIA_READCA2_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_readca2_handler(DEVCB_##_devcb); - -#define MCFG_PIA_READCB1_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_readcb1_handler(DEVCB_##_devcb); - -// TODO: CONVERT THESE TO WRITE LINE -#define MCFG_PIA_WRITEPA_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_writepa_handler(DEVCB_##_devcb); - -#define MCFG_PIA_WRITEPB_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_writepb_handler(DEVCB_##_devcb); - -#define MCFG_PIA_CA2_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_ca2_handler(DEVCB_##_devcb); - -#define MCFG_PIA_CB2_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_cb2_handler(DEVCB_##_devcb); - -#define MCFG_PIA_IRQA_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_irqa_handler(DEVCB_##_devcb); - -#define MCFG_PIA_IRQB_HANDLER(_devcb) \ - downcast<pia6821_device &>(*device).set_irqb_handler(DEVCB_##_devcb); - - -/*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -79,13 +39,7 @@ public: // construction/destruction pia6821_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - // static configuration helpers // TODO: REMOVE THESE - template<class Obj> devcb_base &set_readpa_handler(Obj &&object) { return m_in_a_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_readpb_handler(Obj &&object) { return m_in_b_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_readca1_handler(Obj &&object) { return m_in_ca1_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_readca2_handler(Obj &&object) { return m_in_ca2_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_readcb1_handler(Obj &&object) { return m_in_cb1_handler.set_callback(std::forward<Obj>(object)); } auto readpa_handler() { return m_in_a_handler.bind(); } auto readpb_handler() { return m_in_b_handler.bind(); } auto readca1_handler() { return m_in_ca1_handler.bind(); } @@ -93,15 +47,9 @@ public: auto readcb1_handler() { return m_in_cb1_handler.bind(); } // TODO: CONVERT THESE TO WRITE LINE - template<class Obj> devcb_base &set_writepa_handler(Obj &&object) { return m_out_a_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_writepb_handler(Obj &&object) { return m_out_b_handler.set_callback(std::forward<Obj>(object)); } auto writepa_handler() { return m_out_a_handler.bind(); } auto writepb_handler() { return m_out_b_handler.bind(); } - template<class Obj> devcb_base &set_ca2_handler(Obj &&object) { return m_ca2_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_cb2_handler(Obj &&object) { return m_cb2_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_irqa_handler(Obj &&object) { return m_irqa_handler.set_callback(std::forward<Obj>(object)); } - template<class Obj> devcb_base &set_irqb_handler(Obj &&object) { return m_irqb_handler.set_callback(std::forward<Obj>(object)); } auto ca2_handler() { return m_ca2_handler.bind(); } auto cb2_handler() { return m_cb2_handler.bind(); } auto irqa_handler() { return m_irqa_handler.bind(); } diff --git a/src/mame/audio/cmi01a.cpp b/src/mame/audio/cmi01a.cpp index 3c027d7ed5d..147054c0920 100644 --- a/src/mame/audio/cmi01a.cpp +++ b/src/mame/audio/cmi01a.cpp @@ -27,22 +27,22 @@ cmi01a_device::cmi01a_device(const machine_config &mconfig, const char *tag, dev } MACHINE_CONFIG_START(cmi01a_device::device_add_mconfig) - MCFG_DEVICE_ADD("cmi01a_pia_0", PIA6821, 0) // pia_cmi01a_1_config - MCFG_PIA_READCB1_HANDLER(READLINE(*this, cmi01a_device, tri_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, cmi01a_device, ws_dir_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, cmi01a_device, rp_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, cmi01a_device, pia_0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, cmi01a_device, pia_0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("cmi01a_irq", input_merger_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("cmi01a_irq", input_merger_device, in_w<1>)) - - MCFG_DEVICE_ADD("cmi01a_pia_1", PIA6821, 0) // pia_cmi01a_2_config - MCFG_PIA_READCA1_HANDLER(READLINE(*this, cmi01a_device, zx_r)) - MCFG_PIA_READCA2_HANDLER(READLINE(*this, cmi01a_device, eosi_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, cmi01a_device, pia_1_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, cmi01a_device, pia_1_b_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("cmi01a_irq", input_merger_device, in_w<2>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("cmi01a_irq", input_merger_device, in_w<3>)) + PIA6821(config, m_pia[0], 0); // pia_cmi01a_1_config + m_pia[0]->readcb1_handler().set(FUNC(cmi01a_device::tri_r)); + m_pia[0]->writepa_handler().set(FUNC(cmi01a_device::ws_dir_w)); + m_pia[0]->writepb_handler().set(FUNC(cmi01a_device::rp_w)); + m_pia[0]->ca2_handler().set(FUNC(cmi01a_device::pia_0_ca2_w)); + m_pia[0]->cb2_handler().set(FUNC(cmi01a_device::pia_0_cb2_w)); + m_pia[0]->irqa_handler().set("cmi01a_irq", FUNC(input_merger_device::in_w<0>)); + m_pia[0]->irqb_handler().set("cmi01a_irq", FUNC(input_merger_device::in_w<1>)); + + PIA6821(config, m_pia[1], 0); // pia_cmi01a_2_config + m_pia[1]->readca1_handler().set(FUNC(cmi01a_device::zx_r)); + m_pia[1]->readca2_handler().set(FUNC(cmi01a_device::eosi_r)); + m_pia[1]->writepa_handler().set(FUNC(cmi01a_device::pia_1_a_w)); + m_pia[1]->writepb_handler().set(FUNC(cmi01a_device::pia_1_b_w)); + m_pia[1]->irqa_handler().set("cmi01a_irq", FUNC(input_merger_device::in_w<2>)); + m_pia[1]->irqb_handler().set("cmi01a_irq", FUNC(input_merger_device::in_w<3>)); MCFG_DEVICE_ADD("cmi01a_ptm", PTM6840, 2000000) // ptm_cmi01a_config MCFG_PTM6840_EXTERNAL_CLOCKS(250000, 500000, 500000) diff --git a/src/mame/audio/csd.cpp b/src/mame/audio/csd.cpp index 5cddebeff8b..416c3143353 100644 --- a/src/mame/audio/csd.cpp +++ b/src/mame/audio/csd.cpp @@ -40,11 +40,11 @@ MACHINE_CONFIG_START(midway_cheap_squeak_deluxe_device::device_add_mconfig) MCFG_DEVICE_ADD("cpu", M68000, DERIVED_CLOCK(1, 2)) MCFG_DEVICE_PROGRAM_MAP(csdeluxe_map) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, midway_cheap_squeak_deluxe_device, porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, midway_cheap_squeak_deluxe_device, portb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, midway_cheap_squeak_deluxe_device, irq_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, midway_cheap_squeak_deluxe_device, irq_w)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(midway_cheap_squeak_deluxe_device::porta_w)); + m_pia->writepb_handler().set(FUNC(midway_cheap_squeak_deluxe_device::portb_w)); + m_pia->irqa_handler().set(FUNC(midway_cheap_squeak_deluxe_device::irq_w)); + m_pia->irqb_handler().set(FUNC(midway_cheap_squeak_deluxe_device::irq_w)); MCFG_DEVICE_ADD("dac", AD7533, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 1.0) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) diff --git a/src/mame/audio/exidy.cpp b/src/mame/audio/exidy.cpp index da7d8966e78..15979c4532b 100644 --- a/src/mame/audio/exidy.cpp +++ b/src/mame/audio/exidy.cpp @@ -761,12 +761,12 @@ MACHINE_CONFIG_START(venture_sound_device::device_add_mconfig) m_riot->out_pb_callback().set(FUNC(venture_sound_device::r6532_portb_w)); m_riot->irq_callback().set("audioirq", FUNC(input_merger_device::in_w<0>)); - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, venture_sound_device, pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, venture_sound_device, pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, venture_sound_device, pia_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, venture_sound_device, pia_cb2_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("audioirq", input_merger_device, in_w<1>)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(venture_sound_device::pia_pa_w)); + m_pia->writepb_handler().set(FUNC(venture_sound_device::pia_pb_w)); + m_pia->ca2_handler().set(FUNC(venture_sound_device::pia_ca2_w)); + m_pia->cb2_handler().set(FUNC(venture_sound_device::pia_cb2_w)); + m_pia->irqb_handler().set("audioirq", FUNC(input_merger_device::in_w<1>)); MCFG_INPUT_MERGER_ANY_HIGH("audioirq") // open collector MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", m6502_device::IRQ_LINE)) @@ -992,10 +992,10 @@ MACHINE_CONFIG_START(victory_sound_device::device_add_mconfig) m_riot->out_pb_callback().set(FUNC(victory_sound_device::r6532_portb_w)); m_riot->irq_callback().set("audioirq", FUNC(input_merger_device::in_w<0>)); - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, victory_sound_device, irq_clear_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, victory_sound_device, main_ack_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("audioirq", input_merger_device, in_w<1>)) + PIA6821(config, m_pia, 0); + m_pia->ca2_handler().set(FUNC(victory_sound_device::irq_clear_w)); + m_pia->cb2_handler().set(FUNC(victory_sound_device::main_ack_w)); + m_pia->irqb_handler().set("audioirq", FUNC(input_merger_device::in_w<1>)); MCFG_INPUT_MERGER_ANY_HIGH("audioirq") // open collector MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", m6502_device::IRQ_LINE)) diff --git a/src/mame/audio/midway.cpp b/src/mame/audio/midway.cpp index 9e83ee1b4fd..0ca31ea0958 100644 --- a/src/mame/audio/midway.cpp +++ b/src/mame/audio/midway.cpp @@ -593,11 +593,11 @@ MACHINE_CONFIG_START(midway_sounds_good_device::device_add_mconfig) MCFG_DEVICE_ADD("cpu", M68000, DERIVED_CLOCK(1, 2)) MCFG_DEVICE_PROGRAM_MAP(soundsgood_map) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, midway_sounds_good_device, porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, midway_sounds_good_device, portb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, midway_sounds_good_device, irq_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, midway_sounds_good_device, irq_w)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(midway_sounds_good_device::porta_w)); + m_pia->writepb_handler().set(FUNC(midway_sounds_good_device::portb_w)); + m_pia->irqa_handler().set(FUNC(midway_sounds_good_device::irq_w)); + m_pia->irqb_handler().set(FUNC(midway_sounds_good_device::irq_w)); MCFG_DEVICE_ADD("dac", AD7533, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 1.0) /// ad7533jn.u10 MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) @@ -748,11 +748,11 @@ MACHINE_CONFIG_START(midway_turbo_cheap_squeak_device::device_add_mconfig) MCFG_DEVICE_ADD("cpu", MC6809E, DERIVED_CLOCK(1, 4)) MCFG_DEVICE_PROGRAM_MAP(turbocs_map) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, midway_turbo_cheap_squeak_device, porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, midway_turbo_cheap_squeak_device, portb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, midway_turbo_cheap_squeak_device, irq_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, midway_turbo_cheap_squeak_device, irq_w)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(midway_turbo_cheap_squeak_device::porta_w)); + m_pia->writepb_handler().set(FUNC(midway_turbo_cheap_squeak_device::portb_w)); + m_pia->irqa_handler().set(FUNC(midway_turbo_cheap_squeak_device::irq_w)); + m_pia->irqb_handler().set(FUNC(midway_turbo_cheap_squeak_device::irq_w)); MCFG_DEVICE_ADD("dac", AD7533, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 1.0) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) @@ -952,16 +952,16 @@ MACHINE_CONFIG_START(midway_squawk_n_talk_device::device_add_mconfig) MCFG_DEVICE_ADD("cpu", M6802, DERIVED_CLOCK(1, 1)) MCFG_DEVICE_PROGRAM_MAP(squawkntalk_map) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, midway_squawk_n_talk_device, porta1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, midway_squawk_n_talk_device, irq_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, midway_squawk_n_talk_device, irq_w)) + PIA6821(config, m_pia0, 0); + m_pia0->writepa_handler().set(FUNC(midway_squawk_n_talk_device::porta1_w)); + m_pia0->irqa_handler().set(FUNC(midway_squawk_n_talk_device::irq_w)); + m_pia0->irqb_handler().set(FUNC(midway_squawk_n_talk_device::irq_w)); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, midway_squawk_n_talk_device, porta2_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, midway_squawk_n_talk_device, portb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, midway_squawk_n_talk_device, irq_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, midway_squawk_n_talk_device, irq_w)) + PIA6821(config, m_pia1, 0); + m_pia1->writepa_handler().set(FUNC(midway_squawk_n_talk_device::porta2_w)); + m_pia1->writepb_handler().set(FUNC(midway_squawk_n_talk_device::portb2_w)); + m_pia1->irqa_handler().set(FUNC(midway_squawk_n_talk_device::irq_w)); + m_pia1->irqb_handler().set(FUNC(midway_squawk_n_talk_device::irq_w)); // only used on Discs of Tron, which is stereo MCFG_DEVICE_ADD("tms5200", TMS5200, 640000) diff --git a/src/mame/audio/qix.cpp b/src/mame/audio/qix.cpp index b045ab70f04..adc09617e75 100644 --- a/src/mame/audio/qix.cpp +++ b/src/mame/audio/qix.cpp @@ -175,26 +175,26 @@ MACHINE_CONFIG_START(qix_state::qix_audio) MCFG_DEVICE_ADD("audiocpu", M6802, SOUND_CLOCK_OSC/2) /* 0.92 MHz */ MCFG_DEVICE_PROGRAM_MAP(audio_map) - MCFG_DEVICE_ADD("sndpia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, qix_state, sync_sndpia1_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, qix_vol_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("sndpia1", pia6821_device, ca1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, qix_state, qix_flip_screen_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, qix_state, qix_pia_dint)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, qix_state, qix_pia_dint)) - - MCFG_DEVICE_ADD("sndpia1", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("sndpia0", pia6821_device, porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state,qix_dac_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("sndpia0", pia6821_device, ca1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, qix_state, qix_pia_sint)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, qix_state, qix_pia_sint)) - - MCFG_DEVICE_ADD("sndpia2", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, qix_state, sndpia_2_warning_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, sndpia_2_warning_w)) - MCFG_PIA_CA2_HANDLER(WRITE8(*this, qix_state, sndpia_2_warning_w)) - MCFG_PIA_CB2_HANDLER(WRITE8(*this, qix_state, sndpia_2_warning_w)) + PIA6821(config, m_sndpia0, 0); + m_sndpia0->writepa_handler().set(FUNC(qix_state::sync_sndpia1_porta_w)); + m_sndpia0->writepb_handler().set(FUNC(qix_state::qix_vol_w)); + m_sndpia0->ca2_handler().set("sndpia1", FUNC(pia6821_device::ca1_w)); + m_sndpia0->cb2_handler().set(FUNC(qix_state::qix_flip_screen_w)); + m_sndpia0->irqa_handler().set(FUNC(qix_state::qix_pia_dint)); + m_sndpia0->irqb_handler().set(FUNC(qix_state::qix_pia_dint)); + + PIA6821(config, m_sndpia1, 0); + m_sndpia1->writepa_handler().set("sndpia0", FUNC(pia6821_device::porta_w)); + m_sndpia1->writepb_handler().set(FUNC(qix_state::qix_dac_w)); + m_sndpia1->ca2_handler().set("sndpia0", FUNC(pia6821_device::ca1_w)); + m_sndpia1->irqa_handler().set(FUNC(qix_state::qix_pia_sint)); + m_sndpia1->irqb_handler().set(FUNC(qix_state::qix_pia_sint)); + + PIA6821(config, m_sndpia2, 0); + m_sndpia2->writepa_handler().set(FUNC(qix_state::sndpia_2_warning_w)); + m_sndpia2->writepb_handler().set(FUNC(qix_state::sndpia_2_warning_w)); + m_sndpia2->ca2_handler().set(FUNC(qix_state::sndpia_2_warning_w)); + m_sndpia2->cb2_handler().set(FUNC(qix_state::sndpia_2_warning_w)); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -206,12 +206,12 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(qix_state::slither_audio) - MCFG_DEVICE_ADD("sndpia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("P2")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, slither_coinctl_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, qix_state, qix_flip_screen_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, qix_state, qix_pia_dint)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, qix_state, qix_pia_dint)) + PIA6821(config, m_sndpia0, 0); + m_sndpia0->readpa_handler().set_ioport("P2"); + m_sndpia0->writepb_handler().set(FUNC(qix_state::slither_coinctl_w)); + m_sndpia0->cb2_handler().set(FUNC(qix_state::qix_flip_screen_w)); + m_sndpia0->irqa_handler().set(FUNC(qix_state::qix_pia_dint)); + m_sndpia0->irqb_handler().set(FUNC(qix_pia_dint)); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/audio/redalert.cpp b/src/mame/audio/redalert.cpp index 2112c9bc4d7..3fa8611966b 100644 --- a/src/mame/audio/redalert.cpp +++ b/src/mame/audio/redalert.cpp @@ -327,10 +327,10 @@ MACHINE_CONFIG_START(redalert_state::demoneye_audio) MCFG_DEVICE_PROGRAM_MAP(demoneye_audio_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(redalert_state, irq0_line_hold, REDALERT_AUDIO_CPU_IRQ_FREQ) /* guess */ - MCFG_DEVICE_ADD("sndpia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, redalert_state, demoneye_ay8910_latch_2_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, redalert_state, demoneye_ay8910_data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, redalert_state, demoneye_ay8910_latch_1_w)) + pia6821_device &sndpia(PIA6821(config, "sndpia", 0)); + sndpia.readpa_handler().set(FUNC(redalert_state::demoneye_ay8910_latch_2_r)); + sndpia.writepa_handler().set(FUNC(redalert_state::demoneye_ay8910_data_w)); + sndpia.writepb_handler().set(FUNC(redalert_state::demoneye_ay8910_latch_1_w)); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/audio/s11c_bg.cpp b/src/mame/audio/s11c_bg.cpp index d88ee8096b4..71fca2276bc 100644 --- a/src/mame/audio/s11c_bg.cpp +++ b/src/mame/audio/s11c_bg.cpp @@ -73,13 +73,13 @@ MACHINE_CONFIG_START(s11c_bg_device::device_add_mconfig) MCFG_DEVICE_ADD("hc55516_bg", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 0.5) - MCFG_DEVICE_ADD("pia40", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11c_bg_device, pia40_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("ym2151", ym2151_device, reset_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11c_bg_device, pia40_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("bgcpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("bgcpu", INPUT_LINE_NMI)) + PIA6821(config, m_pia40, 0); + m_pia40->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pia40->writepb_handler().set(FUNC(s11c_bg_device::pia40_pb_w)); + m_pia40->ca2_handler().set("ym2151", FUNC(ym2151_device::reset_w)); + m_pia40->cb2_handler().set(FUNC(s11c_bg_device::pia40_cb2_w)); + m_pia40->irqa_handler().set_inputline("bgcpu", M6809_FIRQ_LINE); + m_pia40->irqb_handler().set_inputline("bgcpu", INPUT_LINE_NMI); MACHINE_CONFIG_END void s11c_bg_device::device_start() diff --git a/src/mame/audio/zaccaria.cpp b/src/mame/audio/zaccaria.cpp index 2f82f962c6a..20c500f0ab1 100644 --- a/src/mame/audio/zaccaria.cpp +++ b/src/mame/audio/zaccaria.cpp @@ -229,12 +229,12 @@ MACHINE_CONFIG_START(zac1b111xx_melody_base::device_add_mconfig) MCFG_DEVICE_ADD("timebase", CLOCK, XTAL(3'579'545)/4096/2) // CPU clock divided using 4040 and half of 74LS74 MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("melodypia", pia6821_device, cb1_w)) - MCFG_DEVICE_ADD("melodypia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, zac1b111xx_melody_base, melodypia_porta_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, zac1b111xx_melody_base, melodypia_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, zac1b111xx_melody_base, melodypia_portb_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("melodycpu", INPUT_LINE_NMI)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("melodycpu", M6802_IRQ_LINE)) + PIA6821(config, m_melodypia, 0); + m_melodypia->readpa_handler().set(FUNC(zac1b111xx_melody_base::melodypia_porta_r)); + m_melodypia->writepa_handler().set(FUNC(zac1b111xx_melody_base::melodypia_porta_w)); + m_melodypia->writepb_handler().set(FUNC(zac1b111xx_melody_base::melodypia_portb_w)); + m_melodypia->irqa_handler().set_inputline("melodycpu", INPUT_LINE_NMI); + m_melodypia->irqb_handler().set_inputline("melodycpu", M6802_IRQ_LINE); MCFG_DEVICE_ADD("melodypsg1", AY8910, XTAL(3'579'545)/2) // CPU clock divided using 4040 MCFG_AY8910_PORT_B_READ_CB(READ8(*this, zac1b111xx_melody_base, melodypsg1_portb_r)) @@ -426,10 +426,10 @@ MACHINE_CONFIG_START(zac1b11142_audio_device::device_add_mconfig) MCFG_DEVICE_ADD("audiocpu", M6802, XTAL(3'579'545)) // verified on pcb MCFG_DEVICE_PROGRAM_MAP(zac1b11142_audio_map) - MCFG_DEVICE_ADD("pia_1i", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8("speech", tms5220_device, status_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("speech", tms5220_device, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, zac1b11142_audio_device, pia_1i_portb_w)) + PIA6821(config, m_pia_1i, 0); + m_pia_1i->readpa_handler().set("speech", FUNC(tms5220_device::status_r)); + m_pia_1i->writepa_handler().set("speech", FUNC(tms5220_device::data_w)); + m_pia_1i->writepb_handler().set(FUNC(zac1b11142_audio_device::pia_1i_portb_w)); MCFG_DEVICE_ADD("dac", MC1408, 0) MCFG_MIXER_ROUTE(ALL_OUTPUTS, *this, 0.40, 0) // mc1408.1f MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp index ce90e8b2075..9662da4baf1 100644 --- a/src/mame/drivers/5clown.cpp +++ b/src/mame/drivers/5clown.cpp @@ -1035,16 +1035,16 @@ MACHINE_CONFIG_START(_5clown_state::fclown) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, _5clown_state, mux_port_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, _5clown_state, pia0_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, _5clown_state, counters_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("SW4")) - MCFG_PIA_READPB_HANDLER(READ8(*this, _5clown_state, pia1_b_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, _5clown_state, trigsnd_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, _5clown_state, mux_w)) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpa_handler().set(FUNC(_5clown_state::mux_port_r)); + pia0.readpb_handler().set(FUNC(_5clown_state::pia0_b_r)); + pia0.writepb_handler().set(FUNC(_5clown_state::counters_w)); + + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.readpa_handler().set_ioport("SW4"); + pia1.readpb_handler().set(FUNC(_5clown_state::pia1_b_r)); + pia1.writepa_handler().set(FUNC(_5clown_state::trigsnd_w)); + pia1.writepb_handler().set(FUNC(_5clown_state::mux_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/aim65.cpp b/src/mame/drivers/aim65.cpp index 082871eba0f..aba98e53c1e 100644 --- a/src/mame/drivers/aim65.cpp +++ b/src/mame/drivers/aim65.cpp @@ -227,9 +227,9 @@ MACHINE_CONFIG_START(aim65_state::aim65) via6522_device &via1(VIA6522(config, "via6522_1", AIM65_CLOCK)); via1.irq_handler().set_inputline("maincpu", M6502_IRQ_LINE); - MCFG_DEVICE_ADD("pia6821", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, aim65_state, aim65_pia_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, aim65_state, aim65_pia_b_w)) + pia6821_device &pia(PIA6821(config, "pia6821", 0)); + pia.writepa_handler().set(FUNC(aim65_state::aim65_pia_a_w)); + pia.writepb_handler().set(FUNC(aim65_state::aim65_pia_b_w)); // Deck 1 can play and record MCFG_CASSETTE_ADD( "cassette" ) diff --git a/src/mame/drivers/allied.cpp b/src/mame/drivers/allied.cpp index 5bd376775ad..0729d7bc35a 100644 --- a/src/mame/drivers/allied.cpp +++ b/src/mame/drivers/allied.cpp @@ -634,55 +634,55 @@ MACHINE_CONFIG_START(allied_state::allied) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("ic1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, allied_state, ic1_a_r)) - //MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, allied_state, ic1_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, allied_state, ic1_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, allied_state, ic1_b_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(*this, allied_state, ic1_ca2_w)) - //MCFG_PIA_CB2_HANDLER(WRITELINE(*this, allied_state, ic1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - - MCFG_DEVICE_ADD("ic2", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, allied_state, ic2_a_r)) - //MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, allied_state, ic2_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, allied_state, ic2_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, allied_state, ic2_b_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(*this, allied_state, ic2_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, allied_state, ic2_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - - MCFG_DEVICE_ADD("ic4", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, allied_state, ic4_a_r)) - //MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, allied_state, ic4_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, allied_state, ic4_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, allied_state, ic4_b_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(*this, allied_state, ic4_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, allied_state, ic4_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - - MCFG_DEVICE_ADD("ic7", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, allied_state, ic7_a_r)) - //MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, allied_state, ic7_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, allied_state, ic7_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, allied_state, ic7_b_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(*this, allied_state, ic7_ca2_w)) - //MCFG_PIA_CB2_HANDLER(WRITELINE(*this, allied_state, ic7_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - - MCFG_DEVICE_ADD("ic8", PIA6821, 0) - //MCFG_PIA_READPA_HANDLER(READ8(*this, allied_state, ic8_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, allied_state, ic8_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, allied_state, ic8_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, allied_state, ic8_b_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(*this, allied_state, ic8_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, allied_state, ic8_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6504_IRQ_LINE)) + PIA6821(config, m_ic1, 0); + m_ic1->readpa_handler().set(FUNC(allied_state::ic1_a_r)); + //m_ic1->writepa_handler().set(FUNC(allied_state::ic1_a_w)); + //m_ic1->readpb_handler().set(FUNC(allied_state::ic1_b_r)); + m_ic1->writepb_handler().set(FUNC(allied_state::ic1_b_w)); + //m_ic1->ca2_handler().set(FUNC(allied_state::ic1_ca2_w)); + //m_ic1->cb2_handler().set(FUNC(allied_state::ic1_cb2_w)); + m_ic1->irqa_handler().set_inputline("maincpu", M6504_IRQ_LINE); + m_ic1->irqb_handler().set_inputline("maincpu", M6504_IRQ_LINE); + + PIA6821(config, m_ic2, 0); + m_ic2->readpa_handler().set(FUNC(allied_state::ic2_a_r)); + //m_ic2->writepa_handler().set(FUNC(allied_state::ic2_a_w)); + //m_ic2->readpb_handler().set(FUNC(allied_state::ic2_b_r)); + m_ic2->writepb_handler().set(FUNC(allied_state::ic2_b_w)); + //m_ic2->ca2_handler().set(FUNC(allied_state::ic2_ca2_w)); + m_ic2->cb2_handler().set(FUNC(allied_state::ic2_cb2_w)); + m_ic2->irqa_handler().set_inputline("maincpu", M6504_IRQ_LINE); + m_ic2->irqb_handler().set_inputline("maincpu", M6504_IRQ_LINE); + + PIA6821(config, m_ic4, 0); + m_ic4->readpa_handler().set(FUNC(allied_state::ic4_a_r)); + //m_ic4->writepa_handler().set(FUNC(allied_state::ic4_a_w)); + //m_ic4->readpb_handler().set(FUNC(allied_state::ic4_b_r)); + m_ic4->writepb_handler().set(FUNC(allied_state::ic4_b_w)); + //m_ic4->ca2_handler().set(FUNC(allied_state::ic4_ca2_w)); + m_ic4->cb2_handler().set(FUNC(allied_state::ic4_cb2_w)); + m_ic4->irqa_handler().set_inputline("maincpu", M6504_IRQ_LINE); + m_ic4->irqb_handler().set_inputline("maincpu", M6504_IRQ_LINE); + + PIA6821(config, m_ic7, 0); + m_ic7->readpa_handler().set(FUNC(allied_state::ic7_a_r)); + //m_ic7->writepa_handler().set(FUNC(allied_state::ic7_a_w)); + //m_ic7->readpb_handler().set(FUNC(allied_state::ic7_b_r)); + m_ic7->writepb_handler().set(FUNC(allied_state::ic7_b_w)); + //m_ic7->ca2_handler().set(FUNC(allied_state::ic7_ca2_w)); + //m_ic7->cb2_handler().set(FUNC(allied_state::ic7_cb2_w)); + m_ic7->irqa_handler().set_inputline("maincpu", M6504_IRQ_LINE); + m_ic7->irqb_handler().set_inputline("maincpu", M6504_IRQ_LINE); + + PIA6821(config, m_ic8, 0); + //m_ic8->readpa_handler().set(FUNC(allied_state::ic8_a_r)); + m_ic8->writepa_handler().set(FUNC(allied_state::ic8_a_w)); + //m_ic8->readpb_handler().set(FUNC(allied_state::ic8_b_r)); + m_ic8->writepb_handler().set(FUNC(allied_state::ic8_b_w)); + //m_ic8->ca2_handler().set(FUNC(allied_state::ic8_ca2_w)); + m_ic8->cb2_handler().set(FUNC(allied_state::ic8_cb2_w)); + m_ic8->irqa_handler().set_inputline("maincpu", M6504_IRQ_LINE); + m_ic8->irqb_handler().set_inputline("maincpu", M6504_IRQ_LINE); MCFG_DEVICE_ADD("ic3", MOS6530, 3572549/4) // unknown where the ram and i/o is located MCFG_MOS6530_OUT_PB_CB(WRITE8(*this, allied_state, ic3_b_w)) diff --git a/src/mame/drivers/apf.cpp b/src/mame/drivers/apf.cpp index 1b474bcd421..38f9b85fd60 100644 --- a/src/mame/drivers/apf.cpp +++ b/src/mame/drivers/apf.cpp @@ -540,13 +540,13 @@ MACHINE_CONFIG_START(apf_state::apfm1000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* Devices */ - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, apf_state, pia0_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, apf_state, pia0_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, apf_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("speaker", speaker_sound_device, level_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia0, 0); + m_pia0->readpa_handler().set(FUNC(apf_state::pia0_porta_r)); + m_pia0->writepb_handler().set(FUNC(apf_state::pia0_portb_w)); + m_pia0->ca2_handler().set(FUNC(apf_state::pia0_ca2_w)); + m_pia0->cb2_handler().set("speaker", FUNC(speaker_sound_device::level_w)); + m_pia0->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia0->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_APF_CARTRIDGE_ADD("cartslot", apf_cart, nullptr) @@ -566,10 +566,10 @@ MACHINE_CONFIG_START(apf_state::apfimag) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.15); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, apf_state, pia1_porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, apf_state, pia1_portb_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, apf_state, pia1_portb_w)) + PIA6821(config, m_pia1, 0); + m_pia1->readpa_handler().set(FUNC(apf_state::pia1_porta_r)); + m_pia1->readpb_handler().set(FUNC(apf_state::pia1_portb_r)); + m_pia1->writepb_handler().set(FUNC(apf_state::pia1_portb_w)); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_FORMATS(apf_cassette_formats) diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index 36b9ecf6fa3..8c9686eaa06 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -607,10 +607,10 @@ MACHINE_CONFIG_START(apple1_state::apple1) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD(m_pia, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, apple1_state, pia_keyboard_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, apple1_state, pia_display_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, apple1_state, pia_display_gate_w)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(apple1_state::pia_keyboard_r)); + m_pia->writepb_handler().set(FUNC(apple1_state::pia_display_w)); + m_pia->cb2_handler().set(FUNC(apple1_state::pia_display_gate_w)); MCFG_DEVICE_ADD(A1_BUS_TAG, A1BUS, 0) MCFG_A1BUS_CPU(m_maincpu) diff --git a/src/mame/drivers/arachnid.cpp b/src/mame/drivers/arachnid.cpp index a1ba74f71a3..5b8d993e697 100644 --- a/src/mame/drivers/arachnid.cpp +++ b/src/mame/drivers/arachnid.cpp @@ -431,21 +431,21 @@ MACHINE_CONFIG_START(arachnid_state::arachnid) MCFG_NVRAM_ADD_0FILL("nvram") // MK48Z02 (or DS1220Y) // devices - MCFG_DEVICE_ADD(PIA6821_U4_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, arachnid_state, pia_u4_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, arachnid_state, pia_u4_pb_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, arachnid_state, pia_u4_pca_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, arachnid_state, pia_u4_pcb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, arachnid_state, pia_u4_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, arachnid_state, pia_u4_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, arachnid_state, pia_u4_pca_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, arachnid_state, pia_u4_pcb_w)) - - MCFG_DEVICE_ADD(PIA6821_U17_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, arachnid_state, pia_u17_pa_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, arachnid_state, pia_u17_pca_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, arachnid_state, pia_u17_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, arachnid_state, pia_u17_pcb_w)) + PIA6821(config, m_pia_u4, 0); + m_pia_u4->readpa_handler().set(FUNC(arachnid_state::pia_u4_pa_r)); + m_pia_u4->readpb_handler().set(FUNC(arachnid_state::pia_u4_pb_r)); + m_pia_u4->readca1_handler().set(FUNC(arachnid_state::pia_u4_pca_r)); + m_pia_u4->readcb1_handler().set(FUNC(arachnid_state::pia_u4_pcb_r)); + m_pia_u4->writepa_handler().set(FUNC(arachnid_state::pia_u4_pa_w)); + m_pia_u4->writepb_handler().set(FUNC(arachnid_state::pia_u4_pb_w)); + m_pia_u4->ca2_handler().set(FUNC(arachnid_state::pia_u4_pca_w)); + m_pia_u4->cb2_handler().set(FUNC(arachnid_state::pia_u4_pcb_w)); + + PIA6821(config, m_pia_u17, 0); + m_pia_u17->readpa_handler().set(FUNC(arachnid_state::pia_u17_pa_r)); + m_pia_u17->readca1_handler().set(FUNC(arachnid_state::pia_u17_pca_r)); + m_pia_u17->writepb_handler().set(FUNC(arachnid_state::pia_u17_pb_w)); + m_pia_u17->cb2_handler().set(FUNC(arachnid_state::pia_u17_pcb_w)); // video hardware MCFG_DEVICE_ADD(TMS9118_TAG, TMS9118, 10.738635_MHz_XTAL / 2) diff --git a/src/mame/drivers/atari400.cpp b/src/mame/drivers/atari400.cpp index 199c2d1952f..42fa6703c76 100644 --- a/src/mame/drivers/atari400.cpp +++ b/src/mame/drivers/atari400.cpp @@ -2122,11 +2122,11 @@ MACHINE_CONFIG_START(a400_state::atari_common_nodac) MCFG_PALETTE_ADD("palette", sizeof(atari_palette) / 3) MCFG_PALETTE_INIT_OWNER(a400_state, a400) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("djoy_0_1")) - MCFG_PIA_READPB_HANDLER(IOPORT("djoy_2_3")) - MCFG_PIA_CA2_HANDLER(WRITELINE("a8sio", a8sio_device, motor_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("fdc", atari_fdc_device, pia_cb2_w)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set_ioport("djoy_0_1"); + m_pia->readpb_handler().set_ioport("djoy_2_3"); + m_pia->ca2_handler().set("a8sio", FUNC(a8sio_device::motor_w)); + m_pia->cb2_handler().set("fdc", FUNC(atari_fdc_device::pia_cb2_w)); MCFG_DEVICE_ADD("a8sio", A8SIO, 0) MCFG_A8SIO_DATA_IN_CB(WRITELINE("pokey", pokey_device, sid_w)) @@ -2268,8 +2268,7 @@ MACHINE_CONFIG_START(a400_state::a600xl) MCFG_DEVICE_PROGRAM_MAP(a600xl_mem) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1) - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, a400_state, a600xl_pia_pb_w)) + m_pia->writepb_handler().set(FUNC(a400_state::a600xl_pia_pb_w)); MCFG_MACHINE_START_OVERRIDE( a400_state, a800xl ) @@ -2293,8 +2292,7 @@ MACHINE_CONFIG_START(a400_state::a800xl) MCFG_DEVICE_PROGRAM_MAP(a800xl_mem) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1) - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, a400_state, a800xl_pia_pb_w)) + m_pia->writepb_handler().set(FUNC(a400_state::a800xl_pia_pb_w)); MCFG_MACHINE_START_OVERRIDE( a400_state, a800xl ) @@ -2336,8 +2334,7 @@ MACHINE_CONFIG_START(a400_state::a1200xl) MCFG_DEVICE_MODIFY( "maincpu" ) MCFG_DEVICE_PROGRAM_MAP(a1200xl_mem) - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, a400_state, a800xl_pia_pb_w)) + m_pia->writepb_handler().set(FUNC(a400_state::a800xl_pia_pb_w)); MACHINE_CONFIG_END @@ -2390,10 +2387,9 @@ MACHINE_CONFIG_START(a400_state::a5200) MCFG_DEVICE_ADD("antic", ATARI_ANTIC, 0) MCFG_ANTIC_GTIA("gtia") - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_READPA_HANDLER(CONSTANT(0)) // FIXME: is there anything connected here - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) // FIXME: is there anything connected here - MCFG_PIA_CB2_HANDLER(NOOP) // FIXME: is there anything connected here + m_pia->readpa_handler().set_constant(0); // FIXME: is there anything connected here + m_pia->readpb_handler().set_constant(0); // FIXME: is there anything connected here + m_pia->cb2_handler().set_nop(); // FIXME: is there anything connected here MCFG_MACHINE_START_OVERRIDE( a400_state, a5200 ) diff --git a/src/mame/drivers/attckufo.cpp b/src/mame/drivers/attckufo.cpp index 39741ed52a3..b2b120b85c4 100644 --- a/src/mame/drivers/attckufo.cpp +++ b/src/mame/drivers/attckufo.cpp @@ -123,9 +123,9 @@ MACHINE_CONFIG_START(attckufo_state::attckufo) MCFG_DEVICE_ADD("maincpu", M6502, XTAL(14'318'181) / 14) MCFG_DEVICE_PROGRAM_MAP(cpu_map) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("DSW")) - MCFG_PIA_READPB_HANDLER(IOPORT("INPUT")) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.readpa_handler().set_ioport("DSW"); + pia.readpb_handler().set_ioport("INPUT"); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/bitgraph.cpp b/src/mame/drivers/bitgraph.cpp index 21237ce2e44..78d2df89d78 100644 --- a/src/mame/drivers/bitgraph.cpp +++ b/src/mame/drivers/bitgraph.cpp @@ -542,13 +542,13 @@ MACHINE_CONFIG_START(bitgraph_state::bg_motherboard) m_dbrgb->fr_handler().set(FUNC(bitgraph_state::com8116_b_fr_w)); m_dbrgb->ft_handler().set(FUNC(bitgraph_state::com8116_b_ft_w)); - MCFG_DEVICE_ADD(PIA_TAG, PIA6821, 0) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, bitgraph_state, pia_ca1_r)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, bitgraph_state, pia_cb2_w)) - MCFG_PIA_READPA_HANDLER(READ8(*this, bitgraph_state, pia_pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, bitgraph_state, pia_pa_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, bitgraph_state, pia_pb_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, bitgraph_state, pia_pb_w)) + PIA6821(config, m_pia, 0); + m_pia->readca1_handler().set(FUNC(bitgraph_state::pia_ca1_r)); + m_pia->cb2_handler().set(FUNC(bitgraph_state::pia_cb2_w)); + m_pia->readpa_handler().set(FUNC(bitgraph_state::pia_pa_r)); + m_pia->writepa_handler().set(FUNC(bitgraph_state::pia_pa_w)); + m_pia->readpb_handler().set(FUNC(bitgraph_state::pia_pb_r)); + m_pia->writepb_handler().set(FUNC(bitgraph_state::pia_pb_w)); MCFG_DEVICE_ADD(EAROM_TAG, ER2055, 0) diff --git a/src/mame/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp index e3a01365976..b5d92340ccd 100644 --- a/src/mame/drivers/bml3.cpp +++ b/src/mame/drivers/bml3.cpp @@ -999,8 +999,8 @@ MACHINE_CONFIG_START(bml3_state::bml3_common) MCFG_TIMER_DRIVER_ADD_PERIODIC("bml3_c", bml3_state, bml3_c, attotime::from_hz(4800)) MCFG_TIMER_DRIVER_ADD_PERIODIC("bml3_p", bml3_state, bml3_p, attotime::from_hz(40000)) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, bml3_state, bml3_piaA_w)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.writepa_handler().set(FUNC(bml3_state::bml3_piaA_w)); MCFG_DEVICE_ADD("acia", ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, bml3_state, bml3_acia_tx_w)) diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index f70f93174d3..0afe1d4d81e 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -581,13 +581,13 @@ MACHINE_CONFIG_START(bw12_state::common) MCFG_TIMER_DRIVER_ADD(FLOPPY_TIMER_TAG, bw12_state, floppy_motor_off_tick) MCFG_UPD765A_ADD(UPD765_TAG, false, true) - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, bw12_state, pia_pa_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("cent_data_out", output_latch_device, bus_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, bw12_state, pia_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(bw12_state::pia_pa_r)); + m_pia->writepb_handler().set("cent_data_out", FUNC(output_latch_device::bus_w)); + m_pia->ca2_handler().set(CENTRONICS_TAG, FUNC(centronics_device::write_strobe)); + m_pia->cb2_handler().set(FUNC(bw12_state::pia_cb2_w)); + m_pia->irqa_handler().set_inputline(Z80_TAG, INPUT_LINE_IRQ0); + m_pia->irqb_handler().set_inputline(Z80_TAG, INPUT_LINE_IRQ0); MCFG_DEVICE_ADD(Z80SIO_TAG, Z80SIO0, XTAL(16'000'000)/4) MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) diff --git a/src/mame/drivers/by17.cpp b/src/mame/drivers/by17.cpp index 7ffbc648a1c..fc5f683052e 100644 --- a/src/mame/drivers/by17.cpp +++ b/src/mame/drivers/by17.cpp @@ -1007,30 +1007,30 @@ MACHINE_CONFIG_START(by17_state::by17) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia_u10", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by17_state, u10_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by17_state, u10_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, by17_state, u10_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by17_state, u10_b_w)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, by17_state, u10_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, by17_state, u10_cb1_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by17_state, u10_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by17_state, u10_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u10, 0); + m_pia_u10->readpa_handler().set(FUNC(by17_state::u10_a_r)); + m_pia_u10->writepa_handler().set(FUNC(by17_state::u10_a_w)); + m_pia_u10->readpb_handler().set(FUNC(by17_state::u10_b_r)); + m_pia_u10->writepb_handler().set(FUNC(by17_state::u10_b_w)); + m_pia_u10->readca1_handler().set(FUNC(by17_state::u10_ca1_r)); + m_pia_u10->readcb1_handler().set(FUNC(by17_state::u10_cb1_r)); + m_pia_u10->ca2_handler().set(FUNC(by17_state::u10_ca2_w)); + m_pia_u10->cb2_handler().set(FUNC(by17_state::u10_cb2_w)); + m_pia_u10->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u10->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_z_freq", by17_state, timer_z_freq, attotime::from_hz(100)) // Mains Line Frequency * 2 MCFG_TIMER_DRIVER_ADD(m_zero_crossing_active_timer, by17_state, timer_z_pulse) // Active pulse length from Zero Crossing detector - MCFG_DEVICE_ADD("pia_u11", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by17_state, u11_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by17_state, u11_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by17_state, u11_b_w)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, by17_state, u11_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, by17_state, u11_cb1_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by17_state, u11_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by17_state, u11_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u11, 0); + m_pia_u11->readpa_handler().set(FUNC(by17_state::u11_a_r)); + m_pia_u11->writepa_handler().set(FUNC(by17_state::u11_a_w)); + m_pia_u11->writepb_handler().set(FUNC(by17_state::u11_b_w)); + m_pia_u11->readca1_handler().set(FUNC(by17_state::u11_ca1_r)); + m_pia_u11->readcb1_handler().set(FUNC(by17_state::u11_cb1_r)); + m_pia_u11->ca2_handler().set(FUNC(by17_state::u11_ca2_w)); + m_pia_u11->cb2_handler().set(FUNC(by17_state::u11_cb2_w)); + m_pia_u11->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u11->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_d_freq", by17_state, u11_timer, attotime::from_hz(317)) // 555 timer MCFG_TIMER_DRIVER_ADD(m_display_refresh_timer, by17_state, timer_d_pulse) // 555 Active pulse length MACHINE_CONFIG_END diff --git a/src/mame/drivers/by35.cpp b/src/mame/drivers/by35.cpp index 09b9e6788cd..bdcbb3630bc 100644 --- a/src/mame/drivers/by35.cpp +++ b/src/mame/drivers/by35.cpp @@ -163,7 +163,7 @@ protected: static solenoid_feature_data const s_solenoid_features_default; -private: +protected: bool m_u10_ca2; bool m_u10_cb1; bool m_u10_cb2; @@ -1106,30 +1106,30 @@ MACHINE_CONFIG_START(by35_state::by35) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia_u10", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by35_state, u10_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by35_state, u10_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, by35_state, u10_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by35_state, u10_b_w)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, by35_state, u10_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, by35_state, u10_cb1_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by35_state, u10_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by35_state, u10_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u10, 0); + m_pia_u10->readpa_handler().set(FUNC(by35_state::u10_a_r)); + m_pia_u10->writepa_handler().set(FUNC(by35_state::u10_a_w)); + m_pia_u10->readpb_handler().set(FUNC(by35_state::u10_b_r)); + m_pia_u10->writepb_handler().set(FUNC(by35_state::u10_b_w)); + m_pia_u10->readca1_handler().set(FUNC(by35_state::u10_ca1_r)); + m_pia_u10->readcb1_handler().set(FUNC(by35_state::u10_cb1_r)); + m_pia_u10->ca2_handler().set(FUNC(by35_state::u10_ca2_w)); + m_pia_u10->cb2_handler().set(FUNC(by35_state::u10_cb2_w)); + m_pia_u10->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u10->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_z_freq", by35_state, timer_z_freq, attotime::from_hz(100)) // Mains Line Frequency * 2 MCFG_TIMER_DRIVER_ADD(m_zero_crossing_active_timer, by35_state, timer_z_pulse) // Active pulse length from Zero Crossing detector - MCFG_DEVICE_ADD("pia_u11", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by35_state, u11_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by35_state, u11_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by35_state, u11_b_w)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, by35_state, u11_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, by35_state, u11_cb1_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by35_state, u11_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by35_state, u11_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u11, 0); + m_pia_u11->readpa_handler().set(FUNC(by35_state::u11_a_r)); + m_pia_u11->writepa_handler().set(FUNC(by35_state::u11_a_w)); + m_pia_u11->writepb_handler().set(FUNC(by35_state::u11_b_w)); + m_pia_u11->readca1_handler().set(FUNC(by35_state::u11_ca1_r)); + m_pia_u11->readcb1_handler().set(FUNC(by35_state::u11_cb1_r)); + m_pia_u11->ca2_handler().set(FUNC(by35_state::u11_ca2_w)); + m_pia_u11->cb2_handler().set(FUNC(by35_state::u11_cb2_w)); + m_pia_u11->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u11->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_d_freq", by35_state, u11_timer, attotime::from_hz(317)) // 555 timer MCFG_TIMER_DRIVER_ADD(m_display_refresh_timer, by35_state, timer_d_pulse) // 555 Active pulse length MACHINE_CONFIG_END @@ -1139,9 +1139,8 @@ MACHINE_CONFIG_START(as2888_state::as2888_audio) MCFG_DEVICE_ADD("discrete", DISCRETE, as2888_discrete) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_DEVICE_MODIFY("pia_u11") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, as2888_state, u11_b_as2888_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, as2888_state, u11_cb2_as2888_w)) + m_pia_u11->writepb_handler().set(FUNC(as2888_state::u11_b_as2888_w)); + m_pia_u11->cb2_handler().set(FUNC(as2888_state::u11_cb2_as2888_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_s_freq", as2888_state, timer_s, attotime::from_hz(353000)) // Inverter clock on AS-2888 sound board MCFG_TIMER_DRIVER_ADD(m_snd_sustain_timer, as2888_state, timer_as2888) diff --git a/src/mame/drivers/by6803.cpp b/src/mame/drivers/by6803.cpp index 6ee61feeeed..c277bcac59f 100644 --- a/src/mame/drivers/by6803.cpp +++ b/src/mame/drivers/by6803.cpp @@ -393,22 +393,22 @@ MACHINE_CONFIG_START(by6803_state::by6803) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by6803_state, pia0_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by6803_state, pia0_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, by6803_state, pia0_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by6803_state, pia0_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by6803_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by6803_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6803_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6803_IRQ_LINE)) + PIA6821(config, m_pia0, 0); + m_pia0->readpa_handler().set(FUNC(by6803_state::pia0_a_r)); + m_pia0->writepa_handler().set(FUNC(by6803_state::pia0_a_w)); + m_pia0->readpb_handler().set(FUNC(by6803_state::pia0_b_r)); + m_pia0->writepb_handler().set(FUNC(by6803_state::pia0_b_w)); + m_pia0->ca2_handler().set(FUNC(by6803_state::pia0_ca2_w)); + m_pia0->cb2_handler().set(FUNC(by6803_state::pia0_cb2_w)); + m_pia0->irqa_handler().set_inputline("maincpu", M6803_IRQ_LINE); + m_pia0->irqb_handler().set_inputline("maincpu", M6803_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_z", by6803_state, pia0_timer, attotime::from_hz(120)) // mains freq*2 - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by6803_state, pia1_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by6803_state, pia1_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by6803_state, pia1_b_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by6803_state, pia1_cb2_w)) + PIA6821(config, m_pia1, 0); + m_pia1->readpa_handler().set(FUNC(by6803_state::pia1_a_r)); + m_pia1->writepa_handler().set(FUNC(by6803_state::pia1_a_w)); + m_pia1->writepb_handler().set(FUNC(by6803_state::pia1_b_w)); + m_pia1->cb2_handler().set(FUNC(by6803_state::pia1_cb2_w)); //MCFG_SPEAKER_STANDARD_MONO("speaker") //MCFG_DEVICE_ADD("tcs", MIDWAY_TURBO_CHEAP_SQUEAK) // Cheap Squeak Turbo diff --git a/src/mame/drivers/byvid.cpp b/src/mame/drivers/byvid.cpp index 0043cfa403b..ed59a208312 100644 --- a/src/mame/drivers/byvid.cpp +++ b/src/mame/drivers/byvid.cpp @@ -767,36 +767,36 @@ MACHINE_CONFIG_START(by133_state::babypac) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia_u7", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by133_state, u7_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by133_state, u7_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, by133_state, u7_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by133_state, u7_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by133_state, u7_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by133_state, u7_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("videocpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("videocpu", M6809_FIRQ_LINE)) - - MCFG_DEVICE_ADD("pia_u10", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by133_state, u10_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by133_state, u10_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, by133_state, u10_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by133_state, u10_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by133_state, u10_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by133_state, u10_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u7, 0); + m_pia_u7->readpa_handler().set(FUNC(by133_state::u7_a_r)); + m_pia_u7->writepa_handler().set(FUNC(by133_state::u7_a_w)); + m_pia_u7->readpb_handler().set(FUNC(by133_state::u7_b_r)); + m_pia_u7->writepb_handler().set(FUNC(by133_state::u7_b_w)); + m_pia_u7->ca2_handler().set(FUNC(by133_state::u7_ca2_w)); + m_pia_u7->cb2_handler().set(FUNC(by133_state::u7_cb2_w)); + m_pia_u7->irqa_handler().set_inputline("videocpu", M6809_FIRQ_LINE); + m_pia_u7->irqa_handler().set_inputline("videocpu", M6809_FIRQ_LINE); + + PIA6821(config, m_pia_u10, 0); + m_pia_u10->readpa_handler().set(FUNC(by133_state::u10_a_r)); + m_pia_u10->writepa_handler().set(FUNC(by133_state::u10_a_w)); + m_pia_u10->readpb_handler().set(FUNC(by133_state::u10_b_r)); + m_pia_u10->writepb_handler().set(FUNC(by133_state::u10_b_w)); + m_pia_u10->ca2_handler().set(FUNC(by133_state::u10_ca2_w)); + m_pia_u10->cb2_handler().set(FUNC(by133_state::u10_cb2_w)); + m_pia_u10->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u10->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("babypac1", by133_state, u10_timer, attotime::from_hz(120)) // mains freq*2 - MCFG_DEVICE_ADD("pia_u11", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, by133_state, u11_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, by133_state, u11_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, by133_state, u11_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, by133_state, u11_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, by133_state, u11_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, by133_state, u11_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u11, 0); + m_pia_u11->readpa_handler().set(FUNC(by133_state::u11_a_r)); + m_pia_u11->writepa_handler().set(FUNC(by133_state::u11_a_w)); + m_pia_u11->readpb_handler().set(FUNC(by133_state::u11_b_r)); + m_pia_u11->writepb_handler().set(FUNC(by133_state::u11_b_w)); + m_pia_u11->ca2_handler().set(FUNC(by133_state::u11_ca2_w)); + m_pia_u11->cb2_handler().set(FUNC(by133_state::u11_cb2_w)); + m_pia_u11->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u11->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("babypac2", by133_state, u11_timer, attotime::from_hz(634)) // 555 timer*2 /* video hardware */ diff --git a/src/mame/drivers/calomega.cpp b/src/mame/drivers/calomega.cpp index 06e19138401..4342a033fa5 100644 --- a/src/mame/drivers/calomega.cpp +++ b/src/mame/drivers/calomega.cpp @@ -644,7 +644,6 @@ #include "cpu/m6502/m6502.h" #include "cpu/m6502/m65c02.h" -#include "machine/6821pia.h" #include "machine/nvram.h" #include "sound/ay8910.h" #include "video/mc6845.h" @@ -2579,14 +2578,14 @@ MACHINE_CONFIG_START(calomega_state::sys903) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, calomega_state,s903_mux_port_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, calomega_state,lamps_903a_w)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set(FUNC(calomega_state::s903_mux_port_r)); + m_pia[0]->writepb_handler().set(FUNC(calomega_state::lamps_903a_w)); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("SW1")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, calomega_state, lamps_903b_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, calomega_state, s903_mux_w)) + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpa_handler().set_ioport("SW1"); + m_pia[1]->writepa_handler().set(FUNC(calomega_state::lamps_903b_w)); + m_pia[1]->writepb_handler().set(FUNC(calomega_state::s903_mux_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2646,12 +2645,10 @@ MACHINE_CONFIG_START(calomega_state::sys905) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(sys905_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, calomega_state,s905_mux_port_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, calomega_state,lamps_905_w)) + m_pia[0]->readpa_handler().set(FUNC(calomega_state::s905_mux_port_r)); + m_pia[0]->writepb_handler().set(FUNC(calomega_state::lamps_905_w)); - MCFG_DEVICE_MODIFY("pia1") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, calomega_state, s905_mux_w)) + m_pia[1]->writepb_handler().set(FUNC(calomega_state::s905_mux_w)); /* sound hardware */ MCFG_DEVICE_MODIFY("ay8912") @@ -2671,18 +2668,16 @@ MACHINE_CONFIG_START(calomega_state::sys906) MCFG_DEVICE_REPLACE("maincpu", M65C02, CPU_CLOCK) /* guess */ MCFG_DEVICE_PROGRAM_MAP(sys906_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, calomega_state, pia0_ain_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, calomega_state, pia0_bin_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, calomega_state, pia0_aout_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, calomega_state, pia0_bout_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, calomega_state, pia0_ca2_w)) - - MCFG_DEVICE_MODIFY("pia1") - MCFG_PIA_READPA_HANDLER(READ8(*this, calomega_state, pia1_ain_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, calomega_state, pia1_bin_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, calomega_state, pia1_aout_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, calomega_state, pia1_bout_w)) + m_pia[0]->readpa_handler().set(FUNC(calomega_state::pia0_ain_r)); + m_pia[0]->readpb_handler().set(FUNC(calomega_state::pia0_bin_r)); + m_pia[0]->writepa_handler().set(FUNC(calomega_state::pia0_aout_w)); + m_pia[0]->writepb_handler().set(FUNC(calomega_state::pia0_bout_w)); + m_pia[0]->ca2_handler().set(FUNC(calomega_state::pia0_ca2_w)); + + m_pia[1]->readpa_handler().set(FUNC(calomega_state::pia1_ain_r)); + m_pia[1]->readpb_handler().set(FUNC(calomega_state::pia1_bin_r)); + m_pia[1]->writepa_handler().set(FUNC(calomega_state::pia1_aout_w)); + m_pia[1]->writepb_handler().set(FUNC(calomega_state::pia1_bout_w)); MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_sys906) diff --git a/src/mame/drivers/candela.cpp b/src/mame/drivers/candela.cpp index a06804da965..89656e53a05 100644 --- a/src/mame/drivers/candela.cpp +++ b/src/mame/drivers/candela.cpp @@ -674,11 +674,11 @@ MACHINE_CONFIG_START(can09t_state::can09t) MCFG_DEVICE_PROGRAM_MAP(can09t_map) /* --PIA inits----------------------- */ - MCFG_DEVICE_ADD(SYSPIA_TAG, PIA6821, 0) // CPU board - MCFG_PIA_READPA_HANDLER(READ8(*this, can09t_state, syspia_A_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, can09t_state, syspia_B_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, can09t_state, syspia_B_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, can09t_state, syspia_cb2_w)) + PIA6821(config, m_syspia, 0); // CPU board + m_syspia->readpa_handler().set(FUNC(can09t_state::syspia_A_r)); + m_syspia->readpb_handler().set(FUNC(can09t_state::syspia_B_r)); + m_syspia->writepb_handler().set(FUNC(can09t_state::syspia_B_w)); + m_syspia->cb2_handler().set(FUNC(can09t_state::syspia_cb2_w)); /* 0xE1FB 0xB112 (SYSPIA Control A) = 0x00 - Channel A IRQ disabled */ /* 0xE1FB 0xB113 (SYSPIA Control B) = 0x00 - Channel B IRQ disabled */ /* 0xE203 0xB110 (SYSPIA DDR A) = 0x00 - Port A all inputs */ @@ -686,16 +686,17 @@ MACHINE_CONFIG_START(can09t_state::can09t) /* 0xE20A 0xB112 (SYSPIA Control A) = 0x05 - IRQ A enabled on falling transition on CA2 */ /* 0xE20A 0xB113 (SYSPIA Control B) = 0x34 - CB2 is low and lock DDRB */ /* 0xE20E 0xB111 (SYSPIA port B) = 0x10 - Data to port B */ - MCFG_DEVICE_ADD(USRPIA_TAG, PIA6821, 0) // CPU board - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, can09t_state, usrpia_cb2_w)) + + PIA6821(config, m_usrpia, 0); // CPU board + m_usrpia->cb2_handler().set(FUNC(can09t_state::usrpia_cb2_w)); /* 0xE212 0xB122 (USRPIA Control A) = 0x00 - Channel A IRQ disabled */ /* 0xE212 0xB123 (USRPIA Control B) = 0x00 - Channel B IRQ disabled */ /* 0xE215 0xB120 (USRPIA DDR A) = 0x00 - Port A all inputs */ /* 0xE215 0xB121 (USRPIA DDR B) = 0xFF - Port B all outputs */ /* 0xE21A 0xB122 (USRPIA Control A) = 0x34 - CA2 is low and lock DDRB */ /* 0xE21A 0xB123 (USRPIA Control B) = 0x34 - CB2 is low and lock DDRB */ - MCFG_DEVICE_ADD(PIA3_TAG, PIA6821, 0) // ROM board - MCFG_DEVICE_ADD(PIA4_TAG, PIA6821, 0) // ROM board + PIA6821(config, m_pia3, 0); // ROM board + PIA6821(config, m_pia4, 0); // ROM board MCFG_DEVICE_ADD("ptm", PTM6840, 0) @@ -766,12 +767,12 @@ MACHINE_CONFIG_START(can09_state::can09) #endif /* --PIA inits----------------------- */ - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) // CPU board - MCFG_PIA_READPA_HANDLER(READ8(*this, can09_state, pia1_A_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, can09_state, pia1_A_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, can09_state, pia1_B_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, can09_state, pia1_B_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, can09_state, pia1_cb2_w)) + PIA6821(config, m_pia1, 0); // CPU board + m_pia1->readpa_handler().set(FUNC(can09_state::pia1_A_r)); + m_pia1->writepa_handler().set(FUNC(can09_state::pia1_A_w)); + m_pia1->readpb_handler().set(FUNC(can09_state::pia1_B_r)); + m_pia1->writepb_handler().set(FUNC(can09_state::pia1_B_w)); + m_pia1->cb2_handler().set(FUNC(can09_state::pia1_cb2_w)); /* 0xFF7D 0xE035 (PIA1 Control A) = 0x00 - Channel A IRQ disabled */ /* 0xFF81 0xE037 (PIA1 Control B) = 0x00 - Channel A IRQ disabled */ /* 0xFF85 0xE034 (PIA1 DDR A) = 0x1F - Port A mixed mode */ diff --git a/src/mame/drivers/carpolo.cpp b/src/mame/drivers/carpolo.cpp index 724dc318bcd..fdc72d92a86 100644 --- a/src/mame/drivers/carpolo.cpp +++ b/src/mame/drivers/carpolo.cpp @@ -241,18 +241,18 @@ MACHINE_CONFIG_START(carpolo_state::carpolo) but it's supposed to happen 60 times a sec, so it's a good place */ - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, carpolo_state, pia_0_port_b_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, carpolo_state, pia_0_port_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, carpolo_state, pia_0_port_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, carpolo_state, coin1_interrupt_clear_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, carpolo_state,coin2_interrupt_clear_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, carpolo_state, pia_1_port_a_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, carpolo_state, pia_1_port_b_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, carpolo_state, coin3_interrupt_clear_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, carpolo_state, coin4_interrupt_clear_w)) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpb_handler().set(FUNC(carpolo_state::pia_0_port_b_r)); + pia0.writepa_handler().set(FUNC(carpolo_state::pia_0_port_a_w)); + pia0.writepb_handler().set(FUNC(carpolo_state::pia_0_port_b_w)); + pia0.ca2_handler().set(FUNC(carpolo_state::carpolo_state::coin1_interrupt_clear_w)); + pia0.cb2_handler().set(FUNC(carpolo_state::carpolo_state::coin2_interrupt_clear_w)); + + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia0.readpa_handler().set(FUNC(carpolo_state::pia_1_port_a_r)); + pia0.readpb_handler().set(FUNC(carpolo_state::pia_1_port_b_r)); + pia1.ca2_handler().set(FUNC(carpolo_state::coin3_interrupt_clear_w)); + pia1.cb2_handler().set(FUNC(carpolo_state::coin4_interrupt_clear_w)); MCFG_DEVICE_ADD(m_ttl7474_2s_1, TTL7474, 0) MCFG_7474_COMP_OUTPUT_CB(WRITELINE(*this, carpolo_state, carpolo_7474_2s_1_q_cb)) diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index 3788e4d774a..be15f529a3e 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -2223,30 +2223,31 @@ 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)) - MCFG_DEVICE_ADD("q133_pia_1", PIA6821, 0) // pia_q133_1_config - MCFG_PIA_READPA_HANDLER(READ8(*this, cmi_state, q133_1_porta_r)); - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, cmi_state, q133_1_porta_w)); - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, 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 - MCFG_DEVICE_ADD("q133_pia_2", PIA6821, 0) // pia_q133_2_config MCFG_DEVICE_ADD("q133_ptm", PTM6840, 2000000) // ptm_q133_config MCFG_PTM6840_EXTERNAL_CLOCKS(1024, 1, 111) // Third is todo - MCFG_DEVICE_ADD("q219_pia", PIA6821, 0) // pia_q219_config - MCFG_PIA_READPB_HANDLER(READ8(*this, cmi_state, pia_q219_b_r)); - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, cmi_state, vscroll_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, cmi_state, video_attr_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, cmi_state, pia_q219_irqa)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, cmi_state, pia_q219_irqb)) + PIA6821(config, m_q219_pia, 0); // pia_q219_config + m_q219_pia->readpb_handler().set(FUNC(cmi_state::pia_q219_b_r)); + m_q219_pia->writepa_handler().set(FUNC(cmi_state::vscroll_w)); + m_q219_pia->writepb_handler().set(FUNC(cmi_state::video_attr_w)); + m_q219_pia->irqa_handler().set(FUNC(cmi_state::pia_q219_irqa)); + m_q219_pia->irqb_handler().set(FUNC(cmi_state::pia_q219_irqb)); MCFG_DEVICE_ADD("q219_ptm", PTM6840, 2000000) // ptm_q219_config MCFG_PTM6840_EXTERNAL_CLOCKS(HBLANK_FREQ.dvalue(), VBLANK_FREQ.dvalue(), 1'000'000) // TODO: does the third thing come from a crystal? MCFG_PTM6840_IRQ_CB(WRITELINE(*this, cmi_state, ptm_q219_irq)) - MCFG_DEVICE_ADD("cmi02_pia_1", PIA6821, 0) // pia_cmi02_1_config - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, 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)); - MCFG_DEVICE_ADD("cmi02_pia_2", PIA6821, 0) // pia_cmi02_2_config + PIA6821(config, m_cmi02_pia_1, 0); // pia_cmi02_2_config MCFG_DEVICE_ADD("cmi02_ptm", PTM6840, 2000000) // ptm_cmi02_config TODO MCFG_PTM6840_O2_CB(WRITELINE(*this, cmi_state, cmi02_ptm_o2)) @@ -2276,7 +2277,7 @@ MACHINE_CONFIG_START(cmi_state::cmi2x) MCFG_DEVICE_ADD("acia_mkbd_kbd", ACIA6850, 1.8432_MHz_XTAL / 12) // acia_mkbd_kbd MCFG_DEVICE_ADD("acia_mkbd_cmi", ACIA6850, 1.8432_MHz_XTAL / 12) // acia_mkbd_cmi - MCFG_DEVICE_ADD("ank_pia", PIA6821, 0) // pia_ank_config + 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)) @@ -2295,13 +2296,12 @@ MACHINE_CONFIG_START(cmi_state::cmi2x) MCFG_INPUT_MERGER_ANY_HIGH("irqs") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("alphakeys", M6802_IRQ_LINE)) - MCFG_DEVICE_MODIFY("ank_pia") - MCFG_PIA_READPA_HANDLER(READ8(*this, cmi_state, ank_col_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, cmi_state, ank_rts_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE("acia_mkbd_kbd", acia6850_device, write_cts)) - MCFG_PIA_CB2_HANDLER(WRITELINE("acia_mkbd_kbd", acia6850_device, write_rxd)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("irqs", input_merger_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("irqs", input_merger_device, in_w<1>)) + m_ank_pia->readpa_handler().set(FUNC(cmi_state::ank_col_r)); + m_ank_pia->readcb1_handler().set(FUNC(cmi_state::ank_rts_r)); + m_ank_pia->ca2_handler().set("acia_mkbd_kbd", FUNC(acia6850_device::write_cts)); + m_ank_pia->cb2_handler().set("acia_mkbd_kbd", FUNC(acia6850_device::write_rxd)); + m_ank_pia->irqa_handler().set("irqs", FUNC(input_merger_device::in_w<0>)); + m_ank_pia->irqb_handler().set("irqs", FUNC(input_merger_device::in_w<1>)); MCFG_DEVICE_ADD("ank_pia_clock", CLOCK, 9600) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ank_pia", pia6821_device, ca1_w)) @@ -2316,15 +2316,15 @@ MACHINE_CONFIG_START(cmi_state::cmi2x) MCFG_FLOPPY_DRIVE_ADD("wd1791:1", cmi2x_floppies, "8dsdd", floppy_image_device::default_floppy_formats) /* Musical keyboard */ - MCFG_DEVICE_ADD("cmi10_pia_u20", PIA6821, 0) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, cmi_state, cmi10_u20_cb1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, cmi_state, cmi10_u20_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, cmi_state, cmi10_u20_b_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, cmi_state, cmi10_u20_cb2_w)) - - MCFG_DEVICE_ADD("cmi10_pia_u21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, cmi_state, cmi10_u21_a_r)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, cmi_state, cmi10_u21_cb2_w)) + PIA6821(config, m_cmi10_pia_u20, 0); + m_cmi10_pia_u20->readcb1_handler().set(FUNC(cmi_state::cmi10_u20_cb1_r)); + m_cmi10_pia_u20->writepa_handler().set(FUNC(cmi_state::cmi10_u20_a_w)); + m_cmi10_pia_u20->writepb_handler().set(FUNC(cmi_state::cmi10_u20_b_w)); + m_cmi10_pia_u20->cb2_handler().set(FUNC(cmi_state::cmi10_u20_cb2_w)); + + PIA6821(config, m_cmi10_pia_u21, 0); + m_cmi10_pia_u21->readpa_handler().set(FUNC(cmi_state::cmi10_u21_a_r)); + m_cmi10_pia_u21->cb2_handler().set(FUNC(cmi_state::cmi10_u21_cb2_w)); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/coco12.cpp b/src/mame/drivers/coco12.cpp index b9e22c24f8c..7bfcd8a4fc8 100644 --- a/src/mame/drivers/coco12.cpp +++ b/src/mame/drivers/coco12.cpp @@ -442,23 +442,23 @@ MACHINE_CONFIG_START(coco12_state::coco) MCFG_DEVICE_DISASSEMBLE_OVERRIDE(coco_state, dasm_override) // devices - MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, coco_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, coco_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, coco_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia0_irq_b)) - - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, coco_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, coco_state, pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, coco_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, coco_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, coco_state, pia1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia1_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia1_firq_b)) + pia6821_device &pia0(PIA6821(config, PIA0_TAG, 0)); + pia0.writepa_handler().set(FUNC(coco_state::pia0_pa_w)); + pia0.writepb_handler().set(FUNC(coco_state::pia0_pb_w)); + pia0.ca2_handler().set(FUNC(coco_state::pia0_ca2_w)); + pia0.cb2_handler().set(FUNC(coco_state::pia0_cb2_w)); + pia0.irqa_handler().set(FUNC(coco_state::pia0_irq_a)); + pia0.irqb_handler().set(FUNC(coco_state::pia0_irq_b)); + + pia6821_device &pia1(PIA6821(config, PIA1_TAG, 0)); + pia1.readpa_handler().set(FUNC(coco_state::pia1_pa_r)); + pia1.readpb_handler().set(FUNC(coco_state::pia1_pb_r)); + pia1.writepa_handler().set(FUNC(coco_state::pia1_pa_w)); + pia1.writepb_handler().set(FUNC(coco_state::pia1_pb_w)); + pia1.ca2_handler().set(FUNC(coco_state::pia1_ca2_w)); + pia1.cb2_handler().set(FUNC(coco_state::pia1_cb2_w)); + pia1.irqa_handler().set(FUNC(coco_state::pia1_firq_a)); + pia1.irqb_handler().set(FUNC(coco_state::pia1_firq_b)); MCFG_DEVICE_ADD(SAM_TAG, SAM6883, XTAL(14'318'181), MAINCPU_TAG) MCFG_SAM6883_RES_CALLBACK(READ8(*this, coco12_state, sam_read)) diff --git a/src/mame/drivers/coco3.cpp b/src/mame/drivers/coco3.cpp index 4ee4a33c1bb..e614e453424 100644 --- a/src/mame/drivers/coco3.cpp +++ b/src/mame/drivers/coco3.cpp @@ -252,23 +252,23 @@ MACHINE_CONFIG_START(coco3_state::coco3) MCFG_DEVICE_DISASSEMBLE_OVERRIDE(coco_state, dasm_override) // devices - MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, coco_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, coco_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, coco_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia0_irq_b)) - - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, coco_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, coco_state, pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, coco_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, coco_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, coco_state, pia1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia1_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia1_firq_b)) + pia6821_device &pia0(PIA6821(config, PIA0_TAG, 0)); + pia0.writepa_handler().set(FUNC(coco_state::pia0_pa_w)); + pia0.writepb_handler().set(FUNC(coco_state::pia0_pb_w)); + pia0.ca2_handler().set(FUNC(coco_state::pia0_ca2_w)); + pia0.cb2_handler().set(FUNC(coco_state::pia0_cb2_w)); + pia0.irqa_handler().set(FUNC(coco_state::pia0_irq_a)); + pia0.irqb_handler().set(FUNC(coco_state::pia0_irq_b)); + + pia6821_device &pia1(PIA6821(config, PIA1_TAG, 0)); + pia1.readpa_handler().set(FUNC(coco_state::pia1_pa_r)); + pia1.readpb_handler().set(FUNC(coco_state::pia1_pb_r)); + pia1.writepa_handler().set(FUNC(coco_state::pia1_pa_w)); + pia1.writepb_handler().set(FUNC(coco_state::pia1_pb_w)); + pia1.ca2_handler().set(FUNC(coco_state::pia1_ca2_w)); + pia1.cb2_handler().set(FUNC(coco_state::pia1_cb2_w)); + pia1.irqa_handler().set(FUNC(coco_state::pia1_firq_a)); + pia1.irqb_handler().set(FUNC(coco_state::pia1_firq_b)); // Becker Port device MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0) diff --git a/src/mame/drivers/coinmstr.cpp b/src/mame/drivers/coinmstr.cpp index dfc087e0b72..6ab47125c63 100644 --- a/src/mame/drivers/coinmstr.cpp +++ b/src/mame/drivers/coinmstr.cpp @@ -1260,17 +1260,17 @@ MACHINE_CONFIG_START(coinmstr_state::coinmstr) MCFG_DEVICE_PROGRAM_MAP(coinmstr_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", coinmstr_state, irq0_line_hold) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("PIA0.A")) - MCFG_PIA_READPB_HANDLER(IOPORT("PIA0.B")) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpa_handler().set_ioport("PIA0.A"); + pia0.readpb_handler().set_ioport("PIA0.B"); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("PIA1.A")) - MCFG_PIA_READPB_HANDLER(IOPORT("PIA1.B")) + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.readpa_handler().set_ioport("PIA1.A"); + pia1.readpb_handler().set_ioport("PIA1.B"); - MCFG_DEVICE_ADD("pia2", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("PIA2.A")) - MCFG_PIA_READPB_HANDLER(IOPORT("PIA2.B")) + pia6821_device &pia2(PIA6821(config, "pia2", 0)); + pia2.readpa_handler().set_ioport("PIA2.A"); + pia2.readpb_handler().set_ioport("PIA2.B"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/crvision.cpp b/src/mame/drivers/crvision.cpp index 9fa5059cd66..7ba227e3e09 100644 --- a/src/mame/drivers/crvision.cpp +++ b/src/mame/drivers/crvision.cpp @@ -743,11 +743,11 @@ MACHINE_CONFIG_START(crvision_state::creativision) MCFG_DEVICE_PROGRAM_MAP(crvision_map) // devices - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, crvision_state, pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, crvision_state, pia_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, crvision_state, pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(SN76489_TAG, sn76496_base_device, command_w)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(crvision_state::pia_pa_r)); + m_pia->readpb_handler().set(FUNC(crvision_state::pia_pb_r)); + m_pia->writepa_handler().set(FUNC(crvision_state::pia_pa_w)); + m_pia->writepb_handler().set(SN76489_TAG, FUNC(sn76496_base_device::command_w)); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) @@ -820,14 +820,14 @@ MACHINE_CONFIG_START(laser2001_state::lasr2001) MCFG_DEVICE_PROGRAM_MAP(lasr2001_map) // devices - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, laser2001_state, pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, laser2001_state, pia_pb_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, laser2001_state, pia_ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, laser2001_state, pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, laser2001_state, pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, laser2001_state, pia_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, laser2001_state, pia_cb2_w)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(laser2001_state::pia_pa_r)); + m_pia->readpb_handler().set(FUNC(laser2001_state::pia_pb_r)); + m_pia->readca1_handler().set(FUNC(laser2001_state::pia_ca1_r)); + m_pia->writepa_handler().set(FUNC(laser2001_state::pia_pa_w)); + m_pia->writepb_handler().set(FUNC(laser2001_state::pia_pb_w)); + m_pia->ca2_handler().set(FUNC(laser2001_state::pia_ca2_w)); + m_pia->cb2_handler().set(FUNC(laser2001_state::pia_cb2_w)); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) diff --git a/src/mame/drivers/d6800.cpp b/src/mame/drivers/d6800.cpp index 31a79b35608..c69760542db 100644 --- a/src/mame/drivers/d6800.cpp +++ b/src/mame/drivers/d6800.cpp @@ -410,14 +410,14 @@ MACHINE_CONFIG_START(d6800_state::d6800) BEEP(config, "beeper", 1200).add_route(ALL_OUTPUTS, "mono", 0.50); /* devices */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, d6800_state, d6800_keyboard_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, d6800_state, d6800_cassette_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, d6800_state, d6800_keyboard_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, d6800_state, d6800_cassette_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, d6800_state, d6800_screen_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(d6800_state::d6800_keyboard_r)); + m_pia->readpb_handler().set(FUNC(d6800_state::d6800_cassette_r)); + m_pia->writepa_handler().set(FUNC(d6800_state::d6800_keyboard_w)); + m_pia->writepb_handler().set(FUNC(d6800_state::d6800_cassette_w)); + m_pia->cb2_handler().set(FUNC(d6800_state::d6800_screen_w)); + m_pia->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) diff --git a/src/mame/drivers/datum.cpp b/src/mame/drivers/datum.cpp index 7463e718f56..d774b737b66 100644 --- a/src/mame/drivers/datum.cpp +++ b/src/mame/drivers/datum.cpp @@ -191,16 +191,16 @@ MACHINE_CONFIG_START(datum_state::datum) config.set_default_layout(layout_datum); /* Devices */ - MCFG_DEVICE_ADD("pia1", PIA6821, 0) // keyboard & display - MCFG_PIA_READPA_HANDLER(READ8(*this, datum_state, pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, datum_state, pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, datum_state, pb_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia2", PIA6821, 0) // expansion - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) + PIA6821(config, m_pia1, 0); // keyboard & display + m_pia1->readpa_handler().set(FUNC(datum_state::pa_r)); + m_pia1->writepa_handler().set(FUNC(datum_state::pa_w)); + m_pia1->writepb_handler().set(FUNC(datum_state::pb_w)); + m_pia1->irqa_handler().set_inputline("maincpu", M6802_IRQ_LINE); + m_pia1->irqb_handler().set_inputline("maincpu", M6802_IRQ_LINE); + + pia6821_device &pia2(PIA6821(config, "pia2", 0)); // expansion + pia2.irqa_handler().set_inputline("maincpu", M6802_IRQ_LINE); + pia2.irqb_handler().set_inputline("maincpu", M6802_IRQ_LINE); MCFG_DEVICE_ADD("acia", ACIA6850, 0) // rs232 MACHINE_CONFIG_END diff --git a/src/mame/drivers/dgn_beta.cpp b/src/mame/drivers/dgn_beta.cpp index 355a32023d2..747c6265cb9 100644 --- a/src/mame/drivers/dgn_beta.cpp +++ b/src/mame/drivers/dgn_beta.cpp @@ -343,34 +343,34 @@ MACHINE_CONFIG_START(dgn_beta_state::dgnbeta) MCFG_PALETTE_INIT_OWNER(dgn_beta_state, dgn) /* PIA 0 at $FC20-$FC23 I46 */ - MCFG_DEVICE_ADD(PIA_0_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, dgn_beta_state, d_pia0_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, dgn_beta_state, d_pia0_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, dgn_beta_state, d_pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, dgn_beta_state, d_pia0_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia0_irq_b)) + PIA6821(config, m_pia_0, 0); + m_pia_0->readpa_handler().set(FUNC(dgn_beta_state::d_pia0_pa_r)); + m_pia_0->readpb_handler().set(FUNC(dgn_beta_state::d_pia0_pb_r)); + m_pia_0->writepa_handler().set(FUNC(dgn_beta_state::d_pia0_pa_w)); + m_pia_0->writepb_handler().set(FUNC(dgn_beta_state::d_pia0_pb_w)); + m_pia_0->cb2_handler().set(FUNC(dgn_beta_state::d_pia0_cb2_w)); + m_pia_0->irqa_handler().set(FUNC(dgn_beta_state::d_pia0_irq_a)); + m_pia_0->irqb_handler().set(FUNC(dgn_beta_state::d_pia0_irq_b)); /* PIA 1 at $FC24-$FC27 I63 */ - MCFG_DEVICE_ADD(PIA_1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, dgn_beta_state, d_pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, dgn_beta_state, d_pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, dgn_beta_state, d_pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, dgn_beta_state, d_pia1_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia1_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia1_irq_b)) + PIA6821(config, m_pia_1, 0); + m_pia_1->readpa_handler().set(FUNC(dgn_beta_state::d_pia1_pa_r)); + m_pia_1->readpb_handler().set(FUNC(dgn_beta_state::d_pia1_pb_r)); + m_pia_1->writepa_handler().set(FUNC(dgn_beta_state::d_pia1_pa_w)); + m_pia_1->writepb_handler().set(FUNC(dgn_beta_state::d_pia1_pb_w)); + m_pia_1->irqa_handler().set(FUNC(dgn_beta_state::d_pia1_irq_a)); + m_pia_1->irqb_handler().set(FUNC(dgn_beta_state::d_pia1_irq_b)); /* PIA 2 at FCC0-FCC3 I28 */ /* This seems to control the RAM paging system, and have the DRQ */ /* from the WD2797 */ - MCFG_DEVICE_ADD(PIA_2_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, dgn_beta_state, d_pia2_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, dgn_beta_state, d_pia2_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, dgn_beta_state, d_pia2_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, dgn_beta_state, d_pia2_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia2_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, dgn_beta_state, d_pia2_irq_b)) + PIA6821(config, m_pia_2, 0); + m_pia_2->readpa_handler().set(FUNC(dgn_beta_state::d_pia2_pa_r)); + m_pia_2->readpb_handler().set(FUNC(dgn_beta_state::d_pia2_pb_r)); + m_pia_2->writepa_handler().set(FUNC(dgn_beta_state::d_pia2_pa_w)); + m_pia_2->writepb_handler().set(FUNC(dgn_beta_state::d_pia2_pb_w)); + m_pia_2->irqa_handler().set(FUNC(dgn_beta_state::d_pia2_irq_a)); + m_pia_2->irqb_handler().set(FUNC(dgn_beta_state::d_pia2_irq_b)); MCFG_DEVICE_ADD(FDC_TAG, WD2797, 1_MHz_XTAL) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, dgn_beta_state, dgnbeta_fdc_intrq_w)) diff --git a/src/mame/drivers/didact.cpp b/src/mame/drivers/didact.cpp index 02ffff4052f..cbdab4db4e3 100644 --- a/src/mame/drivers/didact.cpp +++ b/src/mame/drivers/didact.cpp @@ -589,10 +589,10 @@ MACHINE_CONFIG_START(md6802_state::md6802) /* Devices */ MCFG_DEVICE_ADD("tb16_74145", TTL74145, 0) /* PIA #1 0xA000-0xA003 - used differently by laborations and loaded software */ - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) + PIA6821(config, m_pia1, 0); /* PIA #2 Keyboard & Display 0xC000-0xC003 */ - MCFG_DEVICE_ADD(PIA2_TAG, PIA6821, 0) + PIA6821(config, m_pia2, 0); /* --PIA init----------------------- */ /* 0xE007 0xC002 (DDR B) = 0xFF - Port B all outputs and set to 0 (zero) */ /* 0xE00B 0xC000 (DDR A) = 0x70 - Port A three outputs and set to 0 (zero) */ @@ -604,11 +604,12 @@ MACHINE_CONFIG_START(md6802_state::md6802) /* 0xE068 0xC000 (Port A) = 0x60 */ /* 0xE08A 0xC002 (Port B) = 0xEE - updating display */ /* 0xE090 0xC000 (Port A) = 0x00 - looping in 0x10,0x20,0x30,0x40,0x50 */ - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, md6802_state, pia2_kbA_w)) - MCFG_PIA_READPA_HANDLER(READ8(*this, md6802_state, pia2_kbA_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, md6802_state, pia2_kbB_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, md6802_state, pia2_kbB_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, md6802_state, pia2_ca2_w)) + m_pia2->writepa_handler().set(FUNC(md6802_state::pia2_kbA_w)); + m_pia2->readpa_handler().set(FUNC(md6802_state::pia2_kbA_r)); + m_pia2->writepb_handler().set(FUNC(md6802_state::pia2_kbB_w)); + m_pia2->readpb_handler().set(FUNC(md6802_state::pia2_kbB_r)); + m_pia2->ca2_handler().set(FUNC(md6802_state::pia2_ca2_w)); + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", md6802_state, scan_artwork, attotime::from_hz(10)) MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) @@ -623,10 +624,10 @@ MACHINE_CONFIG_START(mp68a_state::mp68a) /* Devices */ /* PIA #1 0x500-0x503 - used differently by laborations and loaded software */ - MCFG_DEVICE_ADD(PIA1_TAG, PIA6820, 0) + PIA6820(config, m_pia1, 0); /* PIA #2 Keyboard & Display 0x600-0x603 */ - MCFG_DEVICE_ADD(PIA2_TAG, PIA6820, 0) + PIA6820(config, m_pia2, 0); /* --PIA inits----------------------- */ /* 0x0BAF 0x601 (Control A) = 0x30 - CA2 is low and enable DDRA */ /* 0x0BB1 0x603 (Control B) = 0x30 - CB2 is low and enable DDRB */ @@ -638,13 +639,13 @@ MACHINE_CONFIG_START(mp68a_state::mp68a) /* --execution-wait for key loop-- */ /* 0x086B Update display sequnc, see below */ /* 0x0826 CB1 read = 0x603 (Control B) - is a key pressed? */ - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mp68a_state, pia2_kbA_w)) - MCFG_PIA_READPA_HANDLER(READ8(*this, mp68a_state, pia2_kbA_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mp68a_state, pia2_kbB_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, mp68a_state, pia2_kbB_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, mp68a_state, pia2_cb1_r)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) /* Not used by ROM. Combined trace to CPU IRQ with IRQB */ - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) /* Not used by ROM. Combined trace to CPU IRQ with IRQA */ + m_pia2->writepa_handler().set(FUNC(mp68a_state::pia2_kbA_w)); + m_pia2->readpa_handler().set(FUNC(mp68a_state::pia2_kbA_r)); + m_pia2->writepb_handler().set(FUNC(mp68a_state::pia2_kbB_w)); + m_pia2->readpb_handler().set(FUNC(mp68a_state::pia2_kbB_r)); + m_pia2->readcb1_handler().set(FUNC(mp68a_state::pia2_cb1_r)); + m_pia2->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); /* Not used by ROM. Combined trace to CPU IRQ with IRQB */ + m_pia2->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); /* Not used by ROM. Combined trace to CPU IRQ with IRQA */ /* Display - sequence outputting all '0':s at start */ /* 0x086B 0x600 (Port A) = 0x00 */ diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp index 3f49a441e61..f3489482f15 100644 --- a/src/mame/drivers/dragon.cpp +++ b/src/mame/drivers/dragon.cpp @@ -196,23 +196,23 @@ MACHINE_CONFIG_START(dragon_state::dragon_base) MCFG_DEVICE_PROGRAM_MAP(dragon_mem) // devices - MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, coco_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, coco_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, coco_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia0_irq_b)) - - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, coco_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, coco_state, pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, coco_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, coco_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, coco_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, coco_state, pia1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia1_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia1_firq_b)) + pia6821_device &pia0(PIA6821(config, PIA0_TAG, 0)); + pia0.writepa_handler().set(FUNC(coco_state::pia0_pa_w)); + pia0.writepb_handler().set(FUNC(coco_state::pia0_pb_w)); + pia0.ca2_handler().set(FUNC(coco_state::pia0_ca2_w)); + pia0.cb2_handler().set(FUNC(coco_state::pia0_cb2_w)); + pia0.irqa_handler().set(FUNC(coco_state::pia0_irq_a)); + pia0.irqb_handler().set(FUNC(coco_state::pia0_irq_b)); + + pia6821_device &pia1(PIA6821(config, PIA1_TAG, 0)); + pia1.readpa_handler().set(FUNC(coco_state::pia1_pa_r)); + pia1.readpb_handler().set(FUNC(coco_state::pia1_pb_r)); + pia1.writepa_handler().set(FUNC(coco_state::pia1_pa_w)); + pia1.writepb_handler().set(FUNC(coco_state::pia1_pb_w)); + pia1.ca2_handler().set(FUNC(coco_state::pia1_ca2_w)); + pia1.cb2_handler().set(FUNC(coco_state::pia1_cb2_w)); + pia1.irqa_handler().set(FUNC(coco_state::pia1_firq_a)); + pia1.irqb_handler().set(FUNC(coco_state::pia1_firq_b)); MCFG_DEVICE_ADD(SAM_TAG, SAM6883, 14.218_MHz_XTAL, MAINCPU_TAG) MCFG_SAM6883_RES_CALLBACK(READ8(*this, dragon_state, sam_read)) @@ -350,10 +350,10 @@ MACHINE_CONFIG_START(dragon_alpha_state::dgnalpha) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.75) // pia 2 - MCFG_DEVICE_ADD( PIA2_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, dragon_alpha_state, pia2_pa_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, dragon_alpha_state, pia2_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, dragon_alpha_state, pia2_firq_b)) + pia6821_device &pia2(PIA6821(config, PIA2_TAG, 0)); + pia2.writepa_handler().set(FUNC(dragon_alpha_state::pia2_pa_w)); + pia2.irqa_handler().set(FUNC(dragon_alpha_state::pia2_firq_a)); + pia2.irqb_handler().set(FUNC(dragon_alpha_state::pia2_firq_b)); // software lists MCFG_SOFTWARE_LIST_ADD("dgnalpha_flop_list", "dgnalpha_flop") diff --git a/src/mame/drivers/e100.cpp b/src/mame/drivers/e100.cpp index 67264bd920e..9b6fe1887c7 100644 --- a/src/mame/drivers/e100.cpp +++ b/src/mame/drivers/e100.cpp @@ -560,19 +560,19 @@ MACHINE_CONFIG_START(e100_state::e100) /* 0xF894 0xC818 (PIA2 Control A) = 0x34 - CA2 is low and lock DDRA */ /* 0xF896 0xC818 (PIA1 Control B) = 0x34 - CB2 is low and lock DDRB */ /* 0xF896 0xC818 (PIA2 Control B) = 0x34 - CB2 is low and lock DDRB */ - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, e100_state, pia1_kbA_w)) - MCFG_PIA_READPA_HANDLER(READ8(*this, e100_state, pia1_kbA_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, e100_state, pia1_kbB_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, e100_state, pia1_kbB_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, e100_state, pia1_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, e100_state, pia1_cb1_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, e100_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, e100_state, pia1_cb2_w)) + PIA6821(config, m_pia1, 0); + m_pia1->writepa_handler().set(FUNC(e100_state::pia1_kbA_w)); + m_pia1->readpa_handler().set(FUNC(e100_state::pia1_kbA_r)); + m_pia1->writepb_handler().set(FUNC(e100_state::pia1_kbB_w)); + m_pia1->readpb_handler().set(FUNC(e100_state::pia1_kbB_r)); + m_pia1->readca1_handler().set(FUNC(e100_state::pia1_ca1_r)); + m_pia1->readcb1_handler().set(FUNC(e100_state::pia1_cb1_r)); + m_pia1->ca2_handler().set(FUNC(e100_state::pia1_ca2_w)); + m_pia1->cb2_handler().set(FUNC(e100_state::pia1_cb2_w)); /* The optional second PIA enables the expansion port on CA1 and a software RTC with 50Hz resolution */ - MCFG_DEVICE_ADD(PIA2_TAG, PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia2, 0); + m_pia2->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); /* Serial port support */ MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) diff --git a/src/mame/drivers/eacc.cpp b/src/mame/drivers/eacc.cpp index 89bb4534c4a..0877ee7ab54 100644 --- a/src/mame/drivers/eacc.cpp +++ b/src/mame/drivers/eacc.cpp @@ -252,16 +252,16 @@ MACHINE_CONFIG_START(eacc_state::eacc) config.set_default_layout(layout_eacc); - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, eacc_state, eacc_keyboard_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, eacc_state, eacc_distance_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, eacc_state, eacc_cb1_r)) - MCFG_PIA_READCA2_HANDLER(READLINE(*this, eacc_state, eacc_fuel_sensor_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, eacc_state, eacc_segment_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, eacc_state, eacc_digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, eacc_state, eacc_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) + PIA6821(config, m_pia, 0); + m_pia->readpb_handler().set(FUNC(eacc_state::eacc_keyboard_r)); + m_pia->readca1_handler().set(FUNC(eacc_state::eacc_distance_r)); + m_pia->readcb1_handler().set(FUNC(eacc_state::eacc_cb1_r)); + m_pia->readca2_handler().set(FUNC(eacc_state::eacc_fuel_sensor_r)); + m_pia->writepa_handler().set(FUNC(eacc_state::eacc_segment_w)); + m_pia->writepb_handler().set(FUNC(eacc_state::eacc_digit_w)); + m_pia->cb2_handler().set(FUNC(eacc_state::eacc_cb2_w)); + m_pia->irqa_handler().set_inputline("maincpu", M6802_IRQ_LINE); + m_pia->irqb_handler().set_inputline("maincpu", M6802_IRQ_LINE); MCFG_NVRAM_ADD_0FILL("nvram") MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_nmi", eacc_state, eacc_nmi, attotime::from_hz(600)) diff --git a/src/mame/drivers/et3400.cpp b/src/mame/drivers/et3400.cpp index ac63c025429..e0f28310d44 100644 --- a/src/mame/drivers/et3400.cpp +++ b/src/mame/drivers/et3400.cpp @@ -228,11 +228,12 @@ MACHINE_CONFIG_START(et3400_state::et3400) config.set_default_layout(layout_et3400); // Devices - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, et3400_state, pia_aw)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, et3400_state, pia_bw)) - MCFG_PIA_READPA_HANDLER(READ8(*this, et3400_state, pia_ar)) - MCFG_PIA_READPB_HANDLER(READ8(*this, et3400_state, pia_br)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(et3400_state::pia_aw)); + m_pia->writepb_handler().set(FUNC(et3400_state::pia_bw)); + m_pia->readpa_handler().set(FUNC(et3400_state::pia_ar)); + m_pia->readpb_handler().set(FUNC(et3400_state::pia_br)); + MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp index 39beb25a60f..635c91fc64b 100644 --- a/src/mame/drivers/eurocom2.cpp +++ b/src/mame/drivers/eurocom2.cpp @@ -448,19 +448,19 @@ MACHINE_CONFIG_START(eurocom2_state::eurocom2) MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(PUT(eurocom2_state, kbd_put)) - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, eurocom2_state, pia1_ca1_r)) // keyboard strobe - MCFG_PIA_READCA2_HANDLER(READLINE(*this, eurocom2_state, pia1_ca2_r)) // SST output Q14 - MCFG_PIA_READCB1_HANDLER(READLINE(*this, eurocom2_state, pia1_cb1_r)) // SST output Q6 - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, eurocom2_state, pia1_cb2_w)) // SST reset input - MCFG_PIA_READPA_HANDLER(READ8(*this, eurocom2_state, kbd_get)) -// MCFG_PIA_READPB_HANDLER(READ8(*this, eurocom2_state, kbd_get)) -// MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) -// MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia2", PIA6821, 0) -// MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) -// MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) + PIA6821(config, m_pia1, 0); + m_pia1->readca1_handler().set(FUNC(eurocom2_state::pia1_ca1_r)); // keyboard strobe + m_pia1->readca2_handler().set(FUNC(eurocom2_state::pia1_ca2_r)); // SST output Q14 + m_pia1->readcb1_handler().set(FUNC(eurocom2_state::pia1_cb1_r)); // SST output Q6 + m_pia1->cb2_handler().set(FUNC(eurocom2_state::pia1_cb2_w)); // SST reset input + m_pia1->readpa_handler().set(FUNC(eurocom2_state::kbd_get)); +// m_pia1->readpb_handler().set(FUNC(eurocom2_state::kbd_get)); +// m_pia1->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); +// m_pia1->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); + + PIA6821(config, m_pia2, 0); +// m_pia2->irqa_handler().set_inputline("maincpu", M6809_FIRQ_LINE); +// m_pia2->irqb_handler().set_inputline("maincpu", M6809_FIRQ_LINE); MCFG_DEVICE_ADD("acia", ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE ("rs232", rs232_port_device, write_txd)) @@ -482,21 +482,20 @@ MACHINE_CONFIG_START(waveterm_state::waveterm) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(waveterm_map) - MCFG_DEVICE_MODIFY("pia2") - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, waveterm_state, waveterm_kbh_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, waveterm_state, waveterm_kb_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, waveterm_state, waveterm_kb_r)) + m_pia2->cb2_handler().set(FUNC(waveterm_state::waveterm_kbh_w)); + m_pia2->writepb_handler().set(FUNC(waveterm_state::waveterm_kb_w)); + m_pia2->readpb_handler().set(FUNC(waveterm_state::waveterm_kb_r)); // ports A(in/out), B(out), CA1(in), CA2(in), and CB2(out) = interface to PPG bus via DIL socket on WTI board // CB1 -- front panel "End" button - MCFG_DEVICE_ADD("pia3", PIA6821, 0) -// MCFG_PIA_READPA_HANDLER(READ8(*this, waveterm_state, pia3_pa_r)) -// MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, waveterm_state, pia3_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, waveterm_state, pia3_pb_w)) -// MCFG_PIA_READCA1_HANDLER(READLINE(*this, waveterm_state, pia3_ca1_r)) -// MCFG_PIA_READCA2_HANDLER(READLINE(*this, waveterm_state, pia3_ca2_r)) - MCFG_PIA_READCB1_HANDLER(IOPORT("FP")) -// MCFG_PIA_CB2_HANDLER(WRITELINE(*this, waveterm_state, pia3_cb2_w)) + PIA6821(config, m_pia3, 0); +// m_pia3->readpa_handler().set(FUNC(waveterm_state::pia3_pa_r)); +// m_pia3->writepa_handler().set(FUNC(waveterm_state::pia3_pa_w)); + m_pia3->writepb_handler().set(FUNC(waveterm_state::pia3_pb_w)); +// m_pia3->readca1_handler().set(FUNC(waveterm_state::pia3_ca1_r)); +// m_pia3->readca2_handler().set(FUNC(waveterm_state::pia3_ca2_r)); + m_pia3->readcb1_handler().set_ioport("FP"); +// m_pia3->cb2_handler().set(FUNC(waveterm_state::pia3_cb2_w)); MCFG_DEVICE_ADD("ptm", PTM6840, 0) diff --git a/src/mame/drivers/exidy.cpp b/src/mame/drivers/exidy.cpp index ca4215c51fb..c74bb8a857d 100644 --- a/src/mame/drivers/exidy.cpp +++ b/src/mame/drivers/exidy.cpp @@ -895,11 +895,11 @@ MACHINE_CONFIG_START(exidy_state::venture) MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* audio hardware */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("soundbd", venture_sound_device, pb_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("soundbd", venture_sound_device, pa_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("soundbd", venture_sound_device, cb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("soundbd", venture_sound_device, ca_w)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.writepa_handler().set("soundbd", FUNC(venture_sound_device::pb_w)); + pia.writepb_handler().set("soundbd", FUNC(venture_sound_device::pa_w)); + pia.ca2_handler().set("soundbd", FUNC(venture_sound_device::cb_w)); + pia.cb2_handler().set("soundbd", FUNC(venture_sound_device::ca_w)); MCFG_DEVICE_ADD("soundbd", EXIDY_VENTURE, 0) MCFG_EXIDY_VENTURE_WRITEPA_HANDLER(WRITE8("pia", pia6821_device, portb_w)) @@ -931,11 +931,11 @@ MACHINE_CONFIG_START(exidy_state::mtrap) MCFG_QUANTUM_TIME(attotime::from_hz(1920)) /* audio hardware */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("soundbd", venture_sound_device, pb_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("soundbd", venture_sound_device, pa_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("soundbd", venture_sound_device, cb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("soundbd", venture_sound_device, ca_w)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.writepa_handler().set("soundbd", FUNC(venture_sound_device::pb_w)); + pia.writepb_handler().set("soundbd", FUNC(venture_sound_device::pa_w)); + pia.ca2_handler().set("soundbd", FUNC(venture_sound_device::cb_w)); + pia.cb2_handler().set("soundbd", FUNC(venture_sound_device::ca_w)); MCFG_DEVICE_ADD("soundbd", EXIDY_MTRAP, 0) MCFG_EXIDY_VENTURE_WRITEPA_HANDLER(WRITE8("pia", pia6821_device, portb_w)) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 811ad7a58c9..d26ef5077e7 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -1839,14 +1839,14 @@ MACHINE_CONFIG_START(fidel6502_state::rsc) MCFG_TIMER_START_DELAY(attotime::from_hz(546) - attotime::from_usec(38)) // active for 38us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(546)) - MCFG_DEVICE_ADD("pia", PIA6821, 0) // MOS 6520 - MCFG_PIA_READPA_HANDLER(READ8(*this, fidel6502_state, csc_pia1_pa_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, fidel6502_state, csc_pia1_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, fidel6502_state, csc_pia1_cb1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, fidel6502_state, csc_pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, fidel6502_state, csc_pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, fidel6502_state, csc_pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, fidel6502_state, csc_pia1_cb2_w)) + pia6821_device &pia(PIA6821(config, "pia", 0)); // MOS 6520 + pia.readpa_handler().set(FUNC(fidel6502_state::csc_pia1_pa_r)); + pia.readca1_handler().set(FUNC(fidel6502_state::csc_pia1_ca1_r)); + pia.readcb1_handler().set(FUNC(fidel6502_state::csc_pia1_cb1_r)); + pia.writepa_handler().set(FUNC(fidel6502_state::csc_pia1_pa_w)); + pia.writepb_handler().set(FUNC(fidel6502_state::csc_pia1_pb_w)); + pia.ca2_handler().set(FUNC(fidel6502_state::csc_pia1_ca2_w)); + pia.cb2_handler().set(FUNC(fidel6502_state::csc_pia1_cb2_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_fidel_rsc_v2); @@ -1867,20 +1867,20 @@ MACHINE_CONFIG_START(fidel6502_state::csc) MCFG_TIMER_START_DELAY(attotime::from_hz(38.4_kHz_XTAL/64) - attotime::from_hz(38.4_kHz_XTAL*2)) // edge! MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(38.4_kHz_XTAL/64)) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, fidel6502_state, csc_pia0_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, fidel6502_state, csc_pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, fidel6502_state, csc_pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, fidel6502_state, csc_pia0_ca2_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, fidel6502_state, csc_pia1_pa_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, fidel6502_state, csc_pia1_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, fidel6502_state, csc_pia1_cb1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, fidel6502_state, csc_pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, fidel6502_state, csc_pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, fidel6502_state, csc_pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, fidel6502_state, csc_pia1_cb2_w)) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpb_handler().set(FUNC(fidel6502_state::csc_pia0_pb_r)); + pia0.writepa_handler().set(FUNC(fidel6502_state::csc_pia0_pa_w)); + pia0.writepb_handler().set(FUNC(fidel6502_state::csc_pia0_pb_w)); + pia0.ca2_handler().set(FUNC(fidel6502_state::csc_pia0_ca2_w)); + + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.readpa_handler().set(FUNC(fidel6502_state::csc_pia1_pa_r)); + pia1.readca1_handler().set(FUNC(fidel6502_state::csc_pia1_ca1_r)); + pia1.readcb1_handler().set(FUNC(fidel6502_state::csc_pia1_cb1_r)); + pia1.writepa_handler().set(FUNC(fidel6502_state::csc_pia1_pa_w)); + pia1.writepb_handler().set(FUNC(fidel6502_state::csc_pia1_pb_w)); + pia1.ca2_handler().set(FUNC(fidel6502_state::csc_pia1_ca2_w)); + pia1.cb2_handler().set(FUNC(fidel6502_state::csc_pia1_cb2_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_fidel_csc); diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp index 1d7a3540415..28201530537 100644 --- a/src/mame/drivers/funworld.cpp +++ b/src/mame/drivers/funworld.cpp @@ -3073,14 +3073,14 @@ MACHINE_CONFIG_START(funworld_state::fw1stpal) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) - MCFG_PIA_READPB_HANDLER(IOPORT("DSW")) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, funworld_state, pia1_ca2_w)) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpa_handler().set_ioport("IN0"); + pia0.readpb_handler().set_ioport("IN1"); + + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.readpa_handler().set_ioport("IN2"); + pia1.readpb_handler().set_ioport("DSW"); + pia1.ca2_handler().set(FUNC(funworld_state::pia1_ca2_w)); /* video hardware */ diff --git a/src/mame/drivers/gimix.cpp b/src/mame/drivers/gimix.cpp index 2abd2130495..cf7cdf691e5 100644 --- a/src/mame/drivers/gimix.cpp +++ b/src/mame/drivers/gimix.cpp @@ -571,12 +571,13 @@ MACHINE_CONFIG_START(gimix_state::gimix) MCFG_FLOPPY_DRIVE_ADD("fdc:1", gimix_floppies, "525hd", gimix_state::floppy_formats) /* parallel ports */ - MCFG_DEVICE_ADD("pia1", PIA6821, 2'000'000) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, gimix_state,pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, gimix_state,pia_pb_w)) - MCFG_PIA_READPA_HANDLER(READ8(*this, gimix_state,pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, gimix_state,pia_pb_r)) - MCFG_DEVICE_ADD("pia2", PIA6821, 2'000'000) + pia6821_device &pia1(PIA6821(config, "pia1", 2'000'000)); + pia1.writepa_handler().set(FUNC(gimix_state::pia_pa_w)); + pia1.writepb_handler().set(FUNC(gimix_state::pia_pb_w)); + pia1.readpa_handler().set(FUNC(gimix_state::pia_pa_r)); + pia1.readpb_handler().set(FUNC(gimix_state::pia_pb_r)); + + PIA6821(config, "pia2", 2'000'000); /* serial ports */ MCFG_DEVICE_ADD("acia1", ACIA6850, 2'000'000) diff --git a/src/mame/drivers/goldnpkr.cpp b/src/mame/drivers/goldnpkr.cpp index 60e4be4ae95..2eab70a3f73 100644 --- a/src/mame/drivers/goldnpkr.cpp +++ b/src/mame/drivers/goldnpkr.cpp @@ -1300,6 +1300,7 @@ public: goldnpkr_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_pia(*this, "pia%u", 0U), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_discrete(*this, "discrete"), @@ -1354,6 +1355,7 @@ public: protected: required_device<cpu_device> m_maincpu; + required_device_array<pia6821_device, 2> m_pia; DECLARE_WRITE8_MEMBER(goldnpkr_videoram_w); DECLARE_WRITE8_MEMBER(goldnpkr_colorram_w); @@ -1397,7 +1399,6 @@ private: required_shared_ptr<uint8_t> m_videoram; required_shared_ptr<uint8_t> m_colorram; - optional_device<discrete_device> m_discrete; optional_device<ay8910_device> m_ay8910; required_device<gfxdecode_device> m_gfxdecode; @@ -4322,14 +4323,14 @@ MACHINE_CONFIG_START(goldnpkr_state::goldnpkr_base) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, goldnpkr_mux_port_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, goldnpkr_state, lamps_a_w)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::goldnpkr_mux_port_r)); + m_pia[0]->writepb_handler().set(FUNC(goldnpkr_state::lamps_a_w)); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("SW1")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, goldnpkr_state, mux_w)) + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpa_handler().set_ioport("SW1"); + m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::sound_w)); + m_pia[1]->writepb_handler().set(FUNC(goldnpkr_state::mux_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -4368,9 +4369,8 @@ MACHINE_CONFIG_START(goldnpkr_state::pottnpkr) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(pottnpkr_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4386,9 +4386,8 @@ MACHINE_CONFIG_START(goldnpkr_state::witchcrd) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(witchcrd_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); /* video hardware */ MCFG_PALETTE_MODIFY("palette") @@ -4408,11 +4407,8 @@ MACHINE_CONFIG_START(goldnpkr_state::wcfalcon) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(witchcrd_falcon_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) - - MCFG_DEVICE_MODIFY("pia1") - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, wcfalcon_snd_w)) /* port A out, custom handler due to address + data are muxed */ + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); + m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::wcfalcon_snd_w)); /* port A out, custom handler due to address + data are muxed */ /* video hardware */ MCFG_PALETTE_MODIFY("palette") @@ -4432,9 +4428,8 @@ MACHINE_CONFIG_START(goldnpkr_state::wildcard) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(wildcard_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); /* video hardware */ // MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_wildcard) @@ -4456,9 +4451,8 @@ MACHINE_CONFIG_START(goldnpkr_state::wcrdxtnd) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(wcrdxtnd_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); /* video hardware */ MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_wcrdxtnd) @@ -4484,11 +4478,8 @@ MACHINE_CONFIG_START(goldnpkr_state::wildcrdb) MCFG_DEVICE_PROGRAM_MAP(wildcrdb_mcu_map) MCFG_DEVICE_IO_MAP(wildcrdb_mcu_io_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) - - MCFG_DEVICE_MODIFY("pia1") - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, wcfalcon_snd_w)) + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); + m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::wcfalcon_snd_w)); /* video hardware */ // MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_wildcard) @@ -4510,9 +4501,8 @@ MACHINE_CONFIG_START(goldnpkr_state::genie) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(genie_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); /* video hardware */ MCFG_PALETTE_MODIFY("palette") @@ -4532,9 +4522,8 @@ MACHINE_CONFIG_START(goldnpkr_state::geniea) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(goldnpkr_map) -// MCFG_DEVICE_MODIFY("pia0") -// MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) -// MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, mux_port_w)) +// m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); +// m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); /* video hardware */ MCFG_PALETTE_MODIFY("palette") @@ -4570,17 +4559,15 @@ MACHINE_CONFIG_START(goldnpkr_state::bchancep) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(bchancep_map) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pia0_a_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, goldnpkr_state, pia0_b_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, pia0_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, goldnpkr_state, pia0_b_w)) + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pia0_a_r)); + m_pia[0]->readpb_handler().set(FUNC(goldnpkr_state::pia0_b_r)); + m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::pia0_a_w)); + m_pia[0]->writepb_handler().set(FUNC(goldnpkr_state::pia0_b_w)); - MCFG_DEVICE_MODIFY("pia1") - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pia1_a_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, goldnpkr_state, pia1_b_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, pia1_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, goldnpkr_state, pia1_b_w)) + m_pia[1]->readpa_handler().set(FUNC(goldnpkr_state::pia1_a_r)); + m_pia[1]->readpb_handler().set(FUNC(goldnpkr_state::pia1_b_r)); + m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::pia1_a_w)); + m_pia[1]->writepb_handler().set(FUNC(goldnpkr_state::pia1_b_w)); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4730,14 +4717,14 @@ MACHINE_CONFIG_START(blitz_state::megadpkr) MCFG_DEVICE_ADD("timekpr", M48T02, 0) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, goldnpkr_state, pottnpkr_mux_port_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, goldnpkr_state, lamps_a_w)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set(FUNC(goldnpkr_state::pottnpkr_mux_port_r)); + m_pia[0]->writepb_handler().set(FUNC(goldnpkr_state::lamps_a_w)); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("SW1")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, goldnpkr_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, goldnpkr_state, mux_w)) + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpa_handler().set_ioport("SW1"); + m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::sound_w)); + m_pia[1]->writepb_handler().set(FUNC(goldnpkr_state::mux_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/hankin.cpp b/src/mame/drivers/hankin.cpp index 9a4c94e53bd..523ed47acdd 100644 --- a/src/mame/drivers/hankin.cpp +++ b/src/mame/drivers/hankin.cpp @@ -494,35 +494,35 @@ MACHINE_CONFIG_START(hankin_state::hankin) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) /* Devices */ - MCFG_DEVICE_ADD("ic10", PIA6821, 0) - //MCFG_PIA_READPA_HANDLER(READ8(*this, hankin_state, ic10_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, hankin_state, ic10_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, hankin_state, ic10_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, hankin_state, ic10_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, hankin_state, ic10_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, hankin_state, ic10_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - - MCFG_DEVICE_ADD("ic11", PIA6821, 0) - //MCFG_PIA_READPA_HANDLER(READ8(*this, hankin_state, ic11_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, hankin_state, ic11_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, hankin_state, ic11_b_r)) - //MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, hankin_state, ic11_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, hankin_state, ic11_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, hankin_state, ic11_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6802_IRQ_LINE)) - - MCFG_DEVICE_ADD("ic2", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, hankin_state, ic2_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, hankin_state, ic2_a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, hankin_state, ic2_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, hankin_state, ic2_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, hankin_state, ic2_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, hankin_state, ic2_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_ic10, 0); + //m_ic10->readpa_handler().set(FUNC(hankin_state::ic10_a_r)); + m_ic10->writepa_handler().set(FUNC(hankin_state::ic10_a_w)); + //m_ic10->readpb_handler().set(FUNC(hankin_state::ic10_b_r)); + m_ic10->writepb_handler().set(FUNC(hankin_state::ic10_b_w)); + m_ic10->ca2_handler().set(FUNC(hankin_state::ic10_ca2_w)); + m_ic10->cb2_handler().set(FUNC(hankin_state::ic10_cb2_w)); + m_ic10->irqa_handler().set_inputline("maincpu", M6802_IRQ_LINE); + m_ic10->irqb_handler().set_inputline("maincpu", M6802_IRQ_LINE); + + PIA6821(config, m_ic11, 0); + //m_ic11->readpa_handler().set(FUNC(hankin_state::ic11_a_r)); + m_ic11->writepa_handler().set(FUNC(hankin_state::ic11_a_w)); + m_ic11->readpb_handler().set(FUNC(hankin_state::ic11_b_r)); + //m_ic11->writepb_handler().set(FUNC(hankin_state::ic11_b_w)); + m_ic11->ca2_handler().set(FUNC(hankin_state::ic11_ca2_w)); + m_ic11->cb2_handler().set(FUNC(hankin_state::ic11_cb2_w)); + m_ic11->irqa_handler().set_inputline("maincpu", M6802_IRQ_LINE); + m_ic11->irqb_handler().set_inputline("maincpu", M6802_IRQ_LINE); + + PIA6821(config, m_ic2, 0); + m_ic2->readpa_handler().set(FUNC(hankin_state::ic2_a_r)); + m_ic2->writepa_handler().set(FUNC(hankin_state::ic2_a_w)); + //m_ic2->readpb_handler().set(FUNC(hankin_state::ic2_b_r)); + m_ic2->writepb_handler().set(FUNC(hankin_state::ic2_b_w)); + m_ic2->ca2_handler().set(FUNC(hankin_state::ic2_ca2_w)); + m_ic2->cb2_handler().set(FUNC(hankin_state::ic2_cb2_w)); + m_ic2->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); + m_ic2->irqb_handler().set_inputline("audiocpu", M6802_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_x", hankin_state, timer_x, attotime::from_hz(120)) // mains freq*2 MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_s", hankin_state, timer_s, attotime::from_hz(94000)) // 555 on sound board*2 diff --git a/src/mame/drivers/icecold.cpp b/src/mame/drivers/icecold.cpp index c9d32dc41c8..99e999300ea 100644 --- a/src/mame/drivers/icecold.cpp +++ b/src/mame/drivers/icecold.cpp @@ -368,22 +368,22 @@ MACHINE_CONFIG_START(icecold_state::icecold) MCFG_DEVICE_ADD("maincpu", MC6809E, XTAL(6'000'000)/4) // 68A09E MCFG_DEVICE_PROGRAM_MAP(icecold_map) - MCFG_DEVICE_ADD( "pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("JOY")) - MCFG_PIA_READPB_HANDLER(IOPORT("DSW3")) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD( "pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, icecold_state, ay_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, icecold_state, ay_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, icecold_state, snd_ctrl_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) - - MCFG_DEVICE_ADD( "pia2", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpa_handler().set_ioport("JOY"); + pia0.readpb_handler().set_ioport("DSW3"); + pia0.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + pia0.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); + + PIA6821(config, m_pia1, 0); + m_pia1->readpa_handler().set(FUNC(icecold_state::ay_r)); + m_pia1->writepa_handler().set(FUNC(icecold_state::ay_w)); + m_pia1->writepb_handler().set(FUNC(icecold_state::snd_ctrl_w)); + m_pia1->irqa_handler().set_inputline("maincpu", M6809_FIRQ_LINE); + m_pia1->irqb_handler().set_inputline("maincpu", M6809_FIRQ_LINE); + + pia6821_device &pia2(PIA6821(config, "pia2", 0)); + pia2.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + pia2.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); MCFG_DEVICE_ADD("i8279", I8279, XTAL(6'000'000)/4) MCFG_I8279_OUT_IRQ_CB(WRITELINE("pia0", pia6821_device, cb1_w)) // irq diff --git a/src/mame/drivers/jokrwild.cpp b/src/mame/drivers/jokrwild.cpp index 21b026faafd..a8e09d19bcd 100644 --- a/src/mame/drivers/jokrwild.cpp +++ b/src/mame/drivers/jokrwild.cpp @@ -417,15 +417,15 @@ MACHINE_CONFIG_START(jokrwild_state::jokrwild) // MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, jokrwild_state, testa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, jokrwild_state, testb_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN3")) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpa_handler().set_ioport("IN0"); + pia0.readpb_handler().set_ioport("IN1"); + pia0.writepa_handler().set(FUNC(jokrwild_state::testa_w)); + pia0.writepb_handler().set(FUNC(jokrwild_state::testb_w)); + + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.readpa_handler().set_ioport("IN2"); + pia1.readpb_handler().set_ioport("IN3"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp index 9d30ff1344e..556f38930f5 100644 --- a/src/mame/drivers/jpmsys5.cpp +++ b/src/mame/drivers/jpmsys5.cpp @@ -633,13 +633,13 @@ MACHINE_CONFIG_START(jpmsys5v_state::jpmsys5v) MCFG_DEVICE_ADD("ym2413", YM2413, 4000000 ) /* Unconfirmed */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_DEVICE_ADD("6821pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, jpmsys5v_state, u29_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, jpmsys5v_state, u29_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, jpmsys5v_state, u29_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, jpmsys5v_state, u29_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, jpmsys5v_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, jpmsys5v_state, pia_irq)) + pia6821_device &pia(PIA6821(config, "6821pia", 0)); + pia.readpa_handler().set(FUNC(jpmsys5v_state::u29_porta_r)); + pia.writepb_handler().set(FUNC(jpmsys5v_state::u29_portb_w)); + pia.ca2_handler().set(FUNC(jpmsys5v_state::u29_ca2_w)); + pia.cb2_handler().set(FUNC(jpmsys5v_state::u29_cb2_w)); + pia.irqa_handler().set(FUNC(jpmsys5v_state::pia_irq)); + pia.irqb_handler().set(FUNC(jpmsys5v_state::pia_irq)); /* 6840 PTM */ MCFG_DEVICE_ADD("6840ptm", PTM6840, 1000000) @@ -842,13 +842,13 @@ MACHINE_CONFIG_START(jpmsys5_state::jpmsys5_ym) MCFG_DEVICE_ADD("ym2413", YM2413, 4000000 ) /* Unconfirmed */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_DEVICE_ADD("6821pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, jpmsys5_state, u29_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, jpmsys5_state, u29_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, jpmsys5_state, u29_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, jpmsys5_state, u29_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, jpmsys5_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, jpmsys5_state, pia_irq)) + pia6821_device &pia(PIA6821(config, "6821pia", 0)); + pia.readpa_handler().set(FUNC(jpmsys5_state::u29_porta_r)); + pia.writepb_handler().set(FUNC(jpmsys5_state::u29_portb_w)); + pia.ca2_handler().set(FUNC(jpmsys5_state::u29_ca2_w)); + pia.cb2_handler().set(FUNC(jpmsys5_state::u29_cb2_w)); + pia.irqa_handler().set(FUNC(jpmsys5_state::pia_irq)); + pia.irqb_handler().set(FUNC(jpmsys5_state::pia_irq)); /* 6840 PTM */ MCFG_DEVICE_ADD("6840ptm", PTM6840, 1000000) @@ -899,13 +899,13 @@ MACHINE_CONFIG_START(jpmsys5_state::jpmsys5) MCFG_SAA1099_ADD("saa", 4000000 /* guess */) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_DEVICE_ADD("6821pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, jpmsys5_state, u29_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, jpmsys5_state, u29_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, jpmsys5_state, u29_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, jpmsys5_state, u29_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, jpmsys5_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, jpmsys5_state, pia_irq)) + pia6821_device &pia(PIA6821(config, "6821pia", 0)); + pia.readpa_handler().set(FUNC(jpmsys5_state::u29_porta_r)); + pia.writepb_handler().set(FUNC(jpmsys5_state::u29_portb_w)); + pia.ca2_handler().set(FUNC(jpmsys5_state::u29_ca2_w)); + pia.cb2_handler().set(FUNC(jpmsys5_state::u29_cb2_w)); + pia.irqa_handler().set(FUNC(jpmsys5_state::pia_irq)); + pia.irqb_handler().set(FUNC(jpmsys5_state::pia_irq)); /* 6840 PTM */ MCFG_DEVICE_ADD("6840ptm", PTM6840, 1000000) diff --git a/src/mame/drivers/maxaflex.cpp b/src/mame/drivers/maxaflex.cpp index 1e2dea2e489..5b887ca2247 100644 --- a/src/mame/drivers/maxaflex.cpp +++ b/src/mame/drivers/maxaflex.cpp @@ -340,11 +340,11 @@ MACHINE_CONFIG_START(maxaflex_state::maxaflex) MCFG_DEVICE_ADD("antic", ATARI_ANTIC, 0) MCFG_ANTIC_GTIA("gtia") - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, maxaflex_state, pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, maxaflex_state, pia_pb_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, maxaflex_state, pia_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, maxaflex_state, pia_cb2_w)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.readpa_handler().set(FUNC(maxaflex_state::pia_pa_r)); + pia.readpb_handler().set(FUNC(maxaflex_state::pia_pb_r)); + pia.writepb_handler().set(FUNC(maxaflex_state::pia_pb_w)); + pia.cb2_handler().set(FUNC(maxaflex_state::pia_cb2_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/maygay1b.cpp b/src/mame/drivers/maygay1b.cpp index a6399edf24b..bdc46e936a5 100644 --- a/src/mame/drivers/maygay1b.cpp +++ b/src/mame/drivers/maygay1b.cpp @@ -779,9 +779,9 @@ MACHINE_CONFIG_START(maygay1b_state::maygay_m1) MCFG_MC68681_IRQ_CALLBACK(WRITELINE(*this, maygay1b_state, duart_irq_handler)) MCFG_MC68681_INPORT_CALLBACK(READ8(*this, maygay1b_state, m1_duart_r)) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, maygay1b_state, m1_pia_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, maygay1b_state, m1_pia_portb_w)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.writepa_handler().set(FUNC(maygay1b_state::m1_pia_porta_w)); + pia.writepb_handler().set(FUNC(maygay1b_state::m1_pia_portb_w)); MCFG_DEVICE_ADD("mainlatch", HC259, 0) // U29 MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, maygay1b_state, ramen_w)) // m_RAMEN diff --git a/src/mame/drivers/maygayv1.cpp b/src/mame/drivers/maygayv1.cpp index ae836ce6cdb..00bcddf4619 100644 --- a/src/mame/drivers/maygayv1.cpp +++ b/src/mame/drivers/maygayv1.cpp @@ -890,11 +890,11 @@ MACHINE_CONFIG_START(maygayv1_state::maygayv1) MCFG_MCS51_SERIAL_RX_CB(READ8(*this, maygayv1_state, data_to_i8031)) /* U25 ST 2 9148 EF68B21P */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, maygayv1_state, b_read)) - MCFG_PIA_READPB_HANDLER(READ8(*this, maygayv1_state, b_read)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, maygayv1_state, b_writ)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, maygayv1_state, b_writ)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.readpa_handler().set(FUNC(maygayv1_state::b_read)); + pia.readpb_handler().set(FUNC(maygayv1_state::b_read)); + pia.writepa_handler().set(FUNC(maygayv1_state::b_writ)); + pia.writepb_handler().set(FUNC(maygayv1_state::b_writ)); MCFG_NVRAM_ADD_0FILL("nvram") diff --git a/src/mame/drivers/mekd2.cpp b/src/mame/drivers/mekd2.cpp index 21d88b70c49..56c5d13899b 100644 --- a/src/mame/drivers/mekd2.cpp +++ b/src/mame/drivers/mekd2.cpp @@ -389,18 +389,18 @@ MACHINE_CONFIG_START(mekd2_state::mekd2) MCFG_CASSETTE_ADD("cassette") /* Devices */ - MCFG_DEVICE_ADD("pia_s", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mekd2_state, mekd2_key_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, mekd2_state, mekd2_key40_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mekd2_state, mekd2_segment_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mekd2_state, mekd2_digit_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mekd2_state, mekd2_nmi_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) - - MCFG_DEVICE_ADD("pia_u", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_s, 0); + m_pia_s->readpa_handler().set(FUNC(mekd2_state::mekd2_key_r)); + m_pia_s->readcb1_handler().set(FUNC(mekd2_state::mekd2_key40_r)); + m_pia_s->writepa_handler().set(FUNC(mekd2_state::mekd2_segment_w)); + m_pia_s->writepb_handler().set(FUNC(mekd2_state::mekd2_digit_w)); + m_pia_s->ca2_handler().set(FUNC(mekd2_state::mekd2_nmi_w)); + m_pia_s->irqa_handler().set_inputline("maincpu", INPUT_LINE_NMI); + m_pia_s->irqb_handler().set_inputline("maincpu", INPUT_LINE_NMI); + + PIA6821(config, m_pia_u, 0); + m_pia_u->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_DEVICE_ADD("acia", ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, mekd2_state, cass_w)) diff --git a/src/mame/drivers/micropin.cpp b/src/mame/drivers/micropin.cpp index e5685bc2deb..5db75719677 100644 --- a/src/mame/drivers/micropin.cpp +++ b/src/mame/drivers/micropin.cpp @@ -316,21 +316,21 @@ MACHINE_CONFIG_START(micropin_state::micropin) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* Devices */ - MCFG_DEVICE_ADD("pia50", PIA6821, 0) - //MCFG_PIA_READPA_HANDLER(READ8(*this, micropin_state, p50a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, micropin_state, p50a_w)) - //MCFG_PIA_READPB_HANDLER(READ8(*this, micropin_state, p50b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, micropin_state, p50b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, micropin_state, p50ca2_w)) - //MCFG_PIA_CB2_HANDLER(WRITELINE(*this, micropin_state, p50cb2_w)) - - MCFG_DEVICE_ADD("pia51", PIA6821, 0) - //MCFG_PIA_READPA_HANDLER(READ8(*this, micropin_state, p51a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, micropin_state, p51a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, micropin_state, p51b_r)) - //MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, micropin_state, p51b_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(*this, micropin_state, p51ca2_w)) - //MCFG_PIA_CB2_HANDLER(WRITELINE(*this, micropin_state, p51cb2_w)) + pia6821_device &pia50(PIA6821(config, "pia50", 0)); + //pia50.readpa_handler().set(FUNC(micropin_state::p50a_r)); + pia50.writepa_handler().set(FUNC(micropin_state::p50a_w)); + //pia50.readpb_handler().set(FUNC(micropin_state::p50b_r)); + pia50.writepb_handler().set(FUNC(micropin_state::p50b_w)); + pia50.ca2_handler().set(FUNC(micropin_state::p50ca2_w)); + //pia50.cb2_handler().set(FUNC(micropin_state::p50cb2_w)); + + PIA6821(config, m_pia51, 0); + //m_pia51->readpa_handler().set(FUNC(micropin_state::p51a_r)); + m_pia51->writepa_handler().set(FUNC(micropin_state::p51a_w)); + m_pia51->readpb_handler().set(FUNC(micropin_state::p51b_r)); + //m_pia51->writepb_handler().set(FUNC(micropin_state::p51b_w)); + //m_pia51->ca2_handler().set(FUNC(micropin_state::p51ca2_w)); + //m_pia51->cb2_handler().set(FUNC(micropin_state::p51cb2_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_a", micropin_state, timer_a, attotime::from_hz(100)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp index 5b2c97944cd..deead498699 100644 --- a/src/mame/drivers/miniboy7.cpp +++ b/src/mame/drivers/miniboy7.cpp @@ -519,12 +519,12 @@ MACHINE_CONFIG_START(miniboy7_state::miniboy7) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("INPUT1")) - MCFG_PIA_READPB_HANDLER(READ8(*this, miniboy7_state, pia_pb_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, miniboy7_state, pia_ca2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", 0)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", 0)) + pia6821_device &pia(PIA6821(config, "pia0", 0)); + pia.readpa_handler().set_ioport("INPUT1"); + pia.readpb_handler().set(FUNC(miniboy7_state::pia_pb_r)); + pia.ca2_handler().set(FUNC(miniboy7_state::pia_ca2_w)); + pia.irqa_handler().set_inputline("maincpu", 0); + pia.irqb_handler().set_inputline("maincpu", 0); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/mkit09.cpp b/src/mame/drivers/mkit09.cpp index 2eec24edc8a..679a947e82c 100644 --- a/src/mame/drivers/mkit09.cpp +++ b/src/mame/drivers/mkit09.cpp @@ -211,13 +211,13 @@ MACHINE_CONFIG_START(mkit09_state::mkit09) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); /* Devices */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mkit09_state, pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, mkit09_state, pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mkit09_state, pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mkit09_state, pb_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(mkit09_state::pa_r)); + m_pia->readpb_handler().set(FUNC(mkit09_state::pb_r)); + m_pia->writepa_handler().set(FUNC(mkit09_state::pa_w)); + m_pia->writepb_handler().set(FUNC(mkit09_state::pb_w)); + m_pia->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + m_pia->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); MCFG_CASSETTE_ADD( "cassette" ) MACHINE_CONFIG_END @@ -235,13 +235,13 @@ MACHINE_CONFIG_START(mkit09_state::mkit09a) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); /* Devices */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mkit09_state, pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, mkit09_state, pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mkit09_state, pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mkit09_state, pb_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(mkit09_state::pa_r)); + m_pia->readpb_handler().set(FUNC(mkit09_state::pb_r)); + m_pia->writepa_handler().set(FUNC(mkit09_state::pa_w)); + m_pia->writepb_handler().set(FUNC(mkit09_state::pb_w)); + m_pia->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + m_pia->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); MCFG_CASSETTE_ADD( "cassette" ) MACHINE_CONFIG_END diff --git a/src/mame/drivers/mpu3.cpp b/src/mame/drivers/mpu3.cpp index 5165396fe8c..c23fea1a9c0 100644 --- a/src/mame/drivers/mpu3.cpp +++ b/src/mame/drivers/mpu3.cpp @@ -854,34 +854,34 @@ MACHINE_CONFIG_START(mpu3_state::mpu3base) MCFG_PTM6840_O3_CB(WRITELINE(*this, mpu3_state, ic2_o3_callback)) MCFG_PTM6840_IRQ_CB(WRITELINE(*this, mpu3_state, cpu0_irq)) - MCFG_DEVICE_ADD(m_pia3, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mpu3_state, pia_ic3_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu3_state, pia_ic3_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu3_state, pia_ic3_ca2_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu3_state, cpu0_irq)) - - MCFG_DEVICE_ADD(m_pia4, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mpu3_state, pia_ic4_porta_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu3_state, pia_ic4_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu3_state, pia_ic4_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu3_state, pia_ic4_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu3_state, pia_ic4_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu3_state, cpu0_irq)) - - MCFG_DEVICE_ADD(m_pia5, PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, mpu3_state, pia_ic5_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu3_state, pia_ic5_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu3_state, pia_ic5_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu3_state, pia_ic5_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu3_state, pia_ic5_cb2_w)) - - MCFG_DEVICE_ADD(m_pia6, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mpu3_state, pia_ic6_porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, mpu3_state, pia_ic6_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu3_state, pia_ic6_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu3_state, pia_ic6_portb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu3_state, cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu3_state, cpu0_irq)) + PIA6821(config, m_pia3, 0); + m_pia3->readpa_handler().set(FUNC(mpu3_state::pia_ic3_porta_r)); + m_pia3->writepb_handler().set(FUNC(mpu3_state::pia_ic3_portb_w)); + m_pia3->ca2_handler().set(FUNC(mpu3_state::pia_ic3_ca2_w)); + m_pia3->irqb_handler().set(FUNC(mpu3_state::cpu0_irq)); + + PIA6821(config, m_pia4, 0); + m_pia4->readpa_handler().set(FUNC(mpu3_state::pia_ic4_porta_r)); + m_pia4->writepa_handler().set(FUNC(mpu3_state::pia_ic4_porta_w)); + m_pia4->writepb_handler().set(FUNC(mpu3_state::pia_ic4_portb_w)); + m_pia4->ca2_handler().set(FUNC(mpu3_state::pia_ic4_ca2_w)); + m_pia4->cb2_handler().set(FUNC(mpu3_state::pia_ic4_cb2_w)); + m_pia4->irqa_handler().set(FUNC(mpu3_state::cpu0_irq)); + + PIA6821(config, m_pia5, 0); + m_pia5->readpb_handler().set(FUNC(mpu3_state::pia_ic5_portb_r)); + m_pia5->writepa_handler().set(FUNC(mpu3_state::pia_ic5_porta_w)); + m_pia5->writepb_handler().set(FUNC(mpu3_state::pia_ic5_portb_w)); + m_pia5->ca2_handler().set(FUNC(mpu3_state::pia_ic5_ca2_w)); + m_pia5->cb2_handler().set(FUNC(mpu3_state::pia_ic5_cb2_w)); + + PIA6821(config, m_pia6, 0); + m_pia6->readpa_handler().set(FUNC(mpu3_state::pia_ic6_porta_r)); + m_pia6->readpb_handler().set(FUNC(mpu3_state::pia_ic6_portb_r)); + m_pia6->writepa_handler().set(FUNC(mpu3_state::pia_ic6_porta_w)); + m_pia6->writepb_handler().set(FUNC(mpu3_state::pia_ic6_portb_w)); + m_pia6->irqa_handler().set(FUNC(mpu3_state::cpu0_irq)); + m_pia6->irqb_handler().set(FUNC(mpu3_state::cpu0_irq)); MCFG_DEVICE_ADD("reel0", REEL, MPU3_48STEP_REEL, 1, 3, 0x00, 2) MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(*this, mpu3_state, reel_optic_cb<0>)) diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp index a950375488d..95e01585cb0 100644 --- a/src/mame/drivers/mpu4vid.cpp +++ b/src/mame/drivers/mpu4vid.cpp @@ -1342,10 +1342,9 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(mpu4vid_state::crmaze) mpu4_vid(config); - MCFG_DEVICE_MODIFY("pia_ic5") - MCFG_PIA_READPA_HANDLER(READ8(*this, mpu4vid_state, pia_ic5_porta_track_r)) - MCFG_PIA_WRITEPA_HANDLER(NOOP) - MCFG_PIA_WRITEPB_HANDLER(NOOP) + m_pia5->readpa_handler().set(FUNC(mpu4vid_state::pia_ic5_porta_track_r)); + m_pia5->writepa_handler().set_nop(); + m_pia5->writepb_handler().set_nop(); MACHINE_CONFIG_END MACHINE_CONFIG_START(mpu4vid_state::mating) diff --git a/src/mame/drivers/nyny.cpp b/src/mame/drivers/nyny.cpp index dd20621c83c..3755ae39a82 100644 --- a/src/mame/drivers/nyny.cpp +++ b/src/mame/drivers/nyny.cpp @@ -634,18 +634,18 @@ MACHINE_CONFIG_START(nyny_state::nyny) MCFG_TTL74123_CLEAR_PIN_VALUE(1) /* Clear pin - pulled high */ MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITELINE(*this, nyny_state, ic48_1_74123_output_changed)) - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, nyny_state, main_cpu_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, nyny_state, main_cpu_irq)) - - MCFG_DEVICE_ADD("pia2", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, nyny_state,pia_2_port_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, nyny_state,pia_2_port_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, nyny_state,flipscreen_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, nyny_state,main_cpu_firq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, nyny_state,main_cpu_irq)) + PIA6821(config, m_pia1, 0); + m_pia1->readpa_handler().set_ioport("IN0"); + m_pia1->readpb_handler().set_ioport("IN1"); + m_pia1->irqa_handler().set(FUNC(nyny_state::main_cpu_irq)); + m_pia1->irqb_handler().set(FUNC(nyny_state::main_cpu_irq)); + + PIA6821(config, m_pia2, 0); + m_pia2->writepa_handler().set(FUNC(nyny_state::pia_2_port_a_w)); + m_pia2->writepb_handler().set(FUNC(nyny_state::pia_2_port_b_w)); + m_pia2->ca2_handler().set(FUNC(nyny_state::flipscreen_w)); + m_pia2->irqa_handler().set(FUNC(nyny_state::main_cpu_firq)); + m_pia2->irqb_handler().set(FUNC(nyny_state::main_cpu_irq)); /* audio hardware */ SPEAKER(config, "speaker").front_center(); diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 6acb93a6a06..158e5f1c51c 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -547,19 +547,19 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) MCFG_DEVICE_ADD(m_speaker, SPEAKER_SOUND) MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - MCFG_DEVICE_ADD(m_pia[0], PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, osbexec_state, osbexec_pia0_a_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, osbexec_state, osbexec_pia0_b_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, osbexec_state, osbexec_pia0_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, osbexec_state, osbexec_pia0_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, osbexec_state, osbexec_pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, osbexec_state, osbexec_pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set(FUNC(osbexec_state::osbexec_pia0_a_r)); + m_pia[0]->readpb_handler().set(FUNC(osbexec_state::osbexec_pia0_b_r)); + m_pia[0]->writepa_handler().set(FUNC(osbexec_state::osbexec_pia0_a_w)); + m_pia[0]->writepb_handler().set(FUNC(osbexec_state::osbexec_pia0_b_w)); + m_pia[0]->ca2_handler().set(FUNC(osbexec_state::osbexec_pia0_ca2_w)); + m_pia[0]->cb2_handler().set(FUNC(osbexec_state::osbexec_pia0_cb2_w)); + m_pia[0]->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<0>)); + m_pia[0]->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); MCFG_DEVICE_ADD(m_pia[1], PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<2>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<3>)) + m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<2>)); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<3>)); INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, 0); diff --git a/src/mame/drivers/osi.cpp b/src/mame/drivers/osi.cpp index 5bb8af5602f..9450674c443 100644 --- a/src/mame/drivers/osi.cpp +++ b/src/mame/drivers/osi.cpp @@ -784,9 +784,9 @@ MACHINE_CONFIG_START(c1p_state::c1p) MCFG_DEVICE_ADD("beeper", BEEP, 300) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_DEVICE_ADD("pia_1", PIA6821, 0) - MCFG_DEVICE_ADD("pia_2", PIA6821, 0) - MCFG_DEVICE_ADD("pia_3", PIA6821, 0) + PIA6821(config, "pia_1", 0); + PIA6821(config, "pia_2", 0); + PIA6821(config, "pia_3", 0); /* cassette ACIA */ MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) @@ -809,11 +809,11 @@ MACHINE_CONFIG_START(c1pmf_state::c1pmf) MCFG_DEVICE_MODIFY(M6502_TAG) MCFG_DEVICE_PROGRAM_MAP(c1pmf_mem) - MCFG_DEVICE_ADD("pia_0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, c1pmf_state, osi470_pia_pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, c1pmf_state, osi470_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, c1pmf_state, osi470_pia_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, c1pmf_state, osi470_pia_cb2_w)) + pia6821_device &pia0(PIA6821(config, "pia_0", 0)); + pia0.readpa_handler().set(FUNC(c1pmf_state::osi470_pia_pa_r)); + pia0.writepa_handler().set(FUNC(c1pmf_state::osi470_pia_pa_w)); + pia0.writepb_handler().set(FUNC(c1pmf_state::osi470_pia_pb_w)); + pia0.cb2_handler().set(FUNC(c1pmf_state::osi470_pia_cb2_w)); /* floppy ACIA */ MCFG_DEVICE_ADD("acia_1", ACIA6850, 0) diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp index bd99881025d..cb4b647d0f3 100644 --- a/src/mame/drivers/pegasus.cpp +++ b/src/mame/drivers/pegasus.cpp @@ -511,20 +511,20 @@ MACHINE_CONFIG_START(pegasus_state::pegasus) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.05); /* devices */ - MCFG_DEVICE_ADD("pia_s", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, pegasus_state, pegasus_keyboard_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, pegasus_state, pegasus_cassette_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, pegasus_state, pegasus_keyboard_irq)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, pegasus_state, pegasus_keyboard_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, pegasus_state, pegasus_controls_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, pegasus_state, pegasus_cassette_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, pegasus_state, pegasus_firq_clr)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia_u", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + PIA6821(config, m_pia_s, 0); + m_pia_s->readpb_handler().set(FUNC(pegasus_state::pegasus_keyboard_r)); + m_pia_s->readca1_handler().set(FUNC(pegasus_state::pegasus_cassette_r)); + m_pia_s->readcb1_handler().set(FUNC(pegasus_state::pegasus_keyboard_irq)); + m_pia_s->writepa_handler().set(FUNC(pegasus_state::pegasus_keyboard_w)); + m_pia_s->writepb_handler().set(FUNC(pegasus_state::pegasus_controls_w)); + m_pia_s->ca2_handler().set(FUNC(pegasus_state::pegasus_cassette_w)); + m_pia_s->cb2_handler().set(FUNC(pegasus_state::pegasus_firq_clr)); + m_pia_s->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + m_pia_s->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); + + PIA6821(config, m_pia_u, 0); + m_pia_u->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + m_pia_u->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); MCFG_GENERIC_SOCKET_ADD("exp00", generic_plain_slot, "pegasus_cart") MCFG_GENERIC_LOAD(pegasus_state, exp00_load) diff --git a/src/mame/drivers/poly.cpp b/src/mame/drivers/poly.cpp index 0a40a6a345c..bb32f6ea8da 100644 --- a/src/mame/drivers/poly.cpp +++ b/src/mame/drivers/poly.cpp @@ -326,17 +326,17 @@ MACHINE_CONFIG_START(poly_state::poly) MCFG_GENERIC_KEYBOARD_CB(PUT(poly_state, kbd_put)) /* video control */ - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, poly_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, poly_state, pia0_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("irqs", input_merger_device, in_w<2>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("irqs", input_merger_device, in_w<3>)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->writepa_handler().set(FUNC(poly_state::pia0_pa_w)); + m_pia[0]->writepa_handler().set(FUNC(poly_state::pia0_pb_w)); + m_pia[0]->irqa_handler().set("irqs", FUNC(input_merger_device::in_w<2>)); + m_pia[0]->irqb_handler().set("irqs", FUNC(input_merger_device::in_w<3>)); /* keyboard PIA */ - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, poly_state, pia1_b_in)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("irqs", input_merger_device, in_w<4>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("irqs", input_merger_device, in_w<5>)) + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpb_handler().set(FUNC(poly_state::pia1_b_in)); + m_pia[1]->irqa_handler().set("irqs", FUNC(input_merger_device::in_w<4>)); + m_pia[1]->irqb_handler().set("irqs", FUNC(input_merger_device::in_w<5>)); /* optional rs232 interface */ MCFG_DEVICE_ADD("acia", ACIA6850, 0) diff --git a/src/mame/drivers/proteus.cpp b/src/mame/drivers/proteus.cpp index 1526ce264a6..c078ad5beb7 100644 --- a/src/mame/drivers/proteus.cpp +++ b/src/mame/drivers/proteus.cpp @@ -358,13 +358,13 @@ MACHINE_CONFIG_START(proteus_state::proteus) MCFG_PTM6840_IRQ_CB(WRITELINE("irqs", input_merger_device, in_w<1>)) /* parallel port */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - //MCFG_PIA_READPB_HANDLER(READ8(*this, proteus_state, pia_pb_r)) - //MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, proteus_state, pia_pa_w)) - //MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, proteus_state, pia_pb_w)) - //MCFG_PIA_CA2_HANDLER(WRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("irqs", input_merger_device, in_w<2>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("irqs", input_merger_device, in_w<3>)) + PIA6821(config, m_pia, 0); + //m_pia->readpb_handler().set(FUNC(proteus_state::pia_pb_r)); + //m_pia->writepa_handler().set(FUNC(proteus_state::pia_pa_w)); + //m_pia->writepb_handler().set(FUNC(proteus_state::pia_pb_w)); + //m_pia->ca2_handler().set(CENTRONICS_TAG, FUNC(centronics_device::write_strobe)); + m_pia->irqa_handler().set("irqs", FUNC(input_merger_device::in_w<2>)); + m_pia->irqb_handler().set("irqs", FUNC(input_merger_device::in_w<3>)); MCFG_DEVICE_ADD("parallel", CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_ACK_HANDLER(WRITELINE("pia", pia6821_device, ca1_w)) diff --git a/src/mame/drivers/proteus3.cpp b/src/mame/drivers/proteus3.cpp index 66a4d3acae4..fba12e58db6 100644 --- a/src/mame/drivers/proteus3.cpp +++ b/src/mame/drivers/proteus3.cpp @@ -397,10 +397,11 @@ MACHINE_CONFIG_START(proteus3_state::proteus3) MCFG_PALETTE_ADD_MONOCHROME("palette") /* Devices */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, proteus3_state, video_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, proteus3_state, ca2_w)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set(FUNC(proteus3_state::video_w)); + m_pia->ca2_handler().set(FUNC(proteus3_state::ca2_w)); + m_pia->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(PUT(proteus3_state, kbd_put)) diff --git a/src/mame/drivers/qix.cpp b/src/mame/drivers/qix.cpp index 53deca48408..d7f29cab706 100644 --- a/src/mame/drivers/qix.cpp +++ b/src/mame/drivers/qix.cpp @@ -613,17 +613,17 @@ MACHINE_CONFIG_START(qix_state::qix_base) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("P1")) - MCFG_PIA_READPB_HANDLER(IOPORT("COIN")) + PIA6821(config, m_pia0, 0); + m_pia0->readpa_handler().set_ioport("P1"); + m_pia0->readpb_handler().set_ioport("COIN"); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("SPARE")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN0")) + PIA6821(config, m_pia1, 0); + m_pia1->readpa_handler().set_ioport("SPARE"); + m_pia1->readpb_handler().set_ioport("IN0"); - MCFG_DEVICE_ADD("pia2", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("P2")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, qix_coinctl_w)) + PIA6821(config, m_pia2, 0); + m_pia2->readpa_handler().set_ioport("P2"); + m_pia2->writepb_handler().set(FUNC(qix_state::qix_coinctl_w)); /* video hardware */ qix_video(config); @@ -664,12 +664,10 @@ MACHINE_CONFIG_START(qix_state::mcu) MCFG_MACHINE_START_OVERRIDE(qix_state,qixmcu) - MCFG_DEVICE_MODIFY("pia0") - MCFG_PIA_READPB_HANDLER(READ8(*this, qix_state, qixmcu_coin_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, qixmcu_coin_w)) + m_pia0->readpb_handler().set(FUNC(qix_state::qixmcu_coin_r)); + m_pia0->writepb_handler().set(FUNC(qix_state::qixmcu_coin_w)); - MCFG_DEVICE_MODIFY("pia2") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, qixmcu_coinctrl_w)) + m_pia2->writepb_handler().set(FUNC(qix_state::qixmcu_coinctrl_w)); MACHINE_CONFIG_END @@ -702,15 +700,13 @@ MACHINE_CONFIG_START(qix_state::slither) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_CLOCK(SLITHER_CLOCK_OSC/4/4) /* 1.34 MHz */ - MCFG_DEVICE_MODIFY("pia1") - MCFG_PIA_READPA_HANDLER(READ8(*this, qix_state, slither_trak_lr_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, slither_76489_0_w)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) + m_pia1->readpa_handler().set(FUNC(qix_state::slither_trak_lr_r)); + m_pia1->writepb_handler().set(FUNC(qix_state::slither_76489_0_w)); + m_pia1->readpb_handler().set_constant(0); - MCFG_DEVICE_MODIFY("pia2") - MCFG_PIA_READPA_HANDLER(READ8(*this, qix_state, slither_trak_ud_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, qix_state, slither_76489_1_w)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) + m_pia2->readpa_handler().set(FUNC(qix_state::slither_trak_ud_r)); + m_pia2->writepb_handler().set(FUNC(qix_state::slither_76489_1_w)); + m_pia2->readpb_handler().set_constant(0); /* video hardware */ slither_video(config); diff --git a/src/mame/drivers/r2dtank.cpp b/src/mame/drivers/r2dtank.cpp index 60106a83b81..a89dc444f18 100644 --- a/src/mame/drivers/r2dtank.cpp +++ b/src/mame/drivers/r2dtank.cpp @@ -474,19 +474,19 @@ MACHINE_CONFIG_START(r2dtank_state::r2dtank) MCFG_TTL74123_CLEAR_PIN_VALUE(1) /* Clear pin - pulled high */ MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITELINE(*this, r2dtank_state, ttl74123_output_changed)) - MCFG_DEVICE_ADD("pia_main", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, r2dtank_state, flipscreen_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, r2dtank_state, main_cpu_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, r2dtank_state, main_cpu_irq)) - - MCFG_DEVICE_ADD("pia_audio", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, r2dtank_state, AY8910_port_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, r2dtank_state, AY8910_port_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, r2dtank_state, AY8910_select_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, r2dtank_state, main_cpu_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, r2dtank_state, main_cpu_irq)) + PIA6821(config, m_pia_main, 0); + m_pia_main->readpa_handler().set_ioport("IN0"); + m_pia_main->readpb_handler().set_ioport("IN1"); + m_pia_main->cb2_handler().set(FUNC(r2dtank_state::flipscreen_w)); + m_pia_main->irqa_handler().set(FUNC(r2dtank_state::main_cpu_irq)); + m_pia_main->irqb_handler().set(FUNC(r2dtank_state::main_cpu_irq)); + + PIA6821(config, m_pia_audio, 0); + m_pia_audio->readpa_handler().set(FUNC(r2dtank_state::AY8910_port_r)); + m_pia_audio->writepa_handler().set(FUNC(r2dtank_state::AY8910_port_w)); + m_pia_audio->writepb_handler().set(FUNC(r2dtank_state::AY8910_select_w)); + m_pia_audio->irqa_handler().set(FUNC(r2dtank_state::main_cpu_irq)); + m_pia_audio->irqb_handler().set(FUNC(r2dtank_state::main_cpu_irq)); /* audio hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/s11.cpp b/src/mame/drivers/s11.cpp index e5948db198d..4f5fa1f06dc 100644 --- a/src/mame/drivers/s11.cpp +++ b/src/mame/drivers/s11.cpp @@ -395,50 +395,50 @@ MACHINE_CONFIG_START(s11_state::s11) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, pia28_w7_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia2c", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, pia2c_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia2c_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, switch_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia34", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, pia34_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia34_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia34_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pia21->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s11_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s11_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s11_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s11_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s11_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s11_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s11_state::pia28_w7_r)); + m_pia28->writepa_handler().set(FUNC(s11_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s11_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s11_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s11_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia2c, 0); + m_pia2c->writepa_handler().set(FUNC(s11_state::pia2c_pa_w)); + m_pia2c->writepb_handler().set(FUNC(s11_state::pia2c_pb_w)); + m_pia2c->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia2c->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s11_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s11_state::switch_w)); + m_pia30->cb2_handler().set(FUNC(s11_state::pia30_cb2_w)); + m_pia30->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia34, 0); + m_pia34->writepa_handler().set(FUNC(s11_state::pia34_pa_w)); + m_pia34->writepb_handler().set(FUNC(s11_state::pia34_pb_w)); + m_pia34->cb2_handler().set(FUNC(s11_state::pia34_cb2_w)); + m_pia34->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia34->irqb_handler().set(FUNC(s11_state::pia_irq)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -456,14 +456,14 @@ MACHINE_CONFIG_START(s11_state::s11) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 1.00) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pias_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pias_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pias->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->ca2_handler().set("hc55516", FUNC(hc55516_device::clock_w)); + m_pias->cb2_handler().set("hc55516", FUNC(hc55516_device::digit_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); /* Add the background music card */ MCFG_DEVICE_ADD("bgcpu", MC6809E, 8000000 / 4) // MC68B09E @@ -476,12 +476,12 @@ MACHINE_CONFIG_START(s11_state::s11) MCFG_DEVICE_ADD("dac1", MC1408, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bg", 0.25) - MCFG_DEVICE_ADD("pia40", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac1", dac_byte_interface, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia40_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia40_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("bgcpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("bgcpu", INPUT_LINE_NMI)) + PIA6821(config, m_pia40, 0); + m_pia40->writepa_handler().set("dac1", FUNC(dac_byte_interface::data_w)); + m_pia40->writepb_handler().set(FUNC(s11_state::pia40_pb_w)); + m_pia40->cb2_handler().set(FUNC(s11_state::pia40_cb2_w)); + m_pia40->irqa_handler().set_inputline("bgcpu", M6809_FIRQ_LINE); + m_pia40->irqb_handler().set_inputline("bgcpu", INPUT_LINE_NMI); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s11a.cpp b/src/mame/drivers/s11a.cpp index c9e0fa3876b..44810b4d6c4 100644 --- a/src/mame/drivers/s11a.cpp +++ b/src/mame/drivers/s11a.cpp @@ -187,50 +187,50 @@ MACHINE_CONFIG_START(s11a_state::s11a) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, pia28_w7_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11a_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia2c", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, pia2c_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia2c_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, switch_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia34", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, pia34_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia34_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia34_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pia21->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s11_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s11_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s11_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s11_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s11_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s11_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s11_state::pia28_w7_r)); + m_pia28->writepa_handler().set(FUNC(s11a_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s11_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s11_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s11_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia2c, 0); + m_pia2c->writepa_handler().set(FUNC(s11_state::pia2c_pa_w)); + m_pia2c->writepb_handler().set(FUNC(s11_state::pia2c_pb_w)); + m_pia2c->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia2c->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s11_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s11_state::switch_w)); + m_pia30->cb2_handler().set(FUNC(s11_state::pia30_cb2_w)); + m_pia30->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia34, 0); + m_pia34->writepa_handler().set(FUNC(s11_state::pia34_pa_w)); + m_pia34->writepb_handler().set(FUNC(s11_state::pia34_pb_w)); + m_pia34->cb2_handler().set(FUNC(s11_state::pia34_cb2_w)); + m_pia34->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia34->irqb_handler().set(FUNC(s11_state::pia_irq)); MCFG_NVRAM_ADD_1FILL("nvram") @@ -248,13 +248,13 @@ MACHINE_CONFIG_START(s11a_state::s11a) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 0.50) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia40_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pias->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->cb2_handler().set(FUNC(s11_state::pia40_cb2_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); + m_pias->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); /* Add the background music card */ MCFG_DEVICE_ADD("bgcpu", MC6809E, XTAL(8'000'000) / 4) // MC68B09E @@ -267,13 +267,13 @@ MACHINE_CONFIG_START(s11a_state::s11a) MCFG_DEVICE_ADD("dac1", MC1408, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bg", 0.25) - MCFG_DEVICE_ADD("pia40", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac1", dac_byte_interface, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia40_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pias_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pias_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("bgcpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("bgcpu", INPUT_LINE_NMI)) + PIA6821(config, m_pia40, 0); + m_pia40->writepa_handler().set("dac1", FUNC(dac_byte_interface::data_w)); + m_pia40->writepb_handler().set(FUNC(s11_state::pia40_pb_w)); + m_pia40->ca2_handler().set(FUNC(s11_state::pias_ca2_w)); + m_pia40->cb2_handler().set(FUNC(s11_state::pias_cb2_w)); + m_pia40->irqa_handler().set_inputline("bgcpu", M6809_FIRQ_LINE); + m_pia40->irqb_handler().set_inputline("bgcpu", INPUT_LINE_NMI); MACHINE_CONFIG_END /*------------------------ diff --git a/src/mame/drivers/s11b.cpp b/src/mame/drivers/s11b.cpp index 45f637d13a7..04e16328f58 100644 --- a/src/mame/drivers/s11b.cpp +++ b/src/mame/drivers/s11b.cpp @@ -261,50 +261,50 @@ MACHINE_CONFIG_START(s11b_state::s11b) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, pia28_w7_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11a_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11b_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia2c", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11b_state, pia2c_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11b_state, pia2c_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, switch_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia34", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11b_state, pia34_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia34_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia34_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pia21->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s11_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s11_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s11_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s11_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s11_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s11_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s11_state::pia28_w7_r)); + m_pia28->writepa_handler().set(FUNC(s11a_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s11b_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s11_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s11_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia2c, 0); + m_pia2c->writepa_handler().set(FUNC(s11b_state::pia2c_pa_w)); + m_pia2c->writepb_handler().set(FUNC(s11b_state::pia2c_pb_w)); + m_pia2c->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia2c->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s11_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s11_state::switch_w)); + m_pia30->cb2_handler().set(FUNC(s11_state::pia30_cb2_w)); + m_pia30->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia34, 0); + m_pia34->writepa_handler().set(FUNC(s11b_state::pia34_pa_w)); + m_pia34->writepb_handler().set(FUNC(s11_state::pia34_pb_w)); + m_pia34->cb2_handler().set(FUNC(s11_state::pia34_cb2_w)); + m_pia34->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia34->irqb_handler().set(FUNC(s11_state::pia_irq)); MCFG_NVRAM_ADD_1FILL("nvram") @@ -322,14 +322,14 @@ MACHINE_CONFIG_START(s11b_state::s11b) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 0.50) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pias_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pias_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pias->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->ca2_handler().set("hc55516", FUNC(hc55516_device::clock_w)); + m_pias->cb2_handler().set("hc55516", FUNC(hc55516_device::digit_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); + m_pias->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); /* Add the background music card */ MCFG_DEVICE_ADD("bgcpu", MC6809E, XTAL(8'000'000) / 4) // MC68B09E @@ -346,13 +346,13 @@ MACHINE_CONFIG_START(s11b_state::s11b) MCFG_DEVICE_ADD("hc55516_bg", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 0.50) - MCFG_DEVICE_ADD("pia40", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac1", dac_byte_interface, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia40_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("ym2151", ym2151_device, reset_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia40_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("bgcpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("bgcpu", INPUT_LINE_NMI)) + PIA6821(config, m_pia40, 0); + m_pia40->writepa_handler().set("dac1", FUNC(dac_byte_interface::data_w)); + m_pia40->writepb_handler().set(FUNC(s11_state::pia40_pb_w)); + m_pia40->ca2_handler().set("ym2151", FUNC(ym2151_device::reset_w)); + m_pia40->cb2_handler().set(FUNC(s11_state::pia40_cb2_w)); + m_pia40->irqa_handler().set_inputline("bgcpu", M6809_FIRQ_LINE); + m_pia40->irqb_handler().set_inputline("bgcpu", INPUT_LINE_NMI); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s11c.cpp b/src/mame/drivers/s11c.cpp index 2cbd6fd7248..f962cb7229a 100644 --- a/src/mame/drivers/s11c.cpp +++ b/src/mame/drivers/s11c.cpp @@ -166,50 +166,50 @@ MACHINE_CONFIG_START(s11c_state::s11c) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, pia28_w7_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11a_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11b_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s11_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia2c", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11b_state, pia2c_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11b_state, pia2c_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s11_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, switch_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - - MCFG_DEVICE_ADD("pia34", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s11b_state, pia34_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s11_state, pia34_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s11_state, pia34_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s11_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s11_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s11_state::sound_r)); + m_pia21->writepa_handler().set(FUNC(s11_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s11_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s11_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s11_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s11_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s11_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s11_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s11_state::pia28_w7_r)); + m_pia28->writepa_handler().set(FUNC(s11a_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s11b_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s11_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s11_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia2c, 0); + m_pia2c->writepa_handler().set(FUNC(s11b_state::pia2c_pa_w)); + m_pia2c->writepb_handler().set(FUNC(s11b_state::pia2c_pb_w)); + m_pia2c->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia2c->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s11_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s11_state::switch_w)); + m_pia30->cb2_handler().set(FUNC(s11_state::pia30_cb2_w)); + m_pia30->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s11_state::pia_irq)); + + PIA6821(config, m_pia34, 0); + m_pia34->writepa_handler().set(FUNC(s11b_state::pia34_pa_w)); + m_pia34->writepb_handler().set(FUNC(s11b_state::pia34_pb_w)); + m_pia34->cb2_handler().set(FUNC(s11b_state::pia34_cb2_w)); + m_pia34->irqa_handler().set(FUNC(s11_state::pia_irq)); + m_pia34->irqb_handler().set(FUNC(s11_state::pia_irq)); MCFG_NVRAM_ADD_1FILL("nvram") diff --git a/src/mame/drivers/s3.cpp b/src/mame/drivers/s3.cpp index 3c1fbddc96d..c80b4c355e2 100644 --- a/src/mame/drivers/s3.cpp +++ b/src/mame/drivers/s3.cpp @@ -450,40 +450,40 @@ MACHINE_CONFIG_START(s3_state::s3) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia22", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s3_state, sol0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s3_state, sol1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s3_state, pia22_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s3_state, pia22_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s3_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s3_state, lamp1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s3_state, pia24_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s3_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s3_state, dips_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, s3_state, pia28_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, s3_state, pia28_cb1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s3_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s3_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s3_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s3_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s3_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s3_state, switch_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s3_state, pia30_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s3_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia22, 0); + m_pia22->writepa_handler().set(FUNC(s3_state::sol0_w)); + m_pia22->writepb_handler().set(FUNC(s3_state::sol1_w)); + m_pia22->ca2_handler().set(FUNC(s3_state::pia22_ca2_w)); + m_pia22->cb2_handler().set(FUNC(s3_state::pia22_cb2_w)); + m_pia22->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia22->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s3_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s3_state::lamp1_w)); + m_pia24->ca2_handler().set(FUNC(s3_state::pia24_ca2_w)); + m_pia24->cb2_handler().set(FUNC(s3_state::pia24_cb2_w)); + m_pia24->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia24->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s3_state::dips_r)); + m_pia28->readca1_handler().set(FUNC(s3_state::pia28_ca1_r)); + m_pia28->readcb1_handler().set(FUNC(s3_state::pia28_cb1_r)); + m_pia28->writepa_handler().set(FUNC(s3_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s3_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s3_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s3_state::pia28_cb2_w)); + m_pia28->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia28->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s3_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s3_state::switch_w)); + m_pia30->ca2_handler().set(FUNC(s3_state::pia30_ca2_w)); + m_pia30->cb2_handler().set(FUNC(s3_state::pia30_cb2_w)); + m_pia30->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia30->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END @@ -500,11 +500,11 @@ MACHINE_CONFIG_START(s3_state::s3a) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, s3_state,sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpb_handler().set(FUNC(s3_state::sound_r)); + m_pias->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); + m_pias->irqb_handler().set_inputline("audiocpu", M6802_IRQ_LINE); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s4.cpp b/src/mame/drivers/s4.cpp index 41982978d37..c29439537aa 100644 --- a/src/mame/drivers/s4.cpp +++ b/src/mame/drivers/s4.cpp @@ -444,40 +444,40 @@ MACHINE_CONFIG_START(s4_state::s4) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia22", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s4_state, sol0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s4_state, sol1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s4_state, pia22_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s4_state, pia22_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s4_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s4_state, lamp1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s4_state, pia24_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s4_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s4_state, dips_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, s4_state, pia28_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(*this, s4_state, pia28_cb1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s4_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s4_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s4_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s4_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s4_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s4_state, switch_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s4_state, pia30_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s4_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia22, 0); + m_pia22->writepa_handler().set(FUNC(s4_state::sol0_w)); + m_pia22->writepb_handler().set(FUNC(s4_state::sol1_w)); + m_pia22->ca2_handler().set(FUNC(s4_state::pia22_ca2_w)); + m_pia22->cb2_handler().set(FUNC(s4_state::pia22_cb2_w)); + m_pia22->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia22->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s4_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s4_state::lamp1_w)); + m_pia24->ca2_handler().set(FUNC(s4_state::pia24_ca2_w)); + m_pia24->cb2_handler().set(FUNC(s4_state::pia24_cb2_w)); + m_pia24->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia24->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s4_state::dips_r)); + m_pia28->readca1_handler().set(FUNC(s4_state::pia28_ca1_r)); + m_pia28->readcb1_handler().set(FUNC(s4_state::pia28_cb1_r)); + m_pia28->writepa_handler().set(FUNC(s4_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s4_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s4_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s4_state::pia28_cb2_w)); + m_pia28->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia28->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s4_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s4_state::switch_w)); + m_pia30->ca2_handler().set(FUNC(s4_state::pia30_ca2_w)); + m_pia30->cb2_handler().set(FUNC(s4_state::pia30_cb2_w)); + m_pia30->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia30->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END @@ -494,11 +494,11 @@ MACHINE_CONFIG_START(s4_state::s4a) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, s4_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpb_handler().set(FUNC(s4_state::sound_r)); + m_pias->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); + m_pias->irqb_handler().set_inputline("audiocpu", M6808_IRQ_LINE); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s6.cpp b/src/mame/drivers/s6.cpp index 79db4cea411..397b9236be0 100644 --- a/src/mame/drivers/s6.cpp +++ b/src/mame/drivers/s6.cpp @@ -422,38 +422,38 @@ MACHINE_CONFIG_START(s6_state::s6) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia22", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s6_state, sol0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6_state, sol1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6_state, pia22_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6_state, pia22_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s6_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6_state, lamp1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6_state, pia24_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s6_state, dips_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s6_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s6_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6_state, switch_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6_state, pia30_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6_state, pia_irq)) + PIA6821(config, m_pia22, 0); + m_pia22->writepa_handler().set(FUNC(s6_state::sol0_w)); + m_pia22->writepb_handler().set(FUNC(s6_state::sol1_w)); + m_pia22->ca2_handler().set(FUNC(s6_state::pia22_ca2_w)); + m_pia22->cb2_handler().set(FUNC(s6_state::pia22_cb2_w)); + m_pia22->irqa_handler().set(FUNC(s6_state::pia_irq)); + m_pia22->irqb_handler().set(FUNC(s6_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s6_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s6_state::lamp1_w)); + m_pia24->ca2_handler().set(FUNC(s6_state::pia24_ca2_w)); + m_pia24->cb2_handler().set(FUNC(s6_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s6_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s6_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s6_state::dips_r)); + m_pia28->writepa_handler().set(FUNC(s6_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s6_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s6_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s6_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s6_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s6_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s6_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s6_state::switch_w)); + m_pia30->ca2_handler().set(FUNC(s6_state::pia30_ca2_w)); + m_pia30->cb2_handler().set(FUNC(s6_state::pia30_cb2_w)); + m_pia30->irqa_handler().set(FUNC(s6_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s6_state::pia_irq)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -470,13 +470,13 @@ MACHINE_CONFIG_START(s6_state::s6) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 1.00) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, s6_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("hc55516", hc55516_device, digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("hc55516", hc55516_device, clock_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpb_handler().set(FUNC(s6_state::sound_r)); + m_pias->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->ca2_handler().set(m_hc55516, FUNC(hc55516_device::digit_w)); + m_pias->cb2_handler().set(m_hc55516, FUNC(hc55516_device::clock_w)); + m_pias->irqa_handler().set_inputline(m_audiocpu, M6802_IRQ_LINE); // FIXME: needs an input merger + m_pias->irqb_handler().set_inputline(m_audiocpu, M6802_IRQ_LINE); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s6a.cpp b/src/mame/drivers/s6a.cpp index 14688eb3b1f..552642795c2 100644 --- a/src/mame/drivers/s6a.cpp +++ b/src/mame/drivers/s6a.cpp @@ -405,38 +405,38 @@ MACHINE_CONFIG_START(s6a_state::s6a) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia22", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s6a_state, sol0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6a_state, sol1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6a_state, pia22_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6a_state, pia22_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s6a_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6a_state, lamp1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6a_state, pia24_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6a_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s6a_state, dips_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s6a_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6a_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6a_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6a_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s6a_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s6a_state, switch_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s6a_state, pia30_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s6a_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s6a_state, pia_irq)) + PIA6821(config, m_pia22, 0); + m_pia22->writepa_handler().set(FUNC(s6a_state::sol0_w)); + m_pia22->writepb_handler().set(FUNC(s6a_state::sol1_w)); + m_pia22->ca2_handler().set(FUNC(s6a_state::pia22_ca2_w)); + m_pia22->cb2_handler().set(FUNC(s6a_state::pia22_cb2_w)); + m_pia22->irqa_handler().set(FUNC(s6a_state::pia_irq)); + m_pia22->irqb_handler().set(FUNC(s6a_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s6a_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s6a_state::lamp1_w)); + m_pia24->ca2_handler().set(FUNC(s6a_state::pia24_ca2_w)); + m_pia24->cb2_handler().set(FUNC(s6a_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s6a_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s6a_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s6a_state::dips_r)); + m_pia28->writepa_handler().set(FUNC(s6a_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s6a_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s6a_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s6a_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s6a_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s6a_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s6a_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s6a_state::switch_w)); + m_pia30->ca2_handler().set(FUNC(s6a_state::pia30_ca2_w)); + m_pia30->cb2_handler().set(FUNC(s6a_state::pia30_cb2_w)); + m_pia30->irqa_handler().set(FUNC(s6a_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s6a_state::pia_irq)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -453,13 +453,13 @@ MACHINE_CONFIG_START(s6a_state::s6a) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 1.00) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, s6a_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("hc55516", hc55516_device, digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("hc55516", hc55516_device, clock_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpb_handler().set(FUNC(s6a_state::sound_r)); + m_pias->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->ca2_handler().set("hc55516", FUNC(hc55516_device::digit_w)); + m_pias->cb2_handler().set("hc55516", FUNC(hc55516_device::clock_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); // FIXME: needs an input merger + m_pias->irqb_handler().set_inputline("audiocpu", M6802_IRQ_LINE); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s7.cpp b/src/mame/drivers/s7.cpp index 0c1393e7d8e..cae468527d0 100644 --- a/src/mame/drivers/s7.cpp +++ b/src/mame/drivers/s7.cpp @@ -447,48 +447,48 @@ MACHINE_CONFIG_START(s7_state::s7) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(CONSTANT(0xff)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0x3f)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s7_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s7_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s7_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s7_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - - MCFG_DEVICE_ADD("pia22", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s7_state, sol0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s7_state, sol1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s7_state, pia22_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s7_state, pia22_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s7_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s7_state, lamp1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s7_state, pia24_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s7_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s7_state, dips_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s7_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s7_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s7_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s7_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s7_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s7_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s7_state, switch_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s7_state, pia30_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s7_state, pia30_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6808_IRQ_LINE)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set_constant(0xff); + m_pia21->readpb_handler().set_constant(0x3f); + m_pia21->writepa_handler().set(FUNC(s7_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s7_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s7_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s7_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s7_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s7_state::pia_irq)); + + PIA6821(config, m_pia22, 0); + m_pia22->writepa_handler().set(FUNC(s7_state::sol0_w)); + m_pia22->writepb_handler().set(FUNC(s7_state::sol1_w)); + m_pia22->ca2_handler().set(FUNC(s7_state::pia22_ca2_w)); + m_pia22->cb2_handler().set(FUNC(s7_state::pia22_cb2_w)); + m_pia22->irqa_handler().set(FUNC(s7_state::pia_irq)); + m_pia22->irqb_handler().set(FUNC(s7_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s7_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s7_state::lamp1_w)); + m_pia24->ca2_handler().set(FUNC(s7_state::pia24_ca2_w)); + m_pia24->cb2_handler().set(FUNC(s7_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s7_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s7_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->readpa_handler().set(FUNC(s7_state::dips_r)); + m_pia28->writepa_handler().set(FUNC(s7_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s7_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s7_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s7_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s7_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s7_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s7_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s7_state::switch_w)); + m_pia30->ca2_handler().set(FUNC(s7_state::pia30_ca2_w)); + m_pia30->cb2_handler().set(FUNC(s7_state::pia30_cb2_w)); + m_pia30->irqa_handler().set_inputline("maincpu", M6808_IRQ_LINE); + m_pia30->irqb_handler().set_inputline("maincpu", M6808_IRQ_LINE); MCFG_NVRAM_ADD_0FILL("nvram") diff --git a/src/mame/drivers/s8.cpp b/src/mame/drivers/s8.cpp index 4081ad4cbfd..4ace77fe10e 100644 --- a/src/mame/drivers/s8.cpp +++ b/src/mame/drivers/s8.cpp @@ -330,36 +330,36 @@ MACHINE_CONFIG_START(s8_state::s8) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s8_state, sound_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, s8_state, pia21_ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s8_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s8_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s8_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s8_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s8_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s8_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s8_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s8_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s8_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8_state, switch_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s8_state::sound_r)); + m_pia21->readca1_handler().set(FUNC(s8_state::pia21_ca1_r)); + m_pia21->writepa_handler().set(FUNC(s8_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s8_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s8_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s8_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s8_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s8_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s8_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s8_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s8_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s8_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s8_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->writepa_handler().set(FUNC(s8_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s8_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s8_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s8_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s8_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s8_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s8_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s8_state::switch_w)); + m_pia30->irqa_handler().set(FUNC(s8_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s8_state::pia_irq)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -372,11 +372,11 @@ MACHINE_CONFIG_START(s8_state::s8) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s8_state, sound_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpa_handler().set(FUNC(s8_state::sound_r)); + m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); MACHINE_CONFIG_END /*------------------------------ diff --git a/src/mame/drivers/s8a.cpp b/src/mame/drivers/s8a.cpp index e6316dec599..2d36bfd16f2 100644 --- a/src/mame/drivers/s8a.cpp +++ b/src/mame/drivers/s8a.cpp @@ -302,36 +302,36 @@ MACHINE_CONFIG_START(s8a_state::s8a) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s8a_state, sound_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, s8a_state, pia21_ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s8a_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8a_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s8a_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s8a_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s8a_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8a_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s8a_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s8a_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8a_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s8a_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s8a_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s8a_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s8a_state, switch_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s8a_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s8a_state::sound_r)); + m_pia21->readca1_handler().set(FUNC(s8a_state::pia21_ca1_r)); + m_pia21->writepa_handler().set(FUNC(s8a_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s8a_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s8a_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s8a_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s8a_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s8a_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s8a_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s8a_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s8a_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s8a_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s8a_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->writepa_handler().set(FUNC(s8a_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s8a_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s8a_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s8a_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s8a_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s8a_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s8a_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s8a_state::switch_w)); + m_pia30->irqa_handler().set(FUNC(s8a_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s8a_state::pia_irq)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -344,11 +344,11 @@ MACHINE_CONFIG_START(s8a_state::s8a) MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s8a_state, sound_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpa_handler().set(FUNC(s8a_state::sound_r)); + m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); MACHINE_CONFIG_END diff --git a/src/mame/drivers/s9.cpp b/src/mame/drivers/s9.cpp index 698b6409c81..195cc91b26d 100644 --- a/src/mame/drivers/s9.cpp +++ b/src/mame/drivers/s9.cpp @@ -336,36 +336,36 @@ MACHINE_CONFIG_START(s9_state::s9) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s9_state, sound_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, s9_state, pia21_ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s9_state, sound_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s9_state, sol2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s9_state, pia21_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s9_state, pia21_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s9_state, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s9_state, lamp1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s9_state, pia24_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, s9_state, dig0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s9_state, dig1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, s9_state, pia28_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, s9_state, pia28_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s9_state, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, s9_state, switch_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, s9_state, pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, s9_state, pia_irq)) + PIA6821(config, m_pia21, 0); + m_pia21->readpa_handler().set(FUNC(s9_state::sound_r)); + m_pia21->readca1_handler().set(FUNC(s9_state::pia21_ca1_r)); + m_pia21->writepa_handler().set(FUNC(s9_state::sound_w)); + m_pia21->writepb_handler().set(FUNC(s9_state::sol2_w)); + m_pia21->ca2_handler().set(FUNC(s9_state::pia21_ca2_w)); + m_pia21->cb2_handler().set(FUNC(s9_state::pia21_cb2_w)); + m_pia21->irqa_handler().set(FUNC(s9_state::pia_irq)); + m_pia21->irqb_handler().set(FUNC(s9_state::pia_irq)); + + PIA6821(config, m_pia24, 0); + m_pia24->writepa_handler().set(FUNC(s9_state::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(s9_state::lamp1_w)); + m_pia24->cb2_handler().set(FUNC(s9_state::pia24_cb2_w)); + m_pia24->irqa_handler().set(FUNC(s9_state::pia_irq)); + m_pia24->irqb_handler().set(FUNC(s9_state::pia_irq)); + + PIA6821(config, m_pia28, 0); + m_pia28->writepa_handler().set(FUNC(s9_state::dig0_w)); + m_pia28->writepb_handler().set(FUNC(s9_state::dig1_w)); + m_pia28->ca2_handler().set(FUNC(s9_state::pia28_ca2_w)); + m_pia28->cb2_handler().set(FUNC(s9_state::pia28_cb2_w)); + m_pia28->irqa_handler().set(FUNC(s9_state::pia_irq)); + m_pia28->irqb_handler().set(FUNC(s9_state::pia_irq)); + + PIA6821(config, m_pia30, 0); + m_pia30->readpa_handler().set(FUNC(s9_state::switch_r)); + m_pia30->writepb_handler().set(FUNC(s9_state::switch_w)); + m_pia30->irqa_handler().set(FUNC(s9_state::pia_irq)); + m_pia30->irqb_handler().set(FUNC(s9_state::pia_irq)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -382,13 +382,13 @@ MACHINE_CONFIG_START(s9_state::s9) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 1.00) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, s9_state, sound_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("hc55516", hc55516_device, clock_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("hc55516", hc55516_device, digit_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpa_handler().set(FUNC(s9_state::sound_r)); + m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->ca2_handler().set("hc55516", FUNC(hc55516_device::clock_w)); + m_pias->cb2_handler().set("hc55516", FUNC(hc55516_device::digit_w)); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); + m_pias->irqa_handler().set_inputline("audiocpu", M6808_IRQ_LINE); MACHINE_CONFIG_END /*----------------------------- diff --git a/src/mame/drivers/spiders.cpp b/src/mame/drivers/spiders.cpp index e95e5866281..0e1bf1c4f9e 100644 --- a/src/mame/drivers/spiders.cpp +++ b/src/mame/drivers/spiders.cpp @@ -543,32 +543,32 @@ MACHINE_CONFIG_START(spiders_state::spiders) /* 74LS123 */ - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) - - MCFG_DEVICE_ADD("pia2", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, spiders_state,gfx_rom_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, spiders_state,gfx_rom_intf_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, spiders_state,flipscreen_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<2>)) - - MCFG_DEVICE_ADD("pia3", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, spiders_state, spiders_audio_ctrl_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, spiders_state, spiders_audio_command_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<3>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<4>)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set_ioport("IN0"); + m_pia[0]->readpb_handler().set_ioport("IN1"); + m_pia[0]->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<0>)); + m_pia[0]->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); + + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpa_handler().set(FUNC(spiders_state::gfx_rom_r)); + m_pia[1]->writepb_handler().set(FUNC(spiders_state::gfx_rom_intf_w)); + m_pia[1]->cb2_handler().set(FUNC(spiders_state::flipscreen_w)); + m_pia[1]->irqa_handler().set_inputline("maincpu", M6809_FIRQ_LINE); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<2>)); + + PIA6821(config, m_pia[2], 0); + m_pia[2]->writepa_handler().set(FUNC(spiders_state::spiders_audio_ctrl_w)); + m_pia[2]->writepb_handler().set(FUNC(spiders_state::spiders_audio_command_w)); + m_pia[2]->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<3>)); + m_pia[2]->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<4>)); MCFG_INPUT_MERGER_ANY_HIGH("mainirq") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_DEVICE_ADD("pia4", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, spiders_state, spiders_audio_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, spiders_state, spiders_audio_b_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6802_IRQ_LINE)) + PIA6821(config, m_pia[3], 0); + m_pia[3]->writepa_handler().set(FUNC(spiders_state::spiders_audio_a_w)); + m_pia[3]->writepb_handler().set(FUNC(spiders_state::spiders_audio_b_w)); + m_pia[3]->irqa_handler().set_inputline("audiocpu", M6802_IRQ_LINE); MCFG_DEVICE_ADD("ic60", TTL74123, 0) MCFG_TTL74123_CONNECTION_TYPE(TTL74123_GROUNDED) /* the hook up type */ diff --git a/src/mame/drivers/spirit76.cpp b/src/mame/drivers/spirit76.cpp index 68a85c0b568..327a4eba9c5 100644 --- a/src/mame/drivers/spirit76.cpp +++ b/src/mame/drivers/spirit76.cpp @@ -131,15 +131,15 @@ MACHINE_CONFIG_START(spirit76_state::spirit76) //MCFG_DEFAULT_LAYOUT() //6821pia - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, spirit76_state, porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, spirit76_state, portb_w)) - MCFG_PIA_READPA_HANDLER(READ8(*this, spirit76_state, porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, spirit76_state, portb_r)) -// MCFG_PIA_CA2_HANDLER(WRITELINE(*this, spirit76_state, pia22_ca2_w)) -// MCFG_PIA_CB2_HANDLER(WRITELINE(*this, spirit76_state, pia22_cb2_w)) -// MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) -// MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.writepa_handler().set(FUNC(spirit76_state::porta_w)); + pia.writepb_handler().set(FUNC(spirit76_state::portb_w)); + pia.readpa_handler().set(FUNC(spirit76_state::porta_r)); + pia.readpb_handler().set(FUNC(spirit76_state::portb_r)); +// pia.ca2_handler().set(FUNC(spirit76_state::pia22_ca2_w)); +// pia.cb2_handler().set(FUNC(spirit76_state::pia22_cb2_w)); +// pia.irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); +// pia.irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); /* sound hardware */ genpin_audio(config); diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index 748914c43c5..df79838b2e5 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -786,21 +786,21 @@ MACHINE_CONFIG_START(squale_state::squale) MCFG_DEVICE_PROGRAM_MAP(squale_mem) /* Cartridge pia */ - MCFG_DEVICE_ADD("pia_u72", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, squale_state, pia_u72_porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, squale_state, pia_u72_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, squale_state, pia_u72_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, squale_state, pia_u72_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, squale_state, pia_u72_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, squale_state, pia_u72_cb2_w)) + PIA6821(config, m_pia_u72, 0); + m_pia_u72->readpa_handler().set(FUNC(squale_state::pia_u72_porta_r)); + m_pia_u72->readpb_handler().set(FUNC(squale_state::pia_u72_portb_r)); + m_pia_u72->writepa_handler().set(FUNC(squale_state::pia_u72_porta_w)); + m_pia_u72->writepb_handler().set(FUNC(squale_state::pia_u72_portb_w)); + m_pia_u72->ca2_handler().set(FUNC(squale_state::pia_u72_ca2_w)); + m_pia_u72->cb2_handler().set(FUNC(squale_state::pia_u72_cb2_w)); /* Keyboard pia */ - MCFG_DEVICE_ADD("pia_u75", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, squale_state, pia_u75_porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, squale_state, pia_u75_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, squale_state, pia_u75_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, squale_state, pia_u75_portb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, squale_state, pia_u75_cb2_w)) + PIA6821(config, m_pia_u75, 0); + m_pia_u75->readpa_handler().set(FUNC(squale_state::pia_u75_porta_r)); + m_pia_u75->readpb_handler().set(FUNC(squale_state::pia_u75_portb_r)); + m_pia_u75->writepa_handler().set(FUNC(squale_state::pia_u75_porta_w)); + m_pia_u75->writepb_handler().set(FUNC(squale_state::pia_u75_portb_w)); + m_pia_u75->cb2_handler().set(FUNC(squale_state::pia_u75_cb2_w)); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/st_mp100.cpp b/src/mame/drivers/st_mp100.cpp index fc8aad06f90..a82c9964c1b 100644 --- a/src/mame/drivers/st_mp100.cpp +++ b/src/mame/drivers/st_mp100.cpp @@ -723,25 +723,25 @@ MACHINE_CONFIG_START(st_mp100_state::st_mp100) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia_u10", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, st_mp100_state, u10_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, st_mp100_state, u10_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, st_mp100_state, u10_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, st_mp100_state, u10_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, st_mp100_state, u10_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, st_mp100_state, u10_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u10, 0); + m_pia_u10->readpa_handler().set(FUNC(st_mp100_state::u10_a_r)); + m_pia_u10->writepa_handler().set(FUNC(st_mp100_state::u10_a_w)); + m_pia_u10->readpb_handler().set(FUNC(st_mp100_state::u10_b_r)); + m_pia_u10->writepb_handler().set(FUNC(st_mp100_state::u10_b_w)); + m_pia_u10->ca2_handler().set(FUNC(st_mp100_state::u10_ca2_w)); + m_pia_u10->cb2_handler().set(FUNC(st_mp100_state::u10_cb2_w)); + m_pia_u10->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u10->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_x", st_mp100_state, timer_x, attotime::from_hz(120)) // mains freq*2 - MCFG_DEVICE_ADD("pia_u11", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, st_mp100_state, u11_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, st_mp100_state, u11_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, st_mp100_state, u11_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, st_mp100_state, u11_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, st_mp100_state, u11_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u11, 0); + m_pia_u11->readpa_handler().set(FUNC(st_mp100_state::u11_a_r)); + m_pia_u11->writepa_handler().set(FUNC(st_mp100_state::u11_a_w)); + m_pia_u11->writepb_handler().set(FUNC(st_mp100_state::u11_b_w)); + m_pia_u11->ca2_handler().set(FUNC(st_mp100_state::u11_ca2_w)); + m_pia_u11->cb2_handler().set(FUNC(st_mp100_state::u11_cb2_w)); + m_pia_u11->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u11->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_d", st_mp100_state, u11_timer, attotime::from_hz(634)) // 555 timer*2 MACHINE_CONFIG_END diff --git a/src/mame/drivers/st_mp200.cpp b/src/mame/drivers/st_mp200.cpp index 43cc8fb3359..638c330e2b1 100644 --- a/src/mame/drivers/st_mp200.cpp +++ b/src/mame/drivers/st_mp200.cpp @@ -594,25 +594,25 @@ MACHINE_CONFIG_START(st_mp200_state::st_mp200) genpin_audio(config); /* Devices */ - MCFG_DEVICE_ADD("pia_u10", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, st_mp200_state, u10_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, st_mp200_state, u10_a_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, st_mp200_state, u10_b_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, st_mp200_state, u10_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, st_mp200_state, u10_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, st_mp200_state, u10_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u10, 0); + m_pia_u10->readpa_handler().set(FUNC(st_mp200_state::u10_a_r)); + m_pia_u10->writepa_handler().set(FUNC(st_mp200_state::u10_a_w)); + m_pia_u10->readpb_handler().set(FUNC(st_mp200_state::u10_b_r)); + m_pia_u10->writepb_handler().set(FUNC(st_mp200_state::u10_b_w)); + m_pia_u10->ca2_handler().set(FUNC(st_mp200_state::u10_ca2_w)); + m_pia_u10->cb2_handler().set(FUNC(st_mp200_state::u10_cb2_w)); + m_pia_u10->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u10->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_x", st_mp200_state, timer_x, attotime::from_hz(120)) // mains freq*2 - MCFG_DEVICE_ADD("pia_u11", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, st_mp200_state, u11_a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, st_mp200_state, u11_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, st_mp200_state, u11_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, st_mp200_state, u11_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, st_mp200_state, u11_cb2_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6800_IRQ_LINE)) + PIA6821(config, m_pia_u11, 0); + m_pia_u11->readpa_handler().set(FUNC(st_mp200_state::u11_a_r)); + m_pia_u11->writepa_handler().set(FUNC(st_mp200_state::u11_a_w)); + m_pia_u11->writepb_handler().set(FUNC(st_mp200_state::u11_b_w)); + m_pia_u11->ca2_handler().set(FUNC(st_mp200_state::u11_ca2_w)); + m_pia_u11->cb2_handler().set(FUNC(st_mp200_state::u11_cb2_w)); + m_pia_u11->irqa_handler().set_inputline("maincpu", M6800_IRQ_LINE); + m_pia_u11->irqb_handler().set_inputline("maincpu", M6800_IRQ_LINE); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_d", st_mp200_state, u11_timer, attotime::from_hz(634)) // 555 timer*2 MACHINE_CONFIG_END diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp index 146073b5e40..21102dbc8ac 100644 --- a/src/mame/drivers/tavernie.cpp +++ b/src/mame/drivers/tavernie.cpp @@ -309,13 +309,13 @@ MACHINE_CONFIG_START(tavernie_state::cpu09) /* Devices */ MCFG_CASSETTE_ADD( "cassette" ) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, tavernie_state, pa_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(*this, tavernie_state, ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tavernie_state, pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tavernie_state, pb_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + pia6821_device &pia(PIA6821(config, "pia", 0)); + pia.readpa_handler().set(FUNC(tavernie_state::pa_r)); + pia.readca1_handler().set(FUNC(tavernie_state::ca1_r)); + pia.writepa_handler().set(FUNC(tavernie_state::pa_w)); + pia.writepb_handler().set(FUNC(tavernie_state::pb_w)); + pia.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + pia.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); MCFG_DEVICE_ADD("ptm", PTM6840, 4_MHz_XTAL / 4) // all i/o lines connect to the 40-pin expansion connector @@ -366,10 +366,10 @@ MACHINE_CONFIG_START(tavernie_state::ivg09) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(tavernie_state, crtc_update_row) - MCFG_DEVICE_ADD("pia_ivg", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, tavernie_state, pb_ivg_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tavernie_state, pa_ivg_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("beeper", beep_device, set_state)) + PIA6821(config, m_pia_ivg, 0); + m_pia_ivg->readpb_handler().set(FUNC(tavernie_state::pb_ivg_r)); + m_pia_ivg->writepa_handler().set(FUNC(tavernie_state::pa_ivg_w)); + m_pia_ivg->cb2_handler().set("beeper", FUNC(beep_device::set_state)); MCFG_DEVICE_ADD("fdc", FD1795, 8_MHz_XTAL / 8) MCFG_FLOPPY_DRIVE_ADD("fdc:0", ifd09_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/tek405x.cpp b/src/mame/drivers/tek405x.cpp index 6e206c4a699..5b5e8a4df60 100644 --- a/src/mame/drivers/tek405x.cpp +++ b/src/mame/drivers/tek405x.cpp @@ -1024,63 +1024,63 @@ MACHINE_CONFIG_START(tek4051_state::tek4051) // devices MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", tek4051_state, keyboard_tick, attotime::from_hz(XTAL(12'500'000)/15/4)) - MCFG_DEVICE_ADD(MC6820_X_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, tek4051_state, x_pia_pa_r)) + pia6821_device &piax(PIA6821(config, MC6820_X_TAG, 0)); + piax.readpa_handler().set(FUNC(tek4051_state::x_pia_pa_r)); // CB1 viewcause - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tek4051_state, x_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tek4051_state, x_pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, tek4051_state, adot_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, tek4051_state, bufclk_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, tek4051_state, x_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, tek4051_state, x_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_Y_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, tek4051_state, sa_r)) + piax.writepa_handler().set(FUNC(tek4051_state::x_pia_pa_w)); + piax.writepb_handler().set(FUNC(tek4051_state::x_pia_pb_w)); + piax.ca2_handler().set(FUNC(tek4051_state::adot_w)); + piax.cb2_handler().set(FUNC(tek4051_state::bufclk_w)); + piax.irqa_handler().set(FUNC(tek4051_state::x_pia_irqa_w)); + piax.irqb_handler().set(FUNC(tek4051_state::x_pia_irqb_w)); + + pia6821_device &piay(PIA6821(config, MC6820_Y_TAG, 0)); + piay.readpa_handler().set(FUNC(tek4051_state::sa_r)); // CA1 rdbyte // CB1 mdata // CB2 fmark - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tek4051_state, y_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tek4051_state, sb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, tek4051_state, sot_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, tek4051_state, y_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, tek4051_state, y_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_KB_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, tek4051_state, kb_pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, tek4051_state, kb_pia_pb_r)) + piay.writepa_handler().set(FUNC(tek4051_state::y_pia_pa_w)); + piay.writepb_handler().set(FUNC(tek4051_state::sb_w)); + piay.ca2_handler().set(FUNC(tek4051_state::sot_w)); + piay.irqa_handler().set(FUNC(tek4051_state::y_pia_irqa_w)); + piay.irqb_handler().set(FUNC(tek4051_state::y_pia_irqb_w)); + + pia6821_device &piakbd(PIA6821(config, MC6820_KB_TAG, 0)); + piakbd.readpa_handler().set(FUNC(tek4051_state::kb_pia_pa_r)); + piakbd.readpb_handler().set(FUNC(tek4051_state::kb_pia_pb_r)); // CA1 key - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tek4051_state, kb_pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, tek4051_state, kb_halt_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, tek4051_state, kb_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, tek4051_state, kb_pia_irqb_w)) + piakbd.writepb_handler().set(FUNC(tek4051_state::kb_pia_pb_w)); + piakbd.ca2_handler().set(FUNC(tek4051_state::kb_halt_w)); + piakbd.irqa_handler().set(FUNC(tek4051_state::kb_pia_irqa_w)); + piakbd.irqb_handler().set(FUNC(tek4051_state::kb_pia_irqb_w)); - MCFG_DEVICE_ADD(MC6820_TAPE_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, tek4051_state, tape_pia_pa_r)) + pia6821_device &piatape(PIA6821(config, MC6820_TAPE_TAG, 0)); + piatape.readpa_handler().set(FUNC(tek4051_state::tape_pia_pa_r)); // CA1 rmark // CB1 lohole // CA2 filfnd // CB2 uphole - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tek4051_state, tape_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tek4051_state, tape_pia_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, tek4051_state, tape_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, tek4051_state, tape_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_GPIB_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(IEEE488_TAG, ieee488_device, dio_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, tek4051_state, gpib_pia_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tek4051_state, dio_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tek4051_state, gpib_pia_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, tek4051_state, talk_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, tek4051_state, gpib_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, tek4051_state, gpib_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_COM_TAG, PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, tek4051_state, com_pia_pb_r)) + piatape.writepa_handler().set(FUNC(tek4051_state::tape_pia_pa_w)); + piatape.writepb_handler().set(FUNC(tek4051_state::tape_pia_pb_w)); + piatape.irqa_handler().set(FUNC(tek4051_state::tape_pia_irqa_w)); + piatape.irqb_handler().set(FUNC(tek4051_state::tape_pia_irqb_w)); + + PIA6821(config, m_gpib_pia, 0); + m_gpib_pia->readpa_handler().set(IEEE488_TAG, FUNC(ieee488_device::dio_r)); + m_gpib_pia->readpb_handler().set(FUNC(tek4051_state::gpib_pia_pb_r)); + m_gpib_pia->writepa_handler().set(FUNC(tek4051_state::dio_w)); + m_gpib_pia->writepb_handler().set(FUNC(tek4051_state::gpib_pia_pb_w)); + m_gpib_pia->cb2_handler().set(FUNC(tek4051_state::talk_w)); + m_gpib_pia->irqa_handler().set(FUNC(tek4051_state::gpib_pia_irqa_w)); + m_gpib_pia->irqb_handler().set(FUNC(tek4051_state::gpib_pia_irqb_w)); + + PIA6821(config, m_com_pia, 0); + m_com_pia->readpb_handler().set(FUNC(tek4051_state::com_pia_pb_r)); //CA1 - SRX (RS-232 pin 12) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, tek4051_state, com_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tek4051_state, com_pia_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, tek4051_state, com_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, tek4051_state, com_pia_irqb_w)) + m_com_pia->writepa_handler().set(FUNC(tek4051_state::com_pia_pa_w)); + m_com_pia->writepb_handler().set(FUNC(tek4051_state::com_pia_pb_w)); + m_com_pia->irqa_handler().set(FUNC(tek4051_state::com_pia_irqa_w)); + m_com_pia->irqb_handler().set(FUNC(tek4051_state::com_pia_irqb_w)); MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0) MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, tek4051_state, acia_irq_w)) diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp index 3461f4540d6..31f475de6f0 100644 --- a/src/mame/drivers/thomson.cpp +++ b/src/mame/drivers/thomson.cpp @@ -701,22 +701,22 @@ MACHINE_CONFIG_START(thomson_state::to7) /* pia */ - MCFG_DEVICE_ADD(THOM_PIA_SYS, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, to7_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(*this, thomson_state, to7_sys_portb_in)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, thomson_state, to7_sys_portb_out)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, thomson_state, to7_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, thomson_state, to7_sys_cb2_out)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainfirq", input_merger_device, in_w<1>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainfirq", input_merger_device, in_w<1>)) - - MCFG_DEVICE_ADD(THOM_PIA_GAME, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, to7_game_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(*this, thomson_state, to7_game_portb_in)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, thomson_state, to7_game_portb_out)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, thomson_state, to7_game_cb2_out)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) + PIA6821(config, m_pia_sys, 0); + m_pia_sys->readpa_handler().set(FUNC(thomson_state::to7_sys_porta_in)); + m_pia_sys->readpb_handler().set(FUNC(thomson_state::to7_sys_portb_in)); + m_pia_sys->writepb_handler().set(FUNC(thomson_state::to7_sys_portb_out)); + m_pia_sys->ca2_handler().set(FUNC(thomson_state::to7_set_cassette_motor)); + m_pia_sys->cb2_handler().set(FUNC(thomson_state::to7_sys_cb2_out)); + m_pia_sys->irqa_handler().set("mainfirq", FUNC(input_merger_device::in_w<1>)); + m_pia_sys->irqb_handler().set("mainfirq", FUNC(input_merger_device::in_w<1>)); + + PIA6821(config, m_pia_game, 0); + m_pia_game->readpa_handler().set(FUNC(thomson_state::to7_game_porta_in)); + m_pia_game->readpb_handler().set(FUNC(thomson_state::to7_game_portb_in)); + m_pia_game->writepb_handler().set(FUNC(thomson_state::to7_game_portb_out)); + m_pia_game->cb2_handler().set(FUNC(thomson_state::to7_game_cb2_out)); + m_pia_game->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); + 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) @@ -736,7 +736,7 @@ MACHINE_CONFIG_START(thomson_state::to7) /* TODO: CONVERT THIS TO A SLOT DEVICE (MD 90-120) */ - MCFG_DEVICE_ADD(THOM_PIA_MODEM, PIA6821, 0) + PIA6821(config, THOM_PIA_MODEM, 0); MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, thomson_state, to7_modem_tx_w)) @@ -935,11 +935,10 @@ MACHINE_CONFIG_START(thomson_state::to770) MCFG_DEVICE_MODIFY( "maincpu" ) MCFG_DEVICE_PROGRAM_MAP ( to770) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, to770_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, thomson_state, to770_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, thomson_state, to770_sys_cb2_out)) + m_pia_sys->readpa_handler().set(FUNC(thomson_state::to770_sys_porta_in)); + m_pia_sys->readpb_handler().set_constant(0); + m_pia_sys->writepb_handler().set(FUNC(thomson_state::to770_sys_portb_out)); + m_pia_sys->cb2_handler().set(FUNC(thomson_state::to770_sys_cb2_out)); MCFG_DEVICE_MODIFY("mc6846") MCFG_MC6846_OUT_PORT_CB(WRITE8(*this, thomson_state, to770_timer_port_out)) @@ -1137,14 +1136,13 @@ MACHINE_CONFIG_START(thomson_state::mo5) MCFG_PALETTE_MODIFY( "palette" ) MCFG_PALETTE_INIT_OWNER(thomson_state, mo5) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, mo5_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(*this, thomson_state, mo5_sys_portb_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, mo5_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("buzzer", dac_bit_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, thomson_state, mo5_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(NOOP) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) // WARNING: differs from TO7 ! + m_pia_sys->readpa_handler().set(FUNC(thomson_state::mo5_sys_porta_in)); + m_pia_sys->readpb_handler().set(FUNC(thomson_state::mo5_sys_portb_in)); + m_pia_sys->writepa_handler().set(FUNC(thomson_state::mo5_sys_porta_out)); + m_pia_sys->writepb_handler().set("buzzer", FUNC(dac_bit_interface::data_w)); + m_pia_sys->ca2_handler().set(FUNC(thomson_state::mo5_set_cassette_motor)); + m_pia_sys->cb2_handler().set_nop(); + m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); // WARNING: differs from TO7 ! MCFG_DEVICE_REMOVE("cartslot") MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo_cart") @@ -1492,13 +1490,12 @@ MACHINE_CONFIG_START(thomson_state::to9) MCFG_DEVICE_MODIFY( "maincpu" ) MCFG_DEVICE_PROGRAM_MAP ( to9) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, to9_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, to9_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, thomson_state, to9_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(NOOP) - MCFG_PIA_IRQA_HANDLER(NOOP) + m_pia_sys->readpa_handler().set(FUNC(thomson_state::to9_sys_porta_in)); + m_pia_sys->readpb_handler().set_constant(0); + m_pia_sys->writepa_handler().set(FUNC(thomson_state::to9_sys_porta_out)); + m_pia_sys->writepb_handler().set(FUNC(thomson_state::to9_sys_portb_out)); + m_pia_sys->cb2_handler().set_nop(); + m_pia_sys->irqa_handler().set_nop(); MCFG_DEVICE_MODIFY("mc6846") MCFG_MC6846_OUT_PORT_CB(WRITE8(*this, thomson_state, to9_timer_port_out)) @@ -1718,13 +1715,12 @@ MACHINE_CONFIG_START(thomson_state::to8) //MCFG_DEVICE_ADD("kbdmcu", MC6804, 11_MHz_XTAL) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, to8_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, to9_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, thomson_state, to8_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(NOOP) - MCFG_PIA_IRQA_HANDLER(NOOP) + m_pia_sys->readpa_handler().set(FUNC(thomson_state::to8_sys_porta_in)); + m_pia_sys->readpb_handler().set_constant(0); + m_pia_sys->writepa_handler().set(FUNC(thomson_state::to9_sys_porta_out)); + m_pia_sys->writepb_handler().set(FUNC(thomson_state::to8_sys_portb_out)); + m_pia_sys->cb2_handler().set_nop(); + m_pia_sys->irqa_handler().set_nop(); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(thomson_state::write_centronics_busy)); @@ -1884,14 +1880,13 @@ MACHINE_CONFIG_START(thomson_state::to9p) MCFG_DEVICE_MODIFY( "maincpu" ) MCFG_DEVICE_PROGRAM_MAP ( to9p) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, to9_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(CONSTANT(0)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, to9_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, thomson_state, to8_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(NOOP) - MCFG_PIA_IRQA_HANDLER(NOOP) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainfirq", input_merger_device, in_w<1>)) + m_pia_sys->readpa_handler().set(FUNC(thomson_state::to8_sys_porta_in)); + m_pia_sys->readpb_handler().set_constant(0); + m_pia_sys->writepa_handler().set(FUNC(thomson_state::to9_sys_porta_out)); + m_pia_sys->writepb_handler().set(FUNC(thomson_state::to8_sys_portb_out)); + m_pia_sys->cb2_handler().set_nop(); + m_pia_sys->irqa_handler().set_nop(); + m_pia_sys->irqb_handler().set("mainfirq", FUNC(input_merger_device::in_w<1>)); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(thomson_state::write_centronics_busy)); @@ -2239,18 +2234,16 @@ MACHINE_CONFIG_START(thomson_state::mo6) MCFG_DEVICE_REMOVE( "mc6846" ) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, mo6_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(*this, thomson_state, mo6_sys_portb_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, mo6_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("buzzer", dac_bit_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, thomson_state, mo5_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, thomson_state, mo6_sys_cb2_out)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) // differs from TO + m_pia_sys->readpa_handler().set(FUNC(thomson_state::mo6_sys_porta_in)); + m_pia_sys->readpb_handler().set(FUNC(thomson_state::mo6_sys_portb_in)); + m_pia_sys->writepa_handler().set(FUNC(thomson_state::mo6_sys_porta_out)); + m_pia_sys->writepb_handler().set("buzzer", FUNC(dac_bit_interface::data_w)); + m_pia_sys->ca2_handler().set(FUNC(thomson_state::mo5_set_cassette_motor)); + m_pia_sys->cb2_handler().set(FUNC(thomson_state::mo6_sys_cb2_out)); + m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); // differs from TO - MCFG_DEVICE_MODIFY(THOM_PIA_GAME) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, mo6_game_porta_out)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, thomson_state, mo6_game_cb2_out)) + m_pia_game->writepa_handler().set(FUNC(thomson_state::mo6_game_porta_out)); + m_pia_game->cb2_handler().set(FUNC(thomson_state::mo6_game_cb2_out)); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(thomson_state::write_centronics_busy)); @@ -2509,17 +2502,15 @@ MACHINE_CONFIG_START(thomson_state::mo5nr) MCFG_DEVICE_REMOVE( "mc6846" ) - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(*this, thomson_state, mo6_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(*this, thomson_state, mo5nr_sys_portb_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, mo5nr_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("buzzer", dac_bit_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, thomson_state, mo5_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, thomson_state, mo6_sys_cb2_out)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) // differs from TO - - MCFG_DEVICE_MODIFY(THOM_PIA_GAME) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, thomson_state, mo6_game_porta_out)) + m_pia_sys->readpa_handler().set(FUNC(thomson_state::mo6_sys_porta_in)); + m_pia_sys->readpb_handler().set(FUNC(thomson_state::mo5nr_sys_portb_in)); + m_pia_sys->writepa_handler().set(FUNC(thomson_state::mo5nr_sys_porta_out)); + m_pia_sys->writepb_handler().set("buzzer", FUNC(dac_bit_interface::data_w)); + m_pia_sys->ca2_handler().set(FUNC(thomson_state::mo5_set_cassette_motor)); + m_pia_sys->cb2_handler().set(FUNC(thomson_state::mo6_sys_cb2_out)); + m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); // differs from TO + + m_pia_game->writepa_handler().set(FUNC(thomson_state::mo6_game_porta_out)); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->set_data_input_buffer("cent_data_in"); diff --git a/src/mame/drivers/toratora.cpp b/src/mame/drivers/toratora.cpp index 03242cd931f..3bcf4021684 100644 --- a/src/mame/drivers/toratora.cpp +++ b/src/mame/drivers/toratora.cpp @@ -402,22 +402,22 @@ MACHINE_CONFIG_START(toratora_state::toratora) MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(toratora_state, toratora_timer, 250) /* timer counting at 250 Hz */ - MCFG_DEVICE_ADD("pia_u1", PIA6821, 0) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, toratora_state,port_b_u1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, toratora_state,main_cpu_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, toratora_state,main_cpu_irq)) - - MCFG_DEVICE_ADD("pia_u3", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, toratora_state, sn1_port_a_u3_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, toratora_state, sn1_port_b_u3_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, toratora_state, sn1_ca2_u3_w)) - - MCFG_DEVICE_ADD("pia_u2", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(IOPORT("DSW")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, toratora_state,sn2_port_a_u2_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, toratora_state,sn2_port_b_u2_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, toratora_state,sn2_ca2_u2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, toratora_state,cb2_u2_w)) + PIA6821(config, m_pia_u1, 0); + m_pia_u1->writepb_handler().set(FUNC(toratora_state::port_b_u1_w)); + m_pia_u1->irqa_handler().set(FUNC(toratora_state::main_cpu_irq)); + m_pia_u1->irqb_handler().set(FUNC(toratora_state::main_cpu_irq)); + + PIA6821(config, m_pia_u3, 0); + m_pia_u3->writepa_handler().set(FUNC(toratora_state::sn1_port_a_u3_w)); + m_pia_u3->writepb_handler().set(FUNC(toratora_state::sn1_port_b_u3_w)); + m_pia_u3->ca2_handler().set(FUNC(toratora_state::sn1_ca2_u3_w)); + + PIA6821(config, m_pia_u2, 0); + m_pia_u2->readpb_handler().set_ioport("DSW"); + m_pia_u2->writepa_handler().set(FUNC(toratora_state::sn2_port_a_u2_w)); + m_pia_u2->writepb_handler().set(FUNC(toratora_state::sn2_port_b_u2_w)); + m_pia_u2->ca2_handler().set(FUNC(toratora_state::sn2_ca2_u2_w)); + m_pia_u2->cb2_handler().set(FUNC(toratora_state::cb2_u2_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/truco.cpp b/src/mame/drivers/truco.cpp index 3bca599d30c..2f563a15f2f 100644 --- a/src/mame/drivers/truco.cpp +++ b/src/mame/drivers/truco.cpp @@ -427,14 +427,14 @@ MACHINE_CONFIG_START(truco_state::truco) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(1.6)) /* 1.6 seconds */ - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("P1")) - MCFG_PIA_READPB_HANDLER(IOPORT("JMPRS")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, truco_state,porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, truco_state,portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, truco_state,pia_ca2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, truco_state,pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, truco_state,pia_irqb_w)) + pia6821_device &pia(PIA6821(config, "pia0", 0)); + pia.readpa_handler().set_ioport("P1"); + pia.readpb_handler().set_ioport("JMPRS"); + pia.writepa_handler().set(FUNC(truco_state::porta_w)); + pia.writepb_handler().set(FUNC(truco_state::portb_w)); + pia.ca2_handler().set(FUNC(truco_state::pia_ca2_w)); + pia.irqa_handler().set(FUNC(truco_state::pia_irqa_w)); + pia.irqb_handler().set(FUNC(truco_state::pia_irqb_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/tugboat.cpp b/src/mame/drivers/tugboat.cpp index 92b0d26880a..607ee338e55 100644 --- a/src/mame/drivers/tugboat.cpp +++ b/src/mame/drivers/tugboat.cpp @@ -367,12 +367,12 @@ MACHINE_CONFIG_START(tugboat_state::tugboat) MCFG_DEVICE_ADD("maincpu", M6502, 2000000) /* 2 MHz ???? */ MCFG_DEVICE_PROGRAM_MAP(main_map) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, tugboat_state,input_r)) + pia6821_device &pia0(PIA6821(config, "pia0", 0)); + pia0.readpa_handler().set(FUNC(tugboat_state::input_r)); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("DSW")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tugboat_state, ctrl_w)) + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.readpa_handler().set_ioport("DSW"); + pia1.writepb_handler().set(FUNC(tugboat_state::ctrl_w)); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index 0601684f2e1..f5aedb7b94c 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -314,16 +314,16 @@ MACHINE_CONFIG_START(v6809_state::v6809) // port A = drive select and 2 control lines ; port B = keyboard // CB2 connects to the interrupt pin of the RTC (the rtc code doesn't support it) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, v6809_state, pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, v6809_state, pa_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + PIA6821(config, m_pia0, 0); + m_pia0->readpb_handler().set(FUNC(v6809_state::pb_r)); + m_pia0->writepa_handler().set(FUNC(v6809_state::pa_w)); + m_pia0->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + m_pia0->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); // no idea what this does - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + pia6821_device &pia1(PIA6821(config, "pia1", 0)); + pia1.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); + pia1.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); MCFG_DEVICE_ADD("ptm", PTM6840, 16_MHz_XTAL / 4) MCFG_PTM6840_EXTERNAL_CLOCKS(4000000/14, 4000000/14, 4000000/14/8) diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp index 45098bf8bff..220c728717a 100644 --- a/src/mame/drivers/williams.cpp +++ b/src/mame/drivers/williams.cpp @@ -1527,20 +1527,20 @@ MACHINE_CONFIG_START(williams_state::williams) MCFG_INPUT_MERGER_ANY_HIGH("soundirq") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("soundcpu", M6808_IRQ_LINE)) - MCFG_DEVICE_ADD(m_pia[0], PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - - MCFG_DEVICE_ADD(m_pia[1], PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams_state, williams_snd_cmd_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) - - MCFG_DEVICE_ADD(m_pia[2], PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<1>)) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set_ioport("IN0"); + m_pia[0]->readpb_handler().set_ioport("IN1"); + + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpa_handler().set_ioport("IN2"); + m_pia[1]->writepb_handler().set(FUNC(williams_state::williams_snd_cmd_w)); + m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); + + PIA6821(config, m_pia[2], 0); + m_pia[2]->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pia[2]->irqa_handler().set("soundirq", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[2]->irqb_handler().set("soundirq", FUNC(input_merger_any_high_device::in_w<1>)); MACHINE_CONFIG_END @@ -1610,9 +1610,9 @@ MACHINE_CONFIG_START(spdball_state::spdball) MCFG_DEVICE_PROGRAM_MAP(spdball_map) /* pia */ - MCFG_DEVICE_ADD("pia_3", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN3")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN4")) + PIA6821(config, m_pia[3], 0); + m_pia[3]->readpa_handler().set_ioport("IN3"); + m_pia[3]->readpa_handler().set_ioport("IN4"); MACHINE_CONFIG_END @@ -1641,12 +1641,10 @@ MACHINE_CONFIG_START(williams_state::sinistar) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.8) /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPA_HANDLER(READ8(*this, williams_state, williams_49way_port_0_r)) + m_pia[0]->readpa_handler().set(FUNC(williams_state::williams_49way_port_0_r)); - MCFG_DEVICE_MODIFY("pia_2") - MCFG_PIA_CA2_HANDLER(WRITELINE("cvsd", hc55516_device, digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("cvsd", hc55516_device, clock_w)) + m_pia[2]->ca2_handler().set("cvsd", FUNC(hc55516_device::digit_w)); + m_pia[2]->cb2_handler().set("cvsd", FUNC(hc55516_device::clock_w)); MACHINE_CONFIG_END @@ -1664,12 +1662,10 @@ MACHINE_CONFIG_START(williams_state::playball) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.8) /* pia */ - MCFG_DEVICE_MODIFY("pia_1") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams_state, playball_snd_cmd_w)) + m_pia[1]->writepb_handler().set(FUNC(williams_state::playball_snd_cmd_w)); - MCFG_DEVICE_MODIFY("pia_2") - MCFG_PIA_CA2_HANDLER(WRITELINE("cvsd", hc55516_device, digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("cvsd", hc55516_device, clock_w)) + m_pia[2]->ca2_handler().set("cvsd", FUNC(hc55516_device::digit_w)); + m_pia[2]->cb2_handler().set("cvsd", FUNC(hc55516_device::clock_w)); MACHINE_CONFIG_END @@ -1688,9 +1684,8 @@ MACHINE_CONFIG_START(blaster_state::blastkit) MCFG_SCREEN_UPDATE_DRIVER(blaster_state, screen_update_blaster) /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPA_HANDLER(READ8("mux_a", ls157_x2_device, output_r)) - MCFG_PIA_CB2_HANDLER(WRITELINE("mux_a", ls157_x2_device, select_w)) + m_pia[0]->readpa_handler().set("mux_a", FUNC(ls157_x2_device::output_r)); + m_pia[0]->cb2_handler().set("mux_a", FUNC(ls157_x2_device::select_w)); // All multiplexers on Blaster interface board are really LS257 with OC tied to GND (which is equivalent to LS157) @@ -1724,16 +1719,14 @@ MACHINE_CONFIG_START(blaster_state::blaster) MCFG_INPUT_MERGER_ANY_HIGH("soundirq_b") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("soundcpu_b", M6808_IRQ_LINE)) - MCFG_DEVICE_MODIFY("pia_1") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, blaster_state, blaster_snd_cmd_w)) + m_pia[1]->writepb_handler().set(FUNC(blaster_state::blaster_snd_cmd_w)); - MCFG_DEVICE_MODIFY("pia_2") - MCFG_PIA_WRITEPA_HANDLER(WRITE8("ldac", dac_byte_interface, data_w)) + m_pia[2]->writepa_handler().set("ldac", FUNC(dac_byte_interface::data_w)); - MCFG_DEVICE_ADD("pia_3", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("rdac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("soundirq_b", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("soundirq_b", input_merger_any_high_device, in_w<1>)) + PIA6821(config, m_pia[3], 0); + m_pia[3]->writepa_handler().set("rdac", FUNC(dac_byte_interface::data_w)); + m_pia[3]->irqa_handler().set("soundirq_b", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[3]->irqb_handler().set("soundirq_b", FUNC(input_merger_any_high_device::in_w<1>)); /* sound hardware */ MCFG_DEVICE_REMOVE("speaker") @@ -1802,16 +1795,16 @@ MACHINE_CONFIG_START(williams2_state::williams2) MCFG_INPUT_MERGER_ANY_HIGH("soundirq") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("soundcpu", M6808_IRQ_LINE)) - MCFG_DEVICE_ADD(m_pia[0], PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) + PIA6821(config, m_pia[0], 0); + m_pia[0]->readpa_handler().set_ioport("IN0"); + m_pia[0]->readpb_handler().set_ioport("IN1"); - MCFG_DEVICE_ADD(m_pia[1], PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams2_state,williams2_snd_cmd_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("pia_2", pia6821_device, ca1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) + PIA6821(config, m_pia[1], 0); + m_pia[1]->readpa_handler().set_ioport("IN2"); + m_pia[1]->writepb_handler().set(FUNC(williams2_state::williams2_snd_cmd_w)); + m_pia[1]->cb2_handler().set(m_pia[2], FUNC(pia6821_device::ca1_w)); + m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); PIA6821(config, m_pia[2], 0); m_pia[2]->writepa_handler().set(m_pia[1], FUNC(pia6821_device::portb_w)); @@ -1824,9 +1817,8 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(williams2_state::inferno) williams2(config); - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPA_HANDLER(READ8("mux", ls157_x2_device, output_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE("mux", ls157_x2_device, select_w)) + m_pia[0]->readpa_handler().set("mux", FUNC(ls157_x2_device::output_r)); + m_pia[0]->ca2_handler().set("mux", FUNC(ls157_x2_device::select_w)); MCFG_DEVICE_ADD("mux", LS157_X2, 0) // IC45 (for PA4-PA7) + IC46 (for PA0-PA3) on CPU board MCFG_74157_A_IN_CB(IOPORT("INP1")) @@ -1840,13 +1832,11 @@ MACHINE_CONFIG_START(williams2_state::mysticm) /* basic machine hardware */ /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_IRQA_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) + m_pia[0]->irqa_handler().set_inputline("maincpu", M6809_FIRQ_LINE); + m_pia[0]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); - MCFG_DEVICE_MODIFY("pia_1") - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<2>)) + m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<2>)); MACHINE_CONFIG_END @@ -1860,19 +1850,17 @@ MACHINE_CONFIG_START(tshoot_state::tshoot) MCFG_MACHINE_START_OVERRIDE(tshoot_state,tshoot) /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPA_HANDLER(READ8("mux", ls157_x2_device, output_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, tshoot_state, lamp_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("mux", ls157_x2_device, select_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) + m_pia[0]->readpa_handler().set("mux", FUNC(ls157_x2_device::output_r)); + m_pia[0]->writepb_handler().set(FUNC(tshoot_state::lamp_w)); + m_pia[0]->ca2_handler().set("mux", FUNC(ls157_x2_device::select_w)); + m_pia[0]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[0]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); - MCFG_DEVICE_MODIFY("pia_1") - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<2>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<3>)) + m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<2>)); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<3>)); MCFG_DEVICE_MODIFY("pia_2") - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, tshoot_state, maxvol_w)) + m_pia[2]->cb2_handler().set(FUNC(tshoot_state::maxvol_w)); MCFG_DEVICE_ADD("mux", LS157_X2, 0) // U2 + U3 on interface board MCFG_74157_A_IN_CB(IOPORT("INP1")) @@ -1898,13 +1886,12 @@ MACHINE_CONFIG_START(joust2_state::joust2) m_pia[0]->readpa_handler().append("mux", FUNC(ls157_device::output_r)).mask(0x0f); m_pia[0]->ca2_handler().set("mux", FUNC(ls157_device::select_w)); - MCFG_DEVICE_MODIFY("pia_1") - MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, joust2_state,joust2_snd_cmd_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, joust2_state,joust2_pia_3_cb1_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("pia_2", pia6821_device, ca1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) + m_pia[1]->readpa_handler().set_ioport("IN2"); + m_pia[1]->writepb_handler().set(FUNC(joust2_state::joust2_snd_cmd_w)); + m_pia[1]->ca2_handler().set(FUNC(joust2_state::joust2_pia_3_cb1_w)); + m_pia[1]->cb2_handler().set(m_pia[2], FUNC(pia6821_device::ca1_w)); + m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); MCFG_DEVICE_ADD("mux", LS157, 0) MCFG_74157_A_IN_CB(IOPORT("INP1")) diff --git a/src/mame/drivers/wmg.cpp b/src/mame/drivers/wmg.cpp index d97f97c97ae..0bfd9795bb0 100644 --- a/src/mame/drivers/wmg.cpp +++ b/src/mame/drivers/wmg.cpp @@ -566,21 +566,21 @@ MACHINE_CONFIG_START(wmg_state::wmg) MCFG_INPUT_MERGER_ANY_HIGH("soundirq") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("soundcpu", M6808_IRQ_LINE)) - MCFG_DEVICE_ADD("pia_0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, wmg_state, wmg_port_select_w)) - - MCFG_DEVICE_ADD("pia_1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams_state, williams_snd_cmd_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) - - MCFG_DEVICE_ADD("pia_2", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<1>)) + pia6821_device &pia0(PIA6821(config, "pia_0", 0)); + pia0.readpa_handler().set_ioport("IN0"); + pia0.readpb_handler().set_ioport("IN1"); + pia0.cb2_handler().set(FUNC(wmg_state::wmg_port_select_w)); + + pia6821_device &pia1(PIA6821(config, "pia_1", 0)); + pia1.readpa_handler().set_ioport("IN2"); + pia1.writepb_handler().set(FUNC(williams_state::williams_snd_cmd_w)); + pia1.irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); + pia1.irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); + + pia6821_device &pia2(PIA6821(config, "pia_2", 0)); + pia2.writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + pia2.irqa_handler().set("soundirq", FUNC(input_merger_any_high_device::in_w<0>)); + pia2.irqb_handler().set("soundirq", FUNC(input_merger_any_high_device::in_w<1>)); MACHINE_CONFIG_END /************************************* diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp index 47eb8955a04..7502777a4f5 100644 --- a/src/mame/drivers/z100.cpp +++ b/src/mame/drivers/z100.cpp @@ -706,13 +706,13 @@ MACHINE_CONFIG_START(z100_state::z100) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir3_w)) MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, z100_state, video_pia_A_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, z100_state, video_pia_B_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, z100_state, video_pia_CA2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, z100_state, video_pia_CB2_w)) + PIA6821(config, m_pia0, 0); + m_pia0->writepa_handler().set(FUNC(z100_state::video_pia_A_w)); + m_pia0->writepb_handler().set(FUNC(z100_state::video_pia_B_w)); + m_pia0->ca2_handler().set(FUNC(z100_state::video_pia_CA2_w)); + m_pia0->cb2_handler().set(FUNC(z100_state::video_pia_CB2_w)); - MCFG_DEVICE_ADD("pia1", PIA6821, 0) + PIA6821(config, m_pia1, 0); MCFG_DEVICE_ADD("z207_fdc", FD1797, 1_MHz_XTAL) diff --git a/src/mame/drivers/zwackery.cpp b/src/mame/drivers/zwackery.cpp index 67a58692d95..c3070f260e3 100644 --- a/src/mame/drivers/zwackery.cpp +++ b/src/mame/drivers/zwackery.cpp @@ -504,21 +504,21 @@ MACHINE_CONFIG_START(zwackery_state::zwackery) MCFG_DEVICE_ADD("ptm", PTM6840, 7652400 / 10) MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", 6)) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(IOPORT("IN0")) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, zwackery_state, pia0_porta_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, zwackery_state, pia0_irq_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, zwackery_state, pia0_irq_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, zwackery_state, pia1_porta_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, zwackery_state, pia1_porta_w)) - MCFG_PIA_READPB_HANDLER(READ8(*this, zwackery_state, pia1_portb_r)) - MCFG_PIA_CA2_HANDLER(WRITELINE("csd", midway_cheap_squeak_deluxe_device, sirq_w)) - - MCFG_DEVICE_ADD("pia2", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, zwackery_state, pia2_porta_r)) - MCFG_PIA_READPB_HANDLER(IOPORT("DSW")) + PIA6821(config, m_pia0, 0); + m_pia0->readpb_handler().set_ioport("IN0"); + m_pia0->writepa_handler().set(FUNC(zwackery_state::pia0_porta_w)); + m_pia0->irqa_handler().set(FUNC(zwackery_state::pia0_irq_w)); + m_pia0->irqb_handler().set(FUNC(zwackery_state::pia0_irq_w)); + + PIA6821(config, m_pia1, 0); + m_pia1->readpa_handler().set(FUNC(zwackery_state::pia1_porta_r)); + m_pia1->writepa_handler().set(FUNC(zwackery_state::pia1_porta_w)); + m_pia1->readpb_handler().set(FUNC(zwackery_state::pia1_portb_r)); + m_pia1->ca2_handler().set("csd", FUNC(midway_cheap_squeak_deluxe_device::sirq_w)); + + PIA6821(config, m_pia2, 0); + m_pia2->readpa_handler().set(FUNC(zwackery_state::pia2_porta_r)); + m_pia2->readpb_handler().set_ioport("DSW"); // video hardware MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/includes/calomega.h b/src/mame/includes/calomega.h index 50936342a07..4fdf3ff1efb 100644 --- a/src/mame/includes/calomega.h +++ b/src/mame/includes/calomega.h @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Roberto Fresca +#include "machine/6821pia.h" #include "machine/6850acia.h" #include "machine/clock.h" #include "emupal.h" @@ -9,6 +10,7 @@ class calomega_state : public driver_device public: calomega_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_pia(*this, "pia%u", 0U), m_maincpu(*this, "maincpu"), m_acia6850_0(*this, "acia6850_0"), m_aciabaud(*this, "aciabaud"), @@ -67,6 +69,8 @@ protected: virtual void machine_start() override { m_lamps.resolve(); } virtual void video_start() override; + optional_device_array<pia6821_device, 2> m_pia; + private: required_device<cpu_device> m_maincpu; optional_device<acia6850_device> m_acia6850_0; diff --git a/src/mame/machine/decopincpu.cpp b/src/mame/machine/decopincpu.cpp index f6c99b812e0..78f6563993e 100644 --- a/src/mame/machine/decopincpu.cpp +++ b/src/mame/machine/decopincpu.cpp @@ -205,44 +205,44 @@ MACHINE_CONFIG_START(decocpu_type1_device::device_add_mconfig) MCFG_DEVICE_PROGRAM_MAP(decocpu1_map) /* Devices */ - MCFG_DEVICE_ADD("pia21", PIA6821, 0) // 5F - PIA at 0x2100 - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, decocpu_type1_device, solenoid1_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, decocpu_type1_device, pia21_ca2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - - MCFG_DEVICE_ADD("pia24", PIA6821, 0) // 11D - PIA at 0x2400 - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, decocpu_type1_device, lamp0_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, decocpu_type1_device, lamp1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - - MCFG_DEVICE_ADD("pia28", PIA6821, 0) // 11B - PIA at 0x2800 - MCFG_PIA_READPA_HANDLER(READ8(*this, decocpu_type1_device, display_strobe_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, decocpu_type1_device, display_strobe_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, decocpu_type1_device, display_out1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - - MCFG_DEVICE_ADD("pia2c", PIA6821, 0) // 9B - PIA at 0x2c00 - MCFG_PIA_READPB_HANDLER(READ8(*this, decocpu_type1_device, display_in3_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, decocpu_type1_device, display_out2_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, decocpu_type1_device, display_out3_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - - MCFG_DEVICE_ADD("pia30", PIA6821, 0) // 8H - PIA at 0x3000 - MCFG_PIA_READPA_HANDLER(READ8(*this, decocpu_type1_device, switch_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, decocpu_type1_device, switch_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - - MCFG_DEVICE_ADD("pia34", PIA6821, 0) // 7B - PIA at 0x3400 - MCFG_PIA_READPA_HANDLER(READ8(*this, decocpu_type1_device, dmdstatus_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, decocpu_type1_device, display_out4_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, decocpu_type1_device, sound_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, decocpu_type1_device, cpu_pia_irq)) + PIA6821(config, m_pia21, 0); // 5F - PIA at 0x2100 + m_pia21->writepa_handler().set(FUNC(decocpu_type1_device::solenoid1_w)); + m_pia21->ca2_handler().set(FUNC(decocpu_type1_device::pia21_ca2_w)); + m_pia21->irqa_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + m_pia21->irqb_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + + PIA6821(config, m_pia24, 0); // 11D - PIA at 0x2400 + m_pia24->writepa_handler().set(FUNC(decocpu_type1_device::lamp0_w)); + m_pia24->writepb_handler().set(FUNC(decocpu_type1_device::lamp1_w)); + m_pia24->irqa_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + m_pia24->irqb_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + + PIA6821(config, m_pia28, 0); // 11B - PIA at 0x2800 + m_pia28->readpa_handler().set(FUNC(decocpu_type1_device::display_strobe_r)); + m_pia28->writepa_handler().set(FUNC(decocpu_type1_device::display_strobe_w)); + m_pia28->writepb_handler().set(FUNC(decocpu_type1_device::display_out1_w)); + m_pia28->irqa_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + m_pia28->irqb_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + + PIA6821(config, m_pia2c, 0); // 9B - PIA at 0x2c00 + m_pia2c->readpb_handler().set(FUNC(decocpu_type1_device::display_in3_r)); + m_pia2c->writepa_handler().set(FUNC(decocpu_type1_device::display_out2_w)); + m_pia2c->writepb_handler().set(FUNC(decocpu_type1_device::display_out3_w)); + m_pia2c->irqa_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + m_pia2c->irqb_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + + PIA6821(config, m_pia30, 0); // 8H - PIA at 0x3000 + m_pia30->readpa_handler().set(FUNC(decocpu_type1_device::switch_r)); + m_pia30->writepb_handler().set(FUNC(decocpu_type1_device::switch_w)); + m_pia30->irqa_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + m_pia30->irqb_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + + PIA6821(config, m_pia34, 0); // 7B - PIA at 0x3400 + m_pia34->readpa_handler().set(FUNC(decocpu_type1_device::dmdstatus_r)); + m_pia34->writepa_handler().set(FUNC(decocpu_type1_device::display_out4_w)); + m_pia34->writepb_handler().set(FUNC(decocpu_type1_device::sound_w)); + m_pia34->irqa_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); + m_pia34->irqb_handler().set(FUNC(decocpu_type1_device::cpu_pia_irq)); MCFG_NVRAM_ADD_1FILL("nvram") MACHINE_CONFIG_END diff --git a/src/mame/machine/mpu4.cpp b/src/mame/machine/mpu4.cpp index 80693c5212e..ad16220e0db 100644 --- a/src/mame/machine/mpu4.cpp +++ b/src/mame/machine/mpu4.cpp @@ -2968,57 +2968,57 @@ MACHINE_CONFIG_START(mpu4_state::mpu4_common) MCFG_PTM6840_O3_CB(WRITELINE(*this, mpu4_state, ic2_o3_callback)) MCFG_PTM6840_IRQ_CB(WRITELINE(*this, mpu4_state, cpu0_irq)) - MCFG_DEVICE_ADD("pia_ic3", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu4_state, pia_ic3_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_ic3_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic3_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic3_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - - MCFG_DEVICE_ADD("pia_ic4", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, mpu4_state, pia_ic4_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu4_state, pia_ic4_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_ic4_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state,pia_ic4_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state,pia_ic4_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu4_state,cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu4_state,cpu0_irq)) - - MCFG_DEVICE_ADD("pia_ic5", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mpu4_state, pia_ic5_porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(*this, mpu4_state, pia_ic5_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu4_state, pia_ic5_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_ic5_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic5_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic5_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - - MCFG_DEVICE_ADD("pia_ic6", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu4_state, pia_ic6_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_ic6_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic6_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic6_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - - MCFG_DEVICE_ADD("pia_ic7", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, mpu4_state, pia_ic7_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu4_state, pia_ic7_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_ic7_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic7_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic7_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - - MCFG_DEVICE_ADD("pia_ic8", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, mpu4_state, pia_ic8_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_ic8_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic8_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state, pia_ic8_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, mpu4_state, cpu0_irq)) + PIA6821(config, m_pia3, 0); + m_pia3->writepa_handler().set(FUNC(mpu4_state::pia_ic3_porta_w)); + m_pia3->writepb_handler().set(FUNC(mpu4_state::pia_ic3_portb_w)); + m_pia3->ca2_handler().set(FUNC(mpu4_state::pia_ic3_ca2_w)); + m_pia3->cb2_handler().set(FUNC(mpu4_state::pia_ic3_cb2_w)); + m_pia3->irqa_handler().set(FUNC(mpu4_state::cpu0_irq)); + m_pia3->irqb_handler().set(FUNC(mpu4_state::cpu0_irq)); + + PIA6821(config, m_pia4, 0); + m_pia4->readpb_handler().set(FUNC(mpu4_state::pia_ic4_portb_r)); + m_pia4->writepa_handler().set(FUNC(mpu4_state::pia_ic4_porta_w)); + m_pia4->writepb_handler().set(FUNC(mpu4_state::pia_ic4_portb_w)); + m_pia4->ca2_handler().set(FUNC(mpu4_state::pia_ic4_ca2_w)); + m_pia4->cb2_handler().set(FUNC(mpu4_state::pia_ic4_cb2_w)); + m_pia4->irqa_handler().set(FUNC(mpu4_state::cpu0_irq)); + m_pia4->irqb_handler().set(FUNC(mpu4_state::cpu0_irq)); + + PIA6821(config, m_pia5, 0); + m_pia5->readpa_handler().set(FUNC(mpu4_state::pia_ic5_porta_r)); + m_pia5->readpb_handler().set(FUNC(mpu4_state::pia_ic5_portb_r)); + m_pia5->writepa_handler().set(FUNC(mpu4_state::pia_ic5_porta_w)); + m_pia5->writepb_handler().set(FUNC(mpu4_state::pia_ic5_portb_w)); + m_pia5->ca2_handler().set(FUNC(mpu4_state::pia_ic5_ca2_w)); + m_pia5->cb2_handler().set(FUNC(mpu4_state::pia_ic5_cb2_w)); + m_pia5->irqa_handler().set(FUNC(mpu4_state::cpu0_irq)); + m_pia5->irqb_handler().set(FUNC(mpu4_state::cpu0_irq)); + + PIA6821(config, m_pia6, 0); + m_pia6->writepa_handler().set(FUNC(mpu4_state::pia_ic6_porta_w)); + m_pia6->writepb_handler().set(FUNC(mpu4_state::pia_ic6_portb_w)); + m_pia6->ca2_handler().set(FUNC(mpu4_state::pia_ic6_ca2_w)); + m_pia6->cb2_handler().set(FUNC(mpu4_state::pia_ic6_cb2_w)); + m_pia6->irqa_handler().set(FUNC(mpu4_state::cpu0_irq)); + m_pia6->irqb_handler().set(FUNC(mpu4_state::cpu0_irq)); + + PIA6821(config, m_pia7, 0); + m_pia7->readpb_handler().set(FUNC(mpu4_state::pia_ic7_portb_r)); + m_pia7->writepa_handler().set(FUNC(mpu4_state::pia_ic7_porta_w)); + m_pia7->writepb_handler().set(FUNC(mpu4_state::pia_ic7_portb_w)); + m_pia7->ca2_handler().set(FUNC(mpu4_state::pia_ic7_ca2_w)); + m_pia7->cb2_handler().set(FUNC(mpu4_state::pia_ic7_cb2_w)); + m_pia7->irqa_handler().set(FUNC(mpu4_state::cpu0_irq)); + m_pia7->irqb_handler().set(FUNC(mpu4_state::cpu0_irq)); + + PIA6821(config, m_pia8, 0); + m_pia8->readpa_handler().set(FUNC(mpu4_state::pia_ic8_porta_r)); + m_pia8->writepb_handler().set(FUNC(mpu4_state::pia_ic8_portb_w)); + m_pia8->ca2_handler().set(FUNC(mpu4_state::pia_ic8_ca2_w)); + m_pia8->cb2_handler().set(FUNC(mpu4_state::pia_ic8_cb2_w)); + m_pia8->irqa_handler().set(FUNC(mpu4_state::cpu0_irq)); + m_pia8->irqb_handler().set(FUNC(mpu4_state::cpu0_irq)); MCFG_DEVICE_ADD("meters", METERS, 0) MCFG_METERS_NUMBER(8) @@ -3033,12 +3033,12 @@ MACHINE_CONFIG_START(mpu4_state::mpu4_common2) //MCFG_PTM6840_O3_CB(WRITELINE("ptm_ic3ss", ptm6840_device, set_g1)) //MCFG_PTM6840_IRQ_CB(WRITELINE(*this, mpu4_state, cpu1_ptm_irq)) - MCFG_DEVICE_ADD("pia_ic4ss", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, mpu4_state, pia_gb_portb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, mpu4_state, pia_gb_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, mpu4_state, pia_gb_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, mpu4_state, pia_gb_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(*this, mpu4_state, pia_gb_cb2_w)) + pia6821_device &pia_ic4ss(PIA6821(config, "pia_ic4ss", 0)); + pia_ic4ss.readpb_handler().set(FUNC(mpu4_state::pia_gb_portb_r)); + pia_ic4ss.writepa_handler().set(FUNC(mpu4_state::pia_gb_porta_w)); + pia_ic4ss.writepb_handler().set(FUNC(mpu4_state::pia_gb_portb_w)); + pia_ic4ss.ca2_handler().set(FUNC(mpu4_state::pia_gb_ca2_w)); + pia_ic4ss.cb2_handler().set(FUNC(mpu4_state::pia_gb_cb2_w)); MACHINE_CONFIG_END /* machine driver for MOD 2 board */ diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index 3d0daeb81bd..7b5243cc1d2 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -522,13 +522,13 @@ to7_io_line_device::to7_io_line_device(const machine_config &mconfig, const char MACHINE_CONFIG_START(to7_io_line_device::device_add_mconfig) /// THIS PIO is part of CC 90-232 expansion - MCFG_DEVICE_ADD(THOM_PIA_IO, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, to7_io_line_device, porta_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, to7_io_line_device, porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("cent_data_out", output_latch_device, bus_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("centronics", centronics_device, write_strobe)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("^mainfirq", input_merger_device, in_w<1>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("^mainfirq", input_merger_device, in_w<1>)) + PIA6821(config, m_pia_io, 0); + m_pia_io->readpa_handler().set(FUNC(to7_io_line_device::porta_in)); + m_pia_io->writepa_handler().set(FUNC(to7_io_line_device::porta_out)); + m_pia_io->writepb_handler().set("cent_data_out", FUNC(output_latch_device::bus_w)); + m_pia_io->cb2_handler().set("centronics", FUNC(centronics_device::write_strobe)); + m_pia_io->irqa_handler().set("^mainfirq", FUNC(input_merger_device::in_w<1>)); + m_pia_io->irqb_handler().set("^mainfirq", FUNC(input_merger_device::in_w<1>)); MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(WRITELINE(*this, to7_io_line_device, write_rxd)) |