From 968fb7f491a1eab76034b8a4fe14ad1f32060a88 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Wed, 8 Sep 2021 16:31:48 -0800 Subject: [PATCH 1/2] bus/nes: Added support for MMC1-based multicarts. - Modified MMC1 base class (SxROM) to have outer bank base/mask to make it extensible by multicarts. - Implemented two boards, reset-based SxROM and a 2-in-1 by TXC, as proof of concept. - Marked Operation Wolf games as partially supported due to zapper inputs not working. - Marked Space Shadow as not supported since it requires the extra buttons on the Bandai Hyper Shot gun. New working software list additions (nes.xml) ----------------------------------- 1997 Super HiK 4 in 1 (JY-021) [MLX] 1995 Super HiK 4 in 1 (JY-022) [NewRisingSun, taizou] 1996 Super HiK 4 in 1 (JY-051) [NewRisingSun, taizou] 2 in 1 Uzi Lightgun [CaH4e3] --- hash/nes.xml | 78 +++++++++++++- scripts/src/bus.lua | 2 + src/devices/bus/nes/mmc1.cpp | 39 +++++-- src/devices/bus/nes/mmc1.h | 5 +- src/devices/bus/nes/mmc1_clones.cpp | 153 ++++++++++++++++++++++++++++ src/devices/bus/nes/mmc1_clones.h | 63 ++++++++++++ src/devices/bus/nes/nes_carts.cpp | 3 + src/devices/bus/nes/nes_ines.hxx | 12 +-- src/devices/bus/nes/nes_pcb.hxx | 2 + src/devices/bus/nes/nes_slot.h | 6 +- 10 files changed, 342 insertions(+), 21 deletions(-) create mode 100644 src/devices/bus/nes/mmc1_clones.cpp create mode 100644 src/devices/bus/nes/mmc1_clones.h diff --git a/hash/nes.xml b/hash/nes.xml index 909c1363771..2f8ccec44a2 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -27662,7 +27662,8 @@ license:CC0 - + + Operation Wolf (Jpn) 1989 Taito @@ -27683,7 +27684,8 @@ license:CC0 - + + Operation Wolf - Take no Prisoners (USA, Rev. 0A) 1989 Taito @@ -27703,7 +27705,8 @@ license:CC0 - + + Operation Wolf - Take no Prisoners (Euro) 1992 Taito @@ -49948,7 +49951,8 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - + + Space Shadow (Jpn) 1989 Bandai @@ -51850,6 +51854,38 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + + 1997 Super HiK 4 in 1 (JY-021) + 1997 + J.Y. Company + + + + + + + + + + + + + + 1995 Super HiK 4 in 1 (JY-022) + 1995 + J.Y. Company + + + + + + + + + + + + 1995 Super HiK 4 in 1 (JY-023) 1995 @@ -52019,6 +52055,23 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + + + 1996 Super HiK 4 in 1 (JY-051) + 1996 + J.Y. Company + + + + + + + + + + + + 1996 Super HiK 4 in 1 (JY-057) 1996 @@ -54488,6 +54541,23 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + + + 2 in 1 Uzi Lightgun + 199? + Micro Genius + + + + + + + + + + + + Creatom (Tw, Spa) diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index f0349738813..a3c46945b3c 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -2830,6 +2830,8 @@ if (BUSES["NES"]~=null) then MAME_DIR .. "src/devices/bus/nes/legacy.h", MAME_DIR .. "src/devices/bus/nes/mmc1.cpp", MAME_DIR .. "src/devices/bus/nes/mmc1.h", + MAME_DIR .. "src/devices/bus/nes/mmc1_clones.cpp", + MAME_DIR .. "src/devices/bus/nes/mmc1_clones.h", MAME_DIR .. "src/devices/bus/nes/mmc2.cpp", MAME_DIR .. "src/devices/bus/nes/mmc2.h", MAME_DIR .. "src/devices/bus/nes/mmc3.cpp", diff --git a/src/devices/bus/nes/mmc1.cpp b/src/devices/bus/nes/mmc1.cpp index 9a27c601b4c..cb752cb0754 100644 --- a/src/devices/bus/nes/mmc1.cpp +++ b/src/devices/bus/nes/mmc1.cpp @@ -13,6 +13,10 @@ * 001 Yoshi flashes in-game. * 001 Back to the Future have heavily corrupted graphics (since forever). + TODO: + - Combine 2 versions of set_prg in SxROM base class. This means dealing with + variant boards SNROM, SUROM, etc which repurpose bits in the MMC1 regs. + ***********************************************************************************************************/ @@ -142,6 +146,28 @@ TIMER_CALLBACK_MEMBER( nes_sxrom_device::resync_callback ) } +// Standard MMC1 PRG banking with base and mask (to support multicarts, etc) +void nes_sxrom_device::set_prg(int prg_base, int prg_mask) +{ + u8 bank = prg_base | (m_reg[3] & prg_mask); + + switch ((m_reg[0] >> 2) & 3) + { + case 0: + case 1: + prg32(bank >> 1); + break; + case 2: + prg16_89ab(prg_base); + prg16_cdef(bank); + break; + case 3: + prg16_89ab(bank); + prg16_cdef(prg_base | prg_mask); + break; + } +} + void nes_sxrom_device::set_prg() { uint8_t prg_mode, prg_offset; @@ -177,17 +203,16 @@ void nes_sxrom_device::set_prg() } } -void nes_sxrom_device::set_chr() +// Standard MMC1 CHR banking with base and mask (to support multicarts, etc) +void nes_sxrom_device::set_chr(int chr_base, int chr_mask) { - uint8_t chr_mode = BIT(m_reg[0], 4); - - if (chr_mode) + if (BIT(m_reg[0], 4)) { - chr4_0(m_reg[1] & 0x1f, m_chr_source); - chr4_4(m_reg[2] & 0x1f, m_chr_source); + chr4_0(chr_base | (m_reg[1] & chr_mask), m_chr_source); + chr4_4(chr_base | (m_reg[2] & chr_mask), m_chr_source); } else - chr8((m_reg[1] & 0x1f) >> 1, m_chr_source); + chr8((chr_base | (m_reg[1] & chr_mask)) >> 1, m_chr_source); } // this allows for easier implementation of the NES-EVENT board used for Nintento World Championships diff --git a/src/devices/bus/nes/mmc1.h b/src/devices/bus/nes/mmc1.h index c8ccb835d76..bc2198c33aa 100644 --- a/src/devices/bus/nes/mmc1.h +++ b/src/devices/bus/nes/mmc1.h @@ -31,8 +31,11 @@ protected: TIMER_CALLBACK_MEMBER(resync_callback); virtual void update_regs(int reg); // this is needed to simplify NES-EVENT pcb implementation, which handle differently some regs! + void set_prg(int prg_base, int prg_mask); + void set_chr(int chr_base, int chr_mask); virtual void set_prg(); - virtual void set_chr(); +// virtual void set_prg() { set_prg(0x00, 0x0f); } + virtual void set_chr() { set_chr(0x00, 0x1f); } uint8_t m_reg[4]; int m_reg_write_enable; diff --git a/src/devices/bus/nes/mmc1_clones.cpp b/src/devices/bus/nes/mmc1_clones.cpp new file mode 100644 index 00000000000..5d813cd36d3 --- /dev/null +++ b/src/devices/bus/nes/mmc1_clones.cpp @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders: kmg, Fabio Priuli +/*********************************************************************************************************** + + + NES/Famicom cartridge emulation for MMC-1 clone PCBs + + + Here we emulate several pirate PCBs based on MMC-1 boards + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "mmc1_clones.h" + + +#ifdef NES_PCB_DEBUG +#define VERBOSE 1 +#else +#define VERBOSE 0 +#endif + +#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0) + + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +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") + + +nes_resetsxrom_device::nes_resetsxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_sxrom_device(mconfig, NES_RESETSXROM, tag, owner, clock), m_reset_count(-1) +{ +} + +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) +{ +} + + + +void nes_resetsxrom_device::device_start() +{ + nes_sxrom_device::device_start(); + save_item(NAME(m_reset_count)); +} + +void nes_resetsxrom_device::pcb_reset() +{ + m_reset_count = (m_reset_count + 1) & 3; + nes_sxrom_device::pcb_reset(); +} + +void nes_txc_22110_device::device_start() +{ + nes_sxrom_device::device_start(); + save_item(NAME(m_latch0)); + save_item(NAME(m_mode)); +} + +void nes_txc_22110_device::pcb_reset() +{ + nes_sxrom_device::pcb_reset(); + set_nt_mirroring(PPU_MIRROR_VERT); + + m_latch0 = 0; + m_mode = 0; + update_banks(); +} + + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +/*------------------------------------------------- + + MULTIGAME CARTS BASED ON MMC1 + + -------------------------------------------------*/ + +/*------------------------------------------------- + + BMC-RESET-SXROM + + Games: 4 in 1 (JY-021, JY-022, JY-051) + + MMC1 clone with outer banks switched by resetting. + + NES 2.0: mapper 374 + + In MAME: Supported. + + -------------------------------------------------*/ + +/*------------------------------------------------- + + TXC 01-22110-000 Board + + Games: 2 in 1 Uzi Lightgun (MGC-002) + + This board has an MMC1 clone for Operation Wolf and + otherwise is mostly compatible with mapper 70 for + Bandai's Space Shadow. + + NES 2.0: mapper 297 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_txc_22110_device::update_banks() // used by menu and Space Shadow +{ + u8 outer = (m_mode & 0x02) << 1; + prg16_89ab(outer | (m_latch0 & 0x30) >> 4); + prg16_cdef(outer | 3); + chr8(m_latch0 & 0x0f, CHRROM); +} + +void nes_txc_22110_device::write_l(offs_t offset, u8 data) +{ + LOG_MMC(("TXC 22110 write_l, offset: %04x, data: %02x\n", offset, data)); + if (offset < 0x100) // $4100 - $41ff + { + m_mode = data; + if (m_mode & 1) // MMC1 mode + { + set_prg(); + set_chr(); + } + else + update_banks(); + } +} + +void nes_txc_22110_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("TXC 22110 write_h, offset: %04x, data: %02x\n", offset, data)); + + if (m_mode & 1) + nes_sxrom_device::write_h(offset, data); + else + { + m_latch0 = data; + update_banks(); + } +} diff --git a/src/devices/bus/nes/mmc1_clones.h b/src/devices/bus/nes/mmc1_clones.h new file mode 100644 index 00000000000..01fd2ac805d --- /dev/null +++ b/src/devices/bus/nes/mmc1_clones.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders: kmg, Fabio Priuli +#ifndef MAME_BUS_NES_MMC1_CLONES_H +#define MAME_BUS_NES_MMC1_CLONES_H + +#pragma once + +#include "mmc1.h" + + +// ======================> nes_resetsxrom_device + +class nes_resetsxrom_device : public nes_sxrom_device +{ +public: + // construction/destruction + nes_resetsxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + 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_reset_count << 3, 0x07); } + virtual void set_chr() override { nes_sxrom_device::set_chr(m_reset_count << 5, 0x1f); } + +private: + int m_reset_count; +}; + + +// ======================> nes_txc_22110_device + +class nes_txc_22110_device : public nes_sxrom_device +{ +public: + // construction/destruction + nes_txc_22110_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_l(offs_t offset, u8 data) override; + virtual void write_h(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(0x08, 0x07); } + virtual void set_chr() override { nes_sxrom_device::set_chr(0x20, 0x1f); } + +private: + void update_banks(); + u8 m_latch0, m_mode; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(NES_RESETSXROM, nes_resetsxrom_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 bd64a114fa3..b9fa1d7d87c 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -61,6 +61,7 @@ #include "bootleg.h" #include "multigame.h" #include "pirate.h" +#include "mmc1_clones.h" #include "mmc3_clones.h" @@ -217,6 +218,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("tengen_800008", NES_TENGEN_800008); // FIXME: Is this the same as CNROM? device.option_add_internal("tengen_800032", NES_TENGEN_800032); device.option_add_internal("tengen_800037", NES_TENGEN_800037); + device.option_add_internal("txc_22110", NES_TXC_22110); device.option_add_internal("txc_22211", NES_TXC_22211); device.option_add_internal("txc_dumarc", NES_TXC_DUMARACING); device.option_add_internal("txc_mjblock", NES_TXC_MJBLOCK); @@ -418,6 +420,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("bmc_reset4", NES_BMC_4IN1RESET); // mapper 60 with 64k prg and 32k chr device.option_add_internal("bmc_reset42", NES_BMC_42IN1RESET); // mapper 226? or 233? device.option_add_internal("bmc_lc160", NES_BMC_LC160); + device.option_add_internal("resetsxrom", NES_RESETSXROM); // misc multigame cart MMC3 clone boards device.option_add_internal("a88s1", NES_A88S1); device.option_add_internal("fcgj8in1", NES_FCGJ8IN1); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 42553811ae6..b154057dfd6 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -175,7 +175,7 @@ static const nes_mmc mmc_list[] = { 139, SACHEN_8259C }, { 140, JALECO_JF11 }, { 141, SACHEN_8259A }, - { 142, KAISER_KS7032}, + { 142, KAISER_KS7032 }, { 143, SACHEN_TCA01 }, { 144, AGCI_50282 }, { 145, SACHEN_SA72007 }, @@ -195,8 +195,8 @@ static const nes_mmc mmc_list[] = { 159, BANDAI_LZ93EX1 }, // with 24c01 { 160, SACHEN_SA009 }, // 161 Unused - { 162, WAIXING_FS304}, // not confirmed, but a lot of chinese releases use it like this... - { 163, NANJING_BOARD}, + { 162, WAIXING_FS304 }, // not confirmed, but a lot of chinese releases use it like this... + { 163, NANJING_BOARD }, { 164, WAIXING_FFV }, { 165, WAIXING_SH2 }, { 166, SUBOR_TYPE1 }, @@ -208,7 +208,7 @@ static const nes_mmc mmc_list[] = { 172, TXC_DUMARACING }, { 173, TXC_MJBLOCK }, { 174, BMC_2751 }, - { 175, KAISER_KS7022}, + { 175, KAISER_KS7022 }, { 176, UNL_XIAOZY }, { 177, HENGG_SRICH }, { 178, WAIXING_SGZLZ }, @@ -332,7 +332,7 @@ static const nes_mmc mmc_list[] = // 294 variant of mapper 134? // 295 JY multicarts not yet in nes.xml // 296 VT3x handhelds - // 297 2-in-1 Uzi Lightgun not in nes.xml + { 297, TXC_22110 }, // 2-in-1 Uzi Lightgun { 298, UNL_TF1201 }, // Lethal Weapon (Enforcers) pirate { 299, BMC_11160 }, { 300, BMC_190IN1 }, @@ -409,7 +409,7 @@ static const nes_mmc mmc_list[] = // 371 Spanish PEC-586 computer main cart // 372 Rockman 1-6 multicart very close to mapper 45 // 373 Super 4-in-1, not in nes.xml? - // 374 various JY multicarts + { 374, BMC_RESETSXROM }, // 375 135-in-1 2MB multicart // 376 JY-041 multicart // 377 JY-111 multicart, similar to mapper 367 diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 2ec5f5153fd..ce780f60646 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -130,6 +130,7 @@ static const nes_pcb pcb_list[] = { "tengen_800008", TENGEN_800008 }, /* FIXME: Is this the same as mapper 3? */ { "tengen_800032", TENGEN_800032 }, { "tengen_800037", TENGEN_800037 }, + { "txc_22110", TXC_22110 }, { "txc_22211", TXC_22211 }, { "txc_dumarc", TXC_DUMARACING }, { "txc_mjblock", TXC_MJBLOCK }, @@ -302,6 +303,7 @@ static const nes_pcb pcb_list[] = { "fk23c", BMC_FK23C }, { "fk23ca", BMC_FK23CA }, { "nt639", BMC_NT639 }, + { "resetsxrom", BMC_RESETSXROM }, { "resettxrom0", BMC_RESETTXROM0 }, { "resettxrom1", BMC_RESETTXROM1 }, { "resettxrom2", BMC_RESETTXROM2 }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 52d9c7cc6cd..6d6d40b23ac 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -83,8 +83,8 @@ enum // Tengen TENGEN_800008, TENGEN_800032, TENGEN_800037, // TXC - TXC_22211, TXC_DUMARACING, TXC_MJBLOCK, - TXC_COMMANDOS, TXC_TW, TXC_STRIKEW, + TXC_22110, TXC_22211, TXC_COMMANDOS, TXC_DUMARACING, + TXC_MJBLOCK, TXC_STRIKEW, TXC_TW, // Multigame Carts BMC_64IN1NR, BMC_190IN1, BMC_A65AS, BMC_A88S1, BMC_F15, BMC_GN45, BMC_HIK8IN1, BMC_NOVEL1, BMC_NOVEL2, BMC_S24IN1SC03, BMC_T262, @@ -104,7 +104,7 @@ enum BMC_411120C, BMC_GOLD150, BMC_GOLD260, BMC_SUPER22, BMC_12IN1, BMC_4IN1RESET, BMC_42IN1RESET, BMC_LITTLECOM160, BMC_CTC09, BMC_K1029, BMC_K3006, BMC_K3036, BMC_K3046, BMC_SA005A, BMC_TJ03, - BMC_RESETTXROM0, BMC_RESETTXROM1, BMC_RESETTXROM2, BMC_TECHLINE9IN1, + BMC_RESETSXROM, BMC_RESETTXROM0, BMC_RESETTXROM1, BMC_RESETTXROM2, BMC_TECHLINE9IN1, // Unlicensed UNL_8237, UNL_8237A, UNL_CC21, UNL_AX5705, UNL_KN42, UNL_KOF97, UNL_N625092, UNL_SC127, UNL_SMB2J, UNL_T230, UNL_MMALEE, From c05c9603bebfa2f1d301e0900b6806a2144a7311 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Fri, 10 Sep 2021 01:08:44 -0800 Subject: [PATCH 2/2] Converted Chinese Ninja Ryukenden to MMC1 subclass. --- src/devices/bus/nes/mmc1_clones.cpp | 30 +++++++++ src/devices/bus/nes/mmc1_clones.h | 17 +++++ src/devices/bus/nes/pirate.cpp | 96 ----------------------------- src/devices/bus/nes/pirate.h | 24 -------- 4 files changed, 47 insertions(+), 120 deletions(-) diff --git a/src/devices/bus/nes/mmc1_clones.cpp b/src/devices/bus/nes/mmc1_clones.cpp index 5d813cd36d3..eb5b7d937ab 100644 --- a/src/devices/bus/nes/mmc1_clones.cpp +++ b/src/devices/bus/nes/mmc1_clones.cpp @@ -28,10 +28,16 @@ // constructor //------------------------------------------------- +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") +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) +{ +} + nes_resetsxrom_device::nes_resetsxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_sxrom_device(mconfig, NES_RESETSXROM, tag, owner, clock), m_reset_count(-1) { @@ -79,6 +85,30 @@ void nes_txc_22110_device::pcb_reset() mapper specific handlers -------------------------------------------------*/ +/*------------------------------------------------- + + UNL-NINJARYU + + Games: Ninja Ryukenden Chinese + + This board was previously assigned to mapper 111. It has + registers akin to MMC1 but without the need to write to + them serially. The one existing game has 256K CHR, so this + must have at least 1 more bit for CHR banking. Other differences? + + In MAME: Preliminary supported. + + -------------------------------------------------*/ + +void nes_ninjaryu_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("unl_ninjaryu write_h, offset: %04x, data: %02x\n", offset, data)); + u8 reg = (offset >> 13) & 0x03; + m_reg[reg] = data; + update_regs(reg); +} + + /*------------------------------------------------- MULTIGAME CARTS BASED ON MMC1 diff --git a/src/devices/bus/nes/mmc1_clones.h b/src/devices/bus/nes/mmc1_clones.h index 01fd2ac805d..310dfb7c098 100644 --- a/src/devices/bus/nes/mmc1_clones.h +++ b/src/devices/bus/nes/mmc1_clones.h @@ -8,6 +8,22 @@ #include "mmc1.h" +// ======================> nes_ninjaryu_device + +class nes_ninjaryu_device : public nes_sxrom_device +{ +public: + // construction/destruction + nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + +protected: + virtual void set_prg() override { nes_sxrom_device::set_prg(0x00, 0x0f); } + virtual void set_chr() override { nes_sxrom_device::set_chr(0x00, 0x3f); } +}; + + // ======================> nes_resetsxrom_device class nes_resetsxrom_device : public nes_sxrom_device @@ -57,6 +73,7 @@ private: // device type definition +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/pirate.cpp b/src/devices/bus/nes/pirate.cpp index 81acd4dc55d..c6a68d48b98 100644 --- a/src/devices/bus/nes/pirate.cpp +++ b/src/devices/bus/nes/pirate.cpp @@ -49,7 +49,6 @@ DEFINE_DEVICE_TYPE(NES_WHERO, nes_whero_device, "nes_whero", " DEFINE_DEVICE_TYPE(NES_43272, nes_43272_device, "nes_43272", "NES Cart UNL-43272 PCB") DEFINE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device, "nes_tf1201", "NES Cart UNL-TF1201 PCB") DEFINE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device, "nes_cityfight", "NES Cart City Fighter PCB") -DEFINE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device, "nes_ninjaryu", "NES Cart Ninja Ryukenden Chinese PCB") DEFINE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device, "nes_eh8813a", "NES Cart UNL-EH8813A PCB") @@ -128,11 +127,6 @@ nes_cityfight_device::nes_cityfight_device(const machine_config &mconfig, const { } -nes_ninjaryu_device::nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_NINJARYU, tag, owner, clock) -{ -} - nes_eh8813a_device::nes_eh8813a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_EH8813A, tag, owner, clock), m_dipsetting(0), m_latch(0) { @@ -405,22 +399,6 @@ void nes_cityfight_device::pcb_reset() m_irq_count = 0; } -void nes_ninjaryu_device::device_start() -{ - common_start(); - save_item(NAME(m_reg)); -} - -void nes_ninjaryu_device::pcb_reset() -{ - m_reg[0] = 0x0f; - m_reg[1] = m_reg[2] = m_reg[3] = 0; - - set_nt_mirroring(PPU_MIRROR_HORZ); - update_prg(); - update_chr(); -} - void nes_eh8813a_device::device_start() { common_start(); @@ -1256,80 +1234,6 @@ void nes_cityfight_device::write_h(offs_t offset, uint8_t data) } } - -/*------------------------------------------------- - - UNL-NINJARYU - - Games: Ninja Ryukenden Chinese - - This board is mentioned on the NesDev page describing - mapper 111, which used to be assigned to this. It has - registers similar to MMC1 but without the need to write to - them serially. The one existing game has 256K CHR, so this - must have at least 1 more bit for CHR banking. Other differences? - - In MAME: Preliminary supported. - - -------------------------------------------------*/ - -void nes_ninjaryu_device::update_prg() -{ - if (!BIT(m_reg[0], 3)) - prg32((m_reg[3] >> 1) & 0x07); // 32K mode - else if (BIT(m_reg[0], 2)) - { - prg16_89ab(m_reg[3] & 0x0f); - prg16_cdef(m_prg_chunks - 1); // 16K mode fixed last bank - } - else - { - prg16_89ab(0); // 16K mode fixed first bank - prg16_cdef(m_reg[3] & 0x0f); - } -} - -void nes_ninjaryu_device::update_chr() -{ - if (BIT(m_reg[0], 4)) - { - chr4_0(m_reg[1], CHRROM); - chr4_4(m_reg[2], CHRROM); - } - else - chr8(m_reg[1] >> 1, CHRROM); -} - -void nes_ninjaryu_device::write_h(offs_t offset, uint8_t data) -{ - LOG_MMC(("unl_ninjaryu write_h, offset: %04x, data: %02x\n", offset, data)); - - m_reg[(offset >> 13) & 0x03] = data & 0x3f; - - switch (offset & 0x6000) - { - case 0x0000: - switch (data & 0x03) - { - case 0x00: set_nt_mirroring(PPU_MIRROR_LOW); break; - case 0x01: set_nt_mirroring(PPU_MIRROR_HIGH); break; - case 0x02: set_nt_mirroring(PPU_MIRROR_VERT); break; - case 0x03: set_nt_mirroring(PPU_MIRROR_HORZ); break; - } - update_prg(); - update_chr(); - break; - case 0x2000: - case 0x4000: - update_chr(); - break; - case 0x6000: - update_prg(); - break; - } -} - - /*------------------------------------------------- UNL-EH8813A diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h index b98dc8d8a8b..4b0e1f1ae61 100644 --- a/src/devices/bus/nes/pirate.h +++ b/src/devices/bus/nes/pirate.h @@ -343,29 +343,6 @@ private: }; -// ======================> nes_ninjaryu_device - -class nes_ninjaryu_device : public nes_nrom_device -{ -public: - // construction/destruction - nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - virtual void write_h(offs_t offset, uint8_t data) override; - - virtual void pcb_reset() override; - -protected: - // device-level overrides - virtual void device_start() override; - -private: - void update_prg(); - void update_chr(); - uint8_t m_reg[4]; -}; - - // ======================> nes_eh8813a_device class nes_eh8813a_device : public nes_nrom_device @@ -429,7 +406,6 @@ DECLARE_DEVICE_TYPE(NES_WHERO, nes_whero_device) DECLARE_DEVICE_TYPE(NES_43272, nes_43272_device) DECLARE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device) DECLARE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device) -DECLARE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device) DECLARE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device) //DECLARE_DEVICE_TYPE(NES_FUJIYA, nes_fujiya_device)