UNIF KS7057 board support

This commit is contained in:
Souryo 2016-11-12 10:09:42 -05:00
parent 2a9c1d8dd0
commit ddfe9fb4f5
6 changed files with 80 additions and 2 deletions

View File

@ -467,6 +467,7 @@
<ClInclude Include="Kaiser202.h" />
<ClInclude Include="Kaiser7022.h" />
<ClInclude Include="Kaiser7037.h" />
<ClInclude Include="Kaiser7057.h" />
<ClInclude Include="Kaiser7058.h" />
<ClInclude Include="Kaiser7016.h" />
<ClInclude Include="Lh10.h" />

View File

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

71
Core/Kaiser7057.h Normal file
View File

@ -0,0 +1,71 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Kaiser7057 : public BaseMapper
{
private:
uint8_t _regs[8];
protected:
uint16_t GetPRGPageSize() { return 0x800; }
uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper() override
{
memset(_regs, 0, sizeof(_regs));
SelectCHRPage(0, 0);
UpdateState();
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
ArrayInfo<uint8_t> regs{ _regs, 8 };
Stream(regs);
if(!saving) {
UpdateState();
}
}
void UpdateState()
{
for(int i = 0; i < 4; i++) {
SetCpuMemoryMapping(0x6000 + 0x800 * i, 0x67FF + 0x800 * i, _regs[4 + i], PrgMemoryType::PrgRom);
SelectPRGPage(i, _regs[i]);
}
SelectPrgPage4x(1, 0x34);
SelectPrgPage4x(2, 0x38);
SelectPrgPage4x(3, 0x3C);
}
void UpdatePrgReg(int index, uint8_t value, bool low)
{
if(low) {
_regs[index] = (_regs[index] & 0xF0) | (value & 0x0F);
} else {
_regs[index] = (_regs[index] & 0x0F) | ((value << 4) & 0xF0);
}
UpdateState();
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
bool low = (addr & 0x01) == 0x00;
switch(addr & 0xF002) {
case 0x8000: case 0x8002: case 0x9000: case 0x9002:
SetMirroringType(value & 0x01 ? MirroringType::Vertical : MirroringType::Horizontal);
break;
case 0xB000: UpdatePrgReg(0, value, low); break;
case 0xB002: UpdatePrgReg(1, value, low); break;
case 0xC000: UpdatePrgReg(2, value, low); break;
case 0xC002: UpdatePrgReg(3, value, low); break;
case 0xD000: UpdatePrgReg(4, value, low); break;
case 0xD002: UpdatePrgReg(5, value, low); break;
case 0xE000: UpdatePrgReg(6, value, low); break;
case 0xE002: UpdatePrgReg(7, value, low); break;
}
}
};

View File

@ -62,8 +62,9 @@
#include "Kaiser202.h"
#include "Kaiser7016.h"
#include "Kaiser7022.h"
#include "Kaiser7058.h"
#include "Kaiser7037.h"
#include "Kaiser7057.h"
#include "Kaiser7058.h"
#include "Lh10.h"
#include "Malee.h"
#include "Mapper15.h"
@ -503,6 +504,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case UnifBoards::Kof97: return new MMC3_Kof97();
case UnifBoards::Ks7016: return new Kaiser7016();
case UnifBoards::Ks7037: return new Kaiser7037();
case UnifBoards::Ks7057: return new Kaiser7057();
case UnifBoards::Lh10: return new Lh10();
case UnifBoards::Malee: return new Malee();
case UnifBoards::NovelDiamond: return new NovelDiamond();

View File

@ -41,5 +41,6 @@ namespace UnifBoards {
BmcF15,
Lh10,
Ks7037,
Ks7057,
};
}

View File

@ -69,7 +69,7 @@ private:
{ "KS7031", UnifBoards::UnknownBoard },
{ "KS7032", 142 },
{ "KS7037", UnifBoards::Ks7037 },
{ "KS7057", UnifBoards::UnknownBoard },
{ "KS7057", UnifBoards::Ks7057 },
{ "LE05", UnifBoards::UnknownBoard },
{ "LH10", UnifBoards::Lh10 },
{ "LH32", 125 },