2016-06-18 22:16:25 +00:00
|
|
|
#pragma once
|
|
|
|
#include "BaseMapper.h"
|
|
|
|
|
|
|
|
class Mapper218 : public BaseMapper
|
|
|
|
{
|
|
|
|
protected:
|
2016-12-18 04:14:47 +00:00
|
|
|
uint16_t GetPRGPageSize() override { return 0x8000; }
|
|
|
|
uint16_t GetCHRPageSize() override { return 0x2000; }
|
2016-06-18 22:16:25 +00:00
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
void InitMapper() override
|
2016-06-18 22:16:25 +00:00
|
|
|
{
|
|
|
|
SelectPRGPage(0, 0);
|
|
|
|
|
|
|
|
if(GetMirroringType() == MirroringType::FourScreens) {
|
2018-07-07 18:52:51 +00:00
|
|
|
SetMirroringType(_romInfo.NesHeader.Byte6 & 0x01 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
|
2016-06-18 22:16:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t mask = 0;
|
|
|
|
switch(GetMirroringType()) {
|
|
|
|
case MirroringType::Vertical: mask = 0x400; break;
|
|
|
|
case MirroringType::Horizontal: mask = 0x800; break;
|
|
|
|
case MirroringType::ScreenAOnly: mask = 0x1000; break;
|
|
|
|
case MirroringType::ScreenBOnly: mask = 0x2000; break;
|
2018-06-25 19:56:05 +00:00
|
|
|
case MirroringType::FourScreens: break; //Will never be FourScreens, see InitMapper() above
|
2016-06-18 22:16:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < 8; i++) {
|
2019-01-10 01:19:16 +00:00
|
|
|
SetPpuMemoryMapping(i*0x400, i*0x400+0x3FF, ((i * 0x400) & mask) ? 1 : 0, ChrMemoryType::NametableRam);
|
2016-06-18 22:16:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|