Support MSX Sunrise SCC Flash cart type used in Manbow 2

This commit is contained in:
AJR 2023-10-14 23:09:54 -04:00
parent 7f264f417f
commit 3ad1d0d02e
6 changed files with 147 additions and 6 deletions

View File

@ -3707,26 +3707,24 @@ LZ93A13 (32 pin) - 8KB banks
</part>
</software>
<software name="manbow2" supported="no">
<software name="manbow2">
<description>Manbow 2</description>
<year>2007</year>
<publisher>Sunrise</publisher>
<notes>Flash writing is not supported. Game play does not start.</notes>
<part name="cart" interface="msx_cart">
<feature name="slot" value="konami_scc"/>
<feature name="slot" value="sunrise_scc"/>
<dataarea name="rom" size="0x80000">
<rom name="manbow 2 - sunrise.rom" size="0x80000" crc="64d8454a" sha1="e3b9241291b5f19ab239726360258a31e02565a3"/>
</dataarea>
</part>
</software>
<software name="manbow2a" cloneof="manbow2" supported="no">
<software name="manbow2a" cloneof="manbow2">
<description>Manbow 2 (alt)</description>
<year>2007</year>
<publisher>Sunrise</publisher>
<notes>Flash writing is not supported. Game play does not start.</notes>
<part name="cart" interface="msx_cart">
<feature name="slot" value="konami_scc"/>
<feature name="slot" value="sunrise_scc"/>
<dataarea name="rom" size="0x80000">
<rom name="manbow 2 - sunrise (alt).rom" size="0x80000" crc="492b06b8" sha1="c2a2663302c845468dddfe7f4eee8823b7d4bdd6"/>
</dataarea>

View File

@ -88,6 +88,7 @@ void msx_cart(device_slot_interface &device, bool is_in_subslot)
device.option_add_internal(slotoptions::RTYPE, MSX_CART_RTYPE);
device.option_add_internal(slotoptions::SOUND_SNATCHER, MSX_CART_SOUND_SNATCHER);
device.option_add_internal(slotoptions::SOUND_SDSNATCH, MSX_CART_SOUND_SDSNATCHER);
device.option_add_internal(slotoptions::SUNRISE_SCC, MSX_CART_SUNRISE_SCC);
device.option_add_internal(slotoptions::SUPER_SWANGI, MSX_CART_SUPER_SWANGI);
device.option_add_internal(slotoptions::SUPERLODERUNNER, MSX_CART_SUPERLODERUNNER);
device.option_add_internal(slotoptions::SYNTHESIZER, MSX_CART_SYNTHESIZER);

View File

