Mapper 238 support

This commit is contained in:
Souryo 2016-08-12 19:41:47 -04:00
parent 3bf54d7cb6
commit 7626f7df8d
4 changed files with 48 additions and 1 deletions

View File

@ -463,6 +463,7 @@
<ClInclude Include="Mapper227.h" />
<ClInclude Include="Mapper230.h" />
<ClInclude Include="Mapper234.h" />
<ClInclude Include="MMC3_238.h" />
<ClInclude Include="Mapper241.h" />
<ClInclude Include="Mapper244.h" />
<ClInclude Include="Mapper35.h" />

View File

@ -859,6 +859,9 @@
<ClInclude Include="MMC3_254.h">
<Filter>Nes\Mappers\MMC</Filter>
</ClInclude>
<ClInclude Include="MMC3_238.h">
<Filter>Nes\Mappers\MMC</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

41
Core/MMC3_238.h Normal file
View File

@ -0,0 +1,41 @@
#pragma once
#include "stdafx.h"
#include "MMC3.h"
class MMC3_238 : public MMC3
{
private:
const uint8_t _securityLut[4] = { 0x00, 0x02, 0x02, 0x03 };
uint8_t _exReg;
protected:
virtual bool AllowRegisterRead() { return true; }
void InitMapper()
{
MMC3::InitMapper();
_exReg = 0;
AddRegisterRange(0x4020, 0x7FFF, MemoryOperation::Any);
RemoveRegisterRange(0x8000, 0xFFFF, MemoryOperation::Read);
}
void StreamState(bool saving)
{
MMC3::StreamState(saving);
Stream(_exReg);
}
uint8_t ReadRegister(uint16_t addr)
{
return _exReg;
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(addr < 0x8000) {
_exReg = _securityLut[value & 0x03];
} else {
MMC3::WriteRegister(addr, value);
}
}
};

View File

@ -95,6 +95,7 @@
#include "MMC3_189.h"
#include "MMC3_197.h"
#include "MMC3_205.h"
#include "MMC3_238.h"
#include "MMC3_245.h"
#include "MMC3_249.h"
#include "MMC3_250.h"
@ -179,7 +180,7 @@ Supported mappers:
|176|177|178|179|180| |182| |184|185| |187|188|189|===|191|
|192|193|194|195| |197| | |200|201|202|203| |205|206|207|
| |209|210|211|212| | | | | |218| | |221| | |
| |225|226|227|228| |230|231|232| |234|235| |===| |===|
| |225|226|227|228| |230|231|232| |234|235| |===|238|===|
|240|241|242|243|244|245|246|===|===|249|250|===|252| |254| |
-----------------------------------------------------------------
*/
@ -374,6 +375,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 232: return new BF9096();
case 234: return new Mapper234();
case 235: return new Bmc235();
case 238: return new MMC3_238();
case 240: return new Mapper240();
case 241: return new Mapper241();
case 242: return new Mapper242();