Mesen/Core/MMC4.h

49 lines
1.1 KiB
C
Raw Normal View History

2015-12-28 18:57:26 +00:00
#pragma once
#include "stdafx.h"
#include "MMC2.h"
class MMC4 : public MMC2
{
protected:
2016-12-18 04:14:47 +00:00
virtual uint16_t GetPRGPageSize() override { return 0x4000; }
virtual uint16_t GetCHRPageSize() override { return 0x1000; }
2015-12-28 18:57:26 +00:00
2016-12-18 04:14:47 +00:00
virtual void InitMapper() override
2015-12-28 18:57:26 +00:00
{
_leftLatch = 1;
_rightLatch = 1;
_leftChrPage[0] = 0;
_leftChrPage[1] = 0;
_rightChrPage[0] = 0;
_rightChrPage[1] = 0;
SelectPRGPage(0, 0);
SelectPRGPage(1, -1);
SelectCHRPage(0, 0);
SelectCHRPage(0, 1);
}
public:
2016-12-18 04:14:47 +00:00
virtual void NotifyVRAMAddressChange(uint16_t addr) override
2015-12-28 18:57:26 +00:00
{
if(_needChrUpdate) {
SelectCHRPage(0, _leftChrPage[_leftLatch]);
SelectCHRPage(1, _rightChrPage[_rightLatch]);
_needChrUpdate = false;
}
if(addr >= 0x0FD8 && addr <= 0x0FDF) {
_leftLatch = 0;
_needChrUpdate = true;
} else if(addr >= 0x0FE8 && addr <= 0x0FEF) {
_leftLatch = 1;
_needChrUpdate = true;
} else if(addr >= 0x1FD8 && addr <= 0x1FDF) {
_rightLatch = 0;
_needChrUpdate = true;
} else if(addr >= 0x1FE8 && addr <= 0x1FEF) {
_rightLatch = 1;
_needChrUpdate = true;
}
}
};