diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp index 5b07646379c..4ac4dc66df6 100644 --- a/src/devices/bus/bml3/bml3mp1805.cpp +++ b/src/devices/bus/bml3/bml3mp1805.cpp @@ -56,11 +56,12 @@ ROM_END // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(bml3bus_mp1805_device::device_add_mconfig) - MCFG_DEVICE_ADD( "mc6843", MC6843, 0 ) - MCFG_MC6843_IRQ_CALLBACK(WRITELINE(*this, bml3bus_mp1805_device, bml3_mc6843_intrq_w)) - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(bml3_mp1805_floppy_interface) -MACHINE_CONFIG_END +void bml3bus_mp1805_device::device_add_mconfig(machine_config &config) +{ + MC6843(config, m_mc6843, 0); + m_mc6843->irq().set(FUNC(bml3bus_mp1805_device::bml3_mc6843_intrq_w)); + legacy_floppy_image_device::add_4drives(config, &bml3_mp1805_floppy_interface); +} //------------------------------------------------- // rom_region - device-specific ROM region diff --git a/src/devices/bus/dmv/k801.cpp b/src/devices/bus/dmv/k801.cpp index 45ee5df50ad..601f8b5ecaa 100644 --- a/src/devices/bus/dmv/k801.cpp +++ b/src/devices/bus/dmv/k801.cpp @@ -84,6 +84,7 @@ dmv_k801_device::dmv_k801_device(const machine_config &mconfig, device_type type : device_t(mconfig, type, tag, owner, clock), device_dmvslot_interface( mconfig, *this ), m_epci(*this, "epci"), + m_rs232(*this, "rs232"), m_dsw(*this, "DSW"), m_bus(nullptr) { } @@ -142,41 +143,39 @@ void dmv_k801_device::device_reset() // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(dmv_k801_device::device_add_mconfig) - MCFG_DEVICE_ADD("epci", MC2661, XTAL(5'068'800)) - MCFG_MC2661_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MC2661_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_MC2661_RXRDY_HANDLER(WRITELINE(*this, dmv_k801_device, epci_irq_w)) - MCFG_MC2661_TXRDY_HANDLER(WRITELINE(*this, dmv_k801_device, epci_irq_w)) +void dmv_k801_device::device_add_mconfig(machine_config &config) +{ + MC2661(config, m_epci, XTAL(5'068'800)); + m_epci->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_epci->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + m_epci->dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); + m_epci->rxrdy_handler().set(FUNC(dmv_k801_device::epci_irq_w)); + m_epci->txrdy_handler().set(FUNC(dmv_k801_device::epci_irq_w)); - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "printer") - MCFG_RS232_RXD_HANDLER(WRITELINE("epci", mc2661_device, rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("epci", mc2661_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("epci", mc2661_device, dsr_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("epci", mc2661_device, cts_w)) -MACHINE_CONFIG_END + RS232_PORT(config, m_rs232, default_rs232_devices, "printer"); + m_rs232->rxd_handler().set(m_epci, FUNC(mc2661_device::rx_w)); + m_rs232->dcd_handler().set(m_epci, FUNC(mc2661_device::dcd_w)); + m_rs232->dsr_handler().set(m_epci, FUNC(mc2661_device::dsr_w)); + m_rs232->cts_handler().set(m_epci, FUNC(mc2661_device::cts_w)); +} -MACHINE_CONFIG_START(dmv_k211_device::device_add_mconfig) +void dmv_k211_device::device_add_mconfig(machine_config &config) +{ dmv_k801_device::device_add_mconfig(config); + m_rs232->set_default_option("null_modem"); +} - MCFG_DEVICE_MODIFY("rs232") - MCFG_SLOT_DEFAULT_OPTION("null_modem") -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(dmv_k212_device::device_add_mconfig) +void dmv_k212_device::device_add_mconfig(machine_config &config) +{ dmv_k801_device::device_add_mconfig(config); + m_rs232->set_default_option("printer"); +} - MCFG_DEVICE_MODIFY("rs232") - MCFG_SLOT_DEFAULT_OPTION("printer") -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(dmv_k213_device::device_add_mconfig) +void dmv_k213_device::device_add_mconfig(machine_config &config) +{ dmv_k801_device::device_add_mconfig(config); - - MCFG_DEVICE_MODIFY("rs232") - MCFG_SLOT_DEFAULT_OPTION(nullptr) -MACHINE_CONFIG_END + m_rs232->set_default_option(nullptr); +} //------------------------------------------------- // input_ports - device-specific input ports diff --git a/src/devices/bus/dmv/k801.h b/src/devices/bus/dmv/k801.h index cba10725e0a..26f314b2149 100644 --- a/src/devices/bus/dmv/k801.h +++ b/src/devices/bus/dmv/k801.h @@ -40,6 +40,7 @@ protected: virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override; required_device m_epci; + required_device m_rs232; required_ioport m_dsw; private: diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h index 11182f2dc00..cae694146b7 100644 --- a/src/devices/imagedev/flopdrv.h +++ b/src/devices/imagedev/flopdrv.h @@ -11,6 +11,11 @@ #include "formats/flopimg.h" #include "softlist_dev.h" +#define FLOPPY_0 "floppy0" +#define FLOPPY_1 "floppy1" +#define FLOPPY_2 "floppy2" +#define FLOPPY_3 "floppy3" + #define FLOPPY_TYPE_REGULAR 0 #define FLOPPY_TYPE_APPLE 1 #define FLOPPY_TYPE_SONY 2 @@ -53,7 +58,7 @@ TYPE DEFINITIONS ***************************************************************************/ -// ======================> floppy_type_t +DECLARE_DEVICE_TYPE(LEGACY_FLOPPY, legacy_floppy_image_device) struct floppy_type_t { @@ -95,12 +100,26 @@ class legacy_floppy_image_device : public device_t, { public: // construction/destruction + legacy_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const floppy_interface *config) + : legacy_floppy_image_device(mconfig, tag, owner, clock) + { + set_floppy_config(config); + } + legacy_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ~legacy_floppy_image_device(); void set_floppy_config(const floppy_interface *config) { m_config = config; } template devcb_base &set_out_idx_func(Object &&cb) { return m_out_idx_func.set_callback(std::forward(cb)); } + static void add_4drives(machine_config &mconfig, const floppy_interface *config) + { + LEGACY_FLOPPY(mconfig, FLOPPY_0, 0, config); + LEGACY_FLOPPY(mconfig, FLOPPY_1, 0, config); + LEGACY_FLOPPY(mconfig, FLOPPY_2, 0, config); + LEGACY_FLOPPY(mconfig, FLOPPY_3, 0, config); + } + virtual image_init_result call_load() override; virtual const software_list_loader &get_software_list_loader() const override { return image_software_list_loader::instance(); } virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override; @@ -226,11 +245,6 @@ protected: char m_extension_list[256]; }; -// device type definition -DECLARE_DEVICE_TYPE(LEGACY_FLOPPY, legacy_floppy_image_device) - - - legacy_floppy_image_device *floppy_get_device(running_machine &machine,int drive); legacy_floppy_image_device *floppy_get_device_by_type(running_machine &machine,int ftype,int drive); int floppy_get_drive_by_type(legacy_floppy_image_device *image,int ftype); @@ -240,10 +254,6 @@ int floppy_get_count(running_machine &machine); /*************************************************************************** DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define FLOPPY_0 "floppy0" -#define FLOPPY_1 "floppy1" -#define FLOPPY_2 "floppy2" -#define FLOPPY_3 "floppy3" #define MCFG_LEGACY_FLOPPY_CONFIG(_config) \ diff --git a/src/devices/machine/mc2661.h b/src/devices/machine/mc2661.h index 9c6decef34c..5be3520a8d5 100644 --- a/src/devices/machine/mc2661.h +++ b/src/devices/machine/mc2661.h @@ -31,48 +31,6 @@ #include "diserial.h" -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_MC2661_RXC(_clock) \ - downcast(*device).set_rxc(_clock); - -#define MCFG_MC2661_TXC(_clock) \ - downcast(*device).set_txc(_clock); - -#define MCFG_MC2661_TXD_HANDLER(_write) \ - downcast(*device).set_txd_callback(DEVCB_##_write); - -#define MCFG_MC2661_RXRDY_HANDLER(_write) \ - downcast(*device).set_rxrdy_callback(DEVCB_##_write); - -#define MCFG_MC2661_TXRDY_HANDLER(_write) \ - downcast(*device).set_txrdy_callback(DEVCB_##_write); - -#define MCFG_MC2661_RTS_HANDLER(_write) \ - downcast(*device).set_rts_callback(DEVCB_##_write); - -#define MCFG_MC2661_DTR_HANDLER(_write) \ - downcast(*device).set_dtr_callback(DEVCB_##_write); - -#define MCFG_MC2661_TXEMT_DSCHG_HANDLER(_write) \ - downcast(*device).set_txemt_dschg_callback(DEVCB_##_write); - -#define MCFG_MC2661_BKDET_HANDLER(_write) \ - downcast(*device).set_bkdet_callback(DEVCB_##_write); - -#define MCFG_MC2661_XSYNC_HANDLER(_write) \ - downcast(*device).set_xsync_callback(DEVCB_##_write); - - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -// ======================> mc2661_device - class mc2661_device : public device_t, public device_serial_interface { @@ -83,15 +41,6 @@ public: void set_rxc(int clock) { m_rxc = clock; } void set_txc(int clock) { m_txc = clock; } - template devcb_base &set_txd_callback(Object &&cb) { return m_write_txd.set_callback(std::forward(cb)); } - template devcb_base &set_rxrdy_callback(Object &&cb) { return m_write_rxrdy.set_callback(std::forward(cb)); } - template devcb_base &set_txrdy_callback(Object &&cb) { return m_write_txrdy.set_callback(std::forward(cb)); } - template devcb_base &set_rts_callback(Object &&cb) { return m_write_rts.set_callback(std::forward(cb)); } - template devcb_base &set_dtr_callback(Object &&cb) { return m_write_dtr.set_callback(std::forward(cb)); } - template devcb_base &set_txemt_dschg_callback(Object &&cb) { return m_write_txemt_dschg.set_callback(std::forward(cb)); } - template devcb_base &set_bkdet_callback(Object &&cb) { return m_write_bkdet.set_callback(std::forward(cb)); } - template devcb_base &set_xsync_callback(Object &&cb) { return m_write_xsync.set_callback(std::forward(cb)); } - auto txd_handler() { return m_write_txd.bind(); } auto rxrdy_handler() { return m_write_rxrdy.bind(); } auto txrdy_handler() { return m_write_txrdy.bind(); } @@ -147,8 +96,6 @@ private: int m_sync_index; }; - -// device type definition DECLARE_DEVICE_TYPE(MC2661, mc2661_device) #endif // MAME_MACHINE_MC2661_H diff --git a/src/devices/machine/mc68328.h b/src/devices/machine/mc68328.h index f146c6856c5..d9b169b5324 100644 --- a/src/devices/machine/mc68328.h +++ b/src/devices/machine/mc68328.h @@ -4,11 +4,7 @@ Motorola 68328 ("DragonBall") System-on-a-Chip implementation - By Ryan Holtz - - **********************************************************************/ - -/***************************************************************************************************************** +*********************************************************************** P P P P P P P P P P P P P P E E E E E E E J J J J J J J @@ -95,33 +91,39 @@ class mc68328_device : public device_t { public: + template + mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag) + : mc68328_device(mconfig, tag, owner, clock) + { + m_cpu.set_tag(std::forward(cpu_tag)); + } + mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); } - template devcb_base &set_out_port_a_callback(Object &&cb) { return m_out_port_a_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_b_callback(Object &&cb) { return m_out_port_b_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_c_callback(Object &&cb) { return m_out_port_c_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_d_callback(Object &&cb) { return m_out_port_d_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_e_callback(Object &&cb) { return m_out_port_e_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_f_callback(Object &&cb) { return m_out_port_f_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_g_callback(Object &&cb) { return m_out_port_g_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_j_callback(Object &&cb) { return m_out_port_j_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_k_callback(Object &&cb) { return m_out_port_k_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_port_m_callback(Object &&cb) { return m_out_port_m_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_a_callback(Object &&cb) { return m_in_port_a_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_b_callback(Object &&cb) { return m_in_port_b_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_c_callback(Object &&cb) { return m_in_port_c_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_d_callback(Object &&cb) { return m_in_port_d_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_e_callback(Object &&cb) { return m_in_port_e_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_f_callback(Object &&cb) { return m_in_port_f_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_g_callback(Object &&cb) { return m_in_port_g_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_j_callback(Object &&cb) { return m_in_port_j_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_k_callback(Object &&cb) { return m_in_port_k_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_m_callback(Object &&cb) { return m_in_port_m_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pwm_callback(Object &&cb) { return m_out_pwm_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_spim_callback(Object &&cb) { return m_out_spim_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_spim_callback(Object &&cb) { return m_in_spim_cb.set_callback(std::forward(cb)); } - template devcb_base &set_spim_xch_trigger_callback(Object &&cb) { return m_spim_xch_trigger_cb.set_callback(std::forward(cb)); } + auto out_port_a() { return m_out_port_a_cb.bind(); } + auto out_port_b() { return m_out_port_b_cb.bind(); } + auto out_port_c() { return m_out_port_c_cb.bind(); } + auto out_port_d() { return m_out_port_d_cb.bind(); } + auto out_port_e() { return m_out_port_e_cb.bind(); } + auto out_port_f() { return m_out_port_f_cb.bind(); } + auto out_port_g() { return m_out_port_g_cb.bind(); } + auto out_port_j() { return m_out_port_j_cb.bind(); } + auto out_port_k() { return m_out_port_k_cb.bind(); } + auto out_port_m() { return m_out_port_m_cb.bind(); } + auto in_port_a() { return m_in_port_a_cb.bind(); } + auto in_port_b() { return m_in_port_b_cb.bind(); } + auto in_port_c() { return m_in_port_c_cb.bind(); } + auto in_port_d() { return m_in_port_d_cb.bind(); } + auto in_port_e() { return m_in_port_e_cb.bind(); } + auto in_port_f() { return m_in_port_f_cb.bind(); } + auto in_port_g() { return m_in_port_g_cb.bind(); } + auto in_port_j() { return m_in_port_j_cb.bind(); } + auto in_port_k() { return m_in_port_k_cb.bind(); } + auto in_port_m() { return m_in_port_m_cb.bind(); } + auto out_pwm() { return m_out_pwm_cb.bind(); } + auto out_spim() { return m_out_spim_cb.bind(); } + auto in_spim() { return m_in_spim_cb.bind(); } + auto spim_xch_trigger() { return m_spim_xch_trigger_cb.bind(); } DECLARE_WRITE16_MEMBER(write); @@ -385,80 +387,4 @@ private: DECLARE_DEVICE_TYPE(MC68328, mc68328_device) -#define MCFG_MC68328_CPU(_tag) \ - downcast(*device).set_cpu_tag(_tag); - -#define MCFG_MC68328_OUT_PORT_A_CB(_devcb) \ - downcast(*device).set_out_port_a_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_B_CB(_devcb) \ - downcast(*device).set_out_port_b_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_C_CB(_devcb) \ - downcast(*device).set_out_port_c_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_D_CB(_devcb) \ - downcast(*device).set_out_port_d_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_E_CB(_devcb) \ - downcast(*device).set_out_port_e_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_F_CB(_devcb) \ - downcast(*device).set_out_port_f_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_G_CB(_devcb) \ - downcast(*device).set_out_port_g_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_J_CB(_devcb) \ - downcast(*device).set_out_port_j_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_K_CB(_devcb) \ - downcast(*device).set_out_port_k_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PORT_M_CB(_devcb) \ - downcast(*device).set_out_port_m_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_A_CB(_devcb) \ - downcast(*device).set_in_port_a_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_B_CB(_devcb) \ - downcast(*device).set_in_port_b_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_C_CB(_devcb) \ - downcast(*device).set_in_port_c_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_D_CB(_devcb) \ - downcast(*device).set_in_port_d_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_E_CB(_devcb) \ - downcast(*device).set_in_port_e_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_F_CB(_devcb) \ - downcast(*device).set_in_port_f_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_G_CB(_devcb) \ - downcast(*device).set_in_port_g_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_J_CB(_devcb) \ - downcast(*device).set_in_port_j_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_K_CB(_devcb) \ - downcast(*device).set_in_port_k_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_PORT_M_CB(_devcb) \ - downcast(*device).set_in_port_m_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_PWM_CB(_devcb) \ - downcast(*device).set_out_pwm_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_OUT_SPIM_CB(_devcb) \ - downcast(*device).set_out_spim_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_IN_SPIM_CB(_devcb) \ - downcast(*device).set_in_spim_callback(DEVCB_##_devcb); - -#define MCFG_MC68328_SPIM_XCH_TRIGGER_CB(_devcb) \ - downcast(*device).set_spim_xch_trigger_callback(DEVCB_##_devcb); - - #endif // MAME_MACHINE_MC68328_H diff --git a/src/devices/machine/mc6843.h b/src/devices/machine/mc6843.h index 54f6fff58a3..29f3b862bda 100644 --- a/src/devices/machine/mc6843.h +++ b/src/devices/machine/mc6843.h @@ -23,7 +23,7 @@ class mc6843_device : public device_t public: mc6843_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward(cb)); } + auto irq() { return m_write_irq.bind(); } DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); diff --git a/src/devices/machine/mc6846.h b/src/devices/machine/mc6846.h index c5870dc6c39..1b960ae1ef3 100644 --- a/src/devices/machine/mc6846.h +++ b/src/devices/machine/mc6846.h @@ -14,36 +14,17 @@ #pragma once -#define MCFG_MC6846_OUT_PORT_CB(_devcb) \ - downcast(*device).set_out_port_callback(DEVCB_##_devcb); - -#define MCFG_MC6846_OUT_CP1_CB(_devcb) \ - downcast(*device).set_out_cp1_callback(DEVCB_##_devcb); - -#define MCFG_MC6846_OUT_CP2_CB(_devcb) \ - downcast(*device).set_out_cp2_callback(DEVCB_##_devcb); - -#define MCFG_MC6846_IN_PORT_CB(_devcb) \ - downcast(*device).set_in_port_callback(DEVCB_##_devcb); - -#define MCFG_MC6846_OUT_CTO_CB(_devcb) \ - downcast(*device).set_out_cto_callback(DEVCB_##_devcb); - -#define MCFG_MC6846_IRQ_CB(_devcb) \ - downcast(*device).set_irq_callback(DEVCB_##_devcb); - - class mc6846_device : public device_t { public: mc6846_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_out_port_callback(Object &&cb) { return m_out_port_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_cp1_callback(Object &&cb) { return m_out_cp1_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_cp2_callback(Object &&cb) { return m_out_cp2_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_port_callback(Object &&cb) { return m_in_port_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_cto_callback(Object &&cb) { return m_out_cto_cb.set_callback(std::forward(cb)); } - template devcb_base &set_irq_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward(cb)); } + auto out_port() { return m_out_port_cb.bind(); } + auto in_port() { return m_in_port_cb.bind(); } + auto cp1() { return m_out_cp1_cb.bind(); } + auto cp2() { return m_out_cp2_cb.bind(); } + auto cto() { return m_out_cto_cb.bind(); } + auto irq() { return m_irq_cb.bind(); } /* interface to CPU via address/data bus*/ DECLARE_READ8_MEMBER(read); diff --git a/src/mame/drivers/dps1.cpp b/src/mame/drivers/dps1.cpp index 271d72014c9..8d104b1fdc0 100644 --- a/src/mame/drivers/dps1.cpp +++ b/src/mame/drivers/dps1.cpp @@ -197,25 +197,25 @@ static void floppies(device_slot_interface &device) MACHINE_CONFIG_START(dps1_state::dps1) // basic machine hardware - MCFG_DEVICE_ADD("maincpu", Z80, 4000000) - MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_IO_MAP(io_map) + Z80(config, m_maincpu, 4000000); + m_maincpu->set_addrmap(AS_PROGRAM, &dps1_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &dps1_state::io_map); + MCFG_MACHINE_RESET_OVERRIDE(dps1_state, dps1) /* video hardware */ - MCFG_DEVICE_ADD("uart", MC2661, XTAL(5'068'800)) - MCFG_MC2661_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MC2661_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) + mc2661_device &uart(MC2661(config, "uart", XTAL(5'068'800))); + uart.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + uart.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + uart.dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart",mc2661_device,rx_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart",mc2661_device,dsr_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart",mc2661_device,cts_w)) + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set(uart, FUNC(mc2661_device::rx_w)); + rs232.dsr_handler().set(uart, FUNC(mc2661_device::dsr_w)); + rs232.cts_handler().set(uart, FUNC(mc2661_device::cts_w)); - MCFG_DEVICE_ADD("am9519a", AM9519, 0) - - MCFG_DEVICE_ADD("am9519b", AM9519, 0) + AM9519(config, "am9519a", 0); + AM9519(config, "am9519b", 0); // floppy MCFG_UPD765A_ADD("fdc", false, true) diff --git a/src/mame/drivers/micro3d.cpp b/src/mame/drivers/micro3d.cpp index 67a331cd2af..888282c562c 100644 --- a/src/mame/drivers/micro3d.cpp +++ b/src/mame/drivers/micro3d.cpp @@ -358,8 +358,8 @@ MACHINE_CONFIG_START(micro3d_state::micro3d) MCFG_SCREEN_UPDATE_DEVICE("vgb", tms34010_device, tms340x0_ind16) MCFG_SCREEN_PALETTE("palette") - MCFG_DEVICE_ADD("uart", MC2661, 40_MHz_XTAL / 8) // actually SCN2651 - MCFG_MC2661_TXD_HANDLER(WRITELINE("monitor_vgb", rs232_port_device, write_txd)) + MC2661(config, m_vgb_uart, 40_MHz_XTAL / 8); // actually SCN2651 + m_vgb_uart->txd_handler().set("monitor_vgb", FUNC(rs232_port_device::write_txd)); rs232_port_device &monitor_host(RS232_PORT(config, "monitor_host", default_rs232_devices, nullptr)); // J2 (4-pin molex) monitor_host.rxd_handler().set("duart", FUNC(mc68681_device::rx_a_w)); diff --git a/src/mame/drivers/palm.cpp b/src/mame/drivers/palm.cpp index c60d306faac..68874958871 100644 --- a/src/mame/drivers/palm.cpp +++ b/src/mame/drivers/palm.cpp @@ -207,15 +207,14 @@ MACHINE_CONFIG_START(palm_state::palm) 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_DEVICE_ADD( MC68328_TAG, MC68328, 0 ) // lsi device - MCFG_MC68328_CPU("maincpu") - MCFG_MC68328_OUT_PORT_F_CB(WRITE8(*this, palm_state, palm_port_f_out)) // Port F Output - MCFG_MC68328_IN_PORT_C_CB(READ8(*this, palm_state, palm_port_c_in)) // Port C Input - MCFG_MC68328_IN_PORT_F_CB(READ8(*this, palm_state, palm_port_f_in)) // Port F Input - MCFG_MC68328_OUT_PWM_CB(WRITELINE("dac", dac_bit_interface, write)) - MCFG_MC68328_OUT_SPIM_CB(WRITE16(*this, palm_state, palm_spim_out)) - MCFG_MC68328_IN_SPIM_CB(READ16(*this, palm_state, palm_spim_in)) - MCFG_MC68328_SPIM_XCH_TRIGGER_CB(WRITELINE(*this, palm_state, palm_spim_exchange)) + MC68328(config, m_lsi, 0, "maincpu"); // on-board peripherals + m_lsi->out_port_f().set(FUNC(palm_state::palm_port_f_out)); + m_lsi->in_port_c().set(FUNC(palm_state::palm_port_c_in)); + m_lsi->in_port_f().set(FUNC(palm_state::palm_port_f_in)); + m_lsi->out_pwm().set("dac", FUNC(dac_bit_interface::write)); + m_lsi->out_spim().set(FUNC(palm_state::palm_spim_out)); + m_lsi->in_spim().set(FUNC(palm_state::palm_spim_in)); + m_lsi->spim_xch_trigger().set(FUNC(palm_state::palm_spim_exchange)); MACHINE_CONFIG_END static INPUT_PORTS_START( palm ) diff --git a/src/mame/drivers/pcd.cpp b/src/mame/drivers/pcd.cpp index 2ee64e15f8e..d7bfdbe7e16 100644 --- a/src/mame/drivers/pcd.cpp +++ b/src/mame/drivers/pcd.cpp @@ -44,6 +44,7 @@ public: , m_speaker(*this, "speaker") , m_fdc(*this, "fdc") , m_rtc(*this, "rtc") + , m_usart(*this, "usart%u", 1U) , m_scsi(*this, "scsi") , m_scsi_data_out(*this, "scsi_data_out") , m_scsi_data_in(*this, "scsi_data_in") @@ -99,6 +100,7 @@ private: required_device m_speaker; required_device m_fdc; required_device m_rtc; + required_device_array m_usart; required_device m_scsi; required_device m_scsi_data_out; required_device m_scsi_data_in; @@ -459,9 +461,9 @@ void pcd_state::pcd_io(address_map &map) map(0xf904, 0xf905).rw(FUNC(pcd_state::dskctl_r), FUNC(pcd_state::dskctl_w)); map(0xf940, 0xf943).rw(FUNC(pcd_state::scsi_r), FUNC(pcd_state::scsi_w)); map(0xf980, 0xf9bf).m("video", FUNC(pcdx_video_device::map)); - map(0xf9c0, 0xf9c3).rw("usart1", FUNC(mc2661_device::read), FUNC(mc2661_device::write)); // UARTs - map(0xf9d0, 0xf9d3).rw("usart2", FUNC(mc2661_device::read), FUNC(mc2661_device::write)); - map(0xf9e0, 0xf9e3).rw("usart3", FUNC(mc2661_device::read), FUNC(mc2661_device::write)); + map(0xf9c0, 0xf9c3).rw(m_usart[0], FUNC(mc2661_device::read), FUNC(mc2661_device::write)); // UARTs + map(0xf9d0, 0xf9d3).rw(m_usart[1], FUNC(mc2661_device::read), FUNC(mc2661_device::write)); + map(0xf9e0, 0xf9e3).rw(m_usart[2], FUNC(mc2661_device::read), FUNC(mc2661_device::write)); // AM_RANGE(0xfa00, 0xfa7f) // pcs4-n (peripheral chip select) map(0xfb00, 0xfb00).rw(FUNC(pcd_state::nmi_io_r), FUNC(pcd_state::nmi_io_w)); map(0xfb02, 0xffff).rw(FUNC(pcd_state::nmi_io_r), FUNC(pcd_state::nmi_io_w)); @@ -530,23 +532,25 @@ MACHINE_CONFIG_START(pcd_state::pcd) MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcd_floppies, "55f", pcd_state::floppy_formats) // usart - MCFG_DEVICE_ADD("usart1", MC2661, 4.9152_MHz_XTAL) - MCFG_MC2661_RXRDY_HANDLER(WRITELINE(m_pic1, pic8259_device, ir3_w)) - MCFG_MC2661_TXRDY_HANDLER(WRITELINE(m_pic1, pic8259_device, ir3_w)) - MCFG_MC2661_TXD_HANDLER(WRITELINE("rs232_1", rs232_port_device, write_txd)) - MCFG_DEVICE_ADD("usart2", MC2661, 4.9152_MHz_XTAL) - MCFG_MC2661_RXRDY_HANDLER(WRITELINE(m_pic1, pic8259_device, ir2_w)) - //MCFG_MC2661_TXRDY_HANDLER(WRITELINE(m_pic1, pic8259_device, ir2_w)) // this gets stuck high causing the keyboard to not work - MCFG_MC2661_TXD_HANDLER(WRITELINE("keyboard", pcd_keyboard_device, t0_w)) - MCFG_DEVICE_ADD("usart3", MC2661, 4.9152_MHz_XTAL) - MCFG_MC2661_RXRDY_HANDLER(WRITELINE(m_pic1, pic8259_device, ir4_w)) - MCFG_MC2661_TXRDY_HANDLER(WRITELINE(m_pic1, pic8259_device, ir4_w)) - MCFG_MC2661_TXD_HANDLER(WRITELINE("rs232_2", rs232_port_device, write_txd)) + MC2661(config, m_usart[0], 4.9152_MHz_XTAL); + m_usart[0]->rxrdy_handler().set(m_pic1, FUNC(pic8259_device::ir3_w)); + m_usart[0]->txrdy_handler().set(m_pic1, FUNC(pic8259_device::ir3_w)); + m_usart[0]->txd_handler().set("rs232_1", FUNC(rs232_port_device::write_txd)); + + MC2661(config, m_usart[1], 4.9152_MHz_XTAL); + m_usart[1]->rxrdy_handler().set(m_pic1, FUNC(pic8259_device::ir2_w)); + //m_usart[1]->.txrdy_handler().set(m_pic1, FUNC(pic8259_device::ir2_w)); // this gets stuck high causing the keyboard to not work + m_usart[1]->txd_handler().set("keyboard", FUNC(pcd_keyboard_device::t0_w)); + + MC2661(config, m_usart[2], 4.9152_MHz_XTAL); + m_usart[2]->rxrdy_handler().set(m_pic1, FUNC(pic8259_device::ir4_w)); + m_usart[2]->txrdy_handler().set(m_pic1, FUNC(pic8259_device::ir4_w)); + m_usart[2]->txd_handler().set("rs232_2", FUNC(rs232_port_device::write_txd)); MCFG_DEVICE_ADD("rs232_1", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("usart1", mc2661_device, rx_w)) + MCFG_RS232_RXD_HANDLER(WRITELINE(m_usart[0], mc2661_device, rx_w)) MCFG_DEVICE_ADD("rs232_2", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("usart3", mc2661_device, rx_w)) + MCFG_RS232_RXD_HANDLER(WRITELINE(m_usart[2], mc2661_device, rx_w)) // sound hardware SPEAKER(config, "mono").front_center(); @@ -562,7 +566,7 @@ MACHINE_CONFIG_START(pcd_state::pcd) m_rtc->set_24hrs(true); MCFG_DEVICE_ADD("keyboard", PCD_KEYBOARD, 0) - MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(WRITELINE("usart2", mc2661_device, rx_w)) + MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(WRITELINE(m_usart[1], mc2661_device, rx_w)) MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") @@ -588,8 +592,7 @@ MACHINE_CONFIG_START(pcd_state::pcx) MCFG_DEVICE_MODIFY("keyboard") MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(WRITELINE("video", pcx_video_device, rx_w)) - MCFG_DEVICE_MODIFY("usart2") - MCFG_MC2661_TXD_HANDLER(NOOP) + m_usart[1]->txd_handler().set_nop(); MACHINE_CONFIG_END //************************************************************************** diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp index 6f357037517..f3331971922 100644 --- a/src/mame/drivers/thomson.cpp +++ b/src/mame/drivers/thomson.cpp @@ -619,7 +619,7 @@ static void cd90_640_floppies(device_slot_interface &device) /* ------------ driver ------------ */ -MACHINE_CONFIG_START(thomson_state::to7) +MACHINE_CONFIG_START(thomson_state::to7_base) MCFG_MACHINE_START_OVERRIDE( thomson_state, to7 ) MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to7 ) @@ -666,14 +666,6 @@ MACHINE_CONFIG_START(thomson_state::to7) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) MCFG_CASSETTE_INTERFACE("to_cass") -/* timer */ - MCFG_DEVICE_ADD("mc6846", MC6846, 16_MHz_XTAL / 16) - MCFG_MC6846_OUT_PORT_CB(WRITE8(*this, thomson_state, to7_timer_port_out)) - MCFG_MC6846_OUT_CP2_CB(WRITELINE("buzzer", dac_bit_interface, write)) - MCFG_MC6846_IN_PORT_CB(READ8(*this, thomson_state, to7_timer_port_in)) - MCFG_MC6846_OUT_CTO_CB(WRITELINE(*this, thomson_state, to7_set_cassette)) - MCFG_MC6846_IRQ_CB(WRITELINE("mainirq", input_merger_device, in_w<0>)) - /* floppy */ MCFG_DEVICE_ADD("mc6843", MC6843, 16_MHz_XTAL / 16 / 2) @@ -761,9 +753,23 @@ MACHINE_CONFIG_START(thomson_state::to7) MCFG_SOFTWARE_LIST_ADD("to7_qd_list","to7_qd") MACHINE_CONFIG_END -MACHINE_CONFIG_START(thomson_state::t9000) +void thomson_state::to7(machine_config &config) +{ + to7_base(config); + + /* timer */ + MC6846(config, m_mc6846, 16_MHz_XTAL / 16); + m_mc6846->out_port().set(FUNC(thomson_state::to7_timer_port_out)); + m_mc6846->in_port().set(FUNC(thomson_state::to7_timer_port_in)); + m_mc6846->cp2().set("buzzer", FUNC(dac_bit_interface::write)); + m_mc6846->cto().set(FUNC(thomson_state::to7_set_cassette)); + m_mc6846->irq().set("mainirq", FUNC(input_merger_device::in_w<0>)); +} + +void thomson_state::t9000(machine_config &config) +{ to7(config); -MACHINE_CONFIG_END +} COMP( 1982, to7, 0, 0, to7, to7, thomson_state, empty_init, "Thomson", "TO7", 0 ) @@ -938,8 +944,7 @@ MACHINE_CONFIG_START(thomson_state::to770) 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)) + m_mc6846->out_port().set(FUNC(thomson_state::to770_timer_port_out)); /* internal ram */ m_ram->set_default_size("128K").set_extra_options("64K"); @@ -1116,7 +1121,7 @@ INPUT_PORTS_END /* ------------ driver ------------ */ MACHINE_CONFIG_START(thomson_state::mo5) - to7(config); + to7_base(config); MCFG_MACHINE_START_OVERRIDE( thomson_state, mo5 ) MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo5 ) @@ -1127,8 +1132,6 @@ MACHINE_CONFIG_START(thomson_state::mo5) MCFG_CASSETTE_FORMATS(mo5_cassette_formats) MCFG_CASSETTE_INTERFACE("mo_cass") - MCFG_DEVICE_REMOVE( "mc6846" ) - MCFG_PALETTE_MODIFY( "palette" ) MCFG_PALETTE_INIT_OWNER(thomson_state, mo5) @@ -1492,8 +1495,7 @@ MACHINE_CONFIG_START(thomson_state::to9) 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)) + m_mc6846->out_port().set(FUNC(thomson_state::to9_timer_port_out)); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(thomson_state::write_centronics_busy)); @@ -1718,10 +1720,9 @@ MACHINE_CONFIG_START(thomson_state::to8) CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(thomson_state::write_centronics_busy)); - MCFG_DEVICE_MODIFY("mc6846") - MCFG_MC6846_OUT_PORT_CB(WRITE8(*this, thomson_state, to8_timer_port_out)) - MCFG_MC6846_OUT_CP2_CB(WRITELINE(*this, thomson_state, to8_timer_cp2_out)) - MCFG_MC6846_IN_PORT_CB(READ8(*this, thomson_state, to8_timer_port_in)) + m_mc6846->out_port().set(FUNC(thomson_state::to8_timer_port_out)); + m_mc6846->in_port().set(FUNC(thomson_state::to8_timer_port_in)); + m_mc6846->cp2().set(FUNC(thomson_state::to8_timer_cp2_out)); /* internal ram */ m_ram->set_default_size("512K").set_extra_options("256K"); @@ -1882,10 +1883,9 @@ MACHINE_CONFIG_START(thomson_state::to9p) CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(thomson_state::write_centronics_busy)); - MCFG_DEVICE_MODIFY("mc6846") - MCFG_MC6846_OUT_PORT_CB(WRITE8(*this, thomson_state, to9p_timer_port_out)) - MCFG_MC6846_OUT_CP2_CB(WRITELINE(*this, thomson_state, to8_timer_cp2_out)) - MCFG_MC6846_IN_PORT_CB(READ8(*this, thomson_state, to9p_timer_port_in)) + m_mc6846->out_port().set(FUNC(thomson_state::to9p_timer_port_out)); + m_mc6846->in_port().set(FUNC(thomson_state::to9p_timer_port_in)); + m_mc6846->cp2().set(FUNC(thomson_state::to8_timer_cp2_out)); /* internal ram */ m_ram->set_default_size("512K"); @@ -2211,7 +2211,7 @@ INPUT_PORTS_END /* ------------ driver ------------ */ MACHINE_CONFIG_START(thomson_state::mo6) - to7(config); + to7_base(config); MCFG_MACHINE_START_OVERRIDE( thomson_state, mo6 ) MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo6 ) @@ -2222,8 +2222,6 @@ MACHINE_CONFIG_START(thomson_state::mo6) MCFG_CASSETTE_FORMATS(mo5_cassette_formats) MCFG_CASSETTE_INTERFACE("mo_cass") - MCFG_DEVICE_REMOVE( "mc6846" ) - 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)); @@ -2478,7 +2476,7 @@ INPUT_PORTS_END /* ------------ driver ------------ */ MACHINE_CONFIG_START(thomson_state::mo5nr) - to7(config); + to7_base(config); MCFG_MACHINE_START_OVERRIDE( thomson_state, mo5nr ) MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo5nr ) @@ -2489,8 +2487,6 @@ MACHINE_CONFIG_START(thomson_state::mo5nr) MCFG_CASSETTE_FORMATS(mo5_cassette_formats) MCFG_CASSETTE_INTERFACE("mo_cass") - MCFG_DEVICE_REMOVE( "mc6846" ) - 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)); diff --git a/src/mame/drivers/tricep.cpp b/src/mame/drivers/tricep.cpp index f2a924e5dc4..4459d4e5980 100644 --- a/src/mame/drivers/tricep.cpp +++ b/src/mame/drivers/tricep.cpp @@ -83,35 +83,38 @@ void tricep_state::machine_reset() m_mux = 0; } -static DEVICE_INPUT_DEFAULTS_START( terminal ) +static const input_device_default terminal_defaults[] = +{ DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) // FIXME: should be 19200 with SCN2661B DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END + { nullptr, 0, 0 } +}; -MACHINE_CONFIG_START(tricep_state::tricep) - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(8'000'000)) - MCFG_DEVICE_PROGRAM_MAP(tricep_mem) +void tricep_state::tricep(machine_config &config) +{ + M68000(config, m_maincpu, XTAL(8'000'000)); + m_maincpu->set_addrmap(AS_PROGRAM, &tricep_state::tricep_mem); - MCFG_DEVICE_ADD("pci0", MC2661, 4915200) - MCFG_MC2661_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MC2661_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) + MC2661(config, m_pci[0], 4915200); + m_pci[0]->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_pci[0]->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + m_pci[0]->dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); - MCFG_DEVICE_ADD("pci1", MC2661, 4915200) - MCFG_DEVICE_ADD("pci2", MC2661, 4915200) - MCFG_DEVICE_ADD("pci3", MC2661, 4915200) + MC2661(config, m_pci[1], 4915200); + MC2661(config, m_pci[2], 4915200); + MC2661(config, m_pci[3], 4915200); - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("pci0", mc2661_device, rx_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("pci0", mc2661_device, dsr_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("pci0", mc2661_device, dcd_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("pci0", mc2661_device, cts_w)) - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) -MACHINE_CONFIG_END + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set(m_pci[0], FUNC(mc2661_device::rx_w)); + rs232.dsr_handler().set(m_pci[0], FUNC(mc2661_device::dsr_w)); + rs232.dcd_handler().set(m_pci[0], FUNC(mc2661_device::dcd_w)); + rs232.cts_handler().set(m_pci[0], FUNC(mc2661_device::cts_w)); + rs232.set_option_device_input_defaults("terminal", terminal_defaults); +} /* ROM definition */ ROM_START( tricep ) diff --git a/src/mame/drivers/wangpc.cpp b/src/mame/drivers/wangpc.cpp index 1100b867722..d77a2d3b48d 100644 --- a/src/mame/drivers/wangpc.cpp +++ b/src/mame/drivers/wangpc.cpp @@ -1319,12 +1319,12 @@ MACHINE_CONFIG_START(wangpc_state::wangpc) m_uart->dr_callback().set(FUNC(wangpc_state::uart_dr_w)); m_uart->tbre_callback().set(FUNC(wangpc_state::uart_tbre_w)); - MCFG_DEVICE_ADD(SCN2661_TAG, MC2661, 0) - MCFG_MC2661_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(WRITELINE(*this, wangpc_state, epci_irq_w)) - MCFG_MC2661_RTS_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(WRITELINE(*this, wangpc_state, epci_irq_w)) + MC2661(config, m_epci, 0); + m_epci->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); + m_epci->rxrdy_handler().set(FUNC(wangpc_state::epci_irq_w)); + m_epci->rts_handler().set(RS232_TAG, FUNC(rs232_port_device::write_rts)); + m_epci->dtr_handler().set(RS232_TAG, FUNC(rs232_port_device::write_dtr)); + m_epci->txemt_dschg_handler().set(FUNC(wangpc_state::epci_irq_w)); MCFG_UPD765A_ADD(UPD765_TAG, false, false) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, wangpc_state, fdc_irq)) diff --git a/src/mame/includes/thomson.h b/src/mame/includes/thomson.h index 1f84bb31d8c..c53489ce0a9 100644 --- a/src/mame/includes/thomson.h +++ b/src/mame/includes/thomson.h @@ -152,6 +152,7 @@ public: } void to9(machine_config &config); + void to7_base(machine_config &config); void to7(machine_config &config); void mo5e(machine_config &config); void to770a(machine_config &config);