Sunsoft mapper 89/93/184 support

This commit is contained in:
Souryo 2015-12-30 20:31:54 -05:00
parent 4ced4c0f3f
commit d943350386
6 changed files with 90 additions and 0 deletions

View File

@ -337,6 +337,9 @@
<ClInclude Include="MemoryManager.h" />
<ClInclude Include="ROMLoader.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="Sunsoft184.h" />
<ClInclude Include="Sunsoft89.h" />
<ClInclude Include="Sunsoft93.h" />
<ClInclude Include="TaitoTc0190.h" />
<ClInclude Include="TaitoX1005.h" />
<ClInclude Include="TriangleChannel.h" />

View File

@ -278,6 +278,15 @@
<ClInclude Include="TaitoX1005.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
<ClInclude Include="Sunsoft89.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
<ClInclude Include="Sunsoft93.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
<ClInclude Include="Sunsoft184.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CPU.cpp">

View File

@ -20,6 +20,9 @@
#include "Nanjing.h"
#include "Nina03_06.h"
#include "NROM.h"
#include "Sunsoft89.h"
#include "Sunsoft93.h"
#include "Sunsoft184.h"
#include "TaitoTc0190.h"
#include "TaitoX1005.h"
#include "UnlPci556.h"
@ -64,9 +67,12 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
case 79: return new Nina03_06();
case 80: return new TaitoX1005();
case 87: return new JalecoJfxx(false);
case 89: return new Sunsoft89();
case 93: return new Sunsoft93();
case 101: return new JalecoJfxx(true);
case 152: return new Bandai74161_7432(true);
case 163: return new Nanjing();
case 184: return new Sunsoft184();
case 185: return new CNROM(true);
case 189: return new MMC3_189();
}

25
Core/Sunsoft184.h Normal file
View File

@ -0,0 +1,25 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Sunsoft184 : public BaseMapper
{
protected:
virtual uint16_t GetPRGPageSize() { return 0x8000; }
virtual uint16_t GetCHRPageSize() { return 0x1000; }
virtual uint16_t RegisterStartAddress() { return 0x6000; }
virtual uint16_t RegisterEndAddress() { return 0x7FFF; }
void InitMapper()
{
SelectPRGPage(0, 0);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
SelectCHRPage(0, value & 0x07);
//"The most significant bit of H is always set in hardware."
SelectCHRPage(1, 0x80 | ((value >> 4) & 0x07));
}
};

22
Core/Sunsoft89.h Normal file
View File

@ -0,0 +1,22 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Sunsoft89 : public BaseMapper
{
protected:
virtual uint16_t GetPRGPageSize() { return 0x4000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper()
{
SelectPRGPage(1, -1);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
SelectPRGPage(0, (value >> 4) & 0x07);
SelectCHRPage(0, value & 0x07 | ((value & 0x80) >> 4));
SetMirroringType((value & 0x08) == 0x08 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
}
};

25
Core/Sunsoft93.h Normal file
View File

@ -0,0 +1,25 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Sunsoft93 : public BaseMapper
{
protected:
virtual uint16_t GetPRGPageSize() { return 0x4000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper()
{
SelectPRGPage(1, -1);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
SelectPRGPage(0, (value >> 4) & 0x07);
if((value & 0x01) == 0x01) {
SelectCHRPage(0, 0);
} else {
RemovePpuMemoryMapping(0x0000, 0x1FFF);
}
}
};