JalecoJfxx & Bandai 74161/7432 support (Mapper 70, 87, 101, 152)

This commit is contained in:
Souryo 2015-12-30 16:41:47 -05:00
parent 1b218f66c8
commit fc86db8f32
5 changed files with 104 additions and 1 deletions

53
Core/Bandai74161_7432.h Normal file
View file

@ -0,0 +1,53 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Bandai74161_7432 : public BaseMapper
{
private:
bool _enableMirroringControl;
protected:
virtual uint16_t GetPRGPageSize() { return 0x4000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper()
{
SelectPRGPage(0, 0);
SelectPRGPage(1, -1);
SelectCHRPage(0, 0);
//Hack to make Kamen Rider Club - Gekitotsu Shocker Land work correctly (bad header)
SetMirroringType(MirroringType::Vertical);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
bool mirroringBit = (value & 0x80) == 0x80;
if(mirroringBit) {
//If any game tries to set the bit to true, assume it will use mirroring switches
//This is a hack to make as many games as possible work without CRC checks
_enableMirroringControl = true;
}
if(_enableMirroringControl) {
SetMirroringType(mirroringBit ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
}
//Biggest PRG ROM I could find for mapper 70/152 is 128kb, so the 4th bit will never be used on those
SelectPRGPage(0, (value >> 4) & 0x07);
SelectCHRPage(0, value & 0x0F);
}
virtual void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
Stream<bool>(_enableMirroringControl);
}
public:
Bandai74161_7432(bool enableMirroringControl) : _enableMirroringControl(enableMirroringControl)
{
//According to NesDev Wiki, Mapper 70 is meant to have mirroring forced (by the board) and Mapper 152
}
};

View file

@ -267,6 +267,7 @@
<ItemGroup>
<ClInclude Include="APU.h" />
<ClInclude Include="AutoRomTest.h" />
<ClInclude Include="Bandai74161_7432.h" />
<ClInclude Include="BF909x.h" />
<ClInclude Include="CodeDataLogger.h" />
<ClInclude Include="CpRom.h" />
@ -307,6 +308,7 @@
<ClInclude Include="INotificationListener.h" />
<ClInclude Include="InputDataMessage.h" />
<ClInclude Include="IremG101.h" />
<ClInclude Include="JalecoJfxx.h" />
<ClInclude Include="JalecoSs88006.h" />
<ClInclude Include="MMC4.h" />
<ClInclude Include="MMC5.h" />

View file

@ -269,6 +269,12 @@
<ClInclude Include="Nina03_06.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
<ClInclude Include="JalecoJfxx.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
<ClInclude Include="Bandai74161_7432.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CPU.cpp">

37
Core/JalecoJfxx.h Normal file
View file

@ -0,0 +1,37 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class JalecoJfxx : public BaseMapper
{
private:
bool _orderedBits;
protected:
virtual uint16_t GetPRGPageSize() { return 0x8000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
virtual uint16_t RegisterStartAddress() { return 0x6000; }
virtual uint16_t RegisterEndAddress() { return 0x7FFF; }
void InitMapper()
{
SelectPRGPage(0, 0);
SelectCHRPage(0, 0);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(_orderedBits) {
//Mapper 101
SelectCHRPage(0, value);
} else {
//Mapper 87
SelectCHRPage(0, ((value & 0x01) << 1) | ((value & 0x02) >> 1));
}
}
public:
JalecoJfxx(bool orderedBits) : _orderedBits(orderedBits)
{
}
};

View file

@ -3,11 +3,13 @@
#include "MapperFactory.h"
#include "ROMLoader.h"
#include "AXROM.h"
#include "Bandai74161_7432.h"
#include "CNROM.h"
#include "CpRom.h"
#include "ColorDreams.h"
#include "GxRom.h"
#include "IremG101.h"
#include "JalecoJfxx.h"
#include "JalecoSs88006.h"
#include "MMC1.h"
#include "MMC2.h"
@ -56,9 +58,12 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
case 37: break;
case 38: return new UnlPci556();
case 66: return new GxRom();
case 70: return new Bandai74161_7432(false);
case 71: return new BF909x();
case 79: return new Nina03_06();
//case 87: return new JalecoJf05();
case 87: return new JalecoJfxx(false);
case 101: return new JalecoJfxx(true);
case 152: return new Bandai74161_7432(true);
case 163: return new Nanjing();
case 189: return new MMC3_189();
}