diff --git a/hash/megadriv.xml b/hash/megadriv.xml index 5be94c4d763..c768981775b 100644 --- a/hash/megadriv.xml +++ b/hash/megadriv.xml @@ -26119,7 +26119,19 @@ Notice that these are not working on real hardware due to bugged code with VDP i - + + Beggar Prince (USA) + 2005 + Super Fighter Team + + + + + + + + + Xin Qi Gai Wang Zi (Chi, Alt) 1996 C&E @@ -26131,7 +26143,7 @@ Notice that these are not working on real hardware due to bugged code with VDP i - + Xin Qi Gai Wang Zi (Chi) 1996 C&E @@ -26863,6 +26875,18 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Super Mario World 64 + 199? + <unknown> + + + + + + + + The Battle of Red Cliffs - Romance of the Three Kingdoms 199? @@ -27300,6 +27324,28 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Chip 'n Dale Rescue Rangers (Rus) + 199? + <unknown> + + + + + + + + + Chip 'n Dale Rescue Rangers 2 (Rus) + 199? + <unknown> + + + + + + + Command & Conquer (Prototype) 199? @@ -27344,6 +27390,17 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Darkwing Duck (Rus) + 199? + <unknown> + + + + + + + Death Caliber (Rus) 199? @@ -27390,6 +27447,28 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Dragon Ball Final Bout (Chi?) + 1998 + <unknown> + + + + + + + + + Felix the Cat (Rus) + 199? + <unknown> + + + + + + + FIFA World Cup 2002 (Rus) 199? @@ -27682,6 +27761,18 @@ Notice that these are not working on real hardware due to bugged code with VDP i 199? <unknown> + + + + + + + + + Mario 3 - Vokrug Sveta (Rus, Demo?) + 199? + <unknown> + @@ -27701,30 +27792,6 @@ Notice that these are not working on real hardware due to bugged code with VDP i - - - Super Mario World 64 - 199? - <unknown> - - - - - - - - - - Super Mario World 64 (Hacked Protection) - 199? - <unknown> - - - - - - - Metal Gear Solid (Rus) 199? @@ -27880,6 +27947,17 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Samurai Spirits II (Pirate) + 199? + <unknown> + + + + + + + Shrek (Rus) 199? diff --git a/src/mess/drivers/megadriv.c b/src/mess/drivers/megadriv.c index c3f2b3727ff..e6a6f997ab9 100644 --- a/src/mess/drivers/megadriv.c +++ b/src/mess/drivers/megadriv.c @@ -341,6 +341,7 @@ static SLOT_INTERFACE_START(md_cart) SLOT_INTERFACE_INTERNAL("rom_sbubl", MD_ROM_SBUBL) SLOT_INTERFACE_INTERNAL("rom_smb", MD_ROM_SMB) SLOT_INTERFACE_INTERNAL("rom_smb2", MD_ROM_SMB2) + SLOT_INTERFACE_INTERNAL("rom_smw64", MD_ROM_SMW64) SLOT_INTERFACE_INTERNAL("rom_smouse", MD_ROM_SMOUSE) SLOT_INTERFACE_INTERNAL("rom_soulb", MD_ROM_SOULB) SLOT_INTERFACE_INTERNAL("rom_squir", MD_ROM_SQUIR) diff --git a/src/mess/machine/md_rom.c b/src/mess/machine/md_rom.c index 262eb2d145e..aae29b4f450 100644 --- a/src/mess/machine/md_rom.c +++ b/src/mess/machine/md_rom.c @@ -27,6 +27,7 @@ const device_type MD_ROM_FRAM = &device_creator; const device_type MD_ROM_SSF2 = &device_creator; const device_type MD_ROM_BUGSLIFE = &device_creator; const device_type MD_ROM_SMOUSE = &device_creator; +const device_type MD_ROM_SMW64 = &device_creator; const device_type MD_ROM_SMB = &device_creator; const device_type MD_ROM_SMB2 = &device_creator; const device_type MD_ROM_SBUBL = &device_creator; @@ -101,6 +102,11 @@ md_rom_smb2_device::md_rom_smb2_device(const machine_config &mconfig, const char { } +md_rom_smw64_device::md_rom_smw64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : md_std_rom_device(mconfig, MD_ROM_SMW64, "MD Super Mario World 64", tag, owner, clock) +{ +} + md_rom_sbubl_device::md_rom_sbubl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : md_std_rom_device(mconfig, MD_ROM_SBUBL, "MD Super Bubble Bobble", tag, owner, clock) { @@ -253,6 +259,19 @@ void md_rom_squir_device::device_start() save_item(NAME(m_latch)); } +void md_rom_smw64_device::device_start() +{ + m_latch0 = 0xf; + m_latch1 = 0xf; + memset(m_reg, 0, sizeof(m_reg)); + memset(m_ctrl, 0, sizeof(m_ctrl)); + + save_item(NAME(m_latch0)); + save_item(NAME(m_latch1)); + save_item(NAME(m_reg)); + save_item(NAME(m_ctrl)); +} + void md_rom_topf_device::device_start() { m_latch = 0; @@ -817,6 +836,121 @@ READ16_MEMBER(md_rom_smb2_device::read_a13) return 0xffff; } +/*------------------------------------------------- + SUPER MARIO WORLD 64 + -------------------------------------------------*/ + +READ16_MEMBER(md_rom_smw64_device::read) +{ + // 0x000000-0x0fffff: lower 512KB ROM (up to 0x07ffff) + mirror + // 0x600000-0x6fffff: internal hardware (up to 0x67ffff) + mirror + // Namely, + // * 60xxx = bank1 of the upper 512KB ROM + // * 61xxx = bank2 of the upper 512KB ROM + // * 62xxx = alternate 4KB chunks of 0x0000 ~ 0xffff + // * 63xxx = same as 62xxx + // * 64xxx = returns 0x0000 + // * 65xxx = same as 64xxx + // * 66xxx = CTRL/DATA + // * 67xxx = CTRL/DATA + if (offset < 0x100000/2) + return m_rom[offset & 0x3ffff]; + + if ((offset >= 0x600000/2) && (offset < 0x610000/2)) + return m_rom[(m_latch0 * 0x10000)/2 + (offset & 0x7fff)]; + if ((offset >= 0x610000/2) && (offset < 0x620000/2)) + return m_rom[(m_latch1 * 0x10000)/2 + (offset & 0x7fff)]; + + if ((offset >= 0x620000/2) && (offset < 0x640000/2)) + return (offset & 0x1000/2) ? 0x0000 : 0xffff; + if ((offset >= 0x640000/2) && (offset < 0x660000/2)) + return 0x0000; + + if ((offset >= 0x660000/2) && (offset < 0x670000/2)) + { + offset &= 7; + switch (offset) + { + case 0x0: + case 0x2: + case 0x4: + return m_reg[offset/2]; // DATA1, DATA2, DATA3 + case 0x1: + case 0x3: + case 0x5: + return m_reg[offset/2] + 1; // DATA1+1, DATA2+1, DATA3+1 + case 0x6: + return m_reg[2] + 2; // DATA3+2 + case 0x7: + return m_reg[2] + 3; // DATA3+3 + } + } + if ((offset >= 0x670000/2) && (offset < 0x680000/2)) + { + UINT16 data = (m_ctrl[1] & 0x80) ? ((m_ctrl[2] & 0x40) ? (m_reg[4] & m_reg[5]) : (m_reg[4] ^ 0xff)) : 0x0000; + if (offset & 0x1) // odd offset, return lower 7 bits of the above + return data & 0x7f; + else // even offset, return whole data above, but also update the regs if CTRL3 has 0x80 set + { + if (m_ctrl[2] & 0x80) // update regs if CTRL3 has bit7 set + { + if (m_ctrl[2] & 0x20) + m_reg[2] = (m_reg[5] << 2) & 0xfc; // DATA3 + else + m_reg[0] = ((m_reg[4] << 1) ^ m_reg[3]) & 0xfe; // DATA1 + } + return data; + } + } + + return 0xffff; +} + +WRITE16_MEMBER(md_rom_smw64_device::write) +{ + // 0x600000-0x6fffff: internal hardware (up to 0x67ffff) + mirror + // Namely, + // * 62xxx/63xxx = unknown/unmapped + // * 65xxx/66xxx = unknown/unmapped + // * remaining ranges = CTRL/DATA + if ((offset >= 0x600000/2) && (offset < 0x610000/2)) + { + if (offset & 1) + { + if ((m_ctrl[0] & 7) == 0) + m_reg[0] = ((m_reg[0] ^ m_reg[3]) ^ data) & 0xfe; // DATA1 + if ((m_ctrl[0] & 7) == 1) + m_reg[1] = data & 0xfe; // DATA2 + if ((m_ctrl[0] & 7) == 7) + m_latch1 = 8 + ((data & 0x1c) >> 2); // ROM BANKSWITCH $61 + m_reg[3] = data; // DATA4 + } + else + m_ctrl[0] = data; // CTRL1 + } + if ((offset >= 0x610000/2) && (offset < 0x620000/2)) + { + if (offset & 1) + m_ctrl[1] = data; // CTRL2 + } + if ((offset >= 0x640000/2) && (offset < 0x650000/2)) + { + if (offset & 1) + m_reg[5] = data; // DATA6 + else + m_reg[4] = data; // DATA5 + } + if ((offset >= 0x670000/2) && (offset < 0x680000/2)) + { + if (!(offset & 1)) + { + m_ctrl[2] = data; // CTRL3 + if (m_ctrl[1] & 0x80) + m_latch0 = 8 + ((data & 0x1c) >> 2); // ROM BANKSWITCH $60 + } + } +} + /*------------------------------------------------- TOP FIGHTER -------------------------------------------------*/ diff --git a/src/mess/machine/md_rom.h b/src/mess/machine/md_rom.h index 22fdea5d95c..90e643a75af 100644 --- a/src/mess/machine/md_rom.h +++ b/src/mess/machine/md_rom.h @@ -369,6 +369,28 @@ public: virtual DECLARE_READ16_MEMBER(read_a13); }; +// ======================> md_rom_smw64_device + +class md_rom_smw64_device : public md_std_rom_device +{ +public: + // construction/destruction + md_rom_smw64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete() { m_shortname = "md_rom_smw64"; } + + // reading and writing + virtual DECLARE_READ16_MEMBER(read); + virtual DECLARE_WRITE16_MEMBER(write); + +private: + UINT32 m_latch0, m_latch1; + UINT16 m_reg[6]; + UINT16 m_ctrl[3]; +}; + // ======================> md_rom_smouse_device class md_rom_smouse_device : public md_std_rom_device @@ -484,6 +506,7 @@ extern const device_type MD_ROM_RX3; extern const device_type MD_ROM_SBUBL; extern const device_type MD_ROM_SMB; extern const device_type MD_ROM_SMB2; +extern const device_type MD_ROM_SMW64; extern const device_type MD_ROM_SMOUSE; extern const device_type MD_ROM_SOULB; extern const device_type MD_ROM_SSF2; @@ -491,8 +514,4 @@ extern const device_type MD_ROM_SQUIR; extern const device_type MD_ROM_TOPF; extern const device_type MD_ROM_RADICA; -// this are currently unused... protection is directly patched out! -extern const device_type MD_ROM_MULAN; -extern const device_type MD_ROM_POKE2; - #endif diff --git a/src/mess/machine/md_slot.c b/src/mess/machine/md_slot.c index 958bb6431a8..b0a1ef70d8e 100644 --- a/src/mess/machine/md_slot.c +++ b/src/mess/machine/md_slot.c @@ -277,6 +277,7 @@ static const md_slot slot_list[] = { SBUBBOB, "rom_sbubl" }, { SMB, "rom_smb" }, { SMB2, "rom_smb2" }, + { SMW64, "rom_smw64" }, { SMOUSE, "rom_smouse" }, { SOULBLAD, "rom_soulblad" }, { SQUIRRELK, "rom_squir" }, diff --git a/src/mess/machine/md_slot.h b/src/mess/machine/md_slot.h index ba70f37d6c9..c6806b3d068 100644 --- a/src/mess/machine/md_slot.h +++ b/src/mess/machine/md_slot.h @@ -21,7 +21,7 @@ enum // Cart + NVRAM SEGA_SRAM, SEGA_FRAM, HARDBALL95, /* Hardball 95 uses different sram start address */ - BEGGAR, /* Xin Qigai Wangzi uses different sram start address and has no valid header */ + BEGGAR, /* Beggar Prince / Xin Qigai Wangzi uses different sram start address and has no valid header */ // EEPROM SEGA_EEPROM, /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */ @@ -60,6 +60,7 @@ enum SBUBBOB, /* Super Bubble Bobble */ SMB, /* Super Mario Bros. */ SMB2, /* Super Mario Bros. 2 */ + SMW64, /* Super Mario World 64 */ SMOUSE, /* Smart Mouse */ SOULBLAD, /* Soul Blade */ SQUIRRELK, /* Squirrel King */