Mesen-X/Core/Edu2000.h

43 lines
786 B
C
Raw Normal View History

2016-11-06 12:25:54 -05:00
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Edu2000 : public BaseMapper
{
private:
uint8_t _reg;
protected:
uint16_t GetPRGPageSize() { return 0x2000; }
uint16_t GetCHRPageSize() { return 0x2000; }
uint32_t GetWorkRamSize() { return 0x8000; }
uint32_t GetWorkRamPageSize() { return 0x2000; }
void InitMapper() override
{
_reg = 0;
UpdatePrg();
SelectCHRPage(0, 0);
}
void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_reg);
if(!saving) {
UpdatePrg();
}
}
void UpdatePrg()
{
SelectPrgPage4x(0, (_reg & 0x1F) << 2);
SetCpuMemoryMapping(0x6000, 0x7FFF, (_reg >> 6) & 0x03, PrgMemoryType::WorkRam);
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
_reg = value;
UpdatePrg();
}
};