svi318: preliminary support for the sv603 coleco game adapter

lacks controller support
This commit is contained in:
Dirk Best 2016-03-25 17:46:31 +01:00
parent 9adf7c90ff
commit 37a32099cd
11 changed files with 316 additions and 28 deletions

View File

@ -2603,6 +2603,8 @@ if (BUSES["SVI_EXPANDER"]~=null) then
MAME_DIR .. "src/devices/bus/svi3x8/expander/sv601.h",
MAME_DIR .. "src/devices/bus/svi3x8/expander/sv602.cpp",
MAME_DIR .. "src/devices/bus/svi3x8/expander/sv602.h",
MAME_DIR .. "src/devices/bus/svi3x8/expander/sv603.cpp",
MAME_DIR .. "src/devices/bus/svi3x8/expander/sv603.h",
}
end

View File

@ -34,7 +34,9 @@ svi_expander_device::svi_expander_device(const machine_config &mconfig, const ch
m_romdis_handler(*this),
m_ramdis_handler(*this),
m_ctrl1_handler(*this),
m_ctrl2_handler(*this)
m_ctrl2_handler(*this),
m_excsr_handler(*this),
m_excsw_handler(*this)
{
}
@ -61,6 +63,8 @@ void svi_expander_device::device_start()
m_ramdis_handler.resolve_safe();
m_ctrl1_handler.resolve_safe();
m_ctrl2_handler.resolve_safe();
m_excsr_handler.resolve_safe(0xff);
m_excsw_handler.resolve_safe();
}
//-------------------------------------------------
@ -77,6 +81,9 @@ void svi_expander_device::device_reset()
READ8_MEMBER( svi_expander_device::mreq_r )
{
romdis_w(1);
ramdis_w(1);
if (m_module)
return m_module->mreq_r(space, offset);
@ -85,6 +92,9 @@ READ8_MEMBER( svi_expander_device::mreq_r )
WRITE8_MEMBER( svi_expander_device::mreq_w )
{
romdis_w(1);
ramdis_w(1);
if (m_module)
m_module->mreq_w(space, offset, data);
}

View File

@ -65,6 +65,12 @@
#define MCFG_SVI_EXPANDER_CTRL2_HANDLER(_devcb) \
devcb = &svi_expander_device::set_ctrl2_handler(*device, DEVCB_##_devcb);
#define MCFG_SVI_EXPANDER_EXCSR_HANDLER(_devcb) \
devcb = &svi_expander_device::set_excsr_handler(*device, DEVCB_##_devcb);
#define MCFG_SVI_EXPANDER_EXCSW_HANDLER(_devcb) \
devcb = &svi_expander_device::set_excsw_handler(*device, DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
@ -97,6 +103,12 @@ public:
template<class _Object> static devcb_base &set_ctrl2_handler(device_t &device, _Object object)
{ return downcast<svi_expander_device &>(device).m_ctrl2_handler.set_callback(object); }
template<class _Object> static devcb_base &set_excsr_handler(device_t &device, _Object object)
{ return downcast<svi_expander_device &>(device).m_excsr_handler.set_callback(object); }
template<class _Object> static devcb_base &set_excsw_handler(device_t &device, _Object object)
{ return downcast<svi_expander_device &>(device).m_excsw_handler.set_callback(object); }
// called from cart device
DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); }
DECLARE_WRITE_LINE_MEMBER( romdis_w ) { m_romdis_handler(state); }
@ -104,6 +116,9 @@ 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); }
// called from host
DECLARE_READ8_MEMBER( mreq_r );
DECLARE_WRITE8_MEMBER( mreq_w );
@ -128,6 +143,9 @@ private:
devcb_write_line m_ramdis_handler;
devcb_write_line m_ctrl1_handler;
devcb_write_line m_ctrl2_handler;
devcb_read8 m_excsr_handler;
devcb_write8 m_excsw_handler;
};
// ======================> device_svi_expander_interface

View File

