diff options
Diffstat (limited to 'src/devices/bus/svi3x8')
22 files changed, 241 insertions, 233 deletions
diff --git a/src/devices/bus/svi3x8/expander/expander.cpp b/src/devices/bus/svi3x8/expander/expander.cpp index 481789516ff..e9653827fcf 100644 --- a/src/devices/bus/svi3x8/expander/expander.cpp +++ b/src/devices/bus/svi3x8/expander/expander.cpp @@ -80,38 +80,38 @@ void svi_expander_device::device_reset() // host to module interface //------------------------------------------------- -READ8_MEMBER( svi_expander_device::mreq_r ) +uint8_t svi_expander_device::mreq_r(offs_t offset) { romdis_w(1); ramdis_w(1); if (m_module) - return m_module->mreq_r(space, offset); + return m_module->mreq_r(offset); return 0xff; } -WRITE8_MEMBER( svi_expander_device::mreq_w ) +void svi_expander_device::mreq_w(offs_t offset, uint8_t data) { romdis_w(1); ramdis_w(1); if (m_module) - m_module->mreq_w(space, offset, data); + m_module->mreq_w(offset, data); } -READ8_MEMBER( svi_expander_device::iorq_r ) +uint8_t svi_expander_device::iorq_r(offs_t offset) { if (m_module) - return m_module->iorq_r(space, offset); + return m_module->iorq_r(offset); return 0xff; } -WRITE8_MEMBER( svi_expander_device::iorq_w ) +void svi_expander_device::iorq_w(offs_t offset, uint8_t data) { if (m_module) - m_module->iorq_w(space, offset, data); + m_module->iorq_w(offset, data); } WRITE_LINE_MEMBER( svi_expander_device::bk21_w ) diff --git a/src/devices/bus/svi3x8/expander/expander.h b/src/devices/bus/svi3x8/expander/expander.h index 549a17c5970..cc7e75f6332 100644 --- a/src/devices/bus/svi3x8/expander/expander.h +++ b/src/devices/bus/svi3x8/expander/expander.h @@ -40,36 +40,6 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SVI_EXPANDER_BUS_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, SVI_EXPANDER, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(svi_expander_modules, nullptr, false) -#define MCFG_SVI_EXPANDER_INT_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_int_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_ROMDIS_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_romdis_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_RAMDIS_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_ramdis_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_CTRL1_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_ctrl1_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_CTRL2_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_ctrl2_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_EXCSR_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_excsr_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_EXCSW_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_excsw_handler(DEVCB_##_devcb); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -82,17 +52,27 @@ class svi_expander_device : public device_t, public device_slot_interface { public: // construction/destruction + template <typename T> + svi_expander_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts) + : svi_expander_device(mconfig, tag, owner, uint32_t(0)) + { + option_reset(); + opts(*this); + set_default_option(nullptr); + set_fixed(false); + } + svi_expander_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~svi_expander_device(); // callbacks - template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_romdis_handler(Object &&cb) { return m_romdis_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ramdis_handler(Object &&cb) { return m_ramdis_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ctrl1_handler(Object &&cb) { return m_ctrl1_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ctrl2_handler(Object &&cb) { return m_ctrl2_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_excsr_handler(Object &&cb) { return m_excsr_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_excsw_handler(Object &&cb) { return m_excsw_handler.set_callback(std::forward<Object>(cb)); } + auto int_handler() { return m_int_handler.bind(); } + auto romdis_handler() { return m_romdis_handler.bind(); } + auto ramdis_handler() { return m_ramdis_handler.bind(); } + auto ctrl1_handler() { return m_ctrl1_handler.bind(); } + auto ctrl2_handler() { return m_ctrl2_handler.bind(); } + auto excsr_handler() { return m_excsr_handler.bind(); } + auto excsw_handler() { return m_excsw_handler.bind(); } // called from cart device DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); } @@ -101,14 +81,14 @@ public: DECLARE_WRITE_LINE_MEMBER( ctrl1_w ) { m_ctrl1_handler(state); } DECLARE_WRITE_LINE_MEMBER( ctrl2_w ) { m_ctrl2_handler(state); } - DECLARE_READ8_MEMBER( excs_r ) { return m_excsr_handler(space, offset); } - DECLARE_WRITE8_MEMBER( excs_w ) { m_excsw_handler(space, offset, data); } + uint8_t excs_r(offs_t offset) { return m_excsr_handler(offset); } + void excs_w(offs_t offset, uint8_t data) { m_excsw_handler(offset, data); } // called from host - DECLARE_READ8_MEMBER( mreq_r ); - DECLARE_WRITE8_MEMBER( mreq_w ); - DECLARE_READ8_MEMBER( iorq_r ); - DECLARE_WRITE8_MEMBER( iorq_w ); + uint8_t mreq_r(offs_t offset); + void mreq_w(offs_t offset, uint8_t data); + uint8_t iorq_r(offs_t offset); + void iorq_w(offs_t offset, uint8_t data); DECLARE_WRITE_LINE_MEMBER( bk21_w ); DECLARE_WRITE_LINE_MEMBER( bk22_w ); @@ -141,10 +121,10 @@ public: // construction/destruction virtual ~device_svi_expander_interface(); - virtual DECLARE_READ8_MEMBER( mreq_r ) { return 0xff; } - virtual DECLARE_WRITE8_MEMBER( mreq_w ) { } - virtual DECLARE_READ8_MEMBER( iorq_r ) { return 0xff; } - virtual DECLARE_WRITE8_MEMBER( iorq_w ) { } + virtual uint8_t mreq_r(offs_t offset) { return 0xff; } + virtual void mreq_w(offs_t offset, uint8_t data) { } + virtual uint8_t iorq_r(offs_t offset) { return 0xff; } + virtual void iorq_w(offs_t offset, uint8_t data) { } virtual void bk21_w(int state) { } virtual void bk22_w(int state) { } diff --git a/src/devices/bus/svi3x8/expander/sv601.cpp b/src/devices/bus/svi3x8/expander/sv601.cpp index 51a51241897..aec81c79ae6 100644 --- a/src/devices/bus/svi3x8/expander/sv601.cpp +++ b/src/devices/bus/svi3x8/expander/sv601.cpp @@ -20,19 +20,20 @@ DEFINE_DEVICE_TYPE(SV601, sv601_device, "sv601", "SV-601 Super Expander") // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sv601_device::device_add_mconfig) - MCFG_SVI_SLOT_BUS_ADD - MCFG_SVI_SLOT_INT_HANDLER(WRITELINE(*this, sv601_device, int_w)) - MCFG_SVI_SLOT_ROMDIS_HANDLER(WRITELINE(*this, sv601_device, romdis_w)) - MCFG_SVI_SLOT_RAMDIS_HANDLER(WRITELINE(*this, sv601_device, ramdis_w)) - MCFG_SVI_SLOT_ADD("0", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("1", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("2", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("3", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("4", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("5", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("6", svi_slot_cards, nullptr) -MACHINE_CONFIG_END +void sv601_device::device_add_mconfig(machine_config &config) +{ + SVI_SLOT_BUS(config, m_slotbus, 0); + m_slotbus->int_handler().set(FUNC(sv601_device::int_w)); + m_slotbus->romdis_handler().set(FUNC(sv601_device::romdis_w)); + m_slotbus->ramdis_handler().set(FUNC(sv601_device::ramdis_w)); + SVI_SLOT(config, "0", svi_slot_cards, nullptr); + SVI_SLOT(config, "1", svi_slot_cards, nullptr); + SVI_SLOT(config, "2", svi_slot_cards, nullptr); + SVI_SLOT(config, "3", svi_slot_cards, nullptr); + SVI_SLOT(config, "4", svi_slot_cards, nullptr); + SVI_SLOT(config, "5", svi_slot_cards, nullptr); + SVI_SLOT(config, "6", svi_slot_cards, nullptr); +} //************************************************************************** @@ -67,10 +68,10 @@ WRITE_LINE_MEMBER( sv601_device::int_w ) { m_expander->int_w(state); } WRITE_LINE_MEMBER( sv601_device::romdis_w ) { m_expander->romdis_w(state); } WRITE_LINE_MEMBER( sv601_device::ramdis_w ) { m_expander->ramdis_w(state); } -READ8_MEMBER( sv601_device::mreq_r ) { return m_slotbus->mreq_r(space, offset); } -WRITE8_MEMBER( sv601_device::mreq_w ) { m_slotbus->mreq_w(space, offset, data); } -READ8_MEMBER( sv601_device::iorq_r ) { return m_slotbus->iorq_r(space, offset); } -WRITE8_MEMBER( sv601_device::iorq_w ) { m_slotbus->iorq_w(space, offset, data); } +uint8_t sv601_device::mreq_r(offs_t offset) { return m_slotbus->mreq_r(offset); } +void sv601_device::mreq_w(offs_t offset, uint8_t data) { m_slotbus->mreq_w(offset, data); } +uint8_t sv601_device::iorq_r(offs_t offset) { return m_slotbus->iorq_r(offset); } +void sv601_device::iorq_w(offs_t offset, uint8_t data) { m_slotbus->iorq_w(offset, data); } void sv601_device::bk21_w(int state) { m_slotbus->bk21_w(state); } void sv601_device::bk22_w(int state) { m_slotbus->bk22_w(state); } diff --git a/src/devices/bus/svi3x8/expander/sv601.h b/src/devices/bus/svi3x8/expander/sv601.h index 7918bc82441..692191a7ea9 100644 --- a/src/devices/bus/svi3x8/expander/sv601.h +++ b/src/devices/bus/svi3x8/expander/sv601.h @@ -33,10 +33,10 @@ public: WRITE_LINE_MEMBER( ramdis_w ); // from host - virtual DECLARE_READ8_MEMBER( mreq_r ) override; - virtual DECLARE_WRITE8_MEMBER( mreq_w ) override; - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; virtual void bk21_w(int state) override; virtual void bk22_w(int state) override; diff --git a/src/devices/bus/svi3x8/expander/sv602.cpp b/src/devices/bus/svi3x8/expander/sv602.cpp index b7c657bddce..25624a83e9a 100644 --- a/src/devices/bus/svi3x8/expander/sv602.cpp +++ b/src/devices/bus/svi3x8/expander/sv602.cpp @@ -20,13 +20,14 @@ DEFINE_DEVICE_TYPE(SV602, sv602_device, "sv602", "SV-602 Single Slot Expander") // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sv602_device::device_add_mconfig) - MCFG_SVI_SLOT_BUS_ADD - MCFG_SVI_SLOT_INT_HANDLER(WRITELINE(*this, sv602_device, int_w)) - MCFG_SVI_SLOT_ROMDIS_HANDLER(WRITELINE(*this, sv602_device, romdis_w)) - MCFG_SVI_SLOT_RAMDIS_HANDLER(WRITELINE(*this, sv602_device, ramdis_w)) - MCFG_SVI_SLOT_ADD("0", sv602_slot_cards, nullptr) -MACHINE_CONFIG_END +void sv602_device::device_add_mconfig(machine_config &config) +{ + SVI_SLOT_BUS(config, m_slotbus, 0); + m_slotbus->int_handler().set(FUNC(sv602_device::int_w)); + m_slotbus->romdis_handler().set(FUNC(sv602_device::romdis_w)); + m_slotbus->ramdis_handler().set(FUNC(sv602_device::ramdis_w)); + SVI_SLOT(config, "0", sv602_slot_cards, nullptr); +} //************************************************************************** @@ -61,10 +62,10 @@ WRITE_LINE_MEMBER( sv602_device::int_w ) { m_expander->int_w(state); } WRITE_LINE_MEMBER( sv602_device::romdis_w ) { m_expander->romdis_w(state); } WRITE_LINE_MEMBER( sv602_device::ramdis_w ) { m_expander->ramdis_w(state); } -READ8_MEMBER( sv602_device::mreq_r ) { return m_slotbus->mreq_r(space, offset); } -WRITE8_MEMBER( sv602_device::mreq_w ) { m_slotbus->mreq_w(space, offset, data); } -READ8_MEMBER( sv602_device::iorq_r ) { return m_slotbus->iorq_r(space, offset); } -WRITE8_MEMBER( sv602_device::iorq_w ) { m_slotbus->iorq_w(space, offset, data); } +uint8_t sv602_device::mreq_r(offs_t offset) { return m_slotbus->mreq_r(offset); } +void sv602_device::mreq_w(offs_t offset, uint8_t data) { m_slotbus->mreq_w(offset, data); } +uint8_t sv602_device::iorq_r(offs_t offset) { return m_slotbus->iorq_r(offset); } +void sv602_device::iorq_w(offs_t offset, uint8_t data) { m_slotbus->iorq_w(offset, data); } void sv602_device::bk21_w(int state) { m_slotbus->bk21_w(state); } void sv602_device::bk22_w(int state) { m_slotbus->bk22_w(state); } diff --git a/src/devices/bus/svi3x8/expander/sv602.h b/src/devices/bus/svi3x8/expander/sv602.h index bb59b93c7ee..607d1cf6c17 100644 --- a/src/devices/bus/svi3x8/expander/sv602.h +++ b/src/devices/bus/svi3x8/expander/sv602.h @@ -28,10 +28,10 @@ public: sv602_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // from host - virtual DECLARE_READ8_MEMBER( mreq_r ) override; - virtual DECLARE_WRITE8_MEMBER( mreq_w ) override; - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; virtual void bk21_w(int state) override; virtual void bk22_w(int state) override; diff --git a/src/devices/bus/svi3x8/expander/sv603.cpp b/src/devices/bus/svi3x8/expander/sv603.cpp index a35b46e3f84..fc8e8c86d96 100644 --- a/src/devices/bus/svi3x8/expander/sv603.cpp +++ b/src/devices/bus/svi3x8/expander/sv603.cpp @@ -8,7 +8,6 @@ #include "emu.h" #include "sv603.h" - #include "softlist.h" #include "speaker.h" @@ -37,31 +36,20 @@ const tiny_rom_entry *sv603_device::device_rom_region() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sv603_device::device_add_mconfig) - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("snd", SN76489A, XTAL(10'738'635) / 3) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // cartridge slot - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "coleco_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,col") - MCFG_GENERIC_LOAD(sv603_device, cartridge) - MCFG_SOFTWARE_LIST_ADD("cart_list", "coleco") -MACHINE_CONFIG_END - - -//************************************************************************** -// CARTRIDGE -//************************************************************************** - -DEVICE_IMAGE_LOAD_MEMBER( sv603_device, cartridge ) +void sv603_device::device_add_mconfig(machine_config &config) { - uint32_t size = m_cart_rom->common_get_size("rom"); + SPEAKER(config, "mono").front_center(); + SN76489A(config, m_snd, XTAL(10'738'635) / 3).add_route(ALL_OUTPUTS, "mono", 1.00); - m_cart_rom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart_rom->common_load_rom(m_cart_rom->get_rom_base(), size, "rom"); + // controller ports + COLECOVISION_CONTROL_PORT(config, m_joy[0], colecovision_control_port_devices, "hand"); + m_joy[0]->irq().set(FUNC(sv603_device::joy_irq_w<0>)); + COLECOVISION_CONTROL_PORT(config, m_joy[1], colecovision_control_port_devices, nullptr); + m_joy[1]->irq().set(FUNC(sv603_device::joy_irq_w<1>)); - return image_init_result::PASS; + // cartridge slot + COLECOVISION_CARTRIDGE_SLOT(config, m_cart, colecovision_cartridges, nullptr); + SOFTWARE_LIST(config, "cart_list").set_original("coleco"); } @@ -78,7 +66,8 @@ sv603_device::sv603_device(const machine_config &mconfig, const char *tag, devic device_svi_expander_interface(mconfig, *this), m_bios(*this, "bios"), m_snd(*this, "snd"), - m_cart_rom(*this, "cartslot") + m_joy{ {*this, "joy1"}, {*this, "joy2"} }, + m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG) { } @@ -104,40 +93,84 @@ void sv603_device::device_reset() // IMPLEMENTATION //************************************************************************** -READ8_MEMBER( sv603_device::mreq_r ) +template<int N> +WRITE_LINE_MEMBER( sv603_device::joy_irq_w ) { + m_expander->int_w(state); +} + +uint8_t sv603_device::mreq_r(offs_t offset) +{ + uint8_t data = 0xff; + + // ls138 (active low) + int ccs1 = ((offset >> 13) == 0) ? 0 : 1; + int ccs2 = ((offset >> 13) == 1) ? 0 : 1; + int ccs3 = ((offset >> 13) == 2) ? 0 : 1; + int ccs4 = ((offset >> 13) == 3) ? 0 : 1; + int bios = ((offset >> 13) == 4) ? 0 : 1; + // 5, 6, 7: not connected + m_expander->romdis_w(0); + m_expander->ramdis_w(bios); - if (offset < 0x8000) - return m_cart_rom->read_rom(space, offset); + data &= m_cart->bd_r(offset, data, ccs1, ccs2, ccs3, ccs4); - if (offset >= 0x8000 && offset < 0xa000) - { - m_expander->ramdis_w(0); - return m_bios->as_u8(offset & 0x1fff); - } + if (bios == 0) + data &= m_bios->as_u8(offset & 0x1fff); - return 0xff; + return data; } -WRITE8_MEMBER( sv603_device::mreq_w ) +void sv603_device::mreq_w(offs_t offset, uint8_t data) { m_expander->romdis_w(0); } -READ8_MEMBER( sv603_device::iorq_r ) +uint8_t sv603_device::iorq_r(offs_t offset) { - if (offset >= 0xa0 && offset <= 0xbf) - return m_expander->excs_r(space, offset); + uint8_t data = 0xff; + + switch (offset & 0xe0) + { + case 0xa0: + data = m_expander->excs_r(offset); + break; + + case 0xe0: + data = m_joy[BIT(offset, 1)]->read(); + break; + } - return 0xff; + return data; } -WRITE8_MEMBER( sv603_device::iorq_w ) +void sv603_device::iorq_w(offs_t offset, uint8_t data) { - if (offset >= 0xa0 && offset <= 0xbf) - m_expander->excs_w(space, offset, data); - - if (offset >= 0xe0 && offset <= 0xff) + switch (offset & 0xe0) + { + case 0x80: + // keypad mode + m_joy[0]->common0_w(1); + m_joy[0]->common1_w(0); + m_joy[1]->common0_w(1); + m_joy[1]->common1_w(0); + break; + + case 0xa0: + m_expander->excs_w(offset, data); + break; + + case 0xc0: + // joystick mode + m_joy[0]->common0_w(0); + m_joy[0]->common1_w(1); + m_joy[1]->common0_w(0); + m_joy[1]->common1_w(1); + break; + + case 0xe0: m_snd->write(data); + break; + } } diff --git a/src/devices/bus/svi3x8/expander/sv603.h b/src/devices/bus/svi3x8/expander/sv603.h index 57d16521c17..a6b3fde21b8 100644 --- a/src/devices/bus/svi3x8/expander/sv603.h +++ b/src/devices/bus/svi3x8/expander/sv603.h @@ -13,8 +13,8 @@ #include "expander.h" #include "sound/sn76496.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" +#include "bus/coleco/cartridge/exp.h" +#include "bus/coleco/controller/ctrl.h" //************************************************************************** @@ -30,12 +30,12 @@ public: sv603_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // from host - virtual DECLARE_READ8_MEMBER( mreq_r ) override; - virtual DECLARE_WRITE8_MEMBER( mreq_w ) override; - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cartridge); + template<int N> DECLARE_WRITE_LINE_MEMBER( joy_irq_w ); protected: virtual const tiny_rom_entry *device_rom_region() const override; @@ -46,7 +46,8 @@ protected: private: required_memory_region m_bios; required_device<sn76489a_device> m_snd; - required_device<generic_slot_device> m_cart_rom; + required_device<colecovision_control_port_device> m_joy[2]; + required_device<colecovision_cartridge_slot_device> m_cart; }; // device type definition diff --git a/src/devices/bus/svi3x8/slot/slot.cpp b/src/devices/bus/svi3x8/slot/slot.cpp index c345d864f4b..eb2137ce629 100644 --- a/src/devices/bus/svi3x8/slot/slot.cpp +++ b/src/devices/bus/svi3x8/slot/slot.cpp @@ -20,11 +20,11 @@ DEFINE_DEVICE_TYPE(SVI_SLOT_BUS, svi_slot_bus_device, "svislotbus", "SVI Slot Bu // svi_slot_bus_device - constructor //------------------------------------------------- -svi_slot_bus_device::svi_slot_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, SVI_SLOT_BUS, tag, owner, clock), - m_int_handler(*this), - m_romdis_handler(*this), - m_ramdis_handler(*this) +svi_slot_bus_device::svi_slot_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, SVI_SLOT_BUS, tag, owner, clock) + , m_int_handler(*this) + , m_romdis_handler(*this) + , m_ramdis_handler(*this) { } @@ -71,14 +71,14 @@ void svi_slot_bus_device::add_card(device_svi_slot_interface *card) // mreq_r - memory read from slot //------------------------------------------------- -READ8_MEMBER( svi_slot_bus_device::mreq_r ) +uint8_t svi_slot_bus_device::mreq_r(offs_t offset) { device_svi_slot_interface *entry = m_dev.first(); uint8_t data = 0xff; while (entry) { - data &= entry->mreq_r(space, offset); + data &= entry->mreq_r(offset); entry = entry->next(); } @@ -89,13 +89,13 @@ READ8_MEMBER( svi_slot_bus_device::mreq_r ) // mreq_w - memory write to slot //------------------------------------------------- -WRITE8_MEMBER( svi_slot_bus_device::mreq_w ) +void svi_slot_bus_device::mreq_w(offs_t offset, uint8_t data) { device_svi_slot_interface *entry = m_dev.first(); while (entry) { - entry->mreq_w(space, offset, data); + entry->mreq_w(offset, data); entry = entry->next(); } } @@ -104,14 +104,14 @@ WRITE8_MEMBER( svi_slot_bus_device::mreq_w ) // iorq_r - memory read from slot //------------------------------------------------- -READ8_MEMBER( svi_slot_bus_device::iorq_r ) +uint8_t svi_slot_bus_device::iorq_r(offs_t offset) { device_svi_slot_interface *entry = m_dev.first(); uint8_t data = 0xff; while (entry) { - data &= entry->iorq_r(space, offset); + data &= entry->iorq_r(offset); entry = entry->next(); } @@ -122,13 +122,13 @@ READ8_MEMBER( svi_slot_bus_device::iorq_r ) // iorq_w - memory write to slot //------------------------------------------------- -WRITE8_MEMBER( svi_slot_bus_device::iorq_w ) +void svi_slot_bus_device::iorq_w(offs_t offset, uint8_t data) { device_svi_slot_interface *entry = m_dev.first(); while (entry) { - entry->iorq_w(space, offset, data); + entry->iorq_w(offset, data); entry = entry->next(); } } @@ -204,10 +204,9 @@ DEFINE_DEVICE_TYPE(SVI_SLOT, svi_slot_device, "svislot", "SVI Slot") // svi_slot_device - constructor //------------------------------------------------- -svi_slot_device::svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, SVI_SLOT, tag, owner, clock), - device_slot_interface(mconfig, *this), - m_bus_tag(nullptr) +svi_slot_device::svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, SVI_SLOT, tag, owner, clock) + , device_slot_interface(mconfig, *this) { } @@ -221,7 +220,7 @@ void svi_slot_device::device_start() if (dev) { - svi_slot_bus_device *bus = downcast<svi_slot_bus_device *>(m_owner->subdevice(m_bus_tag)); + svi_slot_bus_device *bus = downcast<svi_slot_bus_device *>(owner()->subdevice(SVIBUS_TAG)); bus->add_card(dev); } } diff --git a/src/devices/bus/svi3x8/slot/slot.h b/src/devices/bus/svi3x8/slot/slot.h index 702c005b770..756f17658fd 100644 --- a/src/devices/bus/svi3x8/slot/slot.h +++ b/src/devices/bus/svi3x8/slot/slot.h @@ -40,27 +40,11 @@ #pragma once - //************************************************************************** -// INTERFACE CONFIGURATION MACROS +// CONSTANTS / MACROS //************************************************************************** -#define MCFG_SVI_SLOT_BUS_ADD \ - MCFG_DEVICE_ADD("slotbus", SVI_SLOT_BUS, 0) - -#define MCFG_SVI_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, SVI_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<svi_slot_device &>(*device).set_bus(this, "slotbus"); - -#define MCFG_SVI_SLOT_INT_HANDLER(_devcb) \ - downcast<svi_slot_bus_device &>(*device).set_int_handler(DEVCB_##_devcb); - -#define MCFG_SVI_SLOT_ROMDIS_HANDLER(_devcb) \ - downcast<svi_slot_bus_device &>(*device).set_romdis_handler(DEVCB_##_devcb); - -#define MCFG_SVI_SLOT_RAMDIS_HANDLER(_devcb) \ - downcast<svi_slot_bus_device &>(*device).set_ramdis_handler(DEVCB_##_devcb); +#define SVIBUS_TAG "slot_bux" //************************************************************************** @@ -79,9 +63,9 @@ public: virtual ~svi_slot_bus_device(); // callbacks - template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_romdis_handler(Object &&cb) { return m_romdis_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ramdis_handler(Object &&cb) { return m_ramdis_handler.set_callback(std::forward<Object>(cb)); } + auto int_handler() { return m_int_handler.bind(); } + auto romdis_handler() { return m_romdis_handler.bind(); } + auto ramdis_handler() { return m_ramdis_handler.bind(); } void add_card(device_svi_slot_interface *card); @@ -91,10 +75,10 @@ public: DECLARE_WRITE_LINE_MEMBER( ramdis_w ) { m_ramdis_handler(state); }; // from host - DECLARE_READ8_MEMBER( mreq_r ); - DECLARE_WRITE8_MEMBER( mreq_w ); - DECLARE_READ8_MEMBER( iorq_r ); - DECLARE_WRITE8_MEMBER( iorq_w ); + uint8_t mreq_r(offs_t offset); + void mreq_w(offs_t offset, uint8_t data); + uint8_t iorq_r(offs_t offset); + void iorq_w(offs_t offset, uint8_t data); DECLARE_WRITE_LINE_MEMBER( bk21_w ); DECLARE_WRITE_LINE_MEMBER( bk22_w ); @@ -122,10 +106,17 @@ class svi_slot_device : public device_t, public device_slot_interface { public: // construction/destruction - svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + svi_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : svi_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } - // inline configuration - void set_bus(device_t *owner, const char *bus_tag) { m_owner = owner; m_bus_tag = bus_tag; } + svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -152,10 +143,10 @@ public: device_svi_slot_interface *next() const { return m_next; } - virtual DECLARE_READ8_MEMBER( mreq_r ) { return 0xff; } - virtual DECLARE_WRITE8_MEMBER( mreq_w ) { } - virtual DECLARE_READ8_MEMBER( iorq_r ) { return 0xff; } - virtual DECLARE_WRITE8_MEMBER( iorq_w ) { } + virtual uint8_t mreq_r(offs_t offset) { return 0xff; } + virtual void mreq_w(offs_t offset, uint8_t data) { } + virtual uint8_t iorq_r(offs_t offset) { return 0xff; } + virtual void iorq_w(offs_t offset, uint8_t data) { } virtual DECLARE_WRITE_LINE_MEMBER( bk21_w ) { } virtual DECLARE_WRITE_LINE_MEMBER( bk22_w ) { } diff --git a/src/devices/bus/svi3x8/slot/sv801.cpp b/src/devices/bus/svi3x8/slot/sv801.cpp index 48881ffc9e1..9d73b62aec1 100644 --- a/src/devices/bus/svi3x8/slot/sv801.cpp +++ b/src/devices/bus/svi3x8/slot/sv801.cpp @@ -97,7 +97,7 @@ WRITE_LINE_MEMBER( sv801_device::drq_w ) m_drq = state; } -WRITE8_MEMBER( sv801_device::motor_w ) +void sv801_device::motor_w(uint8_t data) { m_floppy = nullptr; @@ -112,7 +112,7 @@ WRITE8_MEMBER( sv801_device::motor_w ) m_floppy1->get_device()->mon_w(!BIT(data, 3)); } -READ8_MEMBER( sv801_device::iorq_r ) +uint8_t sv801_device::iorq_r(offs_t offset) { switch (offset) { @@ -126,7 +126,7 @@ READ8_MEMBER( sv801_device::iorq_r ) return 0xff; } -WRITE8_MEMBER( sv801_device::iorq_w ) +void sv801_device::iorq_w(offs_t offset, uint8_t data) { switch (offset) { @@ -134,7 +134,7 @@ WRITE8_MEMBER( sv801_device::iorq_w ) case 0x31: m_fdc->track_w(data); break; case 0x32: m_fdc->sector_w(data); break; case 0x33: m_fdc->data_w(data); break; - case 0x34: motor_w(space, 0, data); break; + case 0x34: motor_w(data); break; case 0x38: m_fdc->dden_w(BIT(data, 0)); if (m_floppy) diff --git a/src/devices/bus/svi3x8/slot/sv801.h b/src/devices/bus/svi3x8/slot/sv801.h index 38dea1e55d0..29c2014b872 100644 --- a/src/devices/bus/svi3x8/slot/sv801.h +++ b/src/devices/bus/svi3x8/slot/sv801.h @@ -28,8 +28,8 @@ public: // construction/destruction sv801_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; protected: virtual void device_add_mconfig(machine_config &config) override; @@ -37,7 +37,7 @@ protected: virtual void device_reset() override; private: - DECLARE_WRITE8_MEMBER( motor_w ); + void motor_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER( intrq_w ); DECLARE_WRITE_LINE_MEMBER( drq_w ); diff --git a/src/devices/bus/svi3x8/slot/sv802.cpp b/src/devices/bus/svi3x8/slot/sv802.cpp index 2cc905d472c..909ed2fa712 100644 --- a/src/devices/bus/svi3x8/slot/sv802.cpp +++ b/src/devices/bus/svi3x8/slot/sv802.cpp @@ -20,12 +20,14 @@ DEFINE_DEVICE_TYPE(SV802, sv802_device, "sv802", "SV-802 Centronics Printer Inte // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sv802_device::device_add_mconfig) - MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, sv802_device, busy_w)) +void sv802_device::device_add_mconfig(machine_config &config) +{ + CENTRONICS(config, m_centronics, centronics_devices, "printer"); + m_centronics->busy_handler().set(FUNC(sv802_device::busy_w)); - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END + OUTPUT_LATCH(config, m_cent_data_out); + m_centronics->set_output_latch(*m_cent_data_out); +} //************************************************************************** @@ -60,7 +62,7 @@ void sv802_device::device_start() // IMPLEMENTATION //************************************************************************** -READ8_MEMBER( sv802_device::iorq_r ) +uint8_t sv802_device::iorq_r(offs_t offset) { if (offset == 0x12) return 0xfe | m_busy; @@ -68,7 +70,7 @@ READ8_MEMBER( sv802_device::iorq_r ) return 0xff; } -WRITE8_MEMBER( sv802_device::iorq_w ) +void sv802_device::iorq_w(offs_t offset, uint8_t data) { switch (offset) { diff --git a/src/devices/bus/svi3x8/slot/sv802.h b/src/devices/bus/svi3x8/slot/sv802.h index 2a06329c966..aabea33bbaf 100644 --- a/src/devices/bus/svi3x8/slot/sv802.h +++ b/src/devices/bus/svi3x8/slot/sv802.h @@ -28,8 +28,8 @@ public: // construction/destruction sv802_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; protected: virtual void device_add_mconfig(machine_config &config) override; diff --git a/src/devices/bus/svi3x8/slot/sv803.cpp b/src/devices/bus/svi3x8/slot/sv803.cpp index db79801530c..6adc07fd193 100644 --- a/src/devices/bus/svi3x8/slot/sv803.cpp +++ b/src/devices/bus/svi3x8/slot/sv803.cpp @@ -56,7 +56,7 @@ void sv803_device::device_reset() // IMPLEMENTATION //************************************************************************** -READ8_MEMBER( sv803_device::mreq_r ) +uint8_t sv803_device::mreq_r(offs_t offset) { if (offset >= 0x8000 && offset <= 0xbfff) return m_ram[offset - 0x8000]; @@ -64,7 +64,7 @@ READ8_MEMBER( sv803_device::mreq_r ) return 0xff; } -WRITE8_MEMBER( sv803_device::mreq_w ) +void sv803_device::mreq_w(offs_t offset, uint8_t data) { if (offset >= 0x8000 && offset <= 0xbfff) m_ram[offset - 0x8000] = data; diff --git a/src/devices/bus/svi3x8/slot/sv803.h b/src/devices/bus/svi3x8/slot/sv803.h index 6fd1d2b635a..8cae18acf64 100644 --- a/src/devices/bus/svi3x8/slot/sv803.h +++ b/src/devices/bus/svi3x8/slot/sv803.h @@ -26,8 +26,8 @@ public: // construction/destruction sv803_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual DECLARE_READ8_MEMBER( mreq_r ) override; - virtual DECLARE_WRITE8_MEMBER( mreq_w ) override; + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; protected: virtual void device_start() override; diff --git a/src/devices/bus/svi3x8/slot/sv805.cpp b/src/devices/bus/svi3x8/slot/sv805.cpp index bc4dc77c19f..cdcaee6f167 100644 --- a/src/devices/bus/svi3x8/slot/sv805.cpp +++ b/src/devices/bus/svi3x8/slot/sv805.cpp @@ -65,7 +65,7 @@ void sv805_device::device_start() // IMPLEMENTATION //************************************************************************** -READ8_MEMBER( sv805_device::iorq_r ) +uint8_t sv805_device::iorq_r(offs_t offset) { switch (offset) { @@ -77,13 +77,13 @@ READ8_MEMBER( sv805_device::iorq_r ) case 0x2d: case 0x2e: case 0x2f: - return m_uart->ins8250_r(space, offset & 0x07); + return m_uart->ins8250_r(machine().dummy_space(), offset & 0x07); } return 0xff; } -WRITE8_MEMBER( sv805_device::iorq_w ) +void sv805_device::iorq_w(offs_t offset, uint8_t data) { switch (offset) { @@ -95,7 +95,7 @@ WRITE8_MEMBER( sv805_device::iorq_w ) case 0x2d: case 0x2e: case 0x2f: - m_uart->ins8250_w(space, offset & 0x07, data); + m_uart->ins8250_w(machine().dummy_space(), offset & 0x07, data); } } diff --git a/src/devices/bus/svi3x8/slot/sv805.h b/src/devices/bus/svi3x8/slot/sv805.h index 3a6f350a490..892dc23b432 100644 --- a/src/devices/bus/svi3x8/slot/sv805.h +++ b/src/devices/bus/svi3x8/slot/sv805.h @@ -28,8 +28,8 @@ public: // construction/destruction sv805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; protected: virtual void device_add_mconfig(machine_config &config) override; diff --git a/src/devices/bus/svi3x8/slot/sv806.cpp b/src/devices/bus/svi3x8/slot/sv806.cpp index 5408aa8738c..aed4fb80bda 100644 --- a/src/devices/bus/svi3x8/slot/sv806.cpp +++ b/src/devices/bus/svi3x8/slot/sv806.cpp @@ -114,7 +114,7 @@ MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) } } -READ8_MEMBER( sv806_device::mreq_r ) +uint8_t sv806_device::mreq_r(offs_t offset) { if (offset >= 0xf000 && m_ram_enabled) { @@ -125,7 +125,7 @@ READ8_MEMBER( sv806_device::mreq_r ) return 0xff; } -WRITE8_MEMBER( sv806_device::mreq_w ) +void sv806_device::mreq_w(offs_t offset, uint8_t data) { if (offset >= 0xf000 && m_ram_enabled) { @@ -134,20 +134,20 @@ WRITE8_MEMBER( sv806_device::mreq_w ) } } -READ8_MEMBER( sv806_device::iorq_r ) +uint8_t sv806_device::iorq_r(offs_t offset) { if (offset == 0x51) - return m_crtc->register_r(space, 0); + return m_crtc->register_r(); return 0xff; } -WRITE8_MEMBER( sv806_device::iorq_w ) +void sv806_device::iorq_w(offs_t offset, uint8_t data) { switch (offset) { - case 0x50: m_crtc->address_w(space, 0, data); break; - case 0x51: m_crtc->register_w(space, 0, data); break; + case 0x50: m_crtc->address_w(data); break; + case 0x51: m_crtc->register_w(data); break; case 0x58: m_ram_enabled = data; break; } } diff --git a/src/devices/bus/svi3x8/slot/sv806.h b/src/devices/bus/svi3x8/slot/sv806.h index 868117b8565..e6af5071c56 100644 --- a/src/devices/bus/svi3x8/slot/sv806.h +++ b/src/devices/bus/svi3x8/slot/sv806.h @@ -28,10 +28,10 @@ public: // construction/destruction sv806_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual DECLARE_READ8_MEMBER( mreq_r ) override; - virtual DECLARE_WRITE8_MEMBER( mreq_w ) override; - virtual DECLARE_READ8_MEMBER( iorq_r ) override; - virtual DECLARE_WRITE8_MEMBER( iorq_w ) override; + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; protected: virtual const tiny_rom_entry *device_rom_region() const override; diff --git a/src/devices/bus/svi3x8/slot/sv807.cpp b/src/devices/bus/svi3x8/slot/sv807.cpp index 6ea6a77a6bc..281b7845c64 100644 --- a/src/devices/bus/svi3x8/slot/sv807.cpp +++ b/src/devices/bus/svi3x8/slot/sv807.cpp @@ -118,7 +118,7 @@ void sv807_device::device_reset() // test setup: S2 = enabled (22), S3 = enabled (31) -READ8_MEMBER( sv807_device::mreq_r ) +uint8_t sv807_device::mreq_r(offs_t offset) { if ((BK21_ACTIVE || BK31_ACTIVE) && offset < 0x8000) { @@ -135,7 +135,7 @@ READ8_MEMBER( sv807_device::mreq_r ) return 0xff; } -WRITE8_MEMBER( sv807_device::mreq_w ) +void sv807_device::mreq_w(offs_t offset, uint8_t data) { if ((BK21_ACTIVE || BK31_ACTIVE) && offset < 0x8000) { diff --git a/src/devices/bus/svi3x8/slot/sv807.h b/src/devices/bus/svi3x8/slot/sv807.h index e3f12201d37..8d12befff79 100644 --- a/src/devices/bus/svi3x8/slot/sv807.h +++ b/src/devices/bus/svi3x8/slot/sv807.h @@ -29,8 +29,8 @@ public: // optional information overrides virtual ioport_constructor device_input_ports() const override; - virtual DECLARE_READ8_MEMBER( mreq_r ) override; - virtual DECLARE_WRITE8_MEMBER( mreq_w ) override; + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; virtual void bk21_w(int state) override; virtual void bk22_w(int state) override; |