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();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto prg_read(uint addr) -> uint8 {
|
|
|
|
if((addr & 0xf000) == 0x7000) return mmc6.ram_read(addr);
|
|
|
|
if(addr & 0x8000) return prgrom.read(mmc6.prg_addr(addr));
|
|
|
|
return cpu.mdr();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto prg_write(uint addr, uint8 data) -> void {
|
|
|
|
if((addr & 0xf000) == 0x7000) return mmc6.ram_write(addr, data);
|
|
|
|
if(addr & 0x8000) return mmc6.reg_write(addr, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto chr_read(uint addr) -> uint8 {
|
|
|
|
mmc6.irq_test(addr);
|
2016-06-26 08:54:12 +00:00
|
|
|
if(addr & 0x2000) return ppu.readCIRAM(mmc6.ciram_addr(addr));
|
2015-12-05 05:44:49 +00:00
|
|
|
return Board::chr_read(mmc6.chr_addr(addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
auto chr_write(uint addr, uint8 data) -> void {
|
|
|
|
mmc6.irq_test(addr);
|
2016-06-26 08:54:12 +00:00
|
|
|
if(addr & 0x2000) return ppu.writeCIRAM(mmc6.ciram_addr(addr), data);
|
2015-12-05 05:44:49 +00:00
|
|
|
return Board::chr_write(mmc6.chr_addr(addr), data);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
};
|