Mapper 234 support

This commit is contained in:
Souryo 2016-07-23 12:26:02 -04:00
parent 52a90da973
commit 520478972d
4 changed files with 75 additions and 1 deletions

View file

@ -456,6 +456,7 @@
<ClInclude Include="Mapper226.h" />
<ClInclude Include="Mapper227.h" />
<ClInclude Include="Mapper230.h" />
<ClInclude Include="Mapper234.h" />
<ClInclude Include="Mapper241.h" />
<ClInclude Include="Mapper35.h" />
<ClInclude Include="Mapper40.h" />

View file

@ -799,6 +799,9 @@
<ClInclude Include="Txc22211C.h">
<Filter>Nes\Mappers\Txc</Filter>
</ClInclude>
<ClInclude Include="Mapper234.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

68
Core/Mapper234.h Normal file
View file

@ -0,0 +1,68 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Mapper234 : public BaseMapper
{
private:
uint8_t _regs[2];
protected:
virtual uint16_t RegisterStartAddress() { return 0xFF80; }
virtual uint16_t RegisterEndAddress() { return 0xFF9F; }
virtual uint16_t GetPRGPageSize() { return 0x8000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
virtual bool AllowRegisterRead() { return true; }
virtual bool HasBusConflicts() { return true; }
void InitMapper()
{
AddRegisterRange(0xFFE8, 0xFFF8, MemoryOperation::Any);
memset(_regs, 0, sizeof(_regs));
UpdateState();
}
void UpdateState()
{
if(_regs[0] & 0x40) {
//NINA-03 mode
SelectPRGPage(0, (_regs[0] & 0x0E) | (_regs[1] & 0x01));
SelectCHRPage(0, ((_regs[0] << 2) & 0x38) | (_regs[1] >> 4) & 0x07);
} else {
//CNROM mode
SelectPRGPage(0, _regs[0] & 0x0F);
SelectCHRPage(0, ((_regs[0] << 2) & 0x3C) | (_regs[1] >> 4) & 0x03);
}
SetMirroringType(_regs[0] & 0x80 ? MirroringType::Horizontal : MirroringType::Vertical);
}
uint8_t ReadRegister(uint16_t addr)
{
uint8_t value = InternalReadRam(addr);
if(addr <= 0xFF9F) {
if(!(_regs[0] & 0x3F)) {
_regs[0] = value;
UpdateState();
}
} else {
_regs[1] = value & 0x71;
UpdateState();
}
return value;
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(addr <= 0xFF9F) {
if(!(_regs[0] & 0x3F)) {
_regs[0] = value;
UpdateState();
}
} else {
_regs[1] = value & 0x71;
UpdateState();
}
}
};

View file

@ -62,6 +62,7 @@
#include "Mapper227.h"
#include "Mapper230.h"
#include "Mapper231.h"
#include "Mapper234.h"
#include "Mapper240.h"
#include "Mapper241.h"
#include "Mapper242.h"
@ -160,7 +161,7 @@ Supported mappers:
|176|177|178|179|180| |182| |184|185| | | |189| |191|
|192|193|194|195| | | | |200|201|202|203| |205|206|207|
| |209|210|211| | | | | | |218| | | | | |
| |225|226|227|228| |230|231|232| | |235| | | | |
| |225|226|227|228| |230|231|232| |234|235| | | | |
|240|241|242|243| |245|246| | | | | |252| | | |
-----------------------------------------------------------------
*/
@ -340,6 +341,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 230: return new Mapper230();
case 231: return new Mapper231();
case 232: return new BF9096();
case 234: return new Mapper234();
case 235: return new Bmc235();
case 240: return new Mapper240();
case 241: return new Mapper241();