diff options
author | Dirk Best <mail@dirk-best.de> | 2019-03-12 11:47:20 +0100 |
---|---|---|
committer | Dirk Best <mail@dirk-best.de> | 2019-03-12 11:49:56 +0100 |
commit | 8169286fcc3508f82822df56558f3d669777b898 (patch) | |
tree | 4fb9ae573d8dcb824edf06e7703a5981b0ff9daf | |
parent | f0c72dc1aaed2f2a12295f1adbabcdc754dd2e08 (diff) |
svi3x8: Hook up controllers to the Coleco Game Adapter
Also use our Coleco cartridge emulation instead of generic sockets
and move the cartridge and controller bus emulations to their own
directory.
-rw-r--r-- | scripts/src/bus.lua | 46 | ||||
-rw-r--r-- | scripts/target/mame/arcade.lua | 3 | ||||
-rw-r--r-- | scripts/target/mame/mess.lua | 3 | ||||
-rw-r--r-- | src/devices/bus/coleco/cartridge/exp.cpp (renamed from src/devices/bus/coleco/exp.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/cartridge/exp.h (renamed from src/devices/bus/coleco/exp.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/cartridge/std.cpp (renamed from src/devices/bus/coleco/std.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/cartridge/std.h (renamed from src/devices/bus/coleco/std.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/cartridge/xin1.cpp (renamed from src/devices/bus/coleco/xin1.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/cartridge/xin1.h (renamed from src/devices/bus/coleco/xin1.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/controller/ctrl.cpp (renamed from src/devices/bus/coleco/ctrl.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/controller/ctrl.h (renamed from src/devices/bus/coleco/ctrl.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/controller/hand.cpp (renamed from src/devices/bus/coleco/hand.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/controller/hand.h (renamed from src/devices/bus/coleco/hand.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/controller/sac.cpp (renamed from src/devices/bus/coleco/sac.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/coleco/controller/sac.h (renamed from src/devices/bus/coleco/sac.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/svi3x8/expander/sv603.cpp | 99 | ||||
-rw-r--r-- | src/devices/bus/svi3x8/expander/sv603.h | 9 | ||||
-rw-r--r-- | src/mame/includes/adam.h | 4 | ||||
-rw-r--r-- | src/mame/includes/coleco.h | 2 |
19 files changed, 106 insertions, 60 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index ee55202bb88..0713710baaa 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -716,24 +716,34 @@ end --------------------------------------------------- -- ---@src/devices/bus/coleco/ctrl.h,BUSES["COLECO"] = true ---@src/devices/bus/coleco/exp.h,BUSES["COLECO"] = true ---------------------------------------------------- - -if (BUSES["COLECO"]~=null) then - files { - MAME_DIR .. "src/devices/bus/coleco/ctrl.cpp", - MAME_DIR .. "src/devices/bus/coleco/ctrl.h", - MAME_DIR .. "src/devices/bus/coleco/hand.cpp", - MAME_DIR .. "src/devices/bus/coleco/hand.h", - MAME_DIR .. "src/devices/bus/coleco/sac.cpp", - MAME_DIR .. "src/devices/bus/coleco/sac.h", - MAME_DIR .. "src/devices/bus/coleco/exp.cpp", - MAME_DIR .. "src/devices/bus/coleco/exp.h", - MAME_DIR .. "src/devices/bus/coleco/std.cpp", - MAME_DIR .. "src/devices/bus/coleco/std.h", - MAME_DIR .. "src/devices/bus/coleco/xin1.h", - MAME_DIR .. "src/devices/bus/coleco/xin1.cpp", +--@src/devices/bus/coleco/controller/ctrl.h,BUSES["COLECO_CONTROLLER"] = true +--------------------------------------------------- + +if (BUSES["COLECO_CONTROLLER"]~=null) then + files { + MAME_DIR .. "src/devices/bus/coleco/controller/ctrl.cpp", + MAME_DIR .. "src/devices/bus/coleco/controller/ctrl.h", + MAME_DIR .. "src/devices/bus/coleco/controller/hand.cpp", + MAME_DIR .. "src/devices/bus/coleco/controller/hand.h", + MAME_DIR .. "src/devices/bus/coleco/controller/sac.cpp", + MAME_DIR .. "src/devices/bus/coleco/controller/sac.h", + } +end + + +--------------------------------------------------- +-- +--@src/devices/bus/coleco/exp.h,BUSES["COLECO_CART"] = true +--------------------------------------------------- + +if (BUSES["COLECO_CART"]~=null) then + files { + MAME_DIR .. "src/devices/bus/coleco/cartridge/exp.cpp", + MAME_DIR .. "src/devices/bus/coleco/cartridge/exp.h", + MAME_DIR .. "src/devices/bus/coleco/cartridge/std.cpp", + MAME_DIR .. "src/devices/bus/coleco/cartridge/std.h", + MAME_DIR .. "src/devices/bus/coleco/cartridge/xin1.h", + MAME_DIR .. "src/devices/bus/coleco/cartridge/xin1.cpp", } end diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index de1ad5163ea..96ff56e6dc3 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -680,7 +680,8 @@ BUSES["AMIGA_KEYBOARD"] = true BUSES["CENTRONICS"] = true --BUSES["CHANNELF"] = true --BUSES["COCO"] = true ---BUSES["COLECO"] = true +--BUSES["COLECO_CONTROLLER"] = true +--BUSES["COLECO_CART"] = true --BUSES["COMPUCOLOR"] = true --BUSES["COMX35"] = true --BUSES["CPC"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 42321704576..6d53cb3f789 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -726,7 +726,8 @@ BUSES["CGENIE_EXPANSION"] = true BUSES["CGENIE_PARALLEL"] = true BUSES["CHANNELF"] = true BUSES["COCO"] = true -BUSES["COLECO"] = true +BUSES["COLECO_CONTROLLER"] = true +BUSES["COLECO_CART"] = true BUSES["COMPIS_GRAPHICS"] = true BUSES["COMPUCOLOR"] = true BUSES["COMX35"] = true diff --git a/src/devices/bus/coleco/exp.cpp b/src/devices/bus/coleco/cartridge/exp.cpp index eaf3f144322..eaf3f144322 100644 --- a/src/devices/bus/coleco/exp.cpp +++ b/src/devices/bus/coleco/cartridge/exp.cpp diff --git a/src/devices/bus/coleco/exp.h b/src/devices/bus/coleco/cartridge/exp.h index 4da9d2d1d00..4da9d2d1d00 100644 --- a/src/devices/bus/coleco/exp.h +++ b/src/devices/bus/coleco/cartridge/exp.h diff --git a/src/devices/bus/coleco/std.cpp b/src/devices/bus/coleco/cartridge/std.cpp index 24bb815834e..24bb815834e 100644 --- a/src/devices/bus/coleco/std.cpp +++ b/src/devices/bus/coleco/cartridge/std.cpp diff --git a/src/devices/bus/coleco/std.h b/src/devices/bus/coleco/cartridge/std.h index 6e0c5206ada..6e0c5206ada 100644 --- a/src/devices/bus/coleco/std.h +++ b/src/devices/bus/coleco/cartridge/std.h diff --git a/src/devices/bus/coleco/xin1.cpp b/src/devices/bus/coleco/cartridge/xin1.cpp index 140d2132ee4..140d2132ee4 100644 --- a/src/devices/bus/coleco/xin1.cpp +++ b/src/devices/bus/coleco/cartridge/xin1.cpp diff --git a/src/devices/bus/coleco/xin1.h b/src/devices/bus/coleco/cartridge/xin1.h index 0e8a7813c9f..0e8a7813c9f 100644 --- a/src/devices/bus/coleco/xin1.h +++ b/src/devices/bus/coleco/cartridge/xin1.h diff --git a/src/devices/bus/coleco/ctrl.cpp b/src/devices/bus/coleco/controller/ctrl.cpp index 330c7c71551..330c7c71551 100644 --- a/src/devices/bus/coleco/ctrl.cpp +++ b/src/devices/bus/coleco/controller/ctrl.cpp diff --git a/src/devices/bus/coleco/ctrl.h b/src/devices/bus/coleco/controller/ctrl.h index 3460dec0b7d..3460dec0b7d 100644 --- a/src/devices/bus/coleco/ctrl.h +++ b/src/devices/bus/coleco/controller/ctrl.h diff --git a/src/devices/bus/coleco/hand.cpp b/src/devices/bus/coleco/controller/hand.cpp index b8410183b68..b8410183b68 100644 --- a/src/devices/bus/coleco/hand.cpp +++ b/src/devices/bus/coleco/controller/hand.cpp diff --git a/src/devices/bus/coleco/hand.h b/src/devices/bus/coleco/controller/hand.h index f65ad709106..f65ad709106 100644 --- a/src/devices/bus/coleco/hand.h +++ b/src/devices/bus/coleco/controller/hand.h diff --git a/src/devices/bus/coleco/sac.cpp b/src/devices/bus/coleco/controller/sac.cpp index 7b3cef9b114..7b3cef9b114 100644 --- a/src/devices/bus/coleco/sac.cpp +++ b/src/devices/bus/coleco/controller/sac.cpp diff --git a/src/devices/bus/coleco/sac.h b/src/devices/bus/coleco/controller/sac.h index 20078e33ef7..20078e33ef7 100644 --- a/src/devices/bus/coleco/sac.h +++ b/src/devices/bus/coleco/controller/sac.h diff --git a/src/devices/bus/svi3x8/expander/sv603.cpp b/src/devices/bus/svi3x8/expander/sv603.cpp index e32fb2ac5d3..ce4a9f11bcf 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" @@ -42,30 +41,19 @@ MACHINE_CONFIG_START(sv603_device::device_add_mconfig) MCFG_DEVICE_ADD("snd", SN76489A, XTAL(10'738'635) / 3) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + // 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>)); + // cartridge slot - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "coleco_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,col") - MCFG_GENERIC_LOAD(sv603_device, cartridge) + COLECOVISION_CARTRIDGE_SLOT(config, m_cart, colecovision_cartridges, nullptr); SOFTWARE_LIST(config, "cart_list").set_original("coleco"); MACHINE_CONFIG_END //************************************************************************** -// CARTRIDGE -//************************************************************************** - -DEVICE_IMAGE_LOAD_MEMBER( sv603_device, cartridge ) -{ - uint32_t size = m_cart_rom->common_get_size("rom"); - - 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"); - - return image_init_result::PASS; -} - - -//************************************************************************** // LIVE DEVICE //************************************************************************** @@ -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,20 +93,33 @@ void sv603_device::device_reset() // IMPLEMENTATION //************************************************************************** +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(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; } void sv603_device::mreq_w(offs_t offset, uint8_t data) @@ -127,17 +129,48 @@ void sv603_device::mreq_w(offs_t offset, uint8_t data) uint8_t sv603_device::iorq_r(offs_t offset) { - if (offset >= 0xa0 && offset <= 0xbf) - return m_expander->excs_r(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; } void sv603_device::iorq_w(offs_t offset, uint8_t data) { - if (offset >= 0xa0 && offset <= 0xbf) + 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; - if (offset >= 0xe0 && offset <= 0xff) + 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 c317873d74e..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" //************************************************************************** @@ -35,7 +35,7 @@ public: 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/mame/includes/adam.h b/src/mame/includes/adam.h index b1beee0caea..641f62705ea 100644 --- a/src/mame/includes/adam.h +++ b/src/mame/includes/adam.h @@ -7,8 +7,8 @@ #include "bus/adam/exp.h" #include "bus/adamnet/adamnet.h" -#include "bus/coleco/ctrl.h" -#include "bus/coleco/exp.h" +#include "bus/coleco/controller/ctrl.h" +#include "bus/coleco/cartridge/exp.h" #include "cpu/z80/z80.h" #include "cpu/m6800/m6801.h" #include "machine/coleco.h" diff --git a/src/mame/includes/coleco.h b/src/mame/includes/coleco.h index 742f7a387dd..3367bd3ac38 100644 --- a/src/mame/includes/coleco.h +++ b/src/mame/includes/coleco.h @@ -11,7 +11,7 @@ #include "sound/sn76496.h" #include "video/tms9928a.h" #include "machine/coleco.h" -#include "bus/coleco/exp.h" +#include "bus/coleco/cartridge/exp.h" class coleco_state : public driver_device { |