VRC1 (mapper 75) support
This commit is contained in:
parent
d943350386
commit
c0a14b7886
4 changed files with 66 additions and 0 deletions
|
@ -386,6 +386,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="VideoDecoder.cpp" />
|
||||
<ClCompile Include="VirtualController.cpp" />
|
||||
<ClCompile Include="VRC1.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -376,5 +376,8 @@
|
|||
<ClCompile Include="AutoRomTest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VRC1.h">
|
||||
<Filter>Header Files\Mappers</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -27,6 +27,7 @@
|
|||
#include "TaitoX1005.h"
|
||||
#include "UnlPci556.h"
|
||||
#include "UNROM.h"
|
||||
#include "VRC1.h"
|
||||
#include "VRC2_4.h"
|
||||
#include "BF909x.h"
|
||||
|
||||
|
@ -64,6 +65,7 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
|
|||
case 66: return new GxRom();
|
||||
case 70: return new Bandai74161_7432(false);
|
||||
case 71: return new BF909x();
|
||||
case 75: return new VRC1();
|
||||
case 79: return new Nina03_06();
|
||||
case 80: return new TaitoX1005();
|
||||
case 87: return new JalecoJfxx(false);
|
||||
|
|
60
Core/VRC1.h
Normal file
60
Core/VRC1.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
|
||||
class VRC1 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
uint8_t _chrBanks[2];
|
||||
|
||||
void UpdateChrBanks()
|
||||
{
|
||||
SelectCHRPage(0, _chrBanks[0]);
|
||||
SelectCHRPage(1, _chrBanks[1]);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() { return 0x2000; }
|
||||
virtual uint16_t GetCHRPageSize() { return 0x1000; }
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
SelectPRGPage(3, -1);
|
||||
}
|
||||
|
||||
virtual void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
StreamArray<uint8_t>(_chrBanks, 2);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
switch(addr & 0xF000) {
|
||||
case 0x8000: SelectPRGPage(0, value & 0x0F); break;
|
||||
|
||||
case 0x9000:
|
||||
if(GetMirroringType() != MirroringType::FourScreens) {
|
||||
//"The mirroring bit is ignored if the cartridge is wired for 4-screen VRAM, as is typical for Vs. System games using the VRC1."
|
||||
SetMirroringType((value & 0x01) == 0x01 ? MirroringType::Horizontal : MirroringType::Vertical);
|
||||
}
|
||||
_chrBanks[0] = (_chrBanks[0] & 0x0F) | ((value & 0x02) << 3);
|
||||
_chrBanks[1] = (_chrBanks[1] & 0x0F) | ((value & 0x04) << 2);
|
||||
UpdateChrBanks();
|
||||
break;
|
||||
|
||||
case 0xA000: SelectPRGPage(1, value & 0x0F); break;
|
||||
case 0xC000: SelectPRGPage(2, value & 0x0F); break;
|
||||
|
||||
case 0xE000:
|
||||
_chrBanks[0] = (_chrBanks[0] & 0x10) | (value & 0x0F);
|
||||
UpdateChrBanks();
|
||||
break;
|
||||
|
||||
case 0xF000:
|
||||
_chrBanks[1] = (_chrBanks[1] & 0x10) | (value & 0x0F);
|
||||
UpdateChrBanks();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue