UNIF AX5705 board support

This commit is contained in:
Souryo 2016-11-08 17:18:36 -05:00
parent f2393eeaa6
commit c5850f7946
6 changed files with 74 additions and 1 deletions

65
Core/Ax5705.h Normal file
View file

@ -0,0 +1,65 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Ax5705 : public BaseMapper
{
private:
uint8_t _chrReg[8];
protected:
uint16_t GetPRGPageSize() { return 0x2000; }
uint16_t GetCHRPageSize() { return 0x400; }
void InitMapper() override
{
memset(_chrReg, 0, sizeof(_chrReg));
SelectPRGPage(2, -2);
SelectPRGPage(3, -1);
for(int i = 0; i < 8; i++) {
SelectCHRPage(i, _chrReg[i]);
}
}
void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
ArrayInfo<uint8_t> chrReg{ _chrReg, 8 };
Stream(chrReg);
}
void UpdateChrReg(int index, uint8_t value, bool low)
{
if(low) {
_chrReg[index] = (_chrReg[index] & 0xF0) | (value & 0x0F);
} else {
_chrReg[index] = (_chrReg[index] & 0x0F) | ((((value & 0x04) >> 1) | ((value & 0x02) << 1) | (value & 0x09)) << 4);
}
SelectCHRPage(index, _chrReg[index]);
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr >= 0xA008) {
bool low = (addr & 0x01) == 0x00;
switch(addr & 0xF00E) {
case 0xA008: UpdateChrReg(0, value, low); break;
case 0xA00A: UpdateChrReg(1, value, low); break;
case 0xC000: UpdateChrReg(2, value, low); break;
case 0xC002: UpdateChrReg(3, value, low); break;
case 0xC008: UpdateChrReg(4, value, low); break;
case 0xC00A: UpdateChrReg(5, value, low); break;
case 0xE000: UpdateChrReg(6, value, low); break;
case 0xE002: UpdateChrReg(7, value, low); break;
}
} else {
switch(addr & 0xF00F) {
case 0x8000: SelectPRGPage(0, ((value & 0x02) << 2) | ((value & 0x08) >> 2) | (value & 0x05)); break; // EPROM dump have mixed PRG and CHR banks, data lines to mapper seems to be mixed
case 0x8008: SetMirroringType(value & 0x01 ? MirroringType::Horizontal : MirroringType::Vertical); break;
case 0xA000: SelectPRGPage(1, ((value & 0x02) << 2) | ((value & 0x08) >> 2) | (value & 0x05)); break;
}
}
}
};

View file

@ -405,6 +405,7 @@
<ClInclude Include="ArkanoidController.h" />
<ClInclude Include="AutoRomTest.h" />
<ClInclude Include="AutoSaveManager.h" />
<ClInclude Include="Ax5705.h" />
<ClInclude Include="Bandai74161_7432.h" />
<ClInclude Include="BandaiFcg.h" />
<ClInclude Include="BandaiKaraoke.h" />

View file

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

View file

@ -5,6 +5,7 @@
#include "A65AS.h"
#include "Action53.h"
#include "ActionEnterprises.h"
#include "Ax5705.h"
#include "AXROM.h"
#include "Bandai74161_7432.h"
#include "BandaiFcg.h"
@ -233,6 +234,7 @@ const uint16_t MapperFactory::FdsMapperID;
const uint16_t MapperFactory::NsfMapperID;
const uint16_t MapperFactory::UnknownBoard;
const uint16_t MapperFactory::UnifA65AS;
const uint16_t MapperFactory::UnifAx5705;
const uint16_t MapperFactory::UnifBmc70in1;
const uint16_t MapperFactory::UnifBmc70in1B;
const uint16_t MapperFactory::UnifBmc190in1;
@ -478,6 +480,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 255: return new Bmc255();
case MapperFactory::UnifA65AS: return new A65AS();
case MapperFactory::UnifAx5705: return new Ax5705();
case MapperFactory::UnifBmc70in1: return new Bmc70in1();
case MapperFactory::UnifBmc70in1B: return new Bmc70in1();
case MapperFactory::UnifBmc190in1: return new Bmc190in1();

View file

@ -30,6 +30,7 @@ class MapperFactory
static const uint16_t UnifGhostbusters63in1 = 65517;
static const uint16_t UnifBmc70in1 = 65516;
static const uint16_t UnifBmc70in1B = 65515;
static const uint16_t UnifAx5705 = 65514;
static shared_ptr<BaseMapper> InitializeFromFile(string romFilename, stringstream *filestream, string ipsFilename, int32_t archiveFileIndex);
};

View file

@ -29,7 +29,7 @@ private:
{ "A65AS", MapperFactory::UnifA65AS },
{ "AC08", MapperFactory::UnknownBoard },
{ "ANROM", 7 },
{ "AX5705", MapperFactory::UnknownBoard },
{ "AX5705", MapperFactory::UnifAx5705 },
{ "BB", MapperFactory::UnknownBoard },
{ "BS-5", MapperFactory::UnifBs5 },
{ "CC-21", MapperFactory::UnknownBoard },