From caf6dd6b24cde2cb8127e19cc2adf52b7f43c841 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Sun, 15 Aug 2021 06:24:09 -0800 Subject: [PATCH] bus/nes: Added support of a pair of 4-in-1 multicarts. (#8441) New working software list additions (nes.xml) ----------------------------------- 4 in 1 (K-3131GS) [anonymous] 4 in 1 (K-3131SS) [anonymous] --- hash/nes.xml | 36 ++++++++++++++++++++ src/devices/bus/nes/mmc3_clones.cpp | 51 +++++++++++++++++++++++++++++ src/devices/bus/nes/mmc3_clones.h | 22 +++++++++++++ src/devices/bus/nes/nes_carts.cpp | 1 + src/devices/bus/nes/nes_ines.hxx | 2 +- src/devices/bus/nes/nes_pcb.hxx | 1 + src/devices/bus/nes/nes_slot.h | 2 +- 7 files changed, 113 insertions(+), 2 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 7e9730f5791..4cfad06aa2e 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -79233,6 +79233,42 @@ be better to redump them properly. --> + + 4 in 1 (K-3131GS) + 199? + <pirate> + + + + + + + + + + + + + + + + 4 in 1 (K-3131SS) + 199? + <pirate> + + + + + + + + + + + + + + 4 in 1 (KT-3445AB) 19?? diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 58f06d9309b..45f643d70be 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -61,6 +61,7 @@ DEFINE_DEVICE_TYPE(NES_BMC_HIK8, nes_bmc_hik8_device, "nes_bmc_hik8", 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_GN45, nes_bmc_gn45_device, "nes_bmc_gn45", "NES Cart BMC GN-45 PCB") DEFINE_DEVICE_TYPE(NES_BMC_GOLD7IN1, nes_bmc_gold7in1_device, "nes_bmc_gold7in1", "NES Cart BMC Golden 7 in 1 PCB") DEFINE_DEVICE_TYPE(NES_BMC_GC6IN1, nes_bmc_gc6in1_device, "nes_bmc_gc6in1", "NES Cart BMC Golden Card 6 in 1 PCB") DEFINE_DEVICE_TYPE(NES_BMC_K3006, nes_bmc_k3006_device, "nes_bmc_k3006", "NES Cart BMC K-3006 PCB") @@ -236,6 +237,11 @@ nes_bmc_f15_device::nes_bmc_f15_device(const machine_config &mconfig, const char { } +nes_bmc_gn45_device::nes_bmc_gn45_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_txrom_device(mconfig, NES_BMC_GN45, tag, owner, clock), m_lock(false) +{ +} + 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) { @@ -590,6 +596,20 @@ void nes_bmc_f15_device::pcb_reset() prg16_cdef(0); } +void nes_bmc_gn45_device::device_start() +{ + mmc3_start(); + save_item(NAME(m_lock)); +} + +void nes_bmc_gn45_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + + m_lock = false; + mmc3_common_initialize(0x0f, 0x7f, 0); +} + void nes_bmc_gold7in1_device::device_start() { mmc3_start(); @@ -2348,6 +2368,37 @@ void nes_fcgj8in1_device::write_m(offs_t offset, u8 data) } } +/*------------------------------------------------- + + BMC-GN-45 + + Games: 4 in 1 (K-3131GS and K-3131SS) + + MMC3 clone with banking for multigame menu. + + NES 2.0: mapper 366 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_bmc_gn45_device::write_m(offs_t offset, u8 data) +{ + LOG_MMC(("bmc_gn45 write_m, offset: %04x, data: %02x\n", offset, data)); + + nes_txrom_device::write_m(offset, data); // write to overlapping WRAM + + if (!m_lock) + { + m_prg_base = offset & 0x70; + set_prg(m_prg_base, m_prg_mask); + m_chr_base = m_prg_base << 3; + set_chr(m_chr_source, m_chr_base, m_chr_mask); + + m_lock = BIT(offset, 7); + } +} + /*------------------------------------------------- BMC-GOLD-7IN1 diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h index c44b529dc88..84ca31ccb4e 100644 --- a/src/devices/bus/nes/mmc3_clones.h +++ b/src/devices/bus/nes/mmc3_clones.h @@ -627,6 +627,27 @@ public: }; +// ======================> nes_bmc_gn45_device + +class nes_bmc_gn45_device : public nes_txrom_device +{ +public: + // construction/destruction + nes_bmc_gn45_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_m(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + +private: + bool m_lock; +}; + + // ======================> nes_bmc_gold7in1_device class nes_bmc_gold7in1_device : public nes_txrom_device @@ -822,6 +843,7 @@ DECLARE_DEVICE_TYPE(NES_BMC_HIK8, nes_bmc_hik8_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_GN45, nes_bmc_gn45_device) DECLARE_DEVICE_TYPE(NES_BMC_GOLD7IN1, nes_bmc_gold7in1_device) DECLARE_DEVICE_TYPE(NES_BMC_GC6IN1, nes_bmc_gc6in1_device) DECLARE_DEVICE_TYPE(NES_BMC_K3006, nes_bmc_k3006_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 52985640cc7..f3b69d7419f 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -429,6 +429,7 @@ void nes_cart(device_slot_interface &device) 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_gn45", NES_BMC_GN45); device.option_add_internal("bmc_gold7in1", NES_BMC_GOLD7IN1); device.option_add_internal("bmc_gc6in1", NES_BMC_GC6IN1); device.option_add_internal("bmc_411120c", NES_BMC_411120C); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 796fd63dd44..4f1fc9c3870 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -401,7 +401,7 @@ static const nes_mmc mmc_list[] = // 363 variant of mapper 358? // 364 JY-007, is this ttoons6 in nes.xml? // 365 is this asderp95 in nes.xml? - // 366 K-3131GS and K-3131SS 4-in-1 carts + { 366, BMC_GN45 }, // 367 7-in-1 cart that is a close variant of mapper 205 { 368, BTL_YUNG08 }, // SMB2 FDS conversion // 369 Super Mario Bros Party multicart diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 8ec381a72ad..ae35ffdaafa 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -306,6 +306,7 @@ static const nes_pcb pcb_list[] = { "bmc_hik4in1", BMC_SUPERHIK_4IN1 }, { "bmc_mario7in1", BMC_MARIOPARTY_7IN1 }, { "bmc_f15", BMC_F15 }, + { "bmc_gn45", BMC_GN45 }, { "bmc_gold7in1", BMC_GOLD_7IN1 }, { "bmc_gc6in1", BMC_GOLDENCARD_6IN1 }, { "bmc_411120c", BMC_411120C }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index d33b24e78a1..548de0a7aa7 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -86,7 +86,7 @@ enum TXC_22211, TXC_DUMARACING, TXC_MJBLOCK, TXC_COMMANDOS, TXC_TW, TXC_STRIKEW, // Multigame Carts - BMC_64IN1NR, BMC_190IN1, BMC_A65AS, BMC_F15, + BMC_64IN1NR, BMC_190IN1, BMC_A65AS, BMC_F15, BMC_GN45, BMC_HIK8IN1, BMC_NOVEL1, BMC_NOVEL2, BMC_S24IN1SC03, BMC_T262, BMC_WS, BMC_SUPERBIG_7IN1, BMC_SUPERHIK_4IN1, BMC_BALLGAMES_11IN1, BMC_MARIOPARTY_7IN1, BMC_GOLD_7IN1, BMC_SUPER_700IN1, BMC_FAMILY_4646,