Mapper 53 support

This commit is contained in:
Souryo 2016-07-23 17:01:14 -04:00
parent f5e777bef8
commit 2631b7d327
4 changed files with 63 additions and 2 deletions

View File

@ -599,6 +599,7 @@
<ClInclude Include="Sunsoft89.h" />
<ClInclude Include="Sunsoft93.h" />
<ClInclude Include="SunsoftFme7.h" />
<ClInclude Include="Supervision.h" />
<ClInclude Include="TaitoTc0190.h" />
<ClInclude Include="TaitoTc0690.h" />
<ClInclude Include="TaitoX1005.h" />

View File

@ -814,6 +814,9 @@
<ClInclude Include="OekaKids.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
<ClInclude Include="Supervision.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View File

@ -121,6 +121,7 @@
#include "Sunsoft93.h"
#include "Sunsoft184.h"
#include "SunsoftFme7.h"
#include "Supervision.h"
#include "TaitoTc0190.h"
#include "TaitoTc0690.h"
#include "TaitoX1005.h"
@ -154,10 +155,10 @@ Supported mappers:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| | 15|
| 16| 17| 18| 19|...| 21| 22| 23| 24| 25| 26| 27| 28| | | 31|
| 32| 33| 34| 35| 36| 37| 38|---| 40| 41| 42|---| 44| 45| 46| 47|
| 48| 49| 50| 51| 52| | | | 56| 57| 58|===| 60| 61| 62| 63|
| 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| | | | | |107|108| | | |
| 96| 97|===| 99|...|101| | | | | |107|108| | | |
|112|113| |115| | |118|119| | | | | | | | |
| | | | |132|133| | | |137|138|139|140|141|142|143|
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
@ -232,6 +233,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 50: return new Mapper50();
case 51: return new Bmc51();
case 52: return new MMC3_52();
case 53: return new Supervision();
case 56: return new Kaiser202();
case 57: return new Mapper57();
case 58: return new Mapper58();

55
Core/Supervision.h Normal file
View File

@ -0,0 +1,55 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Supervision : public BaseMapper
{
private:
const uint32_t EPROM_CRC = 0x63794E25;
uint8_t _regs[2];
bool _epromFirst;
protected:
virtual uint16_t RegisterStartAddress() { return 0x6000; }
virtual uint16_t RegisterEndAddress() { return 0xFFFF; }
virtual uint16_t GetPRGPageSize() { return 0x2000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper()
{
_epromFirst = _prgSize >= 0x8000 && CRC32::GetCRC(_prgRom, 0x8000) == EPROM_CRC;
_regs[0] = _regs[1] = 0;
UpdateState();
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
Stream(_regs[0], _regs[1]);
}
void UpdateState()
{
uint16_t r = _regs[0] << 3 & 0x78;
SetCpuMemoryMapping(0x6000, 0x7FFF, (r << 1 | 0x0F) + (_epromFirst ? 0x04 : 0x00), PrgMemoryType::PrgRom);
SelectPrgPage2x(0, ((_regs[0] & 0x10) ? (r | (_regs[1] & 0x07)) + (_epromFirst ? 0x02 : 0x00) : _epromFirst ? 0x00 : 0x80) << 1);
SelectPrgPage2x(1, ((_regs[0] & 0x10) ? (r | (0xFF & 0x07)) + (_epromFirst ? 0x02 : 0x00) : _epromFirst ? 0x01 : 0x81) << 1);
SetMirroringType(_regs[0] & 0x20 ? MirroringType::Horizontal : MirroringType::Vertical);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(addr < 0x8000) {
_regs[0] = value;
} else {
_regs[1] = value;
}
UpdateState();
}
};