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
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto prg_read(uint addr) -> uint8{
|
|
|
|
if((addr & 0xe000) == 0x6000) return vrc6.ram_read(addr);
|
|
|
|
if(addr & 0x8000) return prgrom.read(vrc6.prg_addr(addr));
|
|
|
|
return cpu.mdr();
|
2011-10-01 12:06:48 +00:00
|
|
|
}
|
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto prg_write(uint addr, uint8 data) -> void {
|
|
|
|
if((addr & 0xe000) == 0x6000) return vrc6.ram_write(addr, data);
|
|
|
|
if(addr & 0x8000) {
|
|
|
|
addr = (addr & 0xf003);
|
|
|
|
if(prgram.size) addr = (addr & ~3) | ((addr & 2) >> 1) | ((addr & 1) << 1);
|
|
|
|
return vrc6.reg_write(addr, data);
|
|
|
|
}
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto chr_read(uint addr) -> uint8 {
|
|
|
|
if(addr & 0x2000) return ppu.ciram_read(vrc6.ciram_addr(addr));
|
|
|
|
return Board::chr_read(vrc6.chr_addr(addr));
|
|
|
|
}
|
2011-10-01 12:06:48 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto chr_write(uint addr, uint8 data) -> void {
|
|
|
|
if(addr & 0x2000) return ppu.ciram_write(vrc6.ciram_addr(addr), data);
|
|
|
|
return Board::chr_write(vrc6.chr_addr(addr), data);
|
|
|
|
}
|
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
|
|
|
};
|