summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2021-09-03 12:35:05 -0800
committer GitHub <noreply@github.com>2021-09-04 06:35:05 +1000
commitdfa5b141d632c7fc1d1ab4f15e73ce234f0c7f27 (patch)
tree6a26a2a374af72731468adad8650dbd779779f23
parent94dcdd6a92e4d5c20e6a8d00a28040432939b1cb (diff)
bus/nes: Improved emulation of N625092-related multi-game cartridges. (#8526)
* Fixes corrupt graphics in multiple games on all seven multi-game carts (including the new addition). * Fixes flickering menu for several cartridges, making them usable. New working software list additions (nes.xml) ----------------------------------- 5000000 in 1 (JPx72) [anonymous]
-rw-r--r--hash/nes.xml15
-rw-r--r--src/devices/bus/nes/multigame.cpp129
-rw-r--r--src/devices/bus/nes/multigame.h43
3 files changed, 92 insertions, 95 deletions
diff --git a/hash/nes.xml b/hash/nes.xml
index e91d1c37bb4..723fe81e893 100644
--- a/hash/nes.xml
+++ b/hash/nes.xml
@@ -80126,6 +80126,21 @@ be better to redump them properly. -->
</part>
</software>
+ <software name="mc_5m">
+ <description>5000000 in 1 (JPx72)</description>
+ <year>19??</year>
+ <publisher>&lt;pirate&gt;</publisher>
+ <part name="cart" interface="nes_cart">
+ <feature name="slot" value="n625092" />
+ <dataarea name="prg" size="524288">
+ <rom name="5000000-in-1 (jpx72).prg" size="524288" crc="a831426d" sha1="93c6a3eff4c120e6837639af272f3142be5b0e1d" status="baddump" />
+ </dataarea>
+ <!-- 8k VRAM on cartridge -->
+ <dataarea name="vram" size="8192">
+ </dataarea>
+ </part>
+ </software>
+
<software name="mc_5spc5">
<description>5 in 1 (SPC005)</description>
<year>19??</year>
diff --git a/src/devices/bus/nes/multigame.cpp b/src/devices/bus/nes/multigame.cpp
index ac9452893e0..decded4f6c7 100644
--- a/src/devices/bus/nes/multigame.cpp
+++ b/src/devices/bus/nes/multigame.cpp
@@ -145,11 +145,6 @@ nes_kn42_device::nes_kn42_device(const machine_config &mconfig, const char *tag,
{
}
-nes_n625092_device::nes_n625092_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nes_nrom_device(mconfig, NES_N625092, tag, owner, clock), m_latch1(0), m_latch2(0)
-{
-}
-
nes_a65as_device::nes_a65as_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: nes_nrom_device(mconfig, NES_A65AS, tag, owner, clock)
{
@@ -432,6 +427,11 @@ nes_bmc_k1029_device::nes_bmc_k1029_device(const machine_config &mconfig, const
{
}
+nes_n625092_device::nes_n625092_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_vram_protect_device(mconfig, NES_N625092, tag, owner, clock)
+{
+}
+
nes_bmc_th22913_device::nes_bmc_th22913_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_vram_protect_device(mconfig, NES_BMC_TH22913, tag, owner, clock)
{
@@ -530,24 +530,6 @@ void nes_kn42_device::pcb_reset()
chr8(0, CHRRAM);
}
-void nes_n625092_device::device_start()
-{
- common_start();
- save_item(NAME(m_latch1));
- save_item(NAME(m_latch2));
-}
-
-void nes_n625092_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg16_89ab(0);
- prg16_cdef(0);
- chr8(0, m_chr_source);
-
- m_latch1 = 0;
- m_latch2 = 0;
-}
-
void nes_a65as_device::device_start()
{
common_start();
@@ -1180,6 +1162,21 @@ void nes_bmc_60311c_device::pcb_reset()
update_banks();
}
+void nes_n625092_device::device_start()
+{
+ nes_vram_protect_device::device_start();
+ save_item(NAME(m_latch));
+}
+
+void nes_n625092_device::pcb_reset()
+{
+ nes_vram_protect_device::pcb_reset();
+ prg16_89ab(0);
+ prg16_cdef(0);
+
+ m_latch[0] = m_latch[1] = 0;
+}
+
void nes_bmc_th22913_device::pcb_reset()
{
nes_vram_protect_device::pcb_reset();
@@ -1418,56 +1415,6 @@ void nes_kn42_device::write_h(offs_t offset, u8 data)
/*-------------------------------------------------
- Bootleg Board N625092
-
- Games: 400 in 1, 700 in 1, 1000 in 1
-
- iNES: mapper 221
-
- In MESS: Supported.
-
- -------------------------------------------------*/
-
-void nes_n625092_device::set_prg(uint8_t reg1, uint8_t reg2)
-{
- uint8_t helper1, helper2;
-
- helper1 = !(reg1 & 0x01) ? reg2 : (reg1 & 0x80) ? reg2 : (reg2 & 0x06) | 0x00;
- helper2 = !(reg1 & 0x01) ? reg2 : (reg1 & 0x80) ? 0x07 : (reg2 & 0x06) | 0x01;
-
- prg16_89ab(helper1 | ((reg1 & 0x70) >> 1));
- prg16_cdef(helper2 | ((reg1 & 0x70) >> 1));
-}
-
-void nes_n625092_device::write_h(offs_t offset, uint8_t data)
-{
- LOG_MMC(("n625092 write_h, offset: %04x, data: %02x\n", offset, data));
-
- if (offset < 0x4000)
- {
- set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
- offset = (offset >> 1) & 0xff;
-
- if (m_latch1 != offset)
- {
- m_latch1 = offset;
- set_prg(m_latch1, m_latch2);
- }
- }
- else
- {
- offset &= 0x07;
-
- if (m_latch2 != offset)
- {
- m_latch2 = offset;
- set_prg(m_latch1, m_latch2);
- }
- }
-}
-
-/*-------------------------------------------------
-
Board BMC-A65AS
Games: 3-in-1 (N068)
@@ -3159,6 +3106,42 @@ void nes_bmc_k1029_device::write_h(offs_t offset, u8 data)
/*-------------------------------------------------
+ Bootleg Board N625092
+
+ Games: 320 in 1, 400 in 1, 700 in 1, 800 in 1,
+ 1000 in 1, 2000 in 1, 5000000 in 1
+
+ iNES: mapper 221
+
+ In MAME: Supported.
+
+ -------------------------------------------------*/
+
+void nes_n625092_device::write_h(offs_t offset, u8 data)
+{
+ LOG_MMC(("n625092 write_h, offset: %04x, data: %02x\n", offset, data));
+
+ m_latch[BIT(offset, 14)] = offset;
+
+ u8 bank = (m_latch[0] & 0x200) >> 3 | (m_latch[0] & 0xe0) >> 2 | (m_latch[1] & 0x07); // NesDev shows the high bit here, but is it correct? So far no cart is large enough to use this.
+ u8 mode = BIT(m_latch[0], 1);
+ if (mode && BIT(m_latch[0], 8)) // UNROM mode
+ {
+ prg16_89ab(bank);
+ prg16_cdef(bank | 7);
+ }
+ else // NROM mode
+ {
+ prg16_89ab(bank & ~mode);
+ prg16_cdef(bank | mode);
+ }
+
+ set_nt_mirroring(BIT(m_latch[0], 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
+ m_vram_protect = BIT(m_latch[1], 3);
+}
+
+/*-------------------------------------------------
+
BMC-TH2291-3, BMC-CH-011
Games: Powerful 250 in 1, Powerful 255 in 1
diff --git a/src/devices/bus/nes/multigame.h b/src/devices/bus/nes/multigame.h
index 74342513ff6..83ff5fbf5ef 100644
--- a/src/devices/bus/nes/multigame.h
+++ b/src/devices/bus/nes/multigame.h
@@ -137,28 +137,6 @@ private:
};
-// ======================> nes_n625092_device
-
-class nes_n625092_device : public nes_nrom_device
-{
-public:
- // construction/destruction
- nes_n625092_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 set_prg(uint8_t reg1, uint8_t reg2);
- uint8_t m_latch1, m_latch2;
-};
-
-
// ======================> nes_a65as_device
class nes_a65as_device : public nes_nrom_device
@@ -1166,6 +1144,27 @@ public:
};
+// ======================> nes_n625092_device
+
+class nes_n625092_device : public nes_vram_protect_device
+{
+public:
+ // construction/destruction
+ nes_n625092_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:
+ u16 m_latch[2];
+};
+
+
// ======================> nes_bmc_th22913_device
class nes_bmc_th22913_device : public nes_vram_protect_device