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]
This commit is contained in:
0kmg 2021-09-03 12:35:05 -08:00 committed by GitHub
parent 94dcdd6a92
commit dfa5b141d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 95 deletions

View File

@ -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>

View File

@ -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();
@ -1416,56 +1413,6 @@ void nes_kn42_device::write_h(offs_t offset, u8 data)
prg16_89ab(m_latch | (data & 0x07) << 1 | BIT(data, 4));
}
/*-------------------------------------------------
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
@ -3157,6 +3104,42 @@ void nes_bmc_k1029_device::write_h(offs_t offset, u8 data)
m_vram_protect = BIT(offset, 0) == BIT(offset, 1);
}
/*-------------------------------------------------
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

View File

@ -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