diff options
-rw-r--r-- | hash/megadriv.xml | 69 | ||||
-rw-r--r-- | src/devices/bus/megadrive/md_carts.cpp | 5 | ||||
-rw-r--r-- | src/devices/bus/megadrive/md_slot.cpp | 24 | ||||
-rw-r--r-- | src/devices/bus/megadrive/md_slot.h | 1 | ||||
-rw-r--r-- | src/devices/bus/megadrive/rom.cpp | 127 | ||||
-rw-r--r-- | src/devices/bus/megadrive/rom.h | 23 |
6 files changed, 235 insertions, 14 deletions
diff --git a/hash/megadriv.xml b/hash/megadriv.xml index bae8b86ab70..40e1c93fcf8 100644 --- a/hash/megadriv.xml +++ b/hash/megadriv.xml @@ -21821,6 +21821,57 @@ Notice that these are not working on real hardware due to bugged code with VDP i </dataarea> </part> </software> + + <software name="psolar"> + <description>Pier Solar and the Great Architects (World, Rev. C)</description> + <year>2010</year> + <publisher>WaterMelon</publisher> + <part name="cart" interface="megadriv_cart"> + <feature name="slot" value="rom_stm95"/> + <dataarea name="rom" width="16" endianness="big" size="8388608"> + <rom name="pier solar and the great architects (world) (en,es,pt) (rev c) (unl).bin" size="8388608" crc="dfb94f1b" sha1="2e7710b1956514c27be24db000e60d3c3a1dc2d8" offset="0x000000" /> + </dataarea> + </part> + </software> + + <software name="psolara" cloneof="psolar"> + <description>Pier Solar and the Great Architects (World, Rev. B)</description> + <year>2010</year> + <publisher>WaterMelon</publisher> + <part name="cart" interface="megadriv_cart"> + <feature name="slot" value="rom_stm95"/> + <dataarea name="rom" width="16" endianness="big" size="8388608"> + <rom name="pier solar and the great architects (world) (en,fr,de) (rev b) (unl).bin" size="8388608" crc="25b7063e" sha1="2e2b03cdf58662b450ac09e9883d5767ce2be350" offset="0x000000" /> + </dataarea> + </part> + </software> + + <software name="psolarb" cloneof="psolar"> + <description>Pier Solar and the Great Architects (World, Rev. A)</description> + <year>2010</year> + <publisher>WaterMelon</publisher> + <part name="cart" interface="megadriv_cart"> + <feature name="slot" value="rom_stm95"/> + <dataarea name="rom" width="16" endianness="big" size="8388608"> + <rom name="pier solar and the great architects (world) (en,fr,de) (rev a) (unl).bin" size="8388608" crc="4261ea9b" sha1="59f7557725a740322fa92402e13c98823f795aa9" offset="0x000000" /> + </dataarea> + </part> + </software> + + <software name="psolarp" cloneof="psolar"> + <description>Pier Solar and the Great Architects (World, Prototype)</description> + <year>2010</year> + <publisher>WaterMelon</publisher> + <part name="cart" interface="megadriv_cart"> + <feature name="slot" value="rom_sram"/> + <dataarea name="rom" width="16" endianness="big" size="3407872"> + <rom name="pier solar and the great architects (world) (beta) (unl).bin" size="3407872" crc="55ffb501" sha1="d672e456f1af120d1fa7137c3fbee1d9f62d9296" offset="0x000000" /> + </dataarea> + <!-- What is the correct amount?!? --> + <dataarea name="sram" size="4096"> + </dataarea> + </part> + </software> <software name="pinkp" cloneof="pink"> <description>Pink Goes to Hollywood (USA, Prototype)</description> @@ -25157,6 +25208,20 @@ Notice that these are not working on real hardware due to bugged code with VDP i </software> <software name="starodys"> + <description>Star Odyssey (USA)</description> + <year>2011</year> + <publisher>Super Fighter Team</publisher> + <part name="cart" interface="megadriv_cart"> + <feature name="slot" value="rom_sf004"/> + <dataarea name="rom" width="16" endianness="big" size="2097152"> + <rom name="star odyssey (world) (unl).bin" size="2097152" crc="0b670a3e" sha1="791ee690b2929d4edfda22ff23d7cfd74376299e" offset="0x000000" /> + </dataarea> + <dataarea name="sram" size="32768"> + </dataarea> + </part> + </software> + + <software name="starodysp" cloneof="starodys"> <description>Star Odyssey (USA, Prototype 19920116)</description> <year>1990</year> <publisher>Sage's Creation</publisher> @@ -29589,7 +29654,7 @@ Notice that these are not working on real hardware due to bugged code with VDP i <year>2008</year> <publisher>Super Fighter Team</publisher> <part name="cart" interface="megadriv_cart"> - <feature name="slot" value="rom_wukong"/> + <feature name="slot" value="rom_sf002"/> <dataarea name="rom" width="16" endianness="big" size="2228224"> <rom name="legend of wukong (unl).bin" size="2228224" crc="72f11771" sha1="4ef41e4caccab118014abb8e079c7e5668a4f468" offset="0x000000"/> </dataarea> @@ -29938,7 +30003,7 @@ Notice that these are not working on real hardware due to bugged code with VDP i <year>2005</year> <publisher>Super Fighter Team</publisher> <part name="cart" interface="megadriv_cart"> - <feature name="slot" value="rom_beggarp"/> + <feature name="slot" value="rom_sf001"/> <dataarea name="rom" width="16" endianness="big" size="4194304"> <rom name="beggar prince (unl).bin" size="4194304" crc="f3af46cd" sha1="f481b970756c482d8f408c4bab8902172837e7d8" offset="0x000000"/> </dataarea> diff --git a/src/devices/bus/megadrive/md_carts.cpp b/src/devices/bus/megadrive/md_carts.cpp index fd5a9032ac3..4c9f1b9b2e0 100644 --- a/src/devices/bus/megadrive/md_carts.cpp +++ b/src/devices/bus/megadrive/md_carts.cpp @@ -18,8 +18,9 @@ SLOT_INTERFACE_START(md_cart) SLOT_INTERFACE_INTERNAL("rom_fram", MD_ROM_FRAM) SLOT_INTERFACE_INTERNAL("rom_hardbl95", MD_ROM_SRAM) SLOT_INTERFACE_INTERNAL("rom_xinqig", MD_ROM_SRAM) - SLOT_INTERFACE_INTERNAL("rom_beggarp", MD_ROM_BEGGARP) - SLOT_INTERFACE_INTERNAL("rom_wukong", MD_ROM_WUKONG) + SLOT_INTERFACE_INTERNAL("rom_sf001", MD_ROM_BEGGARP) + SLOT_INTERFACE_INTERNAL("rom_sf002", MD_ROM_WUKONG) + SLOT_INTERFACE_INTERNAL("rom_sf004", MD_ROM_STARODYS) // EEPROM handling (not supported fully yet) SLOT_INTERFACE_INTERNAL("rom_eeprom", MD_STD_EEPROM) SLOT_INTERFACE_INTERNAL("rom_nbajam", MD_EEPROM_NBAJAM) diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index 2d7bc239968..84228207d5e 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -235,8 +235,9 @@ static const md_slot slot_list[] = { SEGA_FRAM, "rom_fram" }, { HARDBALL95, "rom_hardbl95" }, { XINQIG, "rom_xinqig"}, - { BEGGARP, "rom_beggarp"}, - { WUKONG, "rom_wukong"}, + { BEGGARP, "rom_sf001"}, + { WUKONG, "rom_sf002"}, + { STARODYS, "rom_sf004"}, { SEGA_EEPROM, "rom_eeprom" }, { NBA_JAM, "rom_nbajam" }, @@ -526,7 +527,7 @@ int base_md_cart_slot_device::load_nonlist() // STEP 4: determine the cart type (to deal with sram/eeprom & pirate mappers) - m_type = get_cart_type(ROM, len); + m_type = get_cart_type(ROM, tmplen - offset); // handle mirroring of ROM, unless it's SSF2 or Pier Solar if (m_type != SSF2 && m_type != PSOLAR) @@ -667,6 +668,12 @@ void base_md_cart_slot_device::setup_nvram() m_cart->nvram_alloc(m_cart->m_nvram_end - m_cart->m_nvram_start + 1); m_cart->m_nvram_active = 1; break; + case STARODYS: + m_cart->m_nvram_start = 0x200000; + m_cart->m_nvram_end = m_cart->m_nvram_start + 0xfffff; + m_cart->nvram_alloc(0x8000/2); // 32K mirrored + m_cart->m_nvram_active = 1; + break; case NBA_JAM_ALT: m_cart->nvram_alloc(0x100); break; @@ -816,6 +823,9 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp((char *)&ROM[0x0150], "Virtua Racing", 13)) type = SEGA_SVP; + if (!memcmp((char *)&ROM[0x0180], "SF-004", 6)) // Star Odyssey + type = STARODYS; + break; case 0x200005: @@ -823,6 +833,11 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) type = REDCL_EN; break; + case 0x220000: + if (!memcmp((char *)&ROM[0x0180], "SF-002", 6)) // Legend of Wukong + type = WUKONG; + break; + case 0x300000: if (!memcmp(&ROM[0x220], sdk_sig, sizeof(sdk_sig))) type = LIONK3; @@ -858,6 +873,9 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp((char *)&ROM[0x0180], "GM T-81476", 10)) // Big Hurt Baseball type = C_SLAM; + if (!memcmp((char *)&ROM[0x0180], "SF-001", 6)) // Beggar Prince + type = BEGGARP; + break; case 0x500000: diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h index 099b17e9d51..a033daec607 100644 --- a/src/devices/bus/megadrive/md_slot.h +++ b/src/devices/bus/megadrive/md_slot.h @@ -26,6 +26,7 @@ enum XINQIG, /* Xin Qigai Wangzi uses different sram start address and has no valid header */ BEGGARP, /* Beggar Prince uses different sram start address + bankswitch tricks */ WUKONG, /* Legend of Wukong uses different sram start address + bankswitch trick for last 128K of ROM */ + STARODYS, /* Star Odyssey */ // EEPROM SEGA_EEPROM, /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */ diff --git a/src/devices/bus/megadrive/rom.cpp b/src/devices/bus/megadrive/rom.cpp index 2ce6d353e35..5d38557ea86 100644 --- a/src/devices/bus/megadrive/rom.cpp +++ b/src/devices/bus/megadrive/rom.cpp @@ -61,6 +61,7 @@ const device_type MD_ROM_TOPF = &device_creator<md_rom_topf_device>; const device_type MD_ROM_RADICA = &device_creator<md_rom_radica_device>; const device_type MD_ROM_BEGGARP = &device_creator<md_rom_beggarp_device>; const device_type MD_ROM_WUKONG = &device_creator<md_rom_wukong_device>; +const device_type MD_ROM_STARODYS = &device_creator<md_rom_starodys_device>; md_std_rom_device::md_std_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) @@ -235,6 +236,11 @@ md_rom_wukong_device::md_rom_wukong_device(const machine_config &mconfig, const { } +md_rom_starodys_device::md_rom_starodys_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : md_std_rom_device(mconfig, MD_ROM_STARODYS, "MD Star Odyssey", tag, owner, clock, "md_rom_starodys", __FILE__), m_mode(0), m_lock(0), m_ram_enable(0), m_base(0) +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -416,6 +422,22 @@ void md_rom_wukong_device::device_reset() m_mode = 0; } +void md_rom_starodys_device::device_start() +{ + save_item(NAME(m_mode)); + save_item(NAME(m_lock)); + save_item(NAME(m_ram_enable)); + save_item(NAME(m_base)); +} + +void md_rom_starodys_device::device_reset() +{ + m_mode = 0; + m_lock = 0; + m_ram_enable = 1; + m_base = 0; +} + /*------------------------------------------------- mapper specific handlers -------------------------------------------------*/ @@ -1356,16 +1378,14 @@ WRITE16_MEMBER(md_rom_beggarp_device::write) m_nvram[offset & 0x3fff] = data; } +// this works the same as in standard SRAM carts WRITE16_MEMBER(md_rom_beggarp_device::write_a13) { if (offset == 0xf0/2) { - /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */ m_nvram_active = BIT(data, 0); m_nvram_readonly = BIT(data, 1); - // since a lot of generic carts ends up here if loaded from fullpath - // we turn on nvram (with m_nvram_handlers_installed) only if they toggle it on by writing here! if (m_nvram_active) m_nvram_handlers_installed = 1; } @@ -1388,7 +1408,7 @@ READ16_MEMBER(md_rom_wukong_device::read) if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active) return m_nvram[offset - m_nvram_start/2]; - // here can access both last 128K of the ROM and the first 128K, depending of bit7 of m_mode + // here can access both last 128K of the ROM and the first 128K, depending of m_mode if (offset >= 0x200000/2 && offset < 0x220000/2) return !m_mode ? m_rom[offset] : m_rom[offset & 0xffff]; else if (offset < 0x400000/2) @@ -1406,17 +1426,110 @@ WRITE16_MEMBER(md_rom_wukong_device::write) m_nvram[offset - m_nvram_start/2] = data; } +// this works the same as in standard SRAM carts WRITE16_MEMBER(md_rom_wukong_device::write_a13) { if (offset == 0xf0/2) { - /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */ m_nvram_active = BIT(data, 0); m_nvram_readonly = BIT(data, 1); - // since a lot of generic carts ends up here if loaded from fullpath - // we turn on nvram (with m_nvram_handlers_installed) only if they toggle it on by writing here! if (m_nvram_active) m_nvram_handlers_installed = 1; } } + + +/*------------------------------------------------- + STAR ODYSSEY + This game uses a slightly more complex mapper: + not only RAM can be enabled / disabled, but also + ROM can be mapped in three different modes. + In what we call Mode0 the first 256K are mirrored + into area 0x000000-0x1fffff; in Mode1 cart gives + access to 5x256K banks into area 0x000000-0x13ffff + and open bus into 0x140000-0x1fffff; in Mode2 the + ROM is disabled and the whole 0x000000-0x1fffff + gives open bus +-------------------------------------------------*/ + +READ16_MEMBER(md_rom_starodys_device::read) +{ + if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && m_ram_enable) + return m_nvram[offset & 0x3fff]; + + if (offset < 0x200000/2) + { + if (m_mode == 0) + return m_rom[offset & 0x3ffff]; + else if (m_mode == 1 && offset < 0x140000/2) + return m_rom[m_base * 0x40000/2 + offset]; + else + return 0xffff; + } + else if (offset < 0x400000/2) + return m_rom[offset & 0xfffff]; + else + return 0xffff; +} + +WRITE16_MEMBER(md_rom_starodys_device::write) +{ + if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && !m_nvram_readonly && m_ram_enable) + m_nvram[offset & 0x3fff] = data; + + if (offset < 0x10000/2) + { + UINT32 prot_offs = (offset * 2) & 0xf00; + if (!m_lock) + { + if (prot_offs == 0xd00) + { + //printf("RAM enable %s!\n", BIT(data, 7) ? "Yes" : "No"); + m_ram_enable = BIT(data, 7); + } + if (prot_offs == 0xe00) + { + if (BIT(data, 5)) + m_mode = 2; + else if (BIT(data, 6)) + m_mode = 1; + else + m_mode = 0; + //printf("ROM mode %d!\n", m_mode); + + if (!BIT(data, 7)) + { + //printf("LOCK BANKSWITCH!\n"); + m_lock = 1; + } + } + if (prot_offs == 0xf00) + { + m_base = ((data >> 4) & 7); + m_mode = 1; + //printf("ROM base %d!\n", m_base); + } + } + } + +} + +READ16_MEMBER(md_rom_starodys_device::read_a13) +{ + return m_base << 4; +} + +// this works the same as in standard SRAM carts +WRITE16_MEMBER(md_rom_starodys_device::write_a13) +{ + if (offset == 0xf0/2) + { + m_nvram_active = BIT(data, 0); + m_nvram_readonly = BIT(data, 1); + + if (m_nvram_active) + m_nvram_handlers_installed = 1; + } +} + diff --git a/src/devices/bus/megadrive/rom.h b/src/devices/bus/megadrive/rom.h index 796b29dc9fb..4e9b656e08a 100644 --- a/src/devices/bus/megadrive/rom.h +++ b/src/devices/bus/megadrive/rom.h @@ -545,6 +545,28 @@ private: UINT8 m_mode; }; +// ======================> md_rom_starodys_device + +class md_rom_starodys_device : public md_std_rom_device +{ +public: + // construction/destruction + md_rom_starodys_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // reading and writing + virtual DECLARE_READ16_MEMBER(read) override; + virtual DECLARE_WRITE16_MEMBER(write) override; + virtual DECLARE_READ16_MEMBER(read_a13) override; + virtual DECLARE_WRITE16_MEMBER(write_a13) override; + +private: + UINT8 m_mode, m_lock, m_ram_enable, m_base; +}; + // device type definition @@ -581,5 +603,6 @@ extern const device_type MD_ROM_TOPF; extern const device_type MD_ROM_RADICA; extern const device_type MD_ROM_BEGGARP; extern const device_type MD_ROM_WUKONG; +extern const device_type MD_ROM_STARODYS; #endif |