Irem G101 (Mapper 32) support

This commit is contained in:
Souryo 2015-12-28 21:07:32 -05:00
parent 8325aae6ca
commit a7ec11055e
4 changed files with 71 additions and 0 deletions

View File

@ -305,6 +305,7 @@
<ClInclude Include="IMessageManager.h" />
<ClInclude Include="INotificationListener.h" />
<ClInclude Include="InputDataMessage.h" />
<ClInclude Include="IremG101.h" />
<ClInclude Include="JalecoSs88006.h" />
<ClInclude Include="MMC4.h" />
<ClInclude Include="MMC5.h" />

View File

@ -254,6 +254,9 @@
<ClInclude Include="JalecoSs88006.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
<ClInclude Include="IremG101.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CPU.cpp">

65
Core/IremG101.h Normal file
View File

@ -0,0 +1,65 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class IremG101 : public BaseMapper
{
protected:
virtual uint16_t GetPRGPageSize() { return 0x2000; }
virtual uint16_t GetCHRPageSize() { return 0x0400; }
uint8_t _prgRegs[2];
uint8_t _prgMode;
void InitMapper()
{
_prgRegs[0] = _prgRegs[1] = 0;
_prgMode = 0;
SelectPRGPage(2, -2);
SelectPRGPage(3, -1);
}
virtual void StreamState(bool saving)
{
StreamArray<uint8_t>(_prgRegs, 2);
Stream<uint8_t>(_prgMode);
}
void UpdatePrgMode()
{
if(_prgMode == 0) {
SelectPRGPage(0, _prgRegs[0]);
SelectPRGPage(1, _prgRegs[1]);
SelectPRGPage(2, -2);
SelectPRGPage(3, -1);
} else {
SelectPRGPage(0, -2);
SelectPRGPage(1, _prgRegs[1]);
SelectPRGPage(2, _prgRegs[0]);
SelectPRGPage(3, -1);
}
}
void WriteRegister(uint16_t addr, uint8_t value)
{
switch(addr & 0xF000) {
case 0x8000:
_prgRegs[0] = value & 0x1F;
SelectPRGPage(_prgMode == 0 ? 0 : 2, _prgRegs[0]);
break;
case 0x9000:
_prgMode = (value & 0x02) >> 1;
UpdatePrgMode();
SetMirroringType((value & 0x01) == 0x01 ? MirroringType::Horizontal : MirroringType::Vertical);
break;
case 0xA000:
_prgRegs[1] = value & 0x1F;
SelectPRGPage(1, _prgRegs[1]);
break;
case 0xB000:
SelectCHRPage(addr & 0x07, value);
break;
}
}
};

View File

@ -6,6 +6,7 @@
#include "CNROM.h"
#include "CpRom.h"
#include "ColorDreams.h"
#include "IremG101.h"
#include "JalecoSs88006.h"
#include "MMC1.h"
#include "MMC2.h"
@ -45,6 +46,7 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
case 23: return new VRC2_4(VRCVariant::VRC2b); //Conflicts: VRC4e
case 25: return new VRC2_4(VRCVariant::VRC4b); //Conflicts: VRC2c, VRC4d
case 27: return new VRC2_4(VRCVariant::VRC4_27); //Untested
case 32: return new IremG101();
case 71: return new BF909x();
case 163: return new Nanjing();
case 189: return new MMC3_189();