Mesen/Core/Nina03_06.h

41 lines
1009 B
C
Raw Permalink Normal View History

2015-12-30 16:47:36 +00:00
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Nina03_06 : public BaseMapper
{
2015-12-31 13:47:33 +00:00
private:
bool _multicartMode;
2015-12-30 16:47:36 +00:00
2015-12-31 13:47:33 +00:00
protected:
2016-12-18 04:14:47 +00: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 13:47:33 +00:00
2016-12-18 04:14:47 +00:00
void InitMapper() override
2015-12-31 13:47:33 +00:00
{
SelectPRGPage(0, 0);
SelectCHRPage(0, 0);
}
2015-12-30 16:47:36 +00:00
2016-12-18 04:14:47 +00:00
void WriteRegister(uint16_t addr, uint8_t value) override
2015-12-31 13:47:33 +00:00
{
2017-04-04 03:45:24 +00:00
if((addr & 0xE100) == 0x4100) {
2015-12-31 13:47:33 +00:00
if(_multicartMode) {
//Mapper 113
SelectPRGPage(0, (value >> 3) & 0x07);
2015-12-31 17:07:22 +00:00
SelectCHRPage(0, (value & 0x07) | ((value >> 3) & 0x08));
2015-12-31 13:47:33 +00:00
SetMirroringType((value & 0x80) == 0x80 ? MirroringType::Vertical : MirroringType::Horizontal);
} else {
2015-12-30 16:47:36 +00:00
SelectPRGPage(0, (value >> 3) & 0x01);
SelectCHRPage(0, value & 0x07);
}
}
2015-12-31 13:47:33 +00:00
}
public:
Nina03_06(bool multicartMode) : _multicartMode(multicartMode)
{
}
2015-12-30 16:47:36 +00:00
};