2011-09-29 12:44:49 +00:00
|
|
|
//NES-AMROM
|
|
|
|
//NES-ANROM
|
|
|
|
//NES-AN1ROM
|
|
|
|
//NES-AOROM
|
|
|
|
|
2011-10-02 10:05:45 +00:00
|
|
|
struct NES_AxROM : Board {
|
2015-12-05 05:44:49 +00:00
|
|
|
NES_AxROM(Markup::Node& document) : Board(document) {
|
|
|
|
}
|
2011-09-29 12:44:49 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto readPRG(uint addr) -> uint8 {
|
|
|
|
if(addr & 0x8000) return prgrom.read((prgBank << 15) | (addr & 0x7fff));
|
2015-12-05 05:44:49 +00:00
|
|
|
return cpu.mdr();
|
2011-09-29 12:44:49 +00:00
|
|
|
}
|
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto writePRG(uint addr, uint8 data) -> void {
|
2015-12-05 05:44:49 +00:00
|
|
|
if(addr & 0x8000) {
|
2016-06-27 13:07:57 +00:00
|
|
|
prgBank = data & 0x0f;
|
|
|
|
mirrorSelect = data & 0x10;
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
|
|
|
}
|
2011-09-29 12:44:49 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
auto readCHR(uint addr) -> uint8 {
|
|
|
|
if(addr & 0x2000) return ppu.readCIRAM((mirrorSelect << 10) | (addr & 0x03ff));
|
|
|
|
return Board::readCHR(addr);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-09-29 12:44:49 +00:00
|
|
|
|
2016-06-28 10:43:47 +00:00
|
|
|
auto writeCHR(uint addr, uint8 data) -> void {
|
2016-06-27 13:07:57 +00:00
|
|
|
if(addr & 0x2000) return ppu.writeCIRAM((mirrorSelect << 10) | (addr & 0x03ff), data);
|
|
|
|
return Board::writeCHR(addr, data);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-09-29 12:44:49 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto power() -> void {
|
2016-06-27 13:07:57 +00:00
|
|
|
prgBank = 0x0f;
|
|
|
|
mirrorSelect = 0;
|
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);
|
2011-09-29 12:44:49 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
s.integer(prgBank);
|
|
|
|
s.integer(mirrorSelect);
|
2015-12-05 05:44:49 +00:00
|
|
|
}
|
2011-09-29 12:44:49 +00:00
|
|
|
|
2016-06-27 13:07:57 +00:00
|
|
|
uint4 prgBank;
|
|
|
|
bool mirrorSelect;
|
2011-09-29 12:44:49 +00:00
|
|
|
};
|