2014-08-04 19:55:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "MMC3.h"
|
|
|
|
|
|
|
|
class MMC3_189 : public MMC3
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
uint8_t _prgReg = 0;
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
virtual uint16_t RegisterStartAddress() override { return 0x4120; }
|
2014-08-04 19:55:20 +00:00
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
virtual void WriteRegister(uint16_t addr, uint8_t value) override
|
2014-08-04 19:55:20 +00:00
|
|
|
{
|
|
|
|
if(addr <= 0x4FFF) {
|
|
|
|
_prgReg = value;
|
|
|
|
UpdateState();
|
|
|
|
} else {
|
|
|
|
MMC3::WriteRegister(addr, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
virtual void UpdateState() override
|
2014-08-04 19:55:20 +00:00
|
|
|
{
|
|
|
|
MMC3::UpdateState();
|
|
|
|
|
|
|
|
//"$4120-7FFF: [AAAA BBBB]"
|
|
|
|
//" 'A' and 'B' bits of the $4120 reg seem to be effectively OR'd."
|
|
|
|
uint8_t prgPage = (((_prgReg) | (_prgReg >> 4)) & 0x07) * 4;
|
|
|
|
SelectPRGPage(0, prgPage);
|
|
|
|
SelectPRGPage(1, prgPage+1);
|
|
|
|
SelectPRGPage(2, prgPage+2);
|
|
|
|
SelectPRGPage(3, prgPage+3);
|
|
|
|
}
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
virtual void StreamState(bool saving) override
|
2014-08-04 19:55:20 +00:00
|
|
|
{
|
|
|
|
MMC3::StreamState(saving);
|
2016-06-03 00:20:26 +00:00
|
|
|
Stream(_prgReg);
|
2014-08-04 19:55:20 +00:00
|
|
|
}
|
|
|
|
};
|