Merge pull request #8513 from 0kmg/nes-mapper234

bus/nes: Fixed several games not loading in Maxi 15 multicarts.
This commit is contained in:
ajrhacker 2021-08-30 12:28:26 -04:00 committed by GitHub
commit a9ef9231dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 47 deletions

View File

@ -51523,7 +51523,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part> </part>
</software> </software>
<software name="maxi15ua" cloneof="maxi15" supported="no"> <software name="maxi15ua" cloneof="maxi15">
<description>Maxi 15 (USA)</description> <description>Maxi 15 (USA)</description>
<year>1992</year> <year>1992</year>
<publisher>American Video Entertainment</publisher> <publisher>American Video Entertainment</publisher>
@ -51540,7 +51540,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part> </part>
</software> </software>
<software name="maxi15u" cloneof="maxi15" supported="no"> <software name="maxi15u" cloneof="maxi15">
<description>Maxi 15 (USA, v2.0)</description> <description>Maxi 15 (USA, v2.0)</description>
<year>1992</year> <year>1992</year>
<publisher>American Video Entertainment</publisher> <publisher>American Video Entertainment</publisher>
@ -51557,7 +51557,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part> </part>
</software> </software>
<software name="maxi15" supported="no"> <software name="maxi15">
<description>Maxi 15 (Aus)</description> <description>Maxi 15 (Aus)</description>
<year>1992</year> <year>1992</year>
<publisher>HES</publisher> <publisher>HES</publisher>

View File

@ -48,8 +48,8 @@ nes_nina006_device::nes_nina006_device(const machine_config &mconfig, const char
{ {
} }
nes_maxi15_device::nes_maxi15_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) nes_maxi15_device::nes_maxi15_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_MAXI15, tag, owner, clock), m_reg(0), m_bank(0) : nes_nrom_device(mconfig, NES_MAXI15, tag, owner, clock)
{ {
} }
@ -80,29 +80,24 @@ void nes_nina006_device::pcb_reset()
chr8(0, m_chr_source); chr8(0, m_chr_source);
} }
void nes_maxi15_device::device_start() void nes_maxi15_device::device_start()
{ {
common_start(); common_start();
save_item(NAME(m_bank));
save_item(NAME(m_reg)); save_item(NAME(m_reg));
} }
void nes_maxi15_device::pcb_reset() void nes_maxi15_device::pcb_reset()
{ {
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0); prg32(0);
chr8(0, m_chr_source); chr8(0, CHRROM);
set_nt_mirroring(PPU_MIRROR_VERT); set_nt_mirroring(PPU_MIRROR_VERT);
m_reg = 0; m_reg[0] = m_reg[1] = 0;
m_bank = 0;
} }
/*------------------------------------------------- /*-------------------------------------------------
mapper specific handlers mapper specific handlers
-------------------------------------------------*/ -------------------------------------------------*/
@ -118,7 +113,7 @@ void nes_maxi15_device::pcb_reset()
then readable back in WRAM (WRAM is tested by then readable back in WRAM (WRAM is tested by
Impossible Mission II at start) Impossible Mission II at start)
In MESS: Supported. In MAME: Supported.
-------------------------------------------------*/ -------------------------------------------------*/
@ -151,7 +146,7 @@ void nes_nina001_device::write_m(offs_t offset, uint8_t data)
iNES: mapper 79 iNES: mapper 79
In MESS: Supported. In MAME: Supported.
-------------------------------------------------*/ -------------------------------------------------*/
@ -174,41 +169,30 @@ void nes_nina006_device::write_l(offs_t offset, uint8_t data)
iNES: mapper 234 iNES: mapper 234
In MESS: Partially Supported. In MAME: Supported.
-------------------------------------------------*/ -------------------------------------------------*/
void nes_maxi15_device::update_banks() u8 nes_maxi15_device::read_h(offs_t offset)
{
if (m_bank & 0x40)
{
prg32((m_bank & 0x0e) | (m_reg & 1));
chr8(((m_bank & 0x0e) << 2) | ((m_reg >> 4) & 7), m_chr_source);
}
else
{
prg32(m_bank & 0x0f);
chr8(((m_bank & 0x0f) << 2) | ((m_reg >> 4) & 3), m_chr_source);
}
}
uint8_t nes_maxi15_device::read_h(offs_t offset)
{ {
LOG_MMC(("Maxi 15 read_h, offset: %04x\n", offset)); LOG_MMC(("Maxi 15 read_h, offset: %04x\n", offset));
if (offset >= 0x7f80 && offset < 0x7fa0) u8 temp = hi_access_rom(offset);
if ((offset >= 0x7f80 && offset < 0x7fa0) || (offset >= 0x7fe8 && offset < 0x7ff8))
{ {
m_bank = hi_access_rom(offset); int reg = BIT(offset, 6);
set_nt_mirroring(BIT(m_bank, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); if (reg || !(m_reg[0] & 0x3f)) // inner banks always modifiable, outer banks locked once set
update_banks(); {
return m_bank; m_reg[reg] = temp;
}
if (offset >= 0x7fe8 && offset < 0x7ff8) u8 mode = !BIT(m_reg[0], 6);
{ u8 outer = m_reg[0] & (0x0e | mode);
m_reg = hi_access_rom(offset); prg32(outer | (m_reg[1] & !mode));
update_banks(); chr8(outer << 2 | ((m_reg[1] >> 4) & (7 >> mode)), CHRROM);
return m_reg; set_nt_mirroring(BIT(m_reg[0], 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
} }
return hi_access_rom(offset); return temp;
} }

View File

@ -50,9 +50,9 @@ class nes_maxi15_device : public nes_nrom_device
{ {
public: public:
// construction/destruction // construction/destruction
nes_maxi15_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); nes_maxi15_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual uint8_t read_h(offs_t offset) override; virtual u8 read_h(offs_t offset) override;
virtual void pcb_reset() override; virtual void pcb_reset() override;
@ -61,9 +61,7 @@ protected:
virtual void device_start() override; virtual void device_start() override;
private: private:
void update_banks(); u8 m_reg[2];
uint8_t m_reg, m_bank;
}; };