2011-11-04 11:57:54 +00:00
|
|
|
struct KonamiVRC3 : Board {
|
2015-12-05 05:44:49 +00:00
|
|
|
KonamiVRC3(Markup::Node& document) : Board(document), vrc3(*this) {
|
2016-01-12 11:08:34 +00:00
|
|
|
settings.mirror = document["board/mirror/mode"].text() == "vertical" ? 1 : 0;
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto main() -> void {
|
|
|
|
vrc3.main();
|
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto prg_read(uint addr) -> uint8 {
|
|
|
|
if((addr & 0xe000) == 0x6000) return prgram.read(addr & 0x1fff);
|
|
|
|
if(addr & 0x8000) return prgrom.read(vrc3.prg_addr(addr));
|
|
|
|
return cpu.mdr();
|
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto prg_write(uint addr, uint8 data) -> void {
|
|
|
|
if((addr & 0xe000) == 0x6000) return prgram.write(addr & 0x1fff, data);
|
|
|
|
if(addr & 0x8000) return vrc3.reg_write(addr, data);
|
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto chr_read(uint addr) -> uint8 {
|
|
|
|
if(addr & 0x2000) {
|
|
|
|
if(settings.mirror == 0) addr = ((addr & 0x0800) >> 1) | (addr & 0x03ff);
|
2016-06-26 08:54:12 +00:00
|
|
|
return ppu.readCIRAM(addr & 0x07ff);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
|
|
|
return chrram.read(addr);
|
2011-11-04 11:57:54 +00:00
|
|
|
}
|
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto chr_write(uint addr, uint8 data) -> void {
|
|
|
|
if(addr & 0x2000) {
|
|
|
|
if(settings.mirror == 0) addr = ((addr & 0x0800) >> 1) | (addr & 0x03ff);
|
2016-06-26 08:54:12 +00:00
|
|
|
return ppu.writeCIRAM(addr & 0x07ff, data);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
|
|
|
return chrram.write(addr, data);
|
2011-11-04 11:57:54 +00:00
|
|
|
}
|
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto power() -> void {
|
|
|
|
vrc3.power();
|
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto reset() -> void {
|
|
|
|
vrc3.reset();
|
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto serialize(serializer& s) -> void {
|
|
|
|
Board::serialize(s);
|
|
|
|
vrc3.serialize(s);
|
|
|
|
}
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
struct Settings {
|
|
|
|
bool mirror; //0 = horizontal, 1 = vertical
|
|
|
|
} settings;
|
2011-11-04 11:57:54 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
VRC3 vrc3;
|
2011-11-04 11:57:54 +00:00
|
|
|
};
|