mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-27 11:00:50 +00:00
Mapper 166/167 (Subor) support
This commit is contained in:
parent
d8fd734fe2
commit
52a90da973
@ -586,6 +586,7 @@
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="StereoDelayFilter.h" />
|
||||
<ClInclude Include="StereoPanningFilter.h" />
|
||||
<ClInclude Include="Subor166.h" />
|
||||
<ClInclude Include="Sunsoft184.h" />
|
||||
<ClInclude Include="Sunsoft3.h" />
|
||||
<ClInclude Include="Sunsoft4.h" />
|
||||
|
@ -80,6 +80,9 @@
|
||||
<Filter Include="Nes\Mappers\Kaiser">
|
||||
<UniqueIdentifier>{9b0da03f-174e-403b-b988-394f32d4e1d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Nes\Mappers\Txc">
|
||||
<UniqueIdentifier>{c877c2a1-f79e-4a58-82d2-f4318e21ff81}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="IAudioDevice.h">
|
||||
@ -730,15 +733,6 @@
|
||||
<ClInclude Include="Sachen_133.h">
|
||||
<Filter>Nes\Mappers\Sachen</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211A.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211B.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211C.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Kaiser7058.h">
|
||||
<Filter>Nes\Mappers\Kaiser</Filter>
|
||||
</ClInclude>
|
||||
@ -763,9 +757,6 @@
|
||||
<ClInclude Include="FrameInfo.h">
|
||||
<Filter>VideoDecoder</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22000.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Caltron41.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
@ -793,6 +784,21 @@
|
||||
<ClInclude Include="MMC3_165.h">
|
||||
<Filter>Nes\Mappers\MMC</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Subor166.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22000.h">
|
||||
<Filter>Nes\Mappers\Txc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211A.h">
|
||||
<Filter>Nes\Mappers\Txc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211B.h">
|
||||
<Filter>Nes\Mappers\Txc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211C.h">
|
||||
<Filter>Nes\Mappers\Txc</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -109,6 +109,7 @@
|
||||
#include "Sachen74LS374N.h"
|
||||
#include "Sachen74LS374NB.h"
|
||||
#include "Sachen8259.h"
|
||||
#include "Subor166.h"
|
||||
#include "Sunsoft3.h"
|
||||
#include "Sunsoft4.h"
|
||||
#include "Sunsoft89.h"
|
||||
@ -155,7 +156,7 @@ Supported mappers:
|
||||
|112|113| |115| | |118|119| | | | | | | | |
|
||||
| | | | |132|133| | | |137|138|139|140|141|142|143|
|
||||
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
|
||||
| | | |163|164|165| | | | |170|171|172|173| |175|
|
||||
| | | |163|164|165|166|167| | |170|171|172|173| |175|
|
||||
|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| | | | | |
|
||||
@ -300,6 +301,8 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
||||
case 163: return new Nanjing();
|
||||
case 164: return new Waixing164();
|
||||
case 165: return new MMC3_165();
|
||||
case 166: return new Subor166();
|
||||
case 167: return new Subor166();
|
||||
case 170: return new Mapper170();
|
||||
case 171: return new Kaiser7058();
|
||||
case 172: return new Txc22211B();
|
||||
|
55
Core/Subor166.h
Normal file
55
Core/Subor166.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
|
||||
class Subor166 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
uint8_t _regs[4];
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() { return 0x4000; }
|
||||
virtual uint16_t GetCHRPageSize() { return 0x2000; }
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
memset(_regs, 0, sizeof(_regs));
|
||||
WriteRegister(0x8000, 0);
|
||||
SelectCHRPage(0, 0);
|
||||
}
|
||||
|
||||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_regs[0], _regs[1], _regs[2], _regs[3]);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
switch(addr & 0xE000) {
|
||||
case 0x8000: _regs[0] = value & 0x10; break;
|
||||
case 0xA000: _regs[1] = value & 0x1C; break;
|
||||
case 0xC000: _regs[2] = value & 0x1F; break;
|
||||
case 0xE000: _regs[3] = value & 0x1F; break;
|
||||
}
|
||||
|
||||
uint8_t outerBank = ((_regs[0] ^ _regs[1]) & 0x10) << 1;
|
||||
uint8_t innerBank = _regs[2] ^ _regs[3];
|
||||
bool altMode = _mapperID == 167;
|
||||
|
||||
if(_regs[1] & 0x08) {
|
||||
//32 KiB NROM
|
||||
uint8_t bank = (outerBank | innerBank) & 0xFE;
|
||||
SelectPRGPage(0, altMode ? bank + 1 : bank);
|
||||
SelectPRGPage(1, altMode ? bank : bank + 1);
|
||||
} else if(_regs[1] & 0x04) {
|
||||
//512 KiB inverted UNROM(mapper 180)
|
||||
SelectPRGPage(0, 0x1F);
|
||||
SelectPRGPage(1, outerBank | innerBank);
|
||||
} else {
|
||||
//512 KiB UNROM
|
||||
SelectPRGPage(0, outerBank | innerBank);
|
||||
SelectPRGPage(1, altMode ? 0x20 : 0x07);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user