From 9d040f801d6fb91cfcf5129172c14b9ec1c1d8e9 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Wed, 4 May 2022 12:56:14 -0800 Subject: [PATCH] bus/nes: Updated code and dump for mc_mario. (#9686) - Switched mc_mario to use BMC-GOLD-7IN1 board and removed emulation for variant BMC-MARIOPARTY-7IN1. Replaced its CHR ROM with bank swapped dump. - BMC-GOLD-7IN1: Fixed crash when carts with no WRAM are loaded. --- hash/nes.xml | 12 ++-- src/devices/bus/nes/mmc3_clones.cpp | 97 +++++------------------------ src/devices/bus/nes/mmc3_clones.h | 28 +-------- src/devices/bus/nes/nes_carts.cpp | 1 - src/devices/bus/nes/nes_ines.hxx | 10 --- src/devices/bus/nes/nes_pcb.hxx | 1 - src/devices/bus/nes/nes_slot.h | 2 +- 7 files changed, 26 insertions(+), 125 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index bb4f0238ba7..195b1c85872 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -66990,7 +66990,7 @@ We don't include these hacks because they were not burned into real carts nor so - + @@ -85638,16 +85638,16 @@ be better to redump them properly. --> - + - Mario 7 in 1 (Bad Dump) + Mario 7 in 1 19?? <pirate> - - + + - + diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 432f305b758..a83a853a8aa 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -73,7 +73,6 @@ DEFINE_DEVICE_TYPE(NES_BMC_JY302, nes_bmc_jy302_device, "nes_bmc_jy302", DEFINE_DEVICE_TYPE(NES_BMC_KC885, nes_bmc_kc885_device, "nes_bmc_kc885", "NES Cart BMC KC885 PCB") DEFINE_DEVICE_TYPE(NES_BMC_SFC12, nes_bmc_sfc12_device, "nes_bmc_sfc12", "NES Cart BMC SFC-12 PCB") DEFINE_DEVICE_TYPE(NES_BMC_HIK4, nes_bmc_hik4_device, "nes_bmc_hik4", "NES Cart BMC HIK 4 in 1 PCB") -DEFINE_DEVICE_TYPE(NES_BMC_MARIO7IN1, nes_bmc_mario7in1_device, "nes_bmc_mario7in1", "NES Cart BMC Mario 7 in 1 PCB") DEFINE_DEVICE_TYPE(NES_BMC_F15, nes_bmc_f15_device, "nes_bmc_f15", "NES Cart BMC F-15 PCB") DEFINE_DEVICE_TYPE(NES_BMC_F600, nes_bmc_f600_device, "nes_bmc_f600", "NES Cart BMC F600 PCB") DEFINE_DEVICE_TYPE(NES_BMC_GN45, nes_bmc_gn45_device, "nes_bmc_gn45", "NES Cart BMC GN-45 PCB") @@ -407,11 +406,6 @@ nes_bmc_hik4_device::nes_bmc_hik4_device(const machine_config &mconfig, const ch { } -nes_bmc_mario7in1_device::nes_bmc_mario7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_txrom_device(mconfig, NES_BMC_MARIO7IN1, tag, owner, clock), m_reg_written(0) -{ -} - nes_bmc_f15_device::nes_bmc_f15_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_txrom_device(mconfig, NES_BMC_F15, tag, owner, clock) { @@ -429,8 +423,8 @@ nes_bmc_gn45_device::nes_bmc_gn45_device(const machine_config &mconfig, const ch { } -nes_bmc_gold7in1_device::nes_bmc_gold7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_txrom_device(mconfig, NES_BMC_GOLD7IN1, tag, owner, clock), m_reg_written(0) +nes_bmc_gold7in1_device::nes_bmc_gold7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_txrom_device(mconfig, NES_BMC_GOLD7IN1, tag, owner, clock), m_lock(false) { } @@ -899,20 +893,6 @@ void nes_bmc_hik4_device::pcb_reset() mmc3_common_initialize(0x0f, 0x7f, 0); } -void nes_bmc_mario7in1_device::device_start() -{ - mmc3_start(); - save_item(NAME(m_reg_written)); -} - -void nes_bmc_mario7in1_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - - m_reg_written = 0; - mmc3_common_initialize(0x1f, 0xff, 0); -} - void nes_bmc_f15_device::pcb_reset() { m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; @@ -950,14 +930,12 @@ void nes_bmc_gn45_device::pcb_reset() void nes_bmc_gold7in1_device::device_start() { mmc3_start(); - save_item(NAME(m_reg_written)); + save_item(NAME(m_lock)); } void nes_bmc_gold7in1_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - - m_reg_written = 0; + m_lock = false; mmc3_common_initialize(0x1f, 0xff, 0); } @@ -2886,47 +2864,6 @@ void nes_bmc_hik4_device::write_m(offs_t offset, u8 data) } } -/*------------------------------------------------- - - BMC-MARIOPARTY-7IN1 - - Known Boards: Unknown Multigame Bootleg Board - Games: Mario 7 in 1 - - MMC3 clone - - iNES: mapper 52 - - In MESS: Supported. - - -------------------------------------------------*/ - -void nes_bmc_mario7in1_device::write_m(offs_t offset, uint8_t data) -{ - uint8_t helper1, helper2; - LOG_MMC(("bmc_mario7in1 write_m, offset: %04x, data: %02x\n", offset, data)); - - /* mid writes only work when WRAM is enabled. not sure if I should - change the condition to m_map52_reg_written == 0x80 (i.e. what is the effect of - the read-only bit?) and it only can happen once! */ - if ((m_wram_protect & 0x80) && !m_reg_written) - { - helper1 = (data & 0x08); - helper2 = (data & 0x40); - - m_prg_base = helper1 ? ((data & 0x07) << 4) : ((data & 0x06) << 4); - m_prg_mask = helper1 ? 0x0f : 0x1f; - m_chr_base = ((data & 0x20) << 4) | ((data & 0x04) << 6) | (helper2 ? ((data & 0x10) << 3) : 0); - m_chr_mask = helper2 ? 0x7f : 0xff; - set_prg(m_prg_base, m_prg_mask); - set_chr(m_chr_source, m_chr_base, m_chr_mask); - - m_reg_written = 1; - } - else - m_prgram[offset] = data; -} - /*------------------------------------------------- BMC-A88S-1 @@ -3152,36 +3089,34 @@ void nes_bmc_gn45_device::write_m(offs_t offset, u8 data) Known Boards: Unknown Multigame Bootleg Board Games: Super HIK Gold 7 in 1, Golden 7 in 1 and many more - MMC3 clone, same as BMC-MARIOPARTY-7IN1 but with switched CHR - bank lines + MMC3 clone with banking for multigame menu. iNES: mapper 52 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_bmc_gold7in1_device::write_m(offs_t offset, uint8_t data) +void nes_bmc_gold7in1_device::write_m(offs_t offset, u8 data) { - uint8_t helper1, helper2; LOG_MMC(("bmc_gold7in1 write_m, offset: %04x, data: %02x\n", offset, data)); - if ((m_wram_protect & 0x80) && !m_reg_written) + if ((m_wram_protect & 0xc0) == 0x80 && !m_lock) { - helper1 = (data & 0x08); - helper2 = (data & 0x40); + u8 prg128k = BIT(data, 3); + u8 chr128k = BIT(data, 6); - m_prg_base = helper1 ? ((data & 0x07) << 4) : ((data & 0x06) << 4); - m_prg_mask = helper1 ? 0x0f : 0x1f; - m_chr_base = ((data & 0x20) << 3) | ((data & 0x04) << 7) | (helper2 ? ((data & 0x10) << 3) : 0); - m_chr_mask = helper2 ? 0x7f : 0xff; + m_prg_base = (data & (0x06 | prg128k)) << 4; + m_prg_mask = 0x1f >> prg128k; + m_chr_base = (bitswap<3>(data, 2, 5, 4) & (0x06 | chr128k)) << 7; + m_chr_mask = 0xff >> chr128k; set_prg(m_prg_base, m_prg_mask); set_chr(m_chr_source, m_chr_base, m_chr_mask); - m_reg_written = BIT(data, 7); // mc_2hikg & mc_s3nt3 write here multiple time + m_lock = BIT(data, 7); // mc_2hikg & mc_s3nt3 write here multiple time } else - m_prgram[offset] = data; + nes_txrom_device::write_m(offset, data); // write WRAM } /*------------------------------------------------- diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h index 9c97a04f69e..47f0d4cff5f 100644 --- a/src/devices/bus/nes/mmc3_clones.h +++ b/src/devices/bus/nes/mmc3_clones.h @@ -846,27 +846,6 @@ private: }; -// ======================> nes_bmc_mario7in1_device - -class nes_bmc_mario7in1_device : public nes_txrom_device -{ -public: - // construction/destruction - nes_bmc_mario7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - virtual void write_m(offs_t offset, uint8_t data) override; - - virtual void pcb_reset() override; - -protected: - // device-level overrides - virtual void device_start() override; - -private: - uint8_t m_reg_written; -}; - - // ======================> nes_bmc_f15_device class nes_bmc_f15_device : public nes_txrom_device @@ -936,9 +915,9 @@ class nes_bmc_gold7in1_device : public nes_txrom_device { public: // construction/destruction - nes_bmc_gold7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_bmc_gold7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - virtual void write_m(offs_t offset, uint8_t data) override; + virtual void write_m(offs_t offset, u8 data) override; virtual void pcb_reset() override; @@ -947,7 +926,7 @@ protected: virtual void device_start() override; private: - uint8_t m_reg_written; + bool m_lock; }; @@ -1266,7 +1245,6 @@ DECLARE_DEVICE_TYPE(NES_BMC_JY302, nes_bmc_jy302_device) DECLARE_DEVICE_TYPE(NES_BMC_KC885, nes_bmc_kc885_device) DECLARE_DEVICE_TYPE(NES_BMC_SFC12, nes_bmc_sfc12_device) DECLARE_DEVICE_TYPE(NES_BMC_HIK4, nes_bmc_hik4_device) -DECLARE_DEVICE_TYPE(NES_BMC_MARIO7IN1, nes_bmc_mario7in1_device) DECLARE_DEVICE_TYPE(NES_BMC_F15, nes_bmc_f15_device) DECLARE_DEVICE_TYPE(NES_BMC_F600, nes_bmc_f600_device) DECLARE_DEVICE_TYPE(NES_BMC_GN45, nes_bmc_gn45_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 701d12eda22..1b04e56d5e2 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -474,7 +474,6 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("bmc_kc885", NES_BMC_KC885); device.option_add_internal("bmc_sfc12", NES_BMC_SFC12); device.option_add_internal("bmc_hik4in1", NES_BMC_HIK4); - device.option_add_internal("bmc_mario7in1", NES_BMC_MARIO7IN1); device.option_add_internal("bmc_f15", NES_BMC_F15); device.option_add_internal("bmc_f600", NES_BMC_F600); device.option_add_internal("bmc_gn45", NES_BMC_GN45); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 1d5266520e7..69b01ed120a 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -1037,11 +1037,6 @@ void nes_cart_slot_device::call_load_ines() m_pcb_id = WAIXING_DQ8; // Mapper 242 is used for 2 diff boards break; - case BMC_GOLD_7IN1: - if (crc_hack) - m_pcb_id = BMC_MARIOPARTY_7IN1; // Mapper 52 is used for 2 diff boards - break; - case BTL_MARIOBABY: if (crc_hack) m_pcb_id = BTL_AISENSHINICOL; // Mapper 42 is used for 2 diff boards @@ -1328,11 +1323,6 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa pcb_id = WAIXING_DQ8; // Mapper 242 is used for 2 diff boards break; - case BMC_GOLD_7IN1: - if (crc_hack) - pcb_id = BMC_MARIOPARTY_7IN1; // Mapper 52 is used for 2 diff boards - break; - case BTL_MARIOBABY: if (crc_hack) pcb_id = BTL_AISENSHINICOL; // Mapper 42 is used for 2 diff boards diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 8e75f82aa01..59da23cf7fc 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -350,7 +350,6 @@ static const nes_pcb pcb_list[] = { "bmc_kc885", BMC_KC885 }, { "bmc_sfc12", BMC_SFC12 }, { "bmc_hik4in1", BMC_SUPERHIK_4IN1 }, - { "bmc_mario7in1", BMC_MARIOPARTY_7IN1 }, { "bmc_f15", BMC_F15 }, { "bmc_f600", BMC_F600 }, { "bmc_gn45", BMC_GN45 }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 374c60b0233..59da856727f 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -89,7 +89,7 @@ enum BMC_GN45, BMC_HIK8IN1, BMC_SFC12, BMC_JY208, BMC_JY302, BMC_KC885, BMC_KL06, BMC_S24IN1SC03, BMC_T262, BMC_TELETUBBIES, BMC_WS, BMC_SUPERBIG_7IN1, BMC_SUPERHIK_4IN1, BMC_BALLGAMES_11IN1, - BMC_MARIOPARTY_7IN1, BMC_GOLD_7IN1, BMC_SUPER_700IN1, BMC_FAMILY_4646, + BMC_GOLD_7IN1, BMC_SUPER_700IN1, BMC_FAMILY_4646, BMC_36IN1, BMC_21IN1, BMC_150IN1, BMC_35IN1, BMC_64IN1, BMC_8IN1, BMC_15IN1, BMC_SUPERHIK_300IN1, BMC_SUPERGUN_20IN1, BMC_72IN1, BMC_SUPER_42IN1, BMC_76IN1,