diff options
author | 2018-08-16 09:41:23 +0200 | |
---|---|---|
committer | 2018-08-16 09:41:30 +0200 | |
commit | 5ba993152ac02c303444c47fbeb0668b5940be8d (patch) | |
tree | e3815337368eadab75f92b9df4b8d0d1065831d7 /src | |
parent | a72be15a3039d6c0499812322ea9c75a715c65e1 (diff) |
-bcreader, busmouse, cdp1852, cdp1871, cdp1879, cr511b, cs4031, cs8221, cxd1095: Removed MCFG, nw
Diffstat (limited to 'src')
30 files changed, 236 insertions, 513 deletions
diff --git a/src/devices/bus/comx35/exp.h b/src/devices/bus/comx35/exp.h index 4c1572e035b..0629db0a1ac 100644 --- a/src/devices/bus/comx35/exp.h +++ b/src/devices/bus/comx35/exp.h @@ -36,35 +36,8 @@ #pragma once - - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - #define COMX_EXPANSION_BUS_TAG "comxexp" - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_COMX_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - -#define MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(_write) \ - downcast<comx_expansion_slot_device &>(*device).set_irq_wr_callback(DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - // ======================> comx_expansion_slot_device class device_comx_expansion_card_interface; @@ -74,9 +47,20 @@ class comx_expansion_slot_device : public device_t, { public: // construction/destruction + template <typename T> + comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&opts, const char *dflt) + : comx_expansion_slot_device(mconfig, tag, owner, clock) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); } + auto irq_callback() { return m_write_irq.bind(); } uint8_t mrd_r(address_space &space, offs_t offset, int *extrom); void mwr_w(address_space &space, offs_t offset, uint8_t data); @@ -135,12 +119,8 @@ protected: int m_ds; }; - -// device type definition DECLARE_DEVICE_TYPE(COMX_EXPANSION_SLOT, comx_expansion_slot_device) - void comx_expansion_cards(device_slot_interface &device); - #endif // MAME_BUS_COMX35_EXP_H diff --git a/src/devices/bus/comx35/expbox.cpp b/src/devices/bus/comx35/expbox.cpp index 0aaa5551920..f7c693d4ecf 100644 --- a/src/devices/bus/comx35/expbox.cpp +++ b/src/devices/bus/comx35/expbox.cpp @@ -98,16 +98,13 @@ const tiny_rom_entry *comx_eb_device::device_rom_region() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(comx_eb_device::device_add_mconfig) - MCFG_COMX_EXPANSION_SLOT_ADD(SLOT1_TAG, comx_expansion_cards, "fd") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, comx_eb_device, slot1_irq_w)) - MCFG_COMX_EXPANSION_SLOT_ADD(SLOT2_TAG, comx_expansion_cards, "clm") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, comx_eb_device, slot2_irq_w)) - MCFG_COMX_EXPANSION_SLOT_ADD(SLOT3_TAG, comx_expansion_cards, "joy") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, comx_eb_device, slot3_irq_w)) - MCFG_COMX_EXPANSION_SLOT_ADD(SLOT4_TAG, comx_expansion_cards, "ram") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, comx_eb_device, slot4_irq_w)) -MACHINE_CONFIG_END +void comx_eb_device::device_add_mconfig(machine_config &config) +{ + COMX_EXPANSION_SLOT(config, SLOT1_TAG, 0, comx_expansion_cards, "fd").irq_callback().set(FUNC(comx_eb_device::slot1_irq_w)); + COMX_EXPANSION_SLOT(config, SLOT2_TAG, 0, comx_expansion_cards, "clm").irq_callback().set(FUNC(comx_eb_device::slot2_irq_w)); + COMX_EXPANSION_SLOT(config, SLOT3_TAG, 0, comx_expansion_cards, "joy").irq_callback().set(FUNC(comx_eb_device::slot3_irq_w)); + COMX_EXPANSION_SLOT(config, SLOT4_TAG, 0, comx_expansion_cards, "ram").irq_callback().set(FUNC(comx_eb_device::slot4_irq_w)); +} diff --git a/src/devices/bus/isa/fdc.cpp b/src/devices/bus/isa/fdc.cpp index 1f9602018cc..f341480cb17 100644 --- a/src/devices/bus/isa/fdc.cpp +++ b/src/devices/bus/isa/fdc.cpp @@ -164,8 +164,7 @@ MACHINE_CONFIG_START( isa8_ec1841_0003_device::device_add_mconfig ) MCFG_FLOPPY_DRIVE_ADD("fdc:0", pc_dd_floppies, "525dd", isa8_fdc_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", pc_dd_floppies, "525dd", isa8_fdc_device::floppy_formats) - MCFG_DEVICE_ADD("bus_mouse", BUS_MOUSE, 0) - MCFG_BUS_MOUSE_EXTINT_CALLBACK(WRITELINE(*this, isa8_ec1841_0003_device, aux_irq_w)) + BUS_MOUSE(config, "bus_mouse", 0).extint_callback().set(FUNC(isa8_ec1841_0003_device::aux_irq_w)); MACHINE_CONFIG_END DEFINE_DEVICE_TYPE(ISA8_FDC_XT, isa8_fdc_xt_device, "isa8_fdc_xt", "ISA 8bits XT FDC hookup") diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp index 8bf42e53a61..c8549924f68 100644 --- a/src/devices/bus/nes/datach.cpp +++ b/src/devices/bus/nes/datach.cpp @@ -369,7 +369,7 @@ static void datach_cart(device_slot_interface &device) MACHINE_CONFIG_START(nes_datach_device::device_add_mconfig) - MCFG_BARCODE_READER_ADD("datach") + BARCODE_READER(config, "datach", 0); MCFG_DATACH_MINICART_ADD("datach_slot", datach_cart) MCFG_24C02_ADD("i2cmem") MACHINE_CONFIG_END diff --git a/src/devices/bus/nes_ctrl/bcbattle.cpp b/src/devices/bus/nes_ctrl/bcbattle.cpp index 404b0fef12e..a60e3cd158c 100644 --- a/src/devices/bus/nes_ctrl/bcbattle.cpp +++ b/src/devices/bus/nes_ctrl/bcbattle.cpp @@ -20,9 +20,10 @@ DEFINE_DEVICE_TYPE(NES_BARCODE_BATTLER, nes_bcbattle_device, "nes_bcbattle", "Epoch Barcode Battler (FC)") -MACHINE_CONFIG_START(nes_bcbattle_device::device_add_mconfig) - MCFG_BARCODE_READER_ADD("battler") -MACHINE_CONFIG_END +void nes_bcbattle_device::device_add_mconfig(machine_config &config) +{ + BARCODE_READER(config, "battler", 0); +} //------------------------------------------------- diff --git a/src/devices/bus/snes_ctrl/bcbattle.cpp b/src/devices/bus/snes_ctrl/bcbattle.cpp index ddb9b8e18f6..138a4ef4669 100644 --- a/src/devices/bus/snes_ctrl/bcbattle.cpp +++ b/src/devices/bus/snes_ctrl/bcbattle.cpp @@ -20,9 +20,10 @@ DEFINE_DEVICE_TYPE(SNES_BARCODE_BATTLER, snes_bcbattle_device, "snes_bcbattle", "Epoch Barcode Battler (SFC)") -MACHINE_CONFIG_START(snes_bcbattle_device::device_add_mconfig) - MCFG_BARCODE_READER_ADD("battler") -MACHINE_CONFIG_END +void snes_bcbattle_device::device_add_mconfig(machine_config &config) +{ + BARCODE_READER(config, "battler", 0); +} //------------------------------------------------- diff --git a/src/devices/imagedev/snapquik.h b/src/devices/imagedev/snapquik.h index 921f0b2d4c3..55eb7b703d6 100644 --- a/src/devices/imagedev/snapquik.h +++ b/src/devices/imagedev/snapquik.h @@ -82,7 +82,7 @@ DECLARE_DEVICE_TYPE(QUICKLOAD, quickload_image_device) #define SNAPSHOT_LOAD_MEMBER(_class,_name) image_init_result SNAPSHOT_LOAD_NAME(_class,_name)(device_image_interface &image, const char *file_type, int snapshot_size) #define SNAPSHOT_LOAD_DELEGATE(_class,_name) snapquick_load_delegate(&SNAPSHOT_LOAD_NAME(_class,_name), downcast<_class *>(device->owner())) -#define QUICKLOAD_LOAD_MEMBER_NAME(_name) quickload_load##_name +#define QUICKLOAD_LOAD_MEMBER_NAME(_name) quickload_load_##_name #define QUICKLOAD_LOAD_NAME(_class,_name) _class::QUICKLOAD_LOAD_MEMBER_NAME(_name) #define DECLARE_QUICKLOAD_LOAD_MEMBER(_name) image_init_result QUICKLOAD_LOAD_MEMBER_NAME(_name)(device_image_interface &image, const char *file_type, int quickload_size) #define QUICKLOAD_LOAD_MEMBER(_class,_name) image_init_result QUICKLOAD_LOAD_NAME(_class,_name)(device_image_interface &image, const char *file_type, int quickload_size) diff --git a/src/devices/machine/bcreader.h b/src/devices/machine/bcreader.h index b687c19363b..48253de4380 100644 --- a/src/devices/machine/bcreader.h +++ b/src/devices/machine/bcreader.h @@ -11,14 +11,7 @@ #ifndef MAME_DEVICES_MACHINE_BCREADER_H #define MAME_DEVICES_MACHINE_BCREADER_H -#define MCFG_BARCODE_READER_ADD( _tag ) \ - MCFG_DEVICE_ADD( _tag, BARCODE_READER, 0 ) - -#define MCFG_BARCODE_READER_REMOVE( _tag ) \ - MCFG_DEVICE_REMOVE( _tag ) - - -// ======================> barcode_reader_device +#pragma once class barcode_reader_device : public device_t { @@ -56,5 +49,4 @@ DECLARE_DEVICE_TYPE(BARCODE_READER, barcode_reader_device) // device type iterator typedef device_type_iterator<barcode_reader_device> barcode_reader_device_iterator; - #endif // MAME_DEVICES_MACHINE_BCREADER_H diff --git a/src/devices/machine/busmouse.h b/src/devices/machine/busmouse.h index b0e4a23370c..256f8891808 100644 --- a/src/devices/machine/busmouse.h +++ b/src/devices/machine/busmouse.h @@ -11,28 +11,13 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_BUS_MOUSE_EXTINT_CALLBACK(_write) \ - bus_mouse_device::set_extint_wr_callback(*device, DEVCB_##_write); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> bus_mouse_device - class bus_mouse_device : public device_t { public: // construction/destruction bus_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template <class Object> static devcb_base &set_extint_wr_callback(device_t &device, Object &&cb) { return downcast<bus_mouse_device &>(device).m_write_extint.set_callback(std::forward<Object>(cb)); } + auto extint_callback() { return m_write_extint.bind(); } DECLARE_INPUT_CHANGED_MEMBER(mouse_x_changed); DECLARE_INPUT_CHANGED_MEMBER(mouse_y_changed); @@ -66,9 +51,6 @@ private: int8_t m_x, m_y; }; - -// device type definition DECLARE_DEVICE_TYPE(BUS_MOUSE, bus_mouse_device) - #endif // MAME_MACHINE_BUSMOUSE_H diff --git a/src/devices/machine/cdp1852.h b/src/devices/machine/cdp1852.h index 2ca29541934..fa07d196af2 100644 --- a/src/devices/machine/cdp1852.h +++ b/src/devices/machine/cdp1852.h @@ -26,15 +26,6 @@ #pragma once - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cdp1852_device - class cdp1852_device : public device_t { public: @@ -81,8 +72,6 @@ private: emu_timer *m_update_sr_timer; }; - -// device type definition DECLARE_DEVICE_TYPE(CDP1852, cdp1852_device) #endif // MAME_MACHINE_CDP1852_H diff --git a/src/devices/machine/cdp1871.h b/src/devices/machine/cdp1871.h index 31215164a6f..eb2eb94fbd9 100644 --- a/src/devices/machine/cdp1871.h +++ b/src/devices/machine/cdp1871.h @@ -34,79 +34,25 @@ #pragma once - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CDP1871_D1_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d1_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D2_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d2_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D3_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d3_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D4_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d4_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D5_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d5_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D6_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d6_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D7_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d7_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D8_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d8_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D9_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d9_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D10_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d10_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_D11_CALLBACK(_read) \ - downcast<cdp1871_device &>(*device).set_d11_rd_callback(DEVCB_##_read); - -#define MCFG_CDP1871_DA_CALLBACK(_write) \ - downcast<cdp1871_device &>(*device).set_da_wr_callback(DEVCB_##_write); - -#define MCFG_CDP1871_RPT_CALLBACK(_write) \ - downcast<cdp1871_device &>(*device).set_rpt_wr_callback(DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cdp1871_device - class cdp1871_device : public device_t { public: // construction/destruction cdp1871_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template <class Object> devcb_base &set_d1_rd_callback(Object &&cb) { return m_read_d1.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d2_rd_callback(Object &&cb) { return m_read_d2.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d3_rd_callback(Object &&cb) { return m_read_d3.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d4_rd_callback(Object &&cb) { return m_read_d4.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d5_rd_callback(Object &&cb) { return m_read_d5.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d6_rd_callback(Object &&cb) { return m_read_d6.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d7_rd_callback(Object &&cb) { return m_read_d7.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d8_rd_callback(Object &&cb) { return m_read_d8.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d9_rd_callback(Object &&cb) { return m_read_d9.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d10_rd_callback(Object &&cb) { return m_read_d10.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_d11_rd_callback(Object &&cb) { return m_read_d11.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_da_wr_callback(Object &&cb) { return m_write_da.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_rpt_wr_callback(Object &&cb) { return m_write_rpt.set_callback(std::forward<Object>(cb)); } + auto d1_callback() { return m_read_d1.bind(); } + auto d2_callback() { return m_read_d2.bind(); } + auto d3_callback() { return m_read_d3.bind(); } + auto d4_callback() { return m_read_d4.bind(); } + auto d5_callback() { return m_read_d5.bind(); } + auto d6_callback() { return m_read_d6.bind(); } + auto d7_callback() { return m_read_d7.bind(); } + auto d8_callback() { return m_read_d8.bind(); } + auto d9_callback() { return m_read_d9.bind(); } + auto d10_callback() { return m_read_d10.bind(); } + auto d11_callback() { return m_read_d11.bind(); } + auto da_callback() { return m_write_da.bind(); } + auto rpt_callback() { return m_write_rpt.bind(); } DECLARE_READ8_MEMBER( read ); @@ -162,8 +108,6 @@ private: static const uint8_t key_codes[4][11][8]; }; - -// device type definition DECLARE_DEVICE_TYPE(CDP1871, cdp1871_device) #endif // MAME_MACHINE_CDP1871_H diff --git a/src/devices/machine/cdp1879.h b/src/devices/machine/cdp1879.h index 4563fe7376a..3f92efec75e 100644 --- a/src/devices/machine/cdp1879.h +++ b/src/devices/machine/cdp1879.h @@ -13,21 +13,6 @@ #include "dirtc.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CDP1879_IRQ_CALLBACK(_cb) \ - downcast<cdp1879_device &>(*device).set_irq_cb(DEVCB_##_cb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cdp1879_device - class cdp1879_device : public device_t, public device_rtc_interface { @@ -38,9 +23,7 @@ public: DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); - template<class Object> devcb_base &set_irq_cb(Object &&cb) { return m_irq_w.set_callback(std::forward<Object>(cb)); } - - devcb_write_line m_irq_w; + auto irq_callback() { return m_irq_w.bind(); } protected: // device-level overrides @@ -71,6 +54,8 @@ private: R_ALM_HOURS }; + devcb_write_line m_irq_w; + u8 m_regs[11]; bool m_comparator_state; diff --git a/src/devices/machine/cr511b.h b/src/devices/machine/cr511b.h index e75eb84d4da..149b5a071f1 100644 --- a/src/devices/machine/cr511b.h +++ b/src/devices/machine/cr511b.h @@ -38,38 +38,6 @@ #include "imagedev/chd_cd.h" #include "sound/cdda.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CR511B_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, CR511B, 0) -#define MCFG_CR511B_STCH_HANDLER(_devcb) \ - downcast<cr511b_device &>(*device).set_stch_handler(DEVCB_##_devcb); - -#define MCFG_CR511B_STEN_HANDLER(_devcb) \ - downcast<cr511b_device &>(*device).set_sten_handler(DEVCB_##_devcb); - -#define MCFG_CR511B_DRQ_HANDLER(_devcb) \ - downcast<cr511b_device &>(*device).set_drq_handler(DEVCB_##_devcb); - -#define MCFG_CR511B_DTEN_HANDLER(_devcb) \ - downcast<cr511b_device &>(*device).set_dten_handler(DEVCB_##_devcb); - -#define MCFG_CR511B_SCOR_HANDLER(_devcb) \ - downcast<cr511b_device &>(*device).set_scor_handler(DEVCB_##_devcb); - -#define MCFG_CR511B_XAEN_HANDLER(_devcb) \ - downcast<cr511b_device &>(*device).set_xaen_handler(DEVCB_##_devcb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cr511b_device - class cr511b_device : public device_t { public: @@ -138,7 +106,6 @@ private: //uint8_t m_sector_buffer[CD_MAX_SECTOR_DATA]; }; -// device type definition DECLARE_DEVICE_TYPE(CR511B, cr511b_device) #endif // MAME_MACHINE_CR511B_H diff --git a/src/devices/machine/cs4031.cpp b/src/devices/machine/cs4031.cpp index cf45b8bd5f8..1467fb43987 100644 --- a/src/devices/machine/cs4031.cpp +++ b/src/devices/machine/cs4031.cpp @@ -418,7 +418,7 @@ void cs4031_device::update_dma_clock() Not emulated here: Parity check NMI */ -void cs4031_device::nmi() +void cs4031_device::trigger_nmi() { if (m_nmi_mask & BIT(m_portb, 6)) { @@ -445,7 +445,7 @@ WRITE_LINE_MEMBER( cs4031_device::iochck_w ) { // set channel check latch m_portb |= 1 << 6; - nmi(); + trigger_nmi(); } m_iochck = state; @@ -547,7 +547,7 @@ WRITE8_MEMBER( cs4031_device::config_data_w ) break; case SOFT_RESET_AND_GATEA20: - a20m(); + update_a20m(); break; } } @@ -650,7 +650,7 @@ void cs4031_device::update_write_regions() // KEYBOARD / 8042 //************************************************************************** -void cs4031_device::a20m() +void cs4031_device::update_a20m() { // external signal is ignored when emulation is on if (BIT(m_registers[SOFT_RESET_AND_GATEA20], 5)) @@ -674,20 +674,20 @@ void cs4031_device::emulated_gatea20(int state) if (BIT(m_registers[SOFT_RESET_AND_GATEA20], 5)) { m_emu_gatea20 = state; - a20m(); + update_a20m(); } } void cs4031_device::fast_gatea20(int state) { m_fast_gatea20 = state; - a20m(); + update_a20m(); } void cs4031_device::keyboard_gatea20(int state) { m_ext_gatea20 = state; - a20m(); + update_a20m(); } READ8_MEMBER( cs4031_device::keyb_status_r ) diff --git a/src/devices/machine/cs4031.h b/src/devices/machine/cs4031.h index c03a1cc0e43..5ffe8562628 100644 --- a/src/devices/machine/cs4031.h +++ b/src/devices/machine/cs4031.h @@ -31,56 +31,19 @@ #include "machine/ds128x.h" #include "machine/at_keybc.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CS4031_ADD(_tag, _clock, _cputag, _isatag, _biostag, _keybctag) \ - MCFG_DEVICE_ADD(_tag, CS4031, _clock) \ - downcast<cs4031_device &>(*device).set_cputag(_cputag); \ - downcast<cs4031_device &>(*device).set_isatag(_isatag); \ - downcast<cs4031_device &>(*device).set_biostag(_biostag); \ - downcast<cs4031_device &>(*device).set_keybctag(_keybctag); - -#define MCFG_CS4031_IOR(_ior) \ - downcast<cs4031_device *>(device)->set_ior_callback(DEVCB_##_ior); - -#define MCFG_CS4031_IOW(_iow) \ - downcast<cs4031_device *>(device)->set_iow_callback(DEVCB_##_iow); - -#define MCFG_CS4031_TC(_tc) \ - downcast<cs4031_device *>(device)->set_tc_callback(DEVCB_##_tc); - -#define MCFG_CS4031_HOLD(_hold) \ - downcast<cs4031_device *>(device)->set_hold_callback(DEVCB_##_hold); - -#define MCFG_CS4031_NMI(_nmi) \ - downcast<cs4031_device *>(device)->set_nmi_callback(DEVCB_##_nmi); - -#define MCFG_CS4031_INTR(_intr) \ - downcast<cs4031_device *>(device)->set_intr_callback(DEVCB_##_intr); - -#define MCFG_CS4031_CPURESET(_cpureset) \ - downcast<cs4031_device *>(device)->set_cpureset_callback(DEVCB_##_cpureset); - -#define MCFG_CS4031_A20M(_a20m) \ - downcast<cs4031_device *>(device)->set_a20m_callback(DEVCB_##_a20m); - -#define MCFG_CS4031_SPKR(_spkr) \ - downcast<cs4031_device *>(device)->set_spkr_callback(DEVCB_##_spkr); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cs4031_device - class cs4031_device : public device_t { public: // construction/destruction + cs4031_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const char *cputag, const char *isatag, const char *biostag, const char *keybctag) + : cs4031_device(mconfig, tag, owner, clock) + { + set_cputag(cputag); + set_isatag(isatag); + set_biostag(biostag); + set_keybctag(keybctag); + } + cs4031_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // callbacks @@ -93,6 +56,15 @@ public: template <class Obj> devcb_base &set_intr_callback(Obj &&intr) { return m_write_intr.set_callback(std::forward<Obj>(intr)); } template <class Obj> devcb_base &set_a20m_callback(Obj &&a20m) { return m_write_a20m.set_callback(std::forward<Obj>(a20m)); } template <class Obj> devcb_base &set_spkr_callback(Obj &&spkr) { return m_write_spkr.set_callback(std::forward<Obj>(spkr)); } + auto ior() { return m_read_ior.bind(); } + auto iow() { return m_write_iow.bind(); } + auto tc() { return m_write_tc.bind(); } + auto hold() { return m_write_hold.bind(); } + auto cpureset() { return m_write_cpureset.bind(); } + auto nmi() { return m_write_nmi.bind(); } + auto intr() { return m_write_intr.bind(); } + auto a20m() { return m_write_a20m.bind(); } + auto spkr() { return m_write_spkr.bind(); } // internal io DECLARE_WRITE8_MEMBER( config_address_w ); @@ -170,8 +142,8 @@ private: void set_dma_channel(int channel, bool state); void update_dma_clock(); - void nmi(); - void a20m(); + void trigger_nmi(); + void update_a20m(); void emulated_kbreset(int state); void emulated_gatea20(int state); @@ -278,8 +250,6 @@ private: DECLARE_WRITE_LINE_MEMBER( ctc_out2_w ); }; - -// device type definition DECLARE_DEVICE_TYPE(CS4031, cs4031_device) #endif // MAME_MACHINE_CS4031_H diff --git a/src/devices/machine/cs8221.h b/src/devices/machine/cs8221.h index f93b2a50c58..39f5bfcd709 100644 --- a/src/devices/machine/cs8221.h +++ b/src/devices/machine/cs8221.h @@ -20,29 +20,18 @@ #pragma once - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CS8221_ADD(_tag, _cputag, _isatag, _biostag) \ - MCFG_DEVICE_ADD(_tag, CS8221, 0) \ - downcast<cs8221_device &>(*device).set_cputag(_cputag); \ - downcast<cs8221_device &>(*device).set_isatag(_isatag); \ - downcast<cs8221_device &>(*device).set_biostag(_biostag); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cs8221_device - class cs8221_device : public device_t { public: // construction/destruction + cs8221_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const char *cputag, const char *isatag, const char *biostag) + : cs8221_device(mconfig, tag, owner, clock) + { + set_cputag(cputag); + set_isatag(isatag); + set_biostag(biostag); + } + cs8221_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // inline configuration @@ -80,8 +69,6 @@ private: DECLARE_WRITE8_MEMBER( data_w ); }; - -// device type definition DECLARE_DEVICE_TYPE(CS8221, cs8221_device) #endif // MAME_MACHINE_CS8221_H diff --git a/src/devices/machine/cxd1095.h b/src/devices/machine/cxd1095.h index 86ecb58de65..ec7466e5b4b 100644 --- a/src/devices/machine/cxd1095.h +++ b/src/devices/machine/cxd1095.h @@ -44,38 +44,6 @@ #pragma once -//************************************************************************** -// CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CXD1095_IN_PORTA_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_input_cb(0, DEVCB_##_devcb); -#define MCFG_CXD1095_IN_PORTB_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_input_cb(1, DEVCB_##_devcb); -#define MCFG_CXD1095_IN_PORTC_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_input_cb(2, DEVCB_##_devcb); -#define MCFG_CXD1095_IN_PORTD_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_input_cb(3, DEVCB_##_devcb); -#define MCFG_CXD1095_IN_PORTE_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_input_cb(4, DEVCB_##_devcb); - -#define MCFG_CXD1095_OUT_PORTA_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_output_cb(0, DEVCB_##_devcb); -#define MCFG_CXD1095_OUT_PORTB_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_output_cb(1, DEVCB_##_devcb); -#define MCFG_CXD1095_OUT_PORTC_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_output_cb(2, DEVCB_##_devcb); -#define MCFG_CXD1095_OUT_PORTD_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_output_cb(3, DEVCB_##_devcb); -#define MCFG_CXD1095_OUT_PORTE_CB(_devcb) \ - downcast<cxd1095_device &>(*device).set_output_cb(4, DEVCB_##_devcb); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cxd1095_device - class cxd1095_device : public device_t { public: @@ -83,8 +51,18 @@ public: cxd1095_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // configuration - template <class Object> devcb_base &set_input_cb(int p, Object &&cb) { assert(p >= 0 && p < 5); return m_input_cb[p].set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_output_cb(int p, Object &&cb) { assert(p >= 0 && p < 5); return m_output_cb[p].set_callback(std::forward<Object>(cb)); } + template <std::size_t Port> auto in_port_cb() { static_assert(Port >= 0 && Port < 5, "invalid port"); return m_input_cb[Port].bind(); } + template <std::size_t Port> auto out_port_cb() { static_assert(Port >= 0 && Port < 5, "invalid port"); return m_output_cb[Port].bind(); } + auto in_porta_cb() { return in_port_cb<0>(); } + auto in_portb_cb() { return in_port_cb<1>(); } + auto in_portc_cb() { return in_port_cb<2>(); } + auto in_portd_cb() { return in_port_cb<3>(); } + auto in_porte_cb() { return in_port_cb<4>(); } + auto out_porta_cb() { return out_port_cb<0>(); } + auto out_portb_cb() { return out_port_cb<1>(); } + auto out_portc_cb() { return out_port_cb<2>(); } + auto out_portd_cb() { return out_port_cb<3>(); } + auto out_porte_cb() { return out_port_cb<4>(); } // memory handlers DECLARE_READ8_MEMBER(read); @@ -105,7 +83,6 @@ private: u8 m_data_dir[5]; }; -// device type definition DECLARE_DEVICE_TYPE(CXD1095, cxd1095_device) #endif // MAME_MACHINE_CXD1095_H diff --git a/src/mame/drivers/at.cpp b/src/mame/drivers/at.cpp index f6e2d6de791..4ca3da2bc1a 100644 --- a/src/mame/drivers/at.cpp +++ b/src/mame/drivers/at.cpp @@ -529,7 +529,7 @@ MACHINE_CONFIG_START(at_state::neat) MCFG_DS12885_ADD("mb:rtc") MCFG_MC146818_IRQ_HANDLER(WRITELINE("mb:pic8259_slave", pic8259_device, ir0_w)) // this is in :mb MCFG_MC146818_CENTURY_INDEX(0x32) - MCFG_CS8221_ADD("cs8221", "maincpu", "mb:isa", "bios") + CS8221(config, "cs8221", 0, "maincpu", "mb:isa", "bios"); MACHINE_CONFIG_END MACHINE_CONFIG_START(at_state::xb42639) @@ -610,7 +610,7 @@ MACHINE_CONFIG_START(at_state::ct386sx) at386sx(config); MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_IO_MAP(neat_io) - MCFG_CS8221_ADD("cs8221", "maincpu", "mb:isa", "maincpu") + CS8221(config, "cs8221", 0, "maincpu", "mb:isa", "maincpu"); MACHINE_CONFIG_END // Commodore PC 30-III diff --git a/src/mame/drivers/comx35.cpp b/src/mame/drivers/comx35.cpp index 99f809e5564..5d245ccd2ad 100644 --- a/src/mame/drivers/comx35.cpp +++ b/src/mame/drivers/comx35.cpp @@ -48,10 +48,10 @@ void comx35_state::image_fread_memory(device_image_interface &image, uint16_t ad } /*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( comx35_state, comx35_comx ) + QUICKLOAD_LOAD_MEMBER( comx35_state, comx ) -------------------------------------------------*/ -QUICKLOAD_LOAD_MEMBER( comx35_state, comx35_comx ) +QUICKLOAD_LOAD_MEMBER( comx35_state, comx ) { address_space &program = m_maincpu->space(AS_PROGRAM); @@ -595,104 +595,62 @@ void comx35_state::machine_reset() // MACHINE_CONFIG( pal ) //------------------------------------------------- -MACHINE_CONFIG_START(comx35_state::pal) +void comx35_state::base(machine_config &config, const XTAL clock) +{ // basic system hardware - cdp1802_device &cpu(CDP1802(config, CDP1802_TAG, cdp1869_device::CPU_CLK_PAL)); - cpu.set_addrmap(AS_PROGRAM, &comx35_state::comx35_mem); - cpu.set_addrmap(AS_IO, &comx35_state::comx35_io); - cpu.wait_cb().set_constant(1); - cpu.clear_cb().set(FUNC(comx35_state::clear_r)); - cpu.ef2_cb().set(FUNC(comx35_state::ef2_r)); - cpu.ef4_cb().set(FUNC(comx35_state::ef4_r)); - cpu.q_cb().set(FUNC(comx35_state::q_w)); - cpu.sc_cb().set(FUNC(comx35_state::sc_w)); - cpu.sc_cb().append(EXPANSION_TAG, FUNC(comx_expansion_slot_device::sc_w)); - cpu.tpb_cb().set(EXPANSION_TAG, FUNC(comx_expansion_slot_device::tpb_w)); - - // sound and video hardware - comx35_pal_video(config); + CDP1802(config, m_maincpu, clock); + m_maincpu->set_addrmap(AS_PROGRAM, &comx35_state::comx35_mem); + m_maincpu->set_addrmap(AS_IO, &comx35_state::comx35_io); + m_maincpu->wait_cb().set_constant(1); + m_maincpu->clear_cb().set(FUNC(comx35_state::clear_r)); + m_maincpu->ef2_cb().set(FUNC(comx35_state::ef2_r)); + m_maincpu->ef4_cb().set(FUNC(comx35_state::ef4_r)); + m_maincpu->q_cb().set(FUNC(comx35_state::q_w)); + m_maincpu->sc_cb().set(FUNC(comx35_state::sc_w)); + m_maincpu->sc_cb().append(EXPANSION_TAG, FUNC(comx_expansion_slot_device::sc_w)); + m_maincpu->tpb_cb().set(EXPANSION_TAG, FUNC(comx_expansion_slot_device::tpb_w)); // peripheral hardware - MCFG_DEVICE_ADD(CDP1871_TAG, CDP1871, cdp1869_device::CPU_CLK_PAL/8) - MCFG_CDP1871_D1_CALLBACK(IOPORT("D1")) - MCFG_CDP1871_D2_CALLBACK(IOPORT("D2")) - MCFG_CDP1871_D3_CALLBACK(IOPORT("D3")) - MCFG_CDP1871_D4_CALLBACK(IOPORT("D4")) - MCFG_CDP1871_D5_CALLBACK(IOPORT("D5")) - MCFG_CDP1871_D6_CALLBACK(IOPORT("D6")) - MCFG_CDP1871_D7_CALLBACK(IOPORT("D7")) - MCFG_CDP1871_D8_CALLBACK(IOPORT("D8")) - MCFG_CDP1871_D9_CALLBACK(IOPORT("D9")) - MCFG_CDP1871_D10_CALLBACK(IOPORT("D10")) - MCFG_CDP1871_D11_CALLBACK(IOPORT("D11")) - MCFG_CDP1871_DA_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF3)) - MCFG_QUICKLOAD_ADD("quickload", comx35_state, comx35_comx, "comx", 0) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + CDP1871(config, m_kbe, cdp1869_device::CPU_CLK_PAL/8); + m_kbe->d1_callback().set_ioport("D1"); + m_kbe->d2_callback().set_ioport("D2"); + m_kbe->d3_callback().set_ioport("D3"); + m_kbe->d4_callback().set_ioport("D4"); + m_kbe->d5_callback().set_ioport("D5"); + m_kbe->d6_callback().set_ioport("D6"); + m_kbe->d7_callback().set_ioport("D7"); + m_kbe->d8_callback().set_ioport("D8"); + m_kbe->d9_callback().set_ioport("D9"); + m_kbe->d10_callback().set_ioport("D10"); + m_kbe->d11_callback().set_ioport("D11"); + m_kbe->da_callback().set_inputline(m_maincpu, COSMAC_INPUT_LINE_EF3); + + quickload_image_device &quickload(QUICKLOAD(config, "quickload", 0)); + quickload.set_handler(snapquick_load_delegate(&QUICKLOAD_LOAD_NAME(comx35_state, comx), this), "comx", 0); + + CASSETTE(config, m_cassette).set_default_state((cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)); // expansion bus - MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, comx_expansion_cards, "eb") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, comx35_state, irq_w)) + COMX_EXPANSION_SLOT(config, m_exp, 0, comx_expansion_cards, "eb").irq_callback().set(FUNC(comx35_state::irq_w)); // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") + RAM(config, m_ram).set_default_size("32K"); // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop") -MACHINE_CONFIG_END - + SOFTWARE_LIST(config, "flop_list").set_original("comx35_flop"); +} -//------------------------------------------------- -// MACHINE_CONFIG( ntsc ) -//------------------------------------------------- +void comx35_state::pal(machine_config &config) +{ + base(config, cdp1869_device::CPU_CLK_PAL); + comx35_pal_video(config); +} -MACHINE_CONFIG_START(comx35_state::ntsc) - // basic system hardware - cdp1802_device &cpu(CDP1802(config, CDP1802_TAG, cdp1869_device::CPU_CLK_NTSC)); - cpu.set_addrmap(AS_PROGRAM, &comx35_state::comx35_mem); - cpu.set_addrmap(AS_IO, &comx35_state::comx35_io); - cpu.wait_cb().set_constant(1); - cpu.clear_cb().set(FUNC(comx35_state::clear_r)); - cpu.ef2_cb().set(FUNC(comx35_state::ef2_r)); - cpu.ef4_cb().set(FUNC(comx35_state::ef4_r)); - cpu.q_cb().set(FUNC(comx35_state::q_w)); - cpu.sc_cb().set(FUNC(comx35_state::sc_w)); - cpu.sc_cb().append(EXPANSION_TAG, FUNC(comx_expansion_slot_device::sc_w)); - cpu.tpb_cb().set(EXPANSION_TAG, FUNC(comx_expansion_slot_device::tpb_w)); - - // sound and video hardware +void comx35_state::ntsc(machine_config &config) +{ + base(config, cdp1869_device::CPU_CLK_NTSC); comx35_ntsc_video(config); - - // peripheral hardware - MCFG_DEVICE_ADD(CDP1871_TAG, CDP1871, cdp1869_device::CPU_CLK_PAL/8) - MCFG_CDP1871_D1_CALLBACK(IOPORT("D1")) - MCFG_CDP1871_D2_CALLBACK(IOPORT("D2")) - MCFG_CDP1871_D3_CALLBACK(IOPORT("D3")) - MCFG_CDP1871_D4_CALLBACK(IOPORT("D4")) - MCFG_CDP1871_D5_CALLBACK(IOPORT("D5")) - MCFG_CDP1871_D6_CALLBACK(IOPORT("D6")) - MCFG_CDP1871_D7_CALLBACK(IOPORT("D7")) - MCFG_CDP1871_D8_CALLBACK(IOPORT("D8")) - MCFG_CDP1871_D9_CALLBACK(IOPORT("D9")) - MCFG_CDP1871_D10_CALLBACK(IOPORT("D10")) - MCFG_CDP1871_D11_CALLBACK(IOPORT("D11")) - MCFG_CDP1871_DA_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF3)) - MCFG_QUICKLOAD_ADD("quickload", comx35_state, comx35_comx, "comx", 0) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - // expansion bus - MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, comx_expansion_cards, "eb") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(*this, comx35_state, irq_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop") -MACHINE_CONFIG_END +} diff --git a/src/mame/drivers/ct486.cpp b/src/mame/drivers/ct486.cpp index dda503fb45e..80f27b6c1d0 100644 --- a/src/mame/drivers/ct486.cpp +++ b/src/mame/drivers/ct486.cpp @@ -116,19 +116,19 @@ MACHINE_CONFIG_START(ct486_state::ct486) MCFG_DEVICE_IO_MAP(ct486_io) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("cs4031", cs4031_device, int_ack_r) - MCFG_CS4031_ADD("cs4031", XTAL(25'000'000), "maincpu", "isa", "bios", "keybc") + CS4031(config, m_cs4031, XTAL(25'000'000), "maincpu", "isa", "bios", "keybc"); // cpu connections - MCFG_CS4031_HOLD(WRITELINE(*this, ct486_state, cs4031_hold)); - MCFG_CS4031_NMI(INPUTLINE("maincpu", INPUT_LINE_NMI)); - MCFG_CS4031_INTR(INPUTLINE("maincpu", INPUT_LINE_IRQ0)); - MCFG_CS4031_CPURESET(INPUTLINE("maincpu", INPUT_LINE_RESET)); - MCFG_CS4031_A20M(INPUTLINE("maincpu", INPUT_LINE_A20)); + m_cs4031->hold().set(FUNC(ct486_state::cs4031_hold)); + m_cs4031->nmi().set_inputline("maincpu", INPUT_LINE_NMI); + m_cs4031->intr().set_inputline("maincpu", INPUT_LINE_IRQ0); + m_cs4031->cpureset().set_inputline("maincpu", INPUT_LINE_RESET); + m_cs4031->a20m().set_inputline("maincpu", INPUT_LINE_A20); // isa dma - MCFG_CS4031_IOR(READ16(*this, ct486_state, cs4031_ior)) - MCFG_CS4031_IOW(WRITE16(*this, ct486_state, cs4031_iow)) - MCFG_CS4031_TC(WRITE8(*this, ct486_state, cs4031_tc)) + m_cs4031->ior().set(FUNC(ct486_state::cs4031_ior)); + m_cs4031->iow().set(FUNC(ct486_state::cs4031_iow)); + m_cs4031->tc().set(FUNC(ct486_state::cs4031_tc)); // speaker - MCFG_CS4031_SPKR(WRITELINE(*this, ct486_state, cs4031_spkr)) + m_cs4031->spkr().set(FUNC(ct486_state::cs4031_spkr)); MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("4M") diff --git a/src/mame/drivers/magnum.cpp b/src/mame/drivers/magnum.cpp index 842c2de160d..1d24ab79cfa 100644 --- a/src/mame/drivers/magnum.cpp +++ b/src/mame/drivers/magnum.cpp @@ -284,8 +284,7 @@ MACHINE_CONFIG_START(magnum_state::magnum) MCFG_DEVICE_PROGRAM_MAP(magnum_map) MCFG_DEVICE_IO_MAP(magnum_io) - MCFG_DEVICE_ADD("rtc", CDP1879, XTAL(32'768)) - MCFG_CDP1879_IRQ_CALLBACK(WRITELINE(*this, magnum_state, rtcirq_w)) + CDP1879(config, "rtc", XTAL(32'768)).irq_callback().set(FUNC(magnum_state::rtcirq_w)); MCFG_SCREEN_ADD("screen1", LCD) MCFG_SCREEN_REFRESH_RATE(50) diff --git a/src/mame/drivers/megaplay.cpp b/src/mame/drivers/megaplay.cpp index 748d147c6fe..62bca13e941 100644 --- a/src/mame/drivers/megaplay.cpp +++ b/src/mame/drivers/megaplay.cpp @@ -676,21 +676,21 @@ MACHINE_CONFIG_START(mplay_state::megaplay) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_DEVICE_ADD("io1", CXD1095, 0) - MCFG_CXD1095_IN_PORTA_CB(IOPORT("DSW0")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("DSW1")) - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, mplay_state, bios_banksel_w)) - MCFG_CXD1095_IN_PORTE_CB(READ8(*this, mplay_state, bios_6204_r)) - MCFG_CXD1095_OUT_PORTE_CB(WRITE8(*this, mplay_state, bios_width_w)) - - MCFG_DEVICE_ADD("io2", CXD1095, 0) - MCFG_CXD1095_IN_PORTA_CB(IOPORT("TEST")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("COIN")) - MCFG_CXD1095_IN_PORTC_CB(READ8(*this, mplay_state, bios_6402_r)) - MCFG_CXD1095_OUT_PORTC_CB(WRITE8(*this, mplay_state, bios_6402_w)) - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, mplay_state, bios_gamesel_w)) - MCFG_CXD1095_IN_PORTE_CB(READ8(*this, mplay_state, bios_6404_r)) - MCFG_CXD1095_OUT_PORTE_CB(WRITE8(*this, mplay_state, bios_6404_w)) + cxd1095_device &io1(CXD1095(config, "io1", 0)); + io1.in_porta_cb().set_ioport("DSW0"); + io1.in_portb_cb().set_ioport("DSW1"); + io1.out_portd_cb().set(FUNC(mplay_state::bios_banksel_w)); + io1.in_porte_cb().set(FUNC(mplay_state::bios_6204_r)); + io1.out_porte_cb().set(FUNC(mplay_state::bios_width_w)); + + cxd1095_device &io2(CXD1095(config, "io2", 0)); + io2.in_porta_cb().set_ioport("TEST"); + io2.in_portb_cb().set_ioport("COIN"); + io2.in_portb_cb().set(FUNC(mplay_state::bios_6402_r)); + io2.out_portc_cb().set(FUNC(mplay_state::bios_6402_w)); + io2.out_portd_cb().set(FUNC(mplay_state::bios_gamesel_w)); + io2.in_porte_cb().set(FUNC(mplay_state::bios_6404_r)); + io2.out_porte_cb().set(FUNC(mplay_state::bios_6404_w)); MCFG_DEVICE_ADD("sn2", SN76496, MASTER_CLOCK/15) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) /* 3.58 MHz */ diff --git a/src/mame/drivers/megatech.cpp b/src/mame/drivers/megatech.cpp index 0e09d9af6be..e9f5510c47f 100644 --- a/src/mame/drivers/megatech.cpp +++ b/src/mame/drivers/megatech.cpp @@ -695,18 +695,18 @@ MACHINE_CONFIG_START(mtech_state::megatech) MCFG_DEVICE_PROGRAM_MAP(megatech_bios_map) MCFG_DEVICE_IO_MAP(megatech_bios_portmap) - MCFG_DEVICE_ADD("io1", CXD1095, 0) - MCFG_CXD1095_IN_PORTA_CB(IOPORT("BIOS_DSW0")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("BIOS_DSW1")) - MCFG_CXD1095_OUT_PORTE_CB(WRITE8(*this, mtech_state, cart_select_w)) - - MCFG_DEVICE_ADD("io2", CXD1095, 0) - MCFG_CXD1095_IN_PORTA_CB(IOPORT("BIOS_IN0")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("BIOS_IN1")) - MCFG_CXD1095_IN_PORTC_CB(READ8(*this, mtech_state, bios_portc_r)) - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, mtech_state, bios_portd_w)) - MCFG_CXD1095_IN_PORTE_CB(READ8(*this, mtech_state, bios_porte_r)) - MCFG_CXD1095_OUT_PORTE_CB(WRITE8(*this, mtech_state, bios_porte_w)) + cxd1095_device &io1(CXD1095(config, "io1", 0)); + io1.in_porta_cb().set_ioport("BIOS_DSW0"); + io1.in_portb_cb().set_ioport("BIOS_DSW1"); + io1.out_porte_cb().set(FUNC(mtech_state::cart_select_w)); + + cxd1095_device &io2(CXD1095(config, "io2", 0)); + io2.in_porta_cb().set_ioport("BIOS_IN0"); + io2.in_portb_cb().set_ioport("BIOS_IN1"); + io2.in_portc_cb().set(FUNC(mtech_state::bios_portc_r)); + io2.out_portd_cb().set(FUNC(mtech_state::bios_portd_w)); + io2.in_porte_cb().set(FUNC(mtech_state::bios_porte_r)); + io2.out_porte_cb().set(FUNC(mtech_state::bios_porte_w)); MCFG_MACHINE_RESET_OVERRIDE(mtech_state, megatech) diff --git a/src/mame/drivers/pve500.cpp b/src/mame/drivers/pve500.cpp index 8ecb266c8b4..4478849bf3f 100644 --- a/src/mame/drivers/pve500.cpp +++ b/src/mame/drivers/pve500.cpp @@ -393,12 +393,12 @@ MACHINE_CONFIG_START(pve500_state::pve500) MCFG_TMPZ84C015_OUT_PA_CB(WRITE8(*this, pve500_state, eeprom_w)) // ICG3: I/O Expander - MCFG_DEVICE_ADD("cxdio", CXD1095, 0) - MCFG_CXD1095_OUT_PORTA_CB(WRITE8(*this, pve500_state, io_sc_w)) - MCFG_CXD1095_OUT_PORTB_CB(WRITE8(*this, pve500_state, io_le_w)) - MCFG_CXD1095_IN_PORTC_CB(READ8(*this, pve500_state, io_ky_r)) - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, pve500_state, io_ld_w)) - MCFG_CXD1095_OUT_PORTE_CB(WRITE8(*this, pve500_state, io_sel_w)) + CXD1095(config, m_cxdio, 0); + m_cxdio->out_porta_cb().set(FUNC(pve500_state::io_sc_w)); + m_cxdio->out_portb_cb().set(FUNC(pve500_state::io_le_w)); + m_cxdio->in_portc_cb().set(FUNC(pve500_state::io_ky_r)); + m_cxdio->out_portd_cb().set(FUNC(pve500_state::io_ld_w)); + m_cxdio->out_porte_cb().set(FUNC(pve500_state::io_sel_w)); /* Search Dial MCUs */ MCFG_DEVICE_ADD("dial_mcu_left", MB88201, 4_MHz_XTAL) /* PLAYER DIAL MCU */ diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index 4a118255ac0..58d995f97e9 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -3792,9 +3792,10 @@ MACHINE_CONFIG_START(segas16b_state::aceattacb_fd1094) // 834-6602 I/O board MCFG_DEVICE_ADD("upd4701a1", UPD4701A, 0) MCFG_DEVICE_ADD("upd4701a2", UPD4701A, 0) - MCFG_DEVICE_ADD("cxdio", CXD1095, 0) - MCFG_CXD1095_IN_PORTA_CB(IOPORT("HANDX1")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("HANDX2")) + + CXD1095(config, m_cxdio, 0); + m_cxdio->in_porta_cb().set_ioport("HANDX1"); + m_cxdio->in_portb_cb().set_ioport("HANDX2"); MACHINE_CONFIG_END diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp index 8b537033656..6d23cb523c9 100644 --- a/src/mame/drivers/segas32.cpp +++ b/src/mame/drivers/segas32.cpp @@ -2499,10 +2499,10 @@ MACHINE_CONFIG_START(segas32_cd_state::device_add_mconfig) MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_0) MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config) - MCFG_DEVICE_ADD("cxdio", CXD1095, 0) - MCFG_CXD1095_OUT_PORTA_CB(WRITE8(*this, segas32_cd_state, lamps1_w)) - MCFG_CXD1095_OUT_PORTB_CB(WRITE8(*this, segas32_cd_state, lamps2_w)) - MCFG_CXD1095_IN_PORTD_CB(CONSTANT(0xff)) // Ports C-E used for IEEE-488 printer interface + cxd1095_device &cxdio(CXD1095(config, "cxdio", 0)); + cxdio.out_porta_cb().set(FUNC(segas32_cd_state::lamps1_w)); + cxdio.out_portb_cb().set(FUNC(segas32_cd_state::lamps2_w)); + cxdio.in_portd_cb().set_constant(0xff); // Ports C-E used for IEEE-488 printer interface MACHINE_CONFIG_END DEFINE_DEVICE_TYPE(SEGA_S32_CD_DEVICE, segas32_cd_state, "segas32_pcb_cd", "Sega System 32 CD PCB") diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 30c04711044..3921e3f34d5 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -268,7 +268,6 @@ ROMs: #include "includes/segaxbd.h" #include "includes/segaipt.h" -#include "machine/cxd1095.h" #include "machine/nvram.h" #include "sound/ym2151.h" #include "sound/segapcm.h" @@ -290,6 +289,7 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, device_type type, co , m_soundcpu2(*this, "soundcpu2") , m_mcu(*this, "mcu") , m_watchdog(*this, "watchdog") + , m_iochip(*this, "iochip_%u", 0U) , m_cmptimer_1(*this, "cmptimer_main") , m_sprites(*this, "sprites") , m_segaic16vid(*this, "segaic16vid") @@ -934,8 +934,8 @@ void segaxbd_state::main_map(address_map &map) map(0x110000, 0x11ffff).w("sprites", FUNC(sega_xboard_sprite_device::draw_write)); map(0x120000, 0x123fff).mirror(0x00c000).ram().w(FUNC(segaxbd_state::paletteram_w)).share("paletteram"); map(0x130000, 0x13ffff).rw(FUNC(segaxbd_state::adc_r), FUNC(segaxbd_state::adc_w)); - map(0x140000, 0x14000f).mirror(0x00fff0).rw("iochip_0", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff); - map(0x150000, 0x15000f).mirror(0x00fff0).rw("iochip_1", FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff); + map(0x140000, 0x14000f).mirror(0x00fff0).rw(m_iochip[0], FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff); + map(0x150000, 0x15000f).mirror(0x00fff0).rw(m_iochip[1], FUNC(cxd1095_device::read), FUNC(cxd1095_device::write)).umask16(0x00ff); map(0x160000, 0x16ffff).w(FUNC(segaxbd_state::iocontrol_w)); map(0x200000, 0x27ffff).rom().region("subcpu", 0x00000); map(0x280000, 0x283fff).mirror(0x01c000).ram().share("subram0"); @@ -1691,17 +1691,17 @@ MACHINE_CONFIG_START(segaxbd_state::xboard_base_mconfig ) SEGA_315_5250_COMPARE_TIMER(config, "cmptimer_subx", 0); - MCFG_DEVICE_ADD("iochip_0", CXD1095, 0) // IC160 - MCFG_CXD1095_IN_PORTA_CB(IOPORT("IO0PORTA")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("IO0PORTB")) - MCFG_CXD1095_OUT_PORTC_CB(WRITE8(*this, segaxbd_state, pc_0_w)) - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, segaxbd_state, pd_0_w)) + CXD1095(config, m_iochip[0], 0); // IC160 + m_iochip[0]->in_porta_cb().set_ioport("IO0PORTA"); + m_iochip[0]->in_portb_cb().set_ioport("IO0PORTB"); + m_iochip[0]->out_portc_cb().set(FUNC(segaxbd_state::pc_0_w)); + m_iochip[0]->out_portd_cb().set(FUNC(segaxbd_state::pd_0_w)); - MCFG_DEVICE_ADD("iochip_1", CXD1095, 0) // IC159 - MCFG_CXD1095_IN_PORTA_CB(IOPORT("IO1PORTA")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("IO1PORTB")) - MCFG_CXD1095_IN_PORTC_CB(IOPORT("IO1PORTC")) - MCFG_CXD1095_IN_PORTD_CB(IOPORT("IO1PORTD")) + CXD1095(config, m_iochip[1], 0); // IC159 + m_iochip[1]->in_porta_cb().set_ioport("IO1PORTA"); + m_iochip[1]->in_portb_cb().set_ioport("IO1PORTB"); + m_iochip[1]->in_portc_cb().set_ioport("IO1PORTC"); + m_iochip[1]->in_portd_cb().set_ioport("IO1PORTD"); // video hardware MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_segaxbd) @@ -1791,14 +1791,13 @@ segaxbd_aburner2_state::segaxbd_aburner2_state(const machine_config &mconfig, co { } -MACHINE_CONFIG_START(segaxbd_aburner2_state::device_add_mconfig) +void segaxbd_aburner2_state::device_add_mconfig(machine_config &config) +{ segaxbd_state::xboard_base_mconfig(config); - // basic machine hardware - MCFG_DEVICE_MODIFY("iochip_0") - MCFG_CXD1095_IN_PORTA_CB(READ8(*this, segaxbd_state, aburner2_motor_r)) - MCFG_CXD1095_OUT_PORTB_CB(WRITE8(*this, segaxbd_state, aburner2_motor_w)) -MACHINE_CONFIG_END + m_iochip[0]->in_porta_cb().set(FUNC(segaxbd_state::aburner2_motor_r)); + m_iochip[0]->out_portb_cb().set(FUNC(segaxbd_state::aburner2_motor_w)); +} MACHINE_CONFIG_START(segaxbd_new_state::sega_aburner2) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_ABURNER2_DEVICE, 0) @@ -1823,11 +1822,8 @@ MACHINE_CONFIG_START(segaxbd_lastsurv_fd1094_state::device_add_mconfig) // basic machine hardware // TODO: network board - MCFG_DEVICE_MODIFY("iochip_0") - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, segaxbd_state, lastsurv_muxer_w)) - - MCFG_DEVICE_MODIFY("iochip_1") - MCFG_CXD1095_IN_PORTB_CB(READ8(*this, segaxbd_state, lastsurv_port_r)) + m_iochip[0]->out_portd_cb().set(FUNC(segaxbd_state::lastsurv_muxer_w)); + m_iochip[1]->in_portb_cb().set(FUNC(segaxbd_state::lastsurv_port_r)); // sound hardware - ym2151 stereo is reversed MCFG_DEVICE_MODIFY("ymsnd") @@ -1855,11 +1851,8 @@ MACHINE_CONFIG_START(segaxbd_lastsurv_state::device_add_mconfig) // basic machine hardware // TODO: network board - MCFG_DEVICE_MODIFY("iochip_0") - MCFG_CXD1095_OUT_PORTD_CB(WRITE8(*this, segaxbd_state, lastsurv_muxer_w)) - - MCFG_DEVICE_MODIFY("iochip_1") - MCFG_CXD1095_IN_PORTB_CB(READ8(*this, segaxbd_state, lastsurv_port_r)) + m_iochip[0]->out_portd_cb().set(FUNC(segaxbd_state::lastsurv_muxer_w)); + m_iochip[1]->in_portb_cb().set(FUNC(segaxbd_state::lastsurv_port_r)); // sound hardware - ym2151 stereo is reversed MCFG_DEVICE_MODIFY("ymsnd") @@ -1902,9 +1895,8 @@ MACHINE_CONFIG_START(segaxbd_smgp_fd1094_state::device_add_mconfig) m_cmptimer_1->zint_callback().append_inputline(m_soundcpu2, INPUT_LINE_NMI); - MCFG_DEVICE_MODIFY("iochip_0") - MCFG_CXD1095_IN_PORTA_CB(READ8(*this, segaxbd_state, smgp_motor_r)) - MCFG_CXD1095_OUT_PORTB_CB(WRITE8(*this, segaxbd_state, smgp_motor_w)) + m_iochip[0]->in_porta_cb().set(FUNC(segaxbd_state::smgp_motor_r)); + m_iochip[0]->out_portb_cb().set(FUNC(segaxbd_state::smgp_motor_w)); // sound hardware SPEAKER(config, "rearleft").front_left(); @@ -1946,9 +1938,8 @@ MACHINE_CONFIG_START(segaxbd_smgp_state::device_add_mconfig) m_cmptimer_1->zint_callback().append_inputline(m_soundcpu2, INPUT_LINE_NMI); - MCFG_DEVICE_MODIFY("iochip_0") - MCFG_CXD1095_IN_PORTA_CB(READ8(*this, segaxbd_state, smgp_motor_r)) - MCFG_CXD1095_OUT_PORTB_CB(WRITE8(*this, segaxbd_state, smgp_motor_w)) + m_iochip[0]->in_porta_cb().set(FUNC(segaxbd_state::smgp_motor_r)); + m_iochip[0]->out_portb_cb().set(FUNC(segaxbd_state::smgp_motor_w)); // sound hardware SPEAKER(config, "rearleft").front_left(); diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp index 62e90e584bc..e7bf2ab40a6 100644 --- a/src/mame/drivers/tatsumi.cpp +++ b/src/mame/drivers/tatsumi.cpp @@ -1020,18 +1020,18 @@ MACHINE_CONFIG_START(cyclwarr_state::cyclwarr) // saner sync value (avoids crashing after crediting) MCFG_QUANTUM_TIME(attotime::from_hz(CLOCK_2 / 1024)) - MCFG_DEVICE_ADD("io1", CXD1095, 0) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("SERVICE")) - MCFG_CXD1095_IN_PORTC_CB(IOPORT("P1")) - MCFG_CXD1095_IN_PORTD_CB(IOPORT("P2")) - MCFG_CXD1095_IN_PORTE_CB(IOPORT("DSW3")) - - MCFG_DEVICE_ADD("io2", CXD1095, 0) - MCFG_CXD1095_IN_PORTA_CB(IOPORT("DSW1")) - MCFG_CXD1095_IN_PORTB_CB(IOPORT("DSW2")) - MCFG_CXD1095_IN_PORTC_CB(IOPORT("P3")) - MCFG_CXD1095_IN_PORTD_CB(IOPORT("P4")) - MCFG_CXD1095_OUT_PORTE_CB(WRITE8(*this, cyclwarr_state, cyclwarr_control_w)) + cxd1095_device &io1(CXD1095(config, "io1", 0)); + io1.in_portb_cb().set_ioport("SERVICE"); + io1.in_portc_cb().set_ioport("P1"); + io1.in_portd_cb().set_ioport("P2"); + io1.in_porte_cb().set_ioport("DSW3"); + + cxd1095_device &io2(CXD1095(config, "io2", 0)); + io2.in_porta_cb().set_ioport("DSW1"); + io2.in_portb_cb().set_ioport("DSW2"); + io2.in_portc_cb().set_ioport("P3"); + io2.in_portd_cb().set_ioport("P4"); + io2.out_porte_cb().set(FUNC(cyclwarr_state::cyclwarr_control_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/includes/comx35.h b/src/mame/includes/comx35.h index fce9268c2c3..8cd0106baa7 100644 --- a/src/mame/includes/comx35.h +++ b/src/mame/includes/comx35.h @@ -81,12 +81,13 @@ public: DECLARE_WRITE_LINE_MEMBER( irq_w ); DECLARE_WRITE_LINE_MEMBER( prd_w ); DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_QUICKLOAD_LOAD_MEMBER( comx35_comx ); + DECLARE_QUICKLOAD_LOAD_MEMBER( comx ); void image_fread_memory(device_image_interface &image, uint16_t addr, uint32_t count); CDP1869_CHAR_RAM_READ_MEMBER(comx35_charram_r); CDP1869_CHAR_RAM_WRITE_MEMBER(comx35_charram_w); CDP1869_PCB_READ_MEMBER(comx35_pcb_r); + void base(machine_config &config, const XTAL clock); void pal(machine_config &config); void ntsc(machine_config &config); void comx35_pal_video(machine_config &config); diff --git a/src/mame/includes/segaxbd.h b/src/mame/includes/segaxbd.h index 1467ef92cb6..ef82331d500 100644 --- a/src/mame/includes/segaxbd.h +++ b/src/mame/includes/segaxbd.h @@ -18,6 +18,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/mcs51/mcs51.h" #include "cpu/z80/z80.h" +#include "machine/cxd1095.h" #include "machine/mb3773.h" #include "machine/watchdog.h" #include "video/resnet.h" @@ -115,6 +116,7 @@ protected: optional_device<z80_device> m_soundcpu2; optional_device<i8751_device> m_mcu; required_device<mb3773_device> m_watchdog; + required_device_array<cxd1095_device, 2> m_iochip; required_device<sega_315_5250_compare_timer_device> m_cmptimer_1; required_device<sega_xboard_sprite_device> m_sprites; required_device<segaic16_video_device> m_segaic16vid; |