Mapper 106 support

This commit is contained in:
Souryo 2016-08-20 10:02:23 -04:00
parent 228a36ea2d
commit a0fc28fb65
4 changed files with 76 additions and 1 deletions

View file

@ -446,6 +446,7 @@
<ClInclude Include="Kaiser7022.h" />
<ClInclude Include="Kaiser7058.h" />
<ClInclude Include="Mapper103.h" />
<ClInclude Include="Mapper106.h" />
<ClInclude Include="Mapper107.h" />
<ClInclude Include="Mapper108.h" />
<ClInclude Include="Mapper112.h" />

View file

@ -901,6 +901,9 @@
<ClInclude Include="Tf1201.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
<ClInclude Include="Mapper106.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

69
Core/Mapper106.h Normal file
View file

@ -0,0 +1,69 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Mapper106 : public BaseMapper
{
private:
uint16_t _irqCounter;
bool _irqEnabled;
protected:
virtual uint16_t GetPRGPageSize() { return 0x2000; }
virtual uint16_t GetCHRPageSize() { return 0x400; }
void InitMapper()
{
_irqEnabled = false;
_irqCounter = 0;
SelectPRGPage(0, -1);
SelectPRGPage(1, -1);
SelectPRGPage(2, -1);
SelectPRGPage(3, -1);
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
Stream(_irqCounter, _irqEnabled);
}
void ProcessCpuClock()
{
if(_irqEnabled) {
_irqCounter++;
if(_irqCounter == 0) {
CPU::SetIRQSource(IRQSource::External);
_irqEnabled = false;
}
}
}
void WriteRegister(uint16_t addr, uint8_t value)
{
switch(addr & 0x0F) {
case 0: case 2: SelectCHRPage(addr & 0x0F, value & 0xFE); break;
case 1: case 3: SelectCHRPage(addr & 0x0F, value | 0x01); break;
case 4: case 5: case 6: case 7: SelectCHRPage(addr & 0x0F, value); break;
case 8: case 0x0B: SelectPRGPage((addr & 0x0F) - 8, (value & 0x0F) | 0x10); break;
case 9: case 0x0A: SelectPRGPage((addr & 0x0F) - 8, value & 0x1F); break;
case 0x0D:
_irqEnabled = false;
_irqCounter = 0;
CPU::ClearIRQSource(IRQSource::External);
break;
case 0x0E:
_irqCounter = (_irqCounter & 0xFF00) | value;
break;
case 0x0F:
_irqCounter = (_irqCounter & 0xFF) | (value << 8);
_irqEnabled = true;
break;
}
}
};

View file

@ -52,6 +52,7 @@
#include "Mapper62.h"
#include "Mapper91.h"
#include "Mapper103.h"
#include "Mapper106.h"
#include "Mapper107.h"
#include "Mapper108.h"
#include "Mapper112.h"
@ -183,7 +184,7 @@ Supported mappers:
| 48| 49| 50| 51| 52| 53| | | 56| 57| 58|===| 60| 61| 62| 63|
| 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79|
| 80|===| 82| |===| 85| 86| 87| 88| 89| 90| 91| 92| 93| 94| 95|
| 96| 97|===| 99|...|101|===|103| | | |107|108|===|===|===|
| 96| 97|===| 99|...|101|===|103| | |106|107|108|===|===|===|
|112|113|114|115| | |118|119|120|121|===| |===| | |===|
|===|===|===|===|132|133| |===|136|137|138|139|140|141|142|143|
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
@ -304,6 +305,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 101: return new JalecoJfxx(true);
case 103: return new Mapper103();
case 105: break; //NES World Champ - has dip switches
case 106: return new Mapper106();
case 107: return new Mapper107();
case 108: return new Mapper108();
case 112: return new Mapper112();