Mesen/Core/Nina03_06.h

41 lines
950 B
C
Raw 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:
virtual uint16_t GetPRGPageSize() { return 0x8000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
virtual uint16_t RegisterStartAddress() { return 0x4100; }
virtual uint16_t RegisterEndAddress() { return 0x5FFF; }
void InitMapper()
{
SelectPRGPage(0, 0);
SelectCHRPage(0, 0);
}
2015-12-30 16:47:36 +00:00
2015-12-31 13:47:33 +00:00
void WriteRegister(uint16_t addr, uint8_t value)
{
if((addr & 0x5100) != 0) {
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
};