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.
This commit is contained in:
Dirk Best 2019-03-12 11:47:20 +01:00
parent f0c72dc1aa
commit 8169286fcc
19 changed files with 104 additions and 58 deletions

View File

@ -716,24 +716,34 @@ end
---------------------------------------------------
--
--@src/devices/bus/coleco/ctrl.h,BUSES["COLECO"] = true
--@src/devices/bus/coleco/exp.h,BUSES["COLECO"] = true
--@src/devices/bus/coleco/controller/ctrl.h,BUSES["COLECO_CONTROLLER"] = true
---------------------------------------------------
if (BUSES["COLECO"]~=null) then
if (BUSES["COLECO_CONTROLLER"]~=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",
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

View File

@ -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

View File

@ -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

View File

@ -8,7 +8,6 @@
#include "emu.h"
#include "sv603.h"
#include "softlist.h"
#include "speaker.h"
@ -42,29 +41,18 @@ 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;
return 0xff;
switch (offset & 0xe0)
{
case 0xa0:
data = m_expander->excs_r(offset);
break;
case 0xe0:
data = m_joy[BIT(offset, 1)]->read();
break;
}
return data;
}
void sv603_device::iorq_w(offs_t offset, uint8_t data)
{
if (offset >= 0xa0 && offset <= 0xbf)
m_expander->excs_w(offset, data);
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;
if (offset >= 0xe0 && offset <= 0xff)
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;
}
}

View File

@ -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

View File

@ -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"

View File

@ -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
{