mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-24 01:29:41 +00:00
Mapper 222 support
This commit is contained in:
parent
0755b51558
commit
4c1c1f885b
@ -458,6 +458,7 @@
|
||||
<ClInclude Include="Mapper212.h" />
|
||||
<ClInclude Include="Mapper218.h" />
|
||||
<ClInclude Include="Mapper221.h" />
|
||||
<ClInclude Include="Mapper222.h" />
|
||||
<ClInclude Include="Mapper225.h" />
|
||||
<ClInclude Include="Mapper226.h" />
|
||||
<ClInclude Include="Mapper227.h" />
|
||||
|
@ -868,6 +868,9 @@
|
||||
<ClInclude Include="Mapper229.h">
|
||||
<Filter>Nes\Mappers\Unnamed</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mapper222.h">
|
||||
<Filter>Nes\Mappers\Unnamed</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
83
Core/Mapper222.h
Normal file
83
Core/Mapper222.h
Normal file
@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
#include "PPU.h"
|
||||
#include "CPU.h"
|
||||
|
||||
class Mapper222 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
uint16_t _irqCounter;
|
||||
uint32_t _cyclesDown;
|
||||
uint32_t _lastCycle;
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() { return 0x2000; }
|
||||
virtual uint16_t GetCHRPageSize() { return 0x400; }
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
_irqCounter = 0;
|
||||
_cyclesDown = 0;
|
||||
_lastCycle = 0;
|
||||
|
||||
SelectPrgPage2x(1, -2);
|
||||
}
|
||||
|
||||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_irqCounter, _cyclesDown, _lastCycle);
|
||||
}
|
||||
|
||||
virtual void NotifyVRAMAddressChange(uint16_t addr)
|
||||
{
|
||||
uint32_t cycle = PPU::GetFrameCycle();
|
||||
|
||||
if((addr & 0x1000) == 0) {
|
||||
if(_cyclesDown == 0) {
|
||||
_cyclesDown = 1;
|
||||
} else {
|
||||
if(_lastCycle > cycle) {
|
||||
//We changed frames
|
||||
_cyclesDown += (89342 - _lastCycle) + cycle;
|
||||
} else {
|
||||
_cyclesDown += (cycle - _lastCycle);
|
||||
}
|
||||
}
|
||||
} else if(addr & 0x1000) {
|
||||
if(_cyclesDown > 8) {
|
||||
if(_irqCounter) {
|
||||
_irqCounter++;
|
||||
if(_irqCounter >= 240) {
|
||||
CPU::SetIRQSource(IRQSource::External);
|
||||
_irqCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
_cyclesDown = 0;
|
||||
}
|
||||
_lastCycle = cycle;
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
switch(addr & 0xF003) {
|
||||
case 0x8000: SelectPRGPage(0, value); break;
|
||||
case 0x9000: SetMirroringType(value & 0x01 ? MirroringType::Horizontal : MirroringType::Vertical); break;
|
||||
case 0xA000: SelectPRGPage(1, value); break;
|
||||
case 0xB000: SelectCHRPage(0, value); break;
|
||||
case 0xB002: SelectCHRPage(1, value); break;
|
||||
case 0xC000: SelectCHRPage(2, value); break;
|
||||
case 0xC002: SelectCHRPage(3, value); break;
|
||||
case 0xD000: SelectCHRPage(4, value); break;
|
||||
case 0xD002: SelectCHRPage(5, value); break;
|
||||
case 0xE000: SelectCHRPage(6, value); break;
|
||||
case 0xE002: SelectCHRPage(7, value); break;
|
||||
case 0xF000:
|
||||
_irqCounter = value;
|
||||
CPU::ClearIRQSource(IRQSource::External);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
@ -63,6 +63,7 @@
|
||||
#include "Mapper212.h"
|
||||
#include "Mapper218.h"
|
||||
#include "Mapper221.h"
|
||||
#include "Mapper222.h"
|
||||
#include "Mapper225.h"
|
||||
#include "Mapper226.h"
|
||||
#include "Mapper227.h"
|
||||
@ -181,7 +182,7 @@ Supported mappers:
|
||||
| |===| |163|164|165|166|167|168|===|170|171|172|173|===|175|
|
||||
|176|177|178|179|180| |182| |184|185| |187|188|189|===|191|
|
||||
|192|193|194|195| |197| | |200|201|202|203| |205|206|207|
|
||||
| |209|210|211|212| | | | | |218| | |221| | |
|
||||
| |209|210|211|212| | | | | |218| | |221|222| |
|
||||
| |225|226|227|228|229|230|231|232|233|234|235| |===|238|===|
|
||||
|240|241|242|243|244|245|246|===|===|249|250|===|252| |254| |
|
||||
-----------------------------------------------------------------
|
||||
@ -368,6 +369,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
||||
case 212: return new Mapper212();
|
||||
case 218: return new Mapper218();
|
||||
case 221: return new Mapper221();
|
||||
case 222: return new Mapper222();
|
||||
case 225: return new Mapper225();
|
||||
case 226: return new Mapper226();
|
||||
case 227: return new Mapper227();
|
||||
|
Loading…
Reference in New Issue
Block a user