UNIF D1038 board support

This commit is contained in:
Souryo 2017-04-12 20:52:16 -04:00
parent b34d3d2760
commit 17195b8666
6 changed files with 64 additions and 1 deletions

View File

@ -443,6 +443,7 @@
<ClInclude Include="CodeRunner.h" />
<ClInclude Include="ColorDreams46.h" />
<ClInclude Include="CrossFeedFilter.h" />
<ClInclude Include="UnlD1038.h" />
<ClInclude Include="DaouInfosys.h" />
<ClInclude Include="DebugBreakHelper.h" />
<ClInclude Include="DebuggerTypes.h" />

View File

@ -1132,6 +1132,9 @@
<ClInclude Include="Unl255in1.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
<ClInclude Include="UnlD1038.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View File

@ -219,6 +219,7 @@
#include "TxSRom.h"
#include "Unl255in1.h"
#include "Unl43272.h"
#include "UnlD1038.h"
#include "UnlPci556.h"
#include "UnlPuzzle.h"
#include "UNROM.h"
@ -538,6 +539,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case UnifBoards::Tf1201: return new Tf1201();
case UnifBoards::Unl255in1: return new Unl255in1();
case UnifBoards::Unl43272: return new Unl43272();
case UnifBoards::UnlD1038: return new UnlD1038();
case UnifBoards::UnlPuzzle: return new UnlPuzzle();
case MapperFactory::NsfMapperID: return new NsfMapper();

View File

@ -52,5 +52,6 @@ namespace UnifBoards {
Fk23C,
Fk23Ca,
Unl255in1,
UnlD1038,
};
}

View File

@ -33,7 +33,7 @@ std::unordered_map<string, int> UnifLoader::_boardMappings = std::unordered_map<
{ "10-24-C-A1", UnifBoards::UnknownBoard },
{ "CNROM", 3 },
{ "CPROM", 13 },
{ "D1038", 60 },
{ "D1038", UnifBoards::UnlD1038 },
{ "DANCE", UnifBoards::UnknownBoard },
{ "DANCE2000", UnifBoards::UnknownBoard },
{ "DREAMTECH01", UnifBoards::DreamTech01 },

56
Core/UnlD1038.h Normal file
View File

@ -0,0 +1,56 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class UnlD1038 : public BaseMapper
{
private:
uint8_t _dipSwitch;
bool _returnDipSwitch;
protected:
uint16_t GetPRGPageSize() override { return 0x4000; }
uint16_t GetCHRPageSize() override { return 0x2000; }
bool AllowRegisterRead() override { return true; }
void InitMapper() override
{
_dipSwitch = 0;
WriteRegister(0x8000, 0);
}
void Reset(bool softReset) override
{
if(softReset) {
_dipSwitch = (_dipSwitch + 1) & 0x03;
}
}
void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_dipSwitch, _returnDipSwitch);
}
uint8_t ReadRegister(uint16_t addr) override
{
if(_returnDipSwitch) {
return _dipSwitch;
} else {
return InternalReadRam(addr);
}
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr & 0x80) {
SelectPRGPage(0, (addr & 0x70) >> 4);
SelectPRGPage(1, (addr & 0x70) >> 4);
} else {
SelectPrgPage2x(0, (addr & 0x60) >> 4);
}
SelectCHRPage(0, addr & 0x07);
SetMirroringType(addr & 0x08 ? MirroringType::Horizontal : MirroringType::Vertical);
_returnDipSwitch = (addr & 0x100) == 0x100;
}
};