2011-11-04 11:57:54 +00:00
|
|
|
struct NES_HKROM : Board {
|
2015-12-05 05:44:49 +00:00
|
|
|
NES_HKROM(Markup::Node& document) : Board(document), mmc6(*this) {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto main() -> void {
|
|
|
|
mmc6.main();
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto readPRG(uint addr) -> uint8 {
|
|
|
|
if((addr & 0xf000) == 0x7000) return mmc6.readRAM(addr);
|
|
|
|
if(addr & 0x8000) return prgrom.read(mmc6.addrPRG(addr));
|
2015-12-05 05:44:49 +00:00
|
|
|
return cpu.mdr();
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto writePRG(uint addr, uint8 data) -> void {
|
|
|
|
if((addr & 0xf000) == 0x7000) return mmc6.writeRAM(addr, data);
|
|
|
|
if(addr & 0x8000) return mmc6.writeIO(addr, data);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto readCHR(uint addr) -> uint8 {
|
|
|
|
mmc6.irqTest(addr);
|
|
|
|
if(addr & 0x2000) return ppu.readCIRAM(mmc6.addrCIRAM(addr));
|
|
|
|
return Board::readCHR(mmc6.addrCHR(addr));
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto writeCHR(uint addr, uint8 data) -> void {
|
|
|
|
mmc6.irqTest(addr);
|
|
|
|
if(addr & 0x2000) return ppu.writeCIRAM(mmc6.addrCIRAM(addr), data);
|
|
|
|
return Board::writeCHR(mmc6.addrCHR(addr), data);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto power() -> void {
|
|
|
|
mmc6.power();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto reset() -> void {
|
|
|
|
mmc6.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto serialize(serializer& s) -> void {
|
|
|
|
Board::serialize(s);
|
|
|
|
mmc6.serialize(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
MMC6 mmc6;
|
2011-11-04 11:57:54 +00:00
|
|
|
};
|