From 00a9f25e72fa206c1e2e3a0233b47899bfcb9a7a Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Sun, 10 Oct 2021 16:08:41 -0800 Subject: bus/nes: Added support for Super RPG 5 in 1. (#8680) New working software list additions (nes.xml) ----------------------------------- Super RPG 5 in 1 (CH501) [NewRisingSun] --- hash/nes.xml | 19 +++++++++ src/devices/bus/nes/mmc1_clones.cpp | 84 +++++++++++++++++++++++++++++++++++++ src/devices/bus/nes/mmc1_clones.h | 27 ++++++++++++ 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, 134 insertions(+), 2 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 270fe7185bf..a217c4a6e73 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -80956,6 +80956,25 @@ be better to redump them properly. --> + + Super RPG 5 in 1 (CH501) + 1996 + <pirate> + + + + + + + + + + + + + + + TV Game 5 in 1 1989 diff --git a/src/devices/bus/nes/mmc1_clones.cpp b/src/devices/bus/nes/mmc1_clones.cpp index 7abb4927087..9f37d3cac74 100644 --- a/src/devices/bus/nes/mmc1_clones.cpp +++ b/src/devices/bus/nes/mmc1_clones.cpp @@ -32,6 +32,7 @@ DEFINE_DEVICE_TYPE(NES_BMC_JY820845C, nes_bmc_jy820845c_device, "nes_bmc_jy82084 DEFINE_DEVICE_TYPE(NES_FARID_SLROM, nes_farid_slrom_device, "nes_farid_slrom", "NES Cart Farid SLROM 8 in 1 PCB") DEFINE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device, "nes_ninjaryu", "NES Cart Ninja Ryukenden Chinese PCB") DEFINE_DEVICE_TYPE(NES_RESETSXROM, nes_resetsxrom_device, "nes_resetsxrom", "NES Cart BMC RESET-SXROM PCB") +DEFINE_DEVICE_TYPE(NES_SRPG_5IN1, nes_srpg5in1_device, "nes_srpg5in1", "NES Cart Super RPG 5 in 1 PCB") DEFINE_DEVICE_TYPE(NES_TXC_22110, nes_txc_22110_device, "nes_txc_22110", "NES Cart TXC 01-22110-000 PCB") @@ -55,6 +56,11 @@ nes_resetsxrom_device::nes_resetsxrom_device(const machine_config &mconfig, cons { } +nes_srpg5in1_device::nes_srpg5in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_sxrom_device(mconfig, NES_SRPG_5IN1, tag, owner, clock), m_outer(0), m_outer_count(0), m_outer_latch(0) +{ +} + nes_txc_22110_device::nes_txc_22110_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_sxrom_device(mconfig, NES_TXC_22110, tag, owner, clock), m_latch0(0), m_mode(0) { @@ -102,6 +108,22 @@ void nes_resetsxrom_device::pcb_reset() nes_sxrom_device::pcb_reset(); } +void nes_srpg5in1_device::device_start() +{ + nes_sxrom_device::device_start(); + save_item(NAME(m_outer)); + save_item(NAME(m_outer_count)); + save_item(NAME(m_outer_latch)); +} + +void nes_srpg5in1_device::pcb_reset() +{ + m_outer = 0; + m_outer_count = 0; + m_outer_latch = 0; + nes_sxrom_device::pcb_reset(); +} + void nes_txc_22110_device::device_start() { nes_sxrom_device::device_start(); @@ -241,6 +263,68 @@ void nes_farid_slrom_device::write_m(offs_t offset, u8 data) -------------------------------------------------*/ +/*------------------------------------------------- + + BMC-SRPG-5IN1 (PCB has no distinguishing label) + + Games: Super RPG 5 in 1 CH501 + + MMC1 clone with banking for multigame menu. Note: This + game does not soft reset properly on real hardware. + + The interesting feature of this board is that it has a + serially written 4-bit shift register that selects the + outer game bank (meaning it has two shift registers, + since it also clones the MMC1's). The MSB (bit 3) seems + to indicate menu mode (0) or game mode (1), but it's not + clear if/how this is used. Is it a lock? We currently + don't use the MSB nor allow it to be read back. + + NES 2.0: mapper 543 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_srpg5in1_device::write_l(offs_t offset, u8 data) +{ + LOG_MMC(("srpg5in1 write_l, offset: %04x, data: %02x\n", offset, data)); + + offset += 0x100; + if (offset >= 0x1000) + { + m_outer_latch = (data & 0x08) | m_outer_latch >> 1; + m_outer_count = (m_outer_count + 1) & 0x03; + if (!m_outer_count) + { + m_outer = m_outer_latch; + set_prg(); + } + } +} + +void nes_srpg5in1_device::write_m(offs_t offset, u8 data) +{ + LOG_MMC(("srpg5in1 write_m, offset: %04x, data: %02x\n", offset, data)); + + u8 bank = BIT(m_outer, 1) ? bitswap<3>(m_outer, 1, 2, 0) : (m_outer & 1) << 1 | BIT(m_reg[1], 3); + + if (!BIT(m_reg[3], 4)) // WRAM enabled + m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)] = data; +} + +u8 nes_srpg5in1_device::read_m(offs_t offset) +{ + LOG_MMC(("srpg5in1 read_m, offset: %04x\n", offset)); + + u8 bank = BIT(m_outer, 1) ? bitswap<3>(m_outer, 1, 2, 0) : (m_outer & 1) << 1 | BIT(m_reg[1], 3); + + if (!BIT(m_reg[3], 4)) // WRAM enabled + return m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)]; + + return get_open_bus(); +} + /*------------------------------------------------- TXC 01-22110-000 Board diff --git a/src/devices/bus/nes/mmc1_clones.h b/src/devices/bus/nes/mmc1_clones.h index 7f46ac5ee3a..a20e1169ef4 100644 --- a/src/devices/bus/nes/mmc1_clones.h +++ b/src/devices/bus/nes/mmc1_clones.h @@ -96,6 +96,32 @@ private: }; +// ======================> nes_srpg5in1_device + +class nes_srpg5in1_device : public nes_sxrom_device +{ +public: + // construction/destruction + nes_srpg5in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read_m(offs_t offset) override; + virtual void write_l(offs_t offset, u8 data) override; + virtual void write_m(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + + virtual void set_prg() override { nes_sxrom_device::set_prg((m_outer & 0x07) << 4, 0x0f); } + virtual void set_chr() override { nes_sxrom_device::set_chr(0x00, 0x01); } + +private: + u8 m_outer, m_outer_count, m_outer_latch; +}; + + // ======================> nes_txc_22110_device class nes_txc_22110_device : public nes_sxrom_device @@ -127,6 +153,7 @@ DECLARE_DEVICE_TYPE(NES_BMC_JY820845C, nes_bmc_jy820845c_device) DECLARE_DEVICE_TYPE(NES_FARID_SLROM, nes_farid_slrom_device) DECLARE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device) DECLARE_DEVICE_TYPE(NES_RESETSXROM, nes_resetsxrom_device) +DECLARE_DEVICE_TYPE(NES_SRPG_5IN1, nes_srpg5in1_device) DECLARE_DEVICE_TYPE(NES_TXC_22110, nes_txc_22110_device) #endif // MAME_BUS_NES_MMC1_CLONES_H diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 6f38d3cabbf..6deb671cf2f 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -382,6 +382,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("bmc_850437c", NES_BMC_850437C); device.option_add_internal("bmc_970630c", NES_BMC_970630C); device.option_add_internal("bmc_jy820845c", NES_BMC_JY820845C); + device.option_add_internal("srpg_5in1", NES_SRPG_5IN1); device.option_add_internal("n32_4in1", NES_N32_4IN1); device.option_add_internal("ntd03", NES_NTD03); device.option_add_internal("bmc_ctc09", NES_BMC_CTC09); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 0075482f87f..b70b8156f4c 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -505,7 +505,7 @@ static const nes_mmc mmc_list[] = // 540 for mstrfgt6 in nes.xml or a variant of it not in nes.xml? { 541, BMC_LITTLECOM160 }, // 542 Chairman Mao's 100th anniversary cart? You've got to be kidding me. - // 543 5 in 1 (CH-501) multicart, not in nes.xml? + { 543, BMC_SRPG_5IN1 }, // 544 another alt of sango2ht/sanguo2a? // 545 4 in 1 (ST-80) multicart, not in nes.xml? // 546 10 in 1 Tenchi wo Kurau multicart, not in nes.xml? diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 251e146850a..95b55264383 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -263,6 +263,7 @@ static const nes_pcb pcb_list[] = { "bmc_850437c", BMC_850437C }, { "bmc_970630c", BMC_970630C }, { "bmc_jy820845c", BMC_JY820845C }, + { "srpg_5in1", BMC_SRPG_5IN1 }, { "n32_4in1", BMC_N32_4IN1 }, { "ntd03", BMC_NTD_03 }, { "bmc_ctc09", BMC_CTC09 }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index cdb673f9c32..e9d02522bce 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -98,7 +98,7 @@ enum BMC_HP898F, BMC_VT5201, BMC_BENSHIENG, BMC_60311C, BMC_80013B, BMC_810544C, BMC_830425C, BMC_830928C, BMC_850437C, BMC_970630C, - BMC_N32_4IN1, BMC_NC20MB, BMC_NT639, BMC_NTD_03, + BMC_N32_4IN1, BMC_NC20MB, BMC_NT639, BMC_NTD_03, BMC_SRPG_5IN1, BMC_EL860947C, BMC_EL861121C, BMC_FK23C, BMC_FK23CA, BMC_JY820845C, BMC_PJOY84, BMC_TH22913, BMC_11160, BMC_G146, BMC_2751, BMC_8157, BMC_00202650, -- cgit v1.2.3