Mesen-X/Core/Nina03_06.h

41 lines
1,009 B
C
Raw Permalink Normal View History

2015-12-30 11:47:36 -05:00
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Nina03_06 : public BaseMapper
{
2015-12-31 08:47:33 -05:00
private:
bool _multicartMode;
2015-12-30 11:47:36 -05:00
2015-12-31 08:47:33 -05:00
protected:
2016-12-17 23:14:47 -05:00
virtual uint16_t GetPRGPageSize() override { return 0x8000; }
virtual uint16_t GetCHRPageSize() override { return 0x2000; }
virtual uint16_t RegisterStartAddress() override { return 0x4100; }
virtual uint16_t RegisterEndAddress() override { return 0x5FFF; }
2015-12-31 08:47:33 -05:00
2016-12-17 23:14:47 -05:00
void InitMapper() override
2015-12-31 08:47:33 -05:00
{
SelectPRGPage(0, 0);
SelectCHRPage(0, 0);
}
2015-12-30 11:47:36 -05:00
2016-12-17 23:14:47 -05:00
void WriteRegister(uint16_t addr, uint8_t value) override
2015-12-31 08:47:33 -05:00
{
2017-04-03 23:45:24 -04:00
if((addr & 0xE100) == 0x4100) {
2015-12-31 08:47:33 -05:00
if(_multicartMode) {
//Mapper 113
SelectPRGPage(0, (value >> 3) & 0x07);
2015-12-31 12:07:22 -05:00
SelectCHRPage(0, (value & 0x07) | ((value >> 3) & 0x08));
2015-12-31 08:47:33 -05:00
SetMirroringType((value & 0x80) == 0x80 ? MirroringType::Vertical : MirroringType::Horizontal);
} else {
2015-12-30 11:47:36 -05:00
SelectPRGPage(0, (value >> 3) & 0x01);
SelectCHRPage(0, value & 0x07);
}
}
2015-12-31 08:47:33 -05:00
}
public:
Nina03_06(bool multicartMode) : _multicartMode(multicartMode)
{
}
2015-12-30 11:47:36 -05:00
};