2011-10-02 10:05:45 +00:00
|
|
|
struct NES_TxROM : Board {
|
2015-12-05 05:44:49 +00:00
|
|
|
NES_TxROM(Markup::Node& document) : Board(document), mmc3(*this) {
|
|
|
|
revision = Revision::TLROM;
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto main() -> void {
|
|
|
|
mmc3.main();
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto readPRG(uint addr) -> uint8 {
|
|
|
|
if((addr & 0xe000) == 0x6000) return mmc3.readRAM(addr);
|
|
|
|
if(addr & 0x8000) return prgrom.read(mmc3.addrPRG(addr));
|
2015-12-05 05:44:49 +00:00
|
|
|
return cpu.mdr();
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto writePRG(uint addr, uint8 data) -> void {
|
|
|
|
if((addr & 0xe000) == 0x6000) return mmc3.writeRAM(addr, data);
|
|
|
|
if(addr & 0x8000) return mmc3.writeIO(addr, data);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto readCHR(uint addr) -> uint8 {
|
|
|
|
mmc3.irqTest(addr);
|
|
|
|
if(addr & 0x2000) return ppu.readCIRAM(mmc3.addrCIRAM(addr));
|
|
|
|
return Board::readCHR(mmc3.addrCHR(addr));
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto writeCHR(uint addr, uint8 data) -> void {
|
|
|
|
mmc3.irqTest(addr);
|
|
|
|
if(addr & 0x2000) return ppu.writeCIRAM(mmc3.addrCIRAM(addr), data);
|
|
|
|
return Board::writeCHR(mmc3.addrCHR(addr), data);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto power() -> void {
|
|
|
|
mmc3.power();
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto reset() -> void {
|
|
|
|
mmc3.reset();
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto serialize(serializer& s) -> void {
|
|
|
|
Board::serialize(s);
|
|
|
|
mmc3.serialize(s);
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
enum class Revision : uint {
|
|
|
|
TBROM,
|
|
|
|
TEROM,
|
|
|
|
TFROM,
|
|
|
|
TGROM,
|
|
|
|
TKROM,
|
|
|
|
TKSROM,
|
|
|
|
TLROM,
|
|
|
|
TL1ROM,
|
|
|
|
TL2ROM,
|
|
|
|
TLSROM,
|
|
|
|
TNROM,
|
|
|
|
TQROM,
|
|
|
|
TR1ROM,
|
|
|
|
TSROM,
|
|
|
|
TVROM,
|
|
|
|
} revision;
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
MMC3 mmc3;
|
2011-10-01 12:06:48 +00:00
|
|
|
};
|