UNIF: Added support for UNL-DragonFighter boards

This commit is contained in:
Sour 2018-06-21 16:52:54 -04:00
parent 4d3e10dd41
commit 48dcfa6de7
6 changed files with 80 additions and 1 deletions

View file

@ -526,6 +526,7 @@
<ClInclude Include="CityFighter.h" />
<ClInclude Include="ControlDeviceState.h" />
<ClInclude Include="Dance2000.h" />
<ClInclude Include="DragonFighter.h" />
<ClInclude Include="DrawScreenBufferCommand.h" />
<ClInclude Include="FdsSystemActionManager.h" />
<ClInclude Include="HdPackConditions.h" />

View file

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

72
Core/DragonFighter.h Normal file
View file

@ -0,0 +1,72 @@
#pragma once
#include "stdafx.h"
#include "MMC3.h"
class DragonFighter : public MMC3
{
private:
uint8_t _exRegs[3];
protected:
bool AllowRegisterRead() override { return true; }
void InitMapper() override
{
memset(_exRegs, 0, sizeof(_exRegs));
MMC3::InitMapper();
AddRegisterRange(0x6000, 0x6FFF, MemoryOperation::Any);
RemoveRegisterRange(0x8000, 0xFFFF, MemoryOperation::Read);
}
void StreamState(bool saving) override
{
MMC3::StreamState(saving);
Stream(_exRegs[0], _exRegs[1], _exRegs[2]);
}
void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default) override
{
if(slot == 0) {
SelectChrPage2x(0, ((page >> 1) ^ _exRegs[1]) << 1);
} else if(slot == 2) {
SelectChrPage2x(1, ((page >> 1) | ((_exRegs[2] & 0x40) << 1)) << 1);
} else if(slot == 4) {
SelectChrPage4x(1, (_exRegs[2] & 0x3F) << 2);
}
}
void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom) override
{
if(slot == 0) {
MMC3::SelectPRGPage(slot, _exRegs[0] & 0x1F);
} else {
MMC3::SelectPRGPage(slot, page);
}
}
uint8_t ReadRegister(uint16_t addr) override
{
if(!(addr & 0x01)) {
if((_exRegs[0] & 0xE0) == 0xC0) {
_exRegs[1] = CPU::DebugReadByte(0x6A);
} else {
_exRegs[2] = CPU::DebugReadByte(0xFF);
}
UpdateState();
}
return 0;
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr < 0x8000) {
if(!(addr & 0x01)) {
_exRegs[0] = value;
UpdateState();
}
} else {
MMC3::WriteRegister(addr, value);
}
}
};

View file

@ -44,6 +44,7 @@
#include "ColorDreams46.h"
#include "Dance2000.h"
#include "DaouInfosys.h"
#include "DragonFighter.h"
#include "DreamTech01.h"
#include "Edu2000.h"
#include "Eh8813A.h"
@ -553,6 +554,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case UnifBoards::CityFighter: return new CityFighter();
case UnifBoards::Coolboy: return new MMC3_Coolboy();
case UnifBoards::Dance2000: return new Dance2000();
case UnifBoards::DragonFighter: return new DragonFighter();
case UnifBoards::DreamTech01: return new DreamTech01();
case UnifBoards::Edu2000: return new Edu2000();
case UnifBoards::Eh8813A: return new Eh8813A();

View file

@ -68,5 +68,6 @@ namespace UnifBoards {
Yoko,
Unl8237A,
BmcHpxx,
DragonFighter,
};
}

View file

@ -147,7 +147,7 @@ std::unordered_map<string, int> UnifLoader::_boardMappings = std::unordered_map<
{ "YOKO", UnifBoards::Yoko },
{ "SB-2000", UnifBoards::UnknownBoard },
{ "158B", UnifBoards::Unl158B },
{ "DRAGONFIGHTER", UnifBoards::UnknownBoard },
{ "DRAGONFIGHTER", UnifBoards::DragonFighter },
{ "EH8813A", UnifBoards::Eh8813A },
{ "HP898F", UnifBoards::Hp898f },
{ "F-15", UnifBoards::BmcF15 },