From 99f0f69c379a21c6668eccc7ff4edac382562418 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Mon, 9 Aug 2021 08:55:31 -0800 Subject: [PATCH] bus/nes: Improved NTDEC cartridge support. (#8239) Software list items promoted to working ----------------------------- Fighting Hero (Asia) Fighting Hero III (Asia) --- hash/nes.xml | 24 +++++- 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 +- src/devices/bus/nes/ntdec.cpp | 127 ++++++++++++++++++------------ src/devices/bus/nes/ntdec.h | 31 +++++--- 7 files changed, 123 insertions(+), 65 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 16850a74444..af166a6705e 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -53470,7 +53470,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - + Fighting Hero (Asia) 1991 Mega Soft @@ -53708,6 +53708,25 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + + Destroyer (Spa) 1992 @@ -53819,7 +53838,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - + Fighting Hero III (Asia) 1993 NTDEC @@ -53893,6 +53912,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index ecfd1fd331d..98a4a8cf49b 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -196,6 +196,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("nanjing", NES_NANJING); // mapper 163 device.option_add_internal("ntdec_asder", NES_NTDEC_ASDER); // mapper 112 device.option_add_internal("ntdec_fh", NES_NTDEC_FH); // mapper 193 + device.option_add_internal("ntdec_n715021", NES_NTDEC_N715021); // mapper 81 device.option_add_internal("jyc_a", NES_JY_TYPEA); // mapper 90 device.option_add_internal("jyc_b", NES_JY_TYPEB); // mapper 211 device.option_add_internal("jyc_c", NES_JY_TYPEC); // mapper 209 diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 0a6cd971f2d..d3fd9063787 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -113,7 +113,7 @@ static const nes_mmc mmc_list[] = { 78, IREM_HOLYDIVR }, { 79, AVE_NINA06 }, { 80, TAITO_X1_005 }, - // 81 NTDEC's Super Gun. Dump available? + { 81, NTDEC_N715021 }, // 81 Super Gun { 82, TAITO_X1_017 }, { 83, CONY_BOARD }, // 84 Pasofami hacked images? diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 7ace97736e3..9e9066e3312 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -110,6 +110,7 @@ static const nes_pcb pcb_list[] = { "nanjing", NANJING_BOARD }, // mapper 163 { "ntdec_asder", NTDEC_ASDER }, // mapper 112 { "ntdec_fh", NTDEC_FIGHTINGHERO }, // mapper 193 + { "ntdec_n715021", NTDEC_N715021 }, // mapper 81 { "sa009", SACHEN_SA009 }, { "sa0036", SACHEN_SA0036 }, { "sa0037", SACHEN_SA0037 }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 3bc46b8a811..8652e0e82fc 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -65,7 +65,7 @@ enum NAMCOT_163, NAMCOT_175, NAMCOT_340, NAMCOT_3425, NAMCOT_34X3, NAMCOT_3446, /* NTDEC */ - NTDEC_ASDER, NTDEC_FIGHTINGHERO, + NTDEC_ASDER, NTDEC_FIGHTINGHERO, NTDEC_N715021, /* Rex Soft */ REXSOFT_SL1632, REXSOFT_DBZ5, /* Sachen */ diff --git a/src/devices/bus/nes/ntdec.cpp b/src/devices/bus/nes/ntdec.cpp index 6fbcd6f31ef..5967eb51b6c 100644 --- a/src/devices/bus/nes/ntdec.cpp +++ b/src/devices/bus/nes/ntdec.cpp @@ -10,9 +10,10 @@ * NTDEC ASDER [mapper 112] * NTDEC Fighting Hero [mapper 193] + * NTDEC N715021 [mapper 81] TODO: - - why is Master Shooter not working? + - why is Master Shooter not working? (correctly aimed shots score as a hit on random targets) ***********************************************************************************************************/ @@ -34,21 +35,26 @@ // constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(NES_NTDEC_ASDER, nes_ntdec_asder_device, "nes_ntdec_asder", "NES Cart NTDEC Asder PCB") -DEFINE_DEVICE_TYPE(NES_NTDEC_FH, nes_ntdec_fh_device, "nes_fh_asder", "NES Cart NTDEC Fighting Hero PCB") +DEFINE_DEVICE_TYPE(NES_NTDEC_ASDER, nes_ntdec_asder_device, "nes_ntdec_asder", "NES Cart NTDEC Asder PCB") +DEFINE_DEVICE_TYPE(NES_NTDEC_FH, nes_ntdec_fh_device, "nes_ntdec_fh", "NES Cart NTDEC Fighting Hero PCB") +DEFINE_DEVICE_TYPE(NES_NTDEC_N715021, nes_ntdec_n715021_device, "nes_ntdec_n715021", "NES Cart NTDEC N715021 PCB") -nes_ntdec_asder_device::nes_ntdec_asder_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_NTDEC_ASDER, tag, owner, clock) - , m_latch(0) +nes_ntdec_asder_device::nes_ntdec_asder_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_NTDEC_ASDER, tag, owner, clock) , m_latch(0), m_chr_outer(0) { } -nes_ntdec_fh_device::nes_ntdec_fh_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_ntdec_fh_device::nes_ntdec_fh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_NTDEC_FH, tag, owner, clock) { } +nes_ntdec_n715021_device::nes_ntdec_n715021_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, NES_NTDEC_N715021, tag, owner, clock) +{ +} + @@ -56,32 +62,32 @@ void nes_ntdec_asder_device::device_start() { common_start(); save_item(NAME(m_latch)); + save_item(NAME(m_chr_outer)); } void nes_ntdec_asder_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg16_89ab(0); prg16_cdef(m_prg_chunks - 1); - chr8(0, m_chr_source); + chr8(0, CHRROM); m_latch = 0; -} - -void nes_ntdec_fh_device::device_start() -{ - common_start(); + m_chr_outer = 0; } void nes_ntdec_fh_device::pcb_reset() { - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; prg32((m_prg_chunks - 1) >> 1); - chr8(0, m_chr_source); + chr8(0, CHRROM); set_nt_mirroring(PPU_MIRROR_VERT); } - +void nes_ntdec_n715021_device::pcb_reset() +{ + prg16_89ab(0); + prg16_cdef(m_prg_chunks - 1); + chr8(0, CHRROM); +} @@ -96,17 +102,25 @@ void nes_ntdec_fh_device::pcb_reset() Games: Cobra Mission, Fighting Hero III, Huang Di, Master Shooter + This board supports swappable 8K PRG banks at 0x8000 and + 0xa000 via 2 registers. 16K above is fixed. CHR ROM is + selected by 6 registers: 2x2K for the first two, and 4x1K + for the remaining 4. The former can only address 256K of + CHR while the latter combines with latch at 0xc000 to + span 512K. Registers are not directly written to but + selected at 0x8000. + iNES: mapper 112 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_ntdec_asder_device::write_h(offs_t offset, uint8_t data) +void nes_ntdec_asder_device::write_h(offs_t offset, u8 data) { LOG_MMC(("ntdec_asder write_h, offset: %04x, data: %02x\n", offset, data)); - switch (offset) + switch (offset & 0x6001) // writes only at even addresses? { case 0x0000: m_latch = data & 0x07; @@ -114,36 +128,21 @@ void nes_ntdec_asder_device::write_h(offs_t offset, uint8_t data) case 0x2000: switch (m_latch) { - case 0: - prg8_89(data); + case 0: case 1: + prg8_x(m_latch, data); break; - case 1: - prg8_ab(data); + case 2: case 3: + chr2_x((m_latch & 0x01) << 1, data >> 1, CHRROM); break; - case 2: - data &= 0xfe; - chr1_0(data, CHRROM); - chr1_1(data + 1, CHRROM); - break; - case 3: - data &= 0xfe; - chr1_2(data, CHRROM); - chr1_3(data + 1, CHRROM); - break; - case 4: - chr1_4(data, CHRROM); - break; - case 5: - chr1_5(data, CHRROM); - break; - case 6: - chr1_6(data, CHRROM); - break; - case 7: - chr1_7(data, CHRROM); + case 4: case 5: case 6: case 7: + u16 high = BIT(m_chr_outer, m_latch) << 8; + chr1_x(m_latch, high | data, CHRROM); break; } break; + case 0x4000: + m_chr_outer = data; + break; case 0x6000: set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); break; @@ -154,22 +153,23 @@ void nes_ntdec_asder_device::write_h(offs_t offset, uint8_t data) Bootleg Board by NTDEC for Fighting Hero - Games: Fighting Hero + Games: Fighting Hero, War in the Gulf Very simple mapper: writes to 0x6000-0x7fff swap PRG and - CHR banks. + CHR banks. The mirroring register at 0x6004 appears to + not be used by any known software? iNES: mapper 193 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_ntdec_fh_device::write_m(offs_t offset, uint8_t data) +void nes_ntdec_fh_device::write_m(offs_t offset, u8 data) { LOG_MMC(("ntdec_fh write_m, offset: %04x, data: %02x\n", offset, data)); - switch (offset & 0x03) + switch (offset & 0x07) { case 0: chr4_0(data >> 2, CHRROM); @@ -181,7 +181,32 @@ void nes_ntdec_fh_device::write_m(offs_t offset, uint8_t data) chr2_6(data >> 1 , CHRROM); break; case 3: - prg8_89(data); + prg8_89(data & 0x0f); + break; + case 4: + set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); break; } } + +/*------------------------------------------------- + + NTDEC Board N715021 + + Games: Super Gun + + Very simple mapper: writes to 0x8000-0xffff swap PRG and + CHR banks. PCB also has a latch at 0x6000 but it is not used. + + iNES: mapper 81 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_ntdec_n715021_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("ntdec_n715021 write_m, offset: %04x, data: %02x\n", offset, data)); + prg16_89ab((offset >> 2) & 0x03); + chr8(offset & 0x03, CHRROM); +} diff --git a/src/devices/bus/nes/ntdec.h b/src/devices/bus/nes/ntdec.h index 062c5d7dcec..160511a388a 100644 --- a/src/devices/bus/nes/ntdec.h +++ b/src/devices/bus/nes/ntdec.h @@ -14,9 +14,9 @@ class nes_ntdec_asder_device : public nes_nrom_device { public: // construction/destruction - nes_ntdec_asder_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_ntdec_asder_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - virtual void write_h(offs_t offset, uint8_t data) override; + virtual void write_h(offs_t offset, u8 data) override; virtual void pcb_reset() override; @@ -25,7 +25,7 @@ protected: virtual void device_start() override; private: - uint8_t m_latch; + u8 m_latch, m_chr_outer; }; @@ -35,20 +35,31 @@ class nes_ntdec_fh_device : public nes_nrom_device { public: // construction/destruction - nes_ntdec_fh_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_ntdec_fh_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; +}; -protected: - // device-level overrides - virtual void device_start() override; + +// ======================> nes_ntdec_n715021_device + +class nes_ntdec_n715021_device : public nes_nrom_device +{ +public: + // construction/destruction + nes_ntdec_n715021_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; }; // device type definition -DECLARE_DEVICE_TYPE(NES_NTDEC_ASDER, nes_ntdec_asder_device) -DECLARE_DEVICE_TYPE(NES_NTDEC_FH, nes_ntdec_fh_device) +DECLARE_DEVICE_TYPE(NES_NTDEC_ASDER, nes_ntdec_asder_device) +DECLARE_DEVICE_TYPE(NES_NTDEC_FH, nes_ntdec_fh_device) +DECLARE_DEVICE_TYPE(NES_NTDEC_N715021, nes_ntdec_n715021_device) #endif // MAME_BUS_NES_NTDEC_H