2011-10-01 12:06:48 +00:00
|
|
|
struct KonamiVRC6 : Board {
|
2015-12-05 05:44:49 +00:00
|
|
|
KonamiVRC6(Markup::Node& document) : Board(document), vrc6(*this) {
|
|
|
|
}
|
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 vrc6.readRAM(addr);
|
|
|
|
if(addr & 0x8000) return prgrom.read(vrc6.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 vrc6.writeRAM(addr, data);
|
2015-12-05 05:44:49 +00:00
|
|
|
if(addr & 0x8000) {
|
|
|
|
addr = (addr & 0xf003);
|
|
|
|
if(prgram.size) addr = (addr & ~3) | ((addr & 2) >> 1) | ((addr & 1) << 1);
|
2016-06-27 13:07:57 +00:00
|
|
|
return vrc6.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 {
|
|
|
|
if(addr & 0x2000) return ppu.readCIRAM(vrc6.addrCIRAM(addr));
|
|
|
|
return Board::readCHR(vrc6.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 {
|
|
|
|
if(addr & 0x2000) return ppu.writeCIRAM(vrc6.addrCIRAM(addr), data);
|
|
|
|
return Board::writeCHR(vrc6.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 serialize(serializer& s) -> void {
|
|
|
|
Board::serialize(s);
|
|
|
|
vrc6.serialize(s);
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto main() -> void { vrc6.main(); }
|
|
|
|
auto power() -> void { vrc6.power(); }
|
|
|
|
auto reset() -> void { vrc6.reset(); }
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
VRC6 vrc6;
|
2011-10-01 12:06:48 +00:00
|
|
|
};
|