mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-13 21:10:20 +00:00
Mapper 217 support
This commit is contained in:
parent
74b4d32f25
commit
e0570303b5
@ -483,6 +483,7 @@
|
||||
<ClInclude Include="MMC3_196.h" />
|
||||
<ClInclude Include="MMC3_199.h" />
|
||||
<ClInclude Include="MMC3_215.h" />
|
||||
<ClInclude Include="MMC3_217.h" />
|
||||
<ClInclude Include="MMC3_219.h" />
|
||||
<ClInclude Include="MMC3_238.h" />
|
||||
<ClInclude Include="Mapper241.h" />
|
||||
|
@ -949,6 +949,9 @@
|
||||
<ClInclude Include="MMC3_215.h">
|
||||
<Filter>Nes\Mappers\MMC</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MMC3_217.h">
|
||||
<Filter>Nes\Mappers\MMC</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -147,8 +147,6 @@ class MMC3 : public BaseMapper
|
||||
_chrMode = (_state.Reg8000 & 0x80) >> 7;
|
||||
_prgMode = (_state.Reg8000 & 0x40) >> 6;
|
||||
|
||||
UpdateMirroring();
|
||||
|
||||
if(_subMapperID == 1) {
|
||||
bool wramEnabled = (_state.Reg8000 & 0x20) == 0x20;
|
||||
RemoveCpuMemoryMapping(0x6000, 0x7000);
|
||||
@ -225,7 +223,7 @@ class MMC3 : public BaseMapper
|
||||
|
||||
case MMC3Registers::RegA000:
|
||||
_state.RegA000 = value;
|
||||
UpdateState();
|
||||
UpdateMirroring();
|
||||
break;
|
||||
|
||||
case MMC3Registers::RegA001:
|
||||
|
130
Core/MMC3_217.h
Normal file
130
Core/MMC3_217.h
Normal file
@ -0,0 +1,130 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "MMC3.h"
|
||||
|
||||
class MMC3_217 : public MMC3
|
||||
{
|
||||
private:
|
||||
uint8_t _exRegs[4];
|
||||
uint8_t _lut[8] = { 0,6,3,7,5,2,4,1 };
|
||||
|
||||
protected:
|
||||
void InitMapper() override
|
||||
{
|
||||
AddRegisterRange(0x5000, 0x5001, MemoryOperation::Write);
|
||||
AddRegisterRange(0x5007, 0x5007, MemoryOperation::Write);
|
||||
|
||||
MMC3::InitMapper();
|
||||
}
|
||||
|
||||
void Reset(bool softReset) override
|
||||
{
|
||||
_exRegs[0] = 0;
|
||||
_exRegs[1] = 0xFF;
|
||||
_exRegs[2] = 0x03;
|
||||
_exRegs[3] = 0;
|
||||
|
||||
BaseMapper::Reset(softReset);
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void StreamState(bool saving) override
|
||||
{
|
||||
MMC3::StreamState(saving);
|
||||
Stream(_exRegs[0], _exRegs[1], _exRegs[2], _exRegs[3]);
|
||||
}
|
||||
|
||||
void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default) override
|
||||
{
|
||||
if(!(_exRegs[1] & 0x08)) {
|
||||
page = (_exRegs[1] << 3 & 0x80) | (page & 0x7F);
|
||||
}
|
||||
|
||||
MMC3::SelectCHRPage(slot, (_exRegs[1] << 8 & 0x0300) | page);
|
||||
}
|
||||
|
||||
void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom) override
|
||||
{
|
||||
if(_exRegs[1] & 0x08) {
|
||||
page = (page & 0x1F);
|
||||
} else {
|
||||
page = (page & 0x0F) | (_exRegs[1] & 0x10);
|
||||
}
|
||||
|
||||
MMC3::SelectPRGPage(slot, (_exRegs[1] << 5 & 0x60) | page);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
if(addr < 0x8000) {
|
||||
switch(addr) {
|
||||
case 0x5000:
|
||||
_exRegs[0] = value;
|
||||
|
||||
if(value & 0x80) {
|
||||
value = (value & 0x0F) | (_exRegs[1] << 4 & 0x30);
|
||||
value <<= 1;
|
||||
SelectPRGPage(0, value);
|
||||
SelectPRGPage(1, value + 1);
|
||||
SelectPRGPage(2, value);
|
||||
SelectPRGPage(3, value + 1);
|
||||
} else {
|
||||
UpdatePrgMapping();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x5001:
|
||||
if(_exRegs[1] != value) {
|
||||
_exRegs[1] = value;
|
||||
UpdatePrgMapping();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x5007:
|
||||
_exRegs[2] = value;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(addr & 0xE001) {
|
||||
case 0x8000:
|
||||
MMC3::WriteRegister(_exRegs[2] ? 0xC000 : 0x8000, value);
|
||||
break;
|
||||
|
||||
case 0x8001:
|
||||
if(_exRegs[2]) {
|
||||
value = (value & 0xC0) | _lut[value & 0x07];
|
||||
_exRegs[3] = 1;
|
||||
|
||||
MMC3::WriteRegister(0x8000, value);
|
||||
} else {
|
||||
MMC3::WriteRegister(0x8001, value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xA000:
|
||||
if(_exRegs[2]) {
|
||||
if(_exRegs[3] && ((_exRegs[0] & 0x80) == 0 || GetCurrentRegister() < 6)) {
|
||||
_exRegs[3] = 0;
|
||||
MMC3::WriteRegister(0x8001, value);
|
||||
}
|
||||
} else {
|
||||
SetMirroringType(value & 0x01 ? MirroringType::Horizontal : MirroringType::Vertical);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xA001:
|
||||
if(_exRegs[2]) {
|
||||
SetMirroringType(value & 0x01 ? MirroringType::Horizontal : MirroringType::Vertical);
|
||||
} else {
|
||||
MMC3::WriteRegister(0xA001, value);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
MMC3::WriteRegister(addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -114,6 +114,7 @@
|
||||
#include "MMC3_199.h"
|
||||
#include "MMC3_205.h"
|
||||
#include "MMC3_215.h"
|
||||
#include "MMC3_217.h"
|
||||
#include "MMC3_219.h"
|
||||
#include "MMC3_238.h"
|
||||
#include "MMC3_245.h"
|
||||
@ -203,7 +204,7 @@ Supported mappers:
|
||||
|---|===|162|163|164|165|166|167|168|===|170|171|172|173|===|175|
|
||||
|176|177|178|179|180|---|182|183|184|185|186|187|188|189|===|191|
|
||||
|192|193|194|195|196|197| |199|200|201|202|203|204|205|206|207|
|
||||
| |209|210|211|212|213|214|215|216| |218|219| |221|222| |
|
||||
| |209|210|211|212|213|214|215|216|217|218|219| |221|222| |
|
||||
| |225|226|227|228|229|230|231|232|233|234|235| |===|238|===|
|
||||
|240|241|242|243|244|245|246|===|===|249|250|===|252|253|254|255|
|
||||
-----------------------------------------------------------------
|
||||
@ -406,6 +407,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
||||
case 214: return new Mapper214();
|
||||
case 215: return new MMC3_215();
|
||||
case 216: return new Mapper216();
|
||||
case 217: return new MMC3_217();
|
||||
case 218: return new Mapper218();
|
||||
case 219: return new MMC3_219();
|
||||
case 221: return new Mapper221();
|
||||
|
Loading…
x
Reference in New Issue
Block a user