From 7789a0d5faf474c40663cf7dcef5fecf883a97d7 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Mon, 4 Oct 2021 09:48:16 -0800 Subject: bus/nes: Added emulation for a couple homebrew 8 in 1 cartridges. (#8654) Adds support for two multi-game cartridges developed by "FARID". --- src/devices/bus/nes/mmc1_clones.cpp | 39 +++++++++++++++++++++++++++++ src/devices/bus/nes/mmc1_clones.h | 25 +++++++++++++++++++ src/devices/bus/nes/multigame.cpp | 50 +++++++++++++++++++++++++++++++++++++ src/devices/bus/nes/multigame.h | 22 ++++++++++++++++ src/devices/bus/nes/nes_carts.cpp | 2 ++ src/devices/bus/nes/nes_ines.hxx | 4 +-- src/devices/bus/nes/nes_pcb.hxx | 2 ++ src/devices/bus/nes/nes_slot.h | 2 +- src/devices/bus/nes/nes_unif.hxx | 2 ++ 9 files changed, 145 insertions(+), 3 deletions(-) diff --git a/src/devices/bus/nes/mmc1_clones.cpp b/src/devices/bus/nes/mmc1_clones.cpp index b0502e5f394..7abb4927087 100644 --- a/src/devices/bus/nes/mmc1_clones.cpp +++ b/src/devices/bus/nes/mmc1_clones.cpp @@ -29,6 +29,7 @@ //------------------------------------------------- DEFINE_DEVICE_TYPE(NES_BMC_JY820845C, nes_bmc_jy820845c_device, "nes_bmc_jy820845c", "NES Cart BMC JY820845C PCB") +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_TXC_22110, nes_txc_22110_device, "nes_txc_22110", "NES Cart TXC 01-22110-000 PCB") @@ -39,6 +40,11 @@ nes_bmc_jy820845c_device::nes_bmc_jy820845c_device(const machine_config &mconfig { } +nes_farid_slrom_device::nes_farid_slrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_sxrom_device(mconfig, NES_FARID_SLROM, tag, owner, clock), m_outer(0) +{ +} + nes_ninjaryu_device::nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_sxrom_device(mconfig, NES_NINJARYU, tag, owner, clock) { @@ -72,6 +78,18 @@ void nes_bmc_jy820845c_device::pcb_reset() update_banks(); } +void nes_farid_slrom_device::device_start() +{ + nes_sxrom_device::device_start(); + save_item(NAME(m_outer)); +} + +void nes_farid_slrom_device::pcb_reset() +{ + m_outer = 0; + nes_sxrom_device::pcb_reset(); +} + void nes_resetsxrom_device::device_start() { nes_sxrom_device::device_start(); @@ -188,6 +206,27 @@ void nes_bmc_jy820845c_device::write_h(offs_t offset, u8 data) update_banks(); } +/*------------------------------------------------- + + FARID_SLROM_8-IN-1 + + Games: 8 in 1 + + MMC1 clone with banking for multigame menu. + + NES 2.0: mapper 323 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_farid_slrom_device::write_m(offs_t offset, u8 data) +{ + LOG_MMC(("farid_slrom write_m, offset: %04x, data: %02x\n", offset, data)); + if (!BIT(m_reg[3], 4) && !BIT(m_outer, 3)) // MMC1 WRAM enabled and outer bank not locked + m_outer = data; +} + /*------------------------------------------------- BMC-RESET-SXROM diff --git a/src/devices/bus/nes/mmc1_clones.h b/src/devices/bus/nes/mmc1_clones.h index 2a1b7441cea..7f46ac5ee3a 100644 --- a/src/devices/bus/nes/mmc1_clones.h +++ b/src/devices/bus/nes/mmc1_clones.h @@ -34,6 +34,30 @@ private: }; +// ======================> nes_farid_slrom_device + +class nes_farid_slrom_device : public nes_sxrom_device +{ +public: + // construction/destruction + nes_farid_slrom_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; + + virtual void set_prg() override { nes_sxrom_device::set_prg((m_outer & 0x70) >> 1, 0x07); } + virtual void set_chr() override { nes_sxrom_device::set_chr((m_outer & 0x70) << 1, 0x1f); } + +private: + u8 m_outer; +}; + + // ======================> nes_ninjaryu_device class nes_ninjaryu_device : public nes_sxrom_device @@ -100,6 +124,7 @@ private: // device type definition 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_TXC_22110, nes_txc_22110_device) diff --git a/src/devices/bus/nes/multigame.cpp b/src/devices/bus/nes/multigame.cpp index 11c2e4a4331..6e38c8eae3d 100644 --- a/src/devices/bus/nes/multigame.cpp +++ b/src/devices/bus/nes/multigame.cpp @@ -33,6 +33,7 @@ DEFINE_DEVICE_TYPE(NES_CALTRON6IN1, nes_caltron6in1_device, "nes_caltron6i DEFINE_DEVICE_TYPE(NES_CALTRON9IN1, nes_caltron9in1_device, "nes_caltron9in1", "NES Cart Caltron 9 in 1 PCB") DEFINE_DEVICE_TYPE(NES_RUMBLESTATION, nes_rumblestat_device, "nes_rumblestat", "NES Cart Rumblestation PCB") DEFINE_DEVICE_TYPE(NES_SVISION16, nes_svision16_device, "nes_svision16", "NES Cart Supervision 16 in 1 PCB") +DEFINE_DEVICE_TYPE(NES_FARID_UNROM, nes_farid_unrom_device, "nes_farid_unrom", "NES Cart Farid UNROM 8 in 1 PCB") DEFINE_DEVICE_TYPE(NES_KN42, nes_kn42_device, "nes_kn42", "NES Cart KN-42 PCB") DEFINE_DEVICE_TYPE(NES_N625092, nes_n625092_device, "nes_n625092", "NES Cart N625092 PCB") DEFINE_DEVICE_TYPE(NES_A65AS, nes_a65as_device, "nes_a65as", "NES Cart A65AS PCB") @@ -139,6 +140,11 @@ nes_svision16_device::nes_svision16_device(const machine_config &mconfig, const { } +nes_farid_unrom_device::nes_farid_unrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_FARID_UNROM, tag, owner, clock), m_reg(0) +{ +} + nes_kn42_device::nes_kn42_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_KN42, tag, owner, clock), m_latch(0) { @@ -514,6 +520,21 @@ void nes_svision16_device::pcb_reset() m_latch2 = 0; } +void nes_farid_unrom_device::device_start() +{ + common_start(); + save_item(NAME(m_reg)); +} + +void nes_farid_unrom_device::pcb_reset() +{ + prg16_89ab(0); + prg16_cdef(7); + chr8(0, CHRRAM); + + m_reg &= 0x87; // only middle four bits cleared on soft reset +} + void nes_kn42_device::device_start() { common_start(); @@ -1275,6 +1296,35 @@ u8 nes_svision16_device::read_m(offs_t offset) return m_prg[((bank + 4) * 0x2000 + offset) % m_prg_size]; // +4 due to the 32KB menu } +/*------------------------------------------------- + + FARID_UNROM_8-IN-1 + + Games: 8 in 1 + + NES 2.0: mapper 324 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_farid_unrom_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("farid_unrom write_h, offset: %04x, data: %02x\n", offset, data)); + + // this pcb is subject to bus conflict + data = account_bus_conflict(offset, data); + + if (BIT(data, 7) && !(m_reg & 0x88)) + m_reg = data; + else + m_reg = (m_reg & 0x78) | (data & 0x87); + + u8 bank = (m_reg & 0x70) >> 1 | (m_reg & 0x07); + prg16_89ab(bank); + prg16_cdef(bank | 0x07); +} + /*------------------------------------------------- Bootleg Board KN-42 diff --git a/src/devices/bus/nes/multigame.h b/src/devices/bus/nes/multigame.h index 6dfbed4ee7e..c9c6f639cf3 100644 --- a/src/devices/bus/nes/multigame.h +++ b/src/devices/bus/nes/multigame.h @@ -116,6 +116,27 @@ private: }; +// ======================> nes_farid_unrom_device + +class nes_farid_unrom_device : public nes_nrom_device +{ +public: + // construction/destruction + nes_farid_unrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + +private: + u8 m_reg; +}; + + // ======================> nes_kn42_device class nes_kn42_device : public nes_nrom_device @@ -1129,6 +1150,7 @@ DECLARE_DEVICE_TYPE(NES_CALTRON6IN1, nes_caltron6in1_device) DECLARE_DEVICE_TYPE(NES_CALTRON9IN1, nes_caltron9in1_device) DECLARE_DEVICE_TYPE(NES_RUMBLESTATION, nes_rumblestat_device) DECLARE_DEVICE_TYPE(NES_SVISION16, nes_svision16_device) +DECLARE_DEVICE_TYPE(NES_FARID_UNROM, nes_farid_unrom_device) DECLARE_DEVICE_TYPE(NES_KN42, nes_kn42_device) DECLARE_DEVICE_TYPE(NES_N625092, nes_n625092_device) DECLARE_DEVICE_TYPE(NES_A65AS, nes_a65as_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index d42ecd514c4..d980365a9e8 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -462,6 +462,8 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("unrom512", NES_UNROM512); device.option_add_internal("2a03pur", NES_2A03PURITANS); device.option_add_internal("dpcmcart", NES_DPCMCART); + device.option_add_internal("farid_slrom8in1", NES_FARID_SLROM); + device.option_add_internal("farid_unrom8in1", NES_FARID_UNROM); // other unsupported... device.option_add_internal("unl_dance", NES_NROM); // UNSUPPORTED device.option_add_internal("onebus", NES_NROM); // UNSUPPORTED diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 5f8868085c7..8bb29031146 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -358,8 +358,8 @@ static const nes_mmc mmc_list[] = { 320, BMC_830425C }, // 321 duplicate of 287? // 322 BMC-K-3033 35-in-1, related to mc_35? - // 323 Farid SLROM homebrew 8-in-1 - // 324 Farid UNROM homebrew 8-in-1 + { 323, FARID_SLROM8IN1 }, // homebrew 8-in-1 + { 324, FARID_UNROM8IN1 }, // homebrew 8-in-1 { 325, UNL_MALISB }, // Super Mali Splash Bomb pirate hack { 326, BTL_CONTRAJ }, // 327 BMC-10-24-C-A1 6-in-1 diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index e1186988144..fdbe945c9eb 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -372,6 +372,8 @@ static const nes_pcb pcb_list[] = { "unrom512", UNL_UNROM512 }, { "2a03pur", UNL_2A03PURITANS }, { "dpcmcart", UNL_DPCMCART }, + { "farid_slrom8in1", FARID_SLROM8IN1 }, + { "farid_unrom8in1", FARID_UNROM8IN1 }, { "ffe3", FFE3_BOARD }, { "ffe4", FFE4_BOARD }, { "ffe8", FFE8_BOARD }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 5c6013e8f8a..e8ce215d760 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -143,7 +143,7 @@ enum // homebrew PCBs NOCASH_NOCHR, // homebrew PCB design which uses NTRAM for CHRRAM UNL_ACTION53, // homebrew PCB for homebrew multicarts - UNL_2A03PURITANS, + UNL_2A03PURITANS, FARID_SLROM8IN1, FARID_UNROM8IN1, // Batlab Electronics BATMAP_000, BATMAP_SRRX, // Sealie diff --git a/src/devices/bus/nes/nes_unif.hxx b/src/devices/bus/nes/nes_unif.hxx index 66eb6a00e90..8c153e869a2 100644 --- a/src/devices/bus/nes/nes_unif.hxx +++ b/src/devices/bus/nes/nes_unif.hxx @@ -134,6 +134,8 @@ static const unif unif_list[] = { "UNL-MALISB", 0, 0, CHRRAM_0, UNL_MALISB}, { "UNL-TF1201", 0, 0, CHRRAM_0, UNL_TF1201}, { "UNL-DANCE2000", 0, 8, CHRRAM_8, SUBOR_TYPE2}, // similar to some Subor carts + { "FARID_SLROM_8-IN-1", 0, 0, CHRRAM_0, FARID_SLROM8IN1}, + { "FARID_UNROM_8-IN-1", 0, 0, CHRRAM_8, FARID_UNROM8IN1}, { "BMC-12-IN-1", 0, 0, CHRRAM_0, UNSUPPORTED_BOARD}, { "BMC-70IN1", 0, 0, CHRRAM_0, UNSUPPORTED_BOARD}, // mapper 236 { "BMC-70IN1B", 0, 0, CHRRAM_0, UNSUPPORTED_BOARD}, // mapper 236 -- cgit v1.2.3