@ -11,4 +11,5 @@
SLOT_INTERFACE_START( svi_expander_modules )
SLOT_INTERFACE("sv601", SV601)
SLOT_INTERFACE("sv602", SV602)
SLOT_INTERFACE("sv603", SV603)
SLOT_INTERFACE_END

View File

@ -14,6 +14,7 @@
#include "emu.h"
#include "sv601.h"
#include "sv602.h"
#include "sv603.h"
SLOT_INTERFACE_EXTERN( svi_expander_modules );

View File

@ -0,0 +1,146 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
SV-603 Coleco Game Adapter for SVI-318/328
***************************************************************************/
#include "sv603.h"
#include "softlist.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type SV603 = &device_creator<sv603_device>;
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
ROM_START( sv603 )
ROM_REGION(0x2000, "bios", 0)
ROM_LOAD("sv603.ic10", 0x0000, 0x2000, CRC(19e91b82) SHA1(8a30abe5ffef810b0f99b86db38b1b3c9d259b78))
ROM_END
const rom_entry *sv603_device::device_rom_region() const
{
return ROM_NAME( sv603 );
}
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( sv603 )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("snd", SN76489A, XTAL_10_738635MHz / 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
machine_config_constructor sv603_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( sv603 );
}
//**************************************************************************
// CARTRIDGE
//**************************************************************************
DEVICE_IMAGE_LOAD_MEMBER( sv603_device, cartridge )
{
UINT32 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_PASS;
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// sv603_device - constructor
//-------------------------------------------------
sv603_device::sv603_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, SV603, "SV-603 Coleco Game Adapter", tag, owner, clock, "sv603", __FILE__),
device_svi_expander_interface(mconfig, *this),
m_bios(*this, "bios"),
m_snd(*this, "snd"),
m_cart_rom(*this, "cartslot")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void sv603_device::device_start()
{
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void sv603_device::device_reset()
{
m_expander->ctrl1_w(0);
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
READ8_MEMBER( sv603_device::mreq_r )
{
m_expander->romdis_w(0);
if (offset < 0x8000)
return m_cart_rom->read_rom(space, offset);
if (offset >= 0x8000 && offset < 0xa000)
{
m_expander->ramdis_w(0);
return m_bios->u8(offset & 0x1fff);
}
return 0xff;
}
WRITE8_MEMBER( sv603_device::mreq_w )
{
m_expander->romdis_w(0);
}
READ8_MEMBER( sv603_device::iorq_r )
{
if (offset >= 0xa0 && offset <= 0xbf)
return m_expander->excs_r(space, offset);
return 0xff;
}
WRITE8_MEMBER( sv603_device::iorq_w )
{
if (offset >= 0xa0 && offset <= 0xbf)
m_expander->excs_w(space, offset, data);
if (offset >= 0xe0 && offset <= 0xff)
m_snd->write(space, 0, data);
}

View File

@ -0,0 +1,56 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
SV-603 Coleco Game Adapter for SVI-318/328
***************************************************************************/
#pragma once
#ifndef __SVI3X8_EXPANDER_SV603_H__
#define __SVI3X8_EXPANDER_SV603_H__
#include "emu.h"
#include "expander.h"
#include "sound/sn76496.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> sv603_device
class sv603_device : public device_t, public device_svi_expander_interface
{
public:
// construction/destruction
sv603_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 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;
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cartridge);
protected:
virtual const rom_entry *device_rom_region() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_start() override;
virtual void device_reset() override;
private:
required_memory_region m_bios;
required_device<sn76489a_device> m_snd;
required_device<generic_slot_device> m_cart_rom;
};
// device type definition
extern const device_type SV603;
#endif // __SVI3X8_EXPANDER_SV603_H__

View File

@ -75,9 +75,6 @@ READ8_MEMBER( svi_slot_bus_device::mreq_r )
device_svi_slot_interface *entry = m_dev.first();
UINT8 data = 0xff;
romdis_w(1);
ramdis_w(1);
while (entry)
{
data &= entry->mreq_r(space, offset);
@ -95,9 +92,6 @@ WRITE8_MEMBER( svi_slot_bus_device::mreq_w )
{
device_svi_slot_interface *entry = m_dev.first();
romdis_w(1);
ramdis_w(1);
while (entry)
{
entry->mreq_w(space, offset, data);

View File

@ -472,11 +472,6 @@ ROM_START (colecop)
ROM_LOAD( "r72114a_8317.u2", 0x0000, 0x2000, CRC(d393c0cc) SHA1(160077afb139943725c634d6539898db59f33657) )
ROM_END
ROM_START (svi603)
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "svi603.rom", 0x0000, 0x2000, CRC(19e91b82) SHA1(8a30abe5ffef810b0f99b86db38b1b3c9d259b78) )
ROM_END
ROM_START( czz50 )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "czz50.rom", 0x0000, 0x2000, CRC(4999abc6) SHA1(96aecec3712c94517103d894405bc98a7dafa440) )
@ -493,7 +488,6 @@ ROM_END
CONS( 1982, coleco, 0, 0, coleco, coleco, driver_device, 0, "Coleco", "ColecoVision (NTSC)", 0 )
CONS( 1982, onyx, coleco, 0, coleco, coleco, driver_device, 0, "Microdigital", "Onyx (Brazil/Prototype)", 0 )
CONS( 1983, colecop, coleco, 0, colecop, coleco, driver_device, 0, "Coleco", "ColecoVision (PAL)", 0 )
CONS( 1983, svi603, coleco, 0, coleco, coleco, driver_device, 0, "Spectravideo", "SVI-603 Coleco Game Adapter", 0 )
CONS( 1986, czz50, 0, coleco, czz50, czz50, driver_device, 0, "Bit Corporation", "Chuang Zao Zhe 50", 0 )
CONS( 1988, dina, czz50, 0, dina, czz50, driver_device, 0, "Telegames", "Dina", 0 )
CONS( 1988, prsarcde, czz50, 0, czz50, czz50, driver_device, 0, "Telegames", "Personal Arcade", 0 )

View File

@ -10,6 +10,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/ram.h"
#include "machine/bankdev.h"
#include "machine/i8255.h"
#include "video/tms9928a.h"
#include "sound/ay8910.h"
@ -48,7 +49,9 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ram(*this, RAM_TAG),
m_io(*this, "io"),
m_basic(*this, "basic"),
m_vdp(*this, "vdp"),
m_speaker(*this, "speaker"),
m_cassette(*this, "cassette"),
m_cart_rom(*this, "cartslot"),
@ -59,6 +62,7 @@ public:
m_romdis(1), m_ramdis(1),
m_cart(1), m_bk21(1),
m_rom2(1), m_rom3(1),
m_ctrl1(-1),
m_keyboard_row(0)
{}
@ -75,6 +79,10 @@ public:
DECLARE_WRITE_LINE_MEMBER( intexp_w );
DECLARE_WRITE_LINE_MEMBER( romdis_w );
DECLARE_WRITE_LINE_MEMBER( ramdis_w );
DECLARE_WRITE_LINE_MEMBER( ctrl1_w );
DECLARE_READ8_MEMBER( excs_r );
DECLARE_WRITE8_MEMBER( excs_w );
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cartridge);
@ -85,7 +93,9 @@ protected:
private:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
required_device<address_map_bank_device> m_io;
required_memory_region m_basic;
required_device<tms9928a_device> m_vdp;
required_device<speaker_sound_device> m_speaker;
required_device<cassette_image_device> m_cassette;
required_device<generic_slot_device> m_cart_rom;
@ -101,6 +111,7 @@ private:
int m_bk21;
int m_rom2;
int m_rom3;
int m_ctrl1;
UINT8 m_keyboard_row;
};
@ -117,16 +128,21 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( svi3x8_io, AS_IO, 8, svi3x8_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_DEVREADWRITE("exp", svi_expander_device, iorq_r, iorq_w)
AM_RANGE(0x80, 0x80) AM_MIRROR(0x22) AM_DEVWRITE("vdp", tms9928a_device, vram_write)
AM_RANGE(0x81, 0x81) AM_MIRROR(0x22) AM_DEVWRITE("vdp", tms9928a_device, register_write)
AM_RANGE(0x84, 0x84) AM_MIRROR(0x22) AM_DEVREAD("vdp", tms9928a_device, vram_read)
AM_RANGE(0x85, 0x85) AM_MIRROR(0x22) AM_DEVREAD("vdp", tms9928a_device, register_read)
AM_RANGE(0x88, 0x88) AM_MIRROR(0x23) AM_DEVWRITE("psg", ay8910_device, address_w)
AM_RANGE(0x8c, 0x8c) AM_MIRROR(0x23) AM_DEVWRITE("psg", ay8910_device, data_w)
AM_RANGE(0x90, 0x90) AM_MIRROR(0x23) AM_DEVREAD("psg", ay8910_device, data_r)
AM_RANGE(0x94, 0x97) AM_DEVWRITE("ppi", i8255_device, write)
AM_RANGE(0x98, 0x9a) AM_DEVREAD("ppi", i8255_device, read)
AM_RANGE(0x00, 0xff) AM_DEVICE("io", address_map_bank_device, amap8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( svi3x8_io_bank, AS_PROGRAM, 8, svi3x8_state )
AM_RANGE(0x000, 0x0ff) AM_DEVREADWRITE("exp", svi_expander_device, iorq_r, iorq_w)
AM_RANGE(0x100, 0x17f) AM_DEVREADWRITE("exp", svi_expander_device, iorq_r, iorq_w)
AM_RANGE(0x180, 0x180) AM_MIRROR(0x22) AM_DEVWRITE("vdp", tms9928a_device, vram_write)
AM_RANGE(0x181, 0x181) AM_MIRROR(0x22) AM_DEVWRITE("vdp", tms9928a_device, register_write)
AM_RANGE(0x184, 0x184) AM_MIRROR(0x22) AM_DEVREAD("vdp", tms9928a_device, vram_read)
AM_RANGE(0x185, 0x185) AM_MIRROR(0x22) AM_DEVREAD("vdp", tms9928a_device, register_read)
AM_RANGE(0x188, 0x188) AM_MIRROR(0x23) AM_DEVWRITE("psg", ay8910_device, address_w)
AM_RANGE(0x18c, 0x18c) AM_MIRROR(0x23) AM_DEVWRITE("psg", ay8910_device, data_w)
AM_RANGE(0x190, 0x190) AM_MIRROR(0x23) AM_DEVREAD("psg", ay8910_device, data_r)
AM_RANGE(0x194, 0x197) AM_DEVWRITE("ppi", i8255_device, write)
AM_RANGE(0x198, 0x19a) AM_DEVREAD("ppi", i8255_device, read)
ADDRESS_MAP_END
@ -294,10 +310,12 @@ INPUT_PORTS_END
WRITE_LINE_MEMBER( svi3x8_state::intvdp_w )
{
// note: schematics show a CNTRL line that allows switching between
// IRQ and NMI for the interrupt
m_intvdp = state;
m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_intvdp || m_intexp) ? ASSERT_LINE : CLEAR_LINE);
if (m_ctrl1 == 0)
m_maincpu->set_input_line(INPUT_LINE_NMI, m_intvdp ? ASSERT_LINE : CLEAR_LINE);
else
m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_intvdp || m_intexp) ? ASSERT_LINE : CLEAR_LINE);
}
@ -316,6 +334,7 @@ void svi3x8_state::machine_start()
save_item(NAME(m_bk21));
save_item(NAME(m_rom2));
save_item(NAME(m_rom3));
save_item(NAME(m_ctrl1));
save_item(NAME(m_keyboard_row));
}
@ -330,10 +349,17 @@ void svi3x8_state::machine_reset()
m_rom2 = 1;
m_rom3 = 1;
m_keyboard_row = 0;
if (m_ctrl1 == -1)
ctrl1_w(1);
}
READ8_MEMBER( svi3x8_state::mreq_r )
{
// ctrl1 inverts a15
if (m_ctrl1 == 0)
offset ^= 0x8000;
if (CCS1 || CCS2 || CCS3 || CCS4)
return m_cart_rom->read_rom(space, offset);
@ -353,6 +379,10 @@ READ8_MEMBER( svi3x8_state::mreq_r )
WRITE8_MEMBER( svi3x8_state::mreq_w )
{
// ctrl1 inverts a15
if (m_ctrl1 == 0)
offset ^= 0x8000;
if (CCS1 || CCS2 || CCS3 || CCS4)
return;
@ -422,7 +452,11 @@ WRITE8_MEMBER( svi3x8_state::ppi_port_c_w )
WRITE_LINE_MEMBER( svi3x8_state::intexp_w )
{
m_intexp = state;
m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_intvdp || m_intexp) ? ASSERT_LINE : CLEAR_LINE);
if (m_ctrl1 == 0)
m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_intexp ? ASSERT_LINE : CLEAR_LINE);
else
m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_intvdp || m_intexp) ? ASSERT_LINE : CLEAR_LINE);
}
WRITE_LINE_MEMBER( svi3x8_state::romdis_w )
@ -435,6 +469,30 @@ WRITE_LINE_MEMBER( svi3x8_state::ramdis_w )
m_ramdis = state;
}
WRITE_LINE_MEMBER( svi3x8_state::ctrl1_w )
{
m_ctrl1 = state;
// ctrl1 disables internal io address decoding
m_io->set_bank(m_ctrl1);
}
READ8_MEMBER( svi3x8_state::excs_r )
{
if (offset & 1)
return m_vdp->register_read(space, 0);
else
return m_vdp->vram_read(space, 0);
}
WRITE8_MEMBER( svi3x8_state::excs_w )
{
if (offset & 1)
m_vdp->register_write(space, 0, data);
else
m_vdp->vram_write(space, 0, data);
}
//**************************************************************************
// CARTRIDGE
@ -464,6 +522,12 @@ static MACHINE_CONFIG_START( svi318, svi3x8_state )
MCFG_RAM_ADD(RAM_TAG)
MCFG_RAM_DEFAULT_SIZE("16K")
MCFG_DEVICE_ADD("io", ADDRESS_MAP_BANK, 0)
MCFG_DEVICE_PROGRAM_MAP(svi3x8_io_bank)
MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(9)
MCFG_ADDRESS_MAP_BANK_STRIDE(0x100)
MCFG_DEVICE_ADD("ppi", I8255, 0)
MCFG_I8255_IN_PORTA_CB(READ8(svi3x8_state, ppi_port_a_r))
MCFG_I8255_IN_PORTB_CB(READ8(svi3x8_state, ppi_port_b_r))
@ -505,6 +569,9 @@ static MACHINE_CONFIG_START( svi318, svi3x8_state )
MCFG_SVI_EXPANDER_INT_HANDLER(WRITELINE(svi3x8_state, intexp_w))
MCFG_SVI_EXPANDER_ROMDIS_HANDLER(WRITELINE(svi3x8_state, romdis_w))
MCFG_SVI_EXPANDER_RAMDIS_HANDLER(WRITELINE(svi3x8_state, ramdis_w))
MCFG_SVI_EXPANDER_CTRL1_HANDLER(WRITELINE(svi3x8_state, ctrl1_w))
MCFG_SVI_EXPANDER_EXCSR_HANDLER(READ8(svi3x8_state, excs_r))
MCFG_SVI_EXPANDER_EXCSW_HANDLER(WRITE8(svi3x8_state, excs_w))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( svi318n, svi318 )

View File

@ -9266,7 +9266,6 @@ czz50 // Bit Corporation Chuang Zao Zhe 50
dina // Telegames Dina
onyx // Microdigital ONYX (Brazilian Coleco clone / unreleased prototype)
prsarcde // Telegames Personal Arcade
svi603 // Spectravideo SVI-603 Coleco Game Adapter
@source:combatsc.cpp
bootcamp // GX611 (c) 1987