@ -3,6 +3,8 @@
#include "emu.h"
#include "konami.h"
#include "machine/intelfsh.h"
#include "sound/k051649.h"
#include "sound/vlm5030.h"
#include "sound/dac.h"
@ -199,6 +201,142 @@ void msx_cart_konami_scc_device::bank_w(u8 data)
class msx_cart_sunrise_scc_device : public device_t, public msx_cart_interface
{
public:
msx_cart_sunrise_scc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MSX_CART_SUNRISE_SCC, tag, owner, clock)
, msx_cart_interface(mconfig, *this)
, m_k051649(*this, "k051649")
, m_flash(*this, "flash")
, m_scc_view(*this, "scc_view")
{ }
virtual std::error_condition initialize_cartridge(std::string &message) override;
protected:
// device_t implementation
virtual void device_start() override { save_item(NAME(m_selected_bank)); }
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
private:
template <int Bank> u8 flash_r(offs_t offset);
template <int Bank> void flash_w(offs_t offset, u8 data);
template <int Bank> void bank_w(offs_t offset, u8 data);
required_device<k051649_device> m_k051649;
required_device<intelfsh8_device> m_flash;
memory_view m_scc_view;
u8 m_selected_bank[4];
};
ROM_START(msx_cart_sunrise_scc)
ROM_REGION(0x80000, "flash", ROMREGION_ERASEFF)
ROM_END
const tiny_rom_entry *msx_cart_sunrise_scc_device::device_rom_region() const
{
return ROM_NAME(msx_cart_sunrise_scc);
}
void msx_cart_sunrise_scc_device::device_add_mconfig(machine_config &config)
{
K051649(config, m_k051649, DERIVED_CLOCK(1, 1));
if (parent_slot())
m_k051649->add_route(ALL_OUTPUTS, soundin(), 0.4);
AMD_29F040(config, m_flash);
}
void msx_cart_sunrise_scc_device::device_reset()
{
m_scc_view.select(0);
for (int i = 0; i < 4; i++)
m_selected_bank[i] = i;
}
std::error_condition msx_cart_sunrise_scc_device::initialize_cartridge(std::string &message)
{
if (!cart_rom_region())
{
message = "msx_cart_sunrise_scc_device: Required region 'rom' was not found.";
return image_error::INTERNAL;
}
const u32 size = cart_rom_region()->bytes();
if (size != 0x80000)
{
message = "msx_cart_sunrise_scc_device: Region 'rom' has unsupported size.";
return image_error::INVALIDLENGTH;
}
u8 *flash = memregion("flash")->base();
memcpy(flash, cart_rom_region()->base(), size);
page(0)->install_read_handler(0x0000, 0x1fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<2>)));
page(0)->install_write_handler(0x0000, 0x1fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_w<2>)));
page(0)->install_read_handler(0x2000, 0x3fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<3>)));
page(0)->install_write_handler(0x2000, 0x3fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_w<3>)));
page(1)->install_read_handler(0x4000, 0x5fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<0>)));
page(1)->install_write_handler(0x4000, 0x5fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::bank_w<0>)));
page(1)->install_read_handler(0x6000, 0x7fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<1>)));
page(1)->install_write_handler(0x6000, 0x7fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::bank_w<1>)));
page(2)->install_view(0x8000, 0x9fff, m_scc_view);
m_scc_view[0].install_read_handler(0x8000, 0x9fff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<2>)));
m_scc_view[0].install_write_handler(0x8000, 0x97ff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::bank_w<2>)));
m_scc_view[1].install_read_handler(0x8000, 0x97ff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<2>)));
m_scc_view[1].install_write_handler(0x8000, 0x97ff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::bank_w<2>)));
m_scc_view[1].install_read_handler(0x9800, 0x987f, 0, 0x0700, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_waveform_r)));
m_scc_view[1].install_write_handler(0x9800, 0x987f, 0, 0x0700, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_waveform_w)));
m_scc_view[1].install_write_handler(0x9880, 0x9889, 0, 0x0710, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_frequency_w)));
m_scc_view[1].install_write_handler(0x988a, 0x988e, 0, 0x0710, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_volume_w)));
m_scc_view[1].install_write_handler(0x988f, 0x988f, 0, 0x0710, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_keyonoff_w)));
m_scc_view[1].install_read_handler(0x98e0, 0x98e0, 0, 0x071f, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_test_r)));
m_scc_view[1].install_write_handler(0x98e0, 0x98e0, 0, 0x071f, 0, emu::rw_delegate(m_k051649, FUNC(k051649_device::k051649_test_w)));
page(2)->install_read_handler(0xa000, 0xbfff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<3>)));
page(2)->install_write_handler(0xa000, 0xbfff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::bank_w<3>)));
page(3)->install_read_handler(0xc000, 0xdfff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<0>)));
page(3)->install_write_handler(0xc000, 0xdfff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_w<0>)));
page(3)->install_read_handler(0xe000, 0xffff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_r<1>)));
page(3)->install_write_handler(0xe000, 0xffff, emu::rw_delegate(*this, FUNC(msx_cart_sunrise_scc_device::flash_w<1>)));
return std::error_condition();
}
template <int Bank>
u8 msx_cart_sunrise_scc_device::flash_r(offs_t offset)
{
return m_flash->read(m_selected_bank[Bank] * 0x2000 + offset);
}
template <int Bank>
void msx_cart_sunrise_scc_device::flash_w(offs_t offset, u8 data)
{
m_flash->write(m_selected_bank[Bank] * 0x2000 + offset, data);
}
template <int Bank>
void msx_cart_sunrise_scc_device::bank_w(offs_t offset, u8 data)
{
if ((offset & 0x1800) == 0x1000)
{
m_selected_bank[Bank] = data & 0x3f;
if (Bank == 2)
m_scc_view.select(((data & 0x3f) == 0x3f) ? 1 : 0);
}
else
m_flash->write(m_selected_bank[Bank] * 0x2000 + offset, data);
}
class msx_cart_gamemaster2_device : public device_t, public msx_cart_interface
{
public:
@ -817,6 +955,7 @@ void msx_cart_ec701_device::bank_w(u8 data)
DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_KONAMI, msx_cart_interface, msx_cart_konami_device, "msx_cart_konami", "MSX Cartridge - KONAMI")
DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_KONAMI_SCC, msx_cart_interface, msx_cart_konami_scc_device, "msx_cart_konami_scc", "MSX Cartridge - KONAMI+SCC")
DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_SUNRISE_SCC, msx_cart_interface, msx_cart_sunrise_scc_device, "msx_cart_sunrise_scc", "MSX Cartridge - Sunrise+SCC")
DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_GAMEMASTER2, msx_cart_interface, msx_cart_gamemaster2_device, "msx_cart_gamemaster2", "MSX Cartridge - GAMEMASTER2")
DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_SYNTHESIZER, msx_cart_interface, msx_cart_synthesizer_device, "msx_cart_synthesizer", "MSX Cartridge - Synthesizer")
DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_SOUND_SNATCHER, msx_cart_interface, msx_cart_konami_sound_snatcher_device, "msx_cart_sound_snatcher", "MSX Cartridge - Sound Snatcher")

View File

@ -10,6 +10,7 @@
DECLARE_DEVICE_TYPE(MSX_CART_KONAMI, msx_cart_interface)
DECLARE_DEVICE_TYPE(MSX_CART_KONAMI_SCC, msx_cart_interface)
DECLARE_DEVICE_TYPE(MSX_CART_SUNRISE_SCC, msx_cart_interface)
DECLARE_DEVICE_TYPE(MSX_CART_GAMEMASTER2, msx_cart_interface)
DECLARE_DEVICE_TYPE(MSX_CART_SYNTHESIZER, msx_cart_interface)
DECLARE_DEVICE_TYPE(MSX_CART_SOUND_SNATCHER, msx_cart_interface)

View File

@ -77,6 +77,7 @@ char const *const SLOTEXP = "slotexp";
char const *const SOFTCARD = "softcard";
char const *const SOUND_SNATCHER = "sound_snatcher";
char const *const SOUND_SDSNATCH = "sound_sdsnatch";
char const *const SUNRISE_SCC = "sunrise_scc";
char const *const SUPER_SWANGI = "super_swangi";
char const *const SUPERLODERUNNER = "superloderunner";
char const *const SYNTHESIZER = "synthesizer";

View File

@ -80,6 +80,7 @@ extern char const *const SLOTEXP;
extern char const *const SOFTCARD;
extern char const *const SOUND_SNATCHER;
extern char const *const SOUND_SDSNATCH;
extern char const *const SUNRISE_SCC;
extern char const *const SUPER_SWANGI;
extern char const *const SUPERLODERUNNER;
extern char const *const SYNTHESIZER;