1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

nes: IO read/write for registers

This commit is contained in:
Steven Hugg 2019-08-28 15:21:33 -04:00
parent ad38ae2fc4
commit 20318b9859

View File

@ -212,28 +212,30 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable {
if (!mmap.haveProxied) {
var oldload = mmap.load.bind(mmap);
var oldwrite = mmap.write.bind(mmap);
//var oldregLoad = mmap.regLoad.bind(mmap);
//var oldregWrite = mmap.regWrite.bind(mmap);
var oldregLoad = mmap.regLoad.bind(mmap);
var oldregWrite = mmap.regWrite.bind(mmap);
var lastioaddr = -1;
mmap.load = (addr) => {
var val = oldload(addr);
this.probe.logRead(addr, val);
if (addr != lastioaddr) this.probe.logRead(addr, val);
return val;
}
mmap.write = (addr, val) => {
this.probe.logWrite(addr, val);
if (addr != lastioaddr) this.probe.logWrite(addr, val);
oldwrite(addr, val);
}
/*
// try not to read/write then IOread/IOwrite at same time
mmap.regLoad = (addr) => {
var val = oldregLoad(addr);
this.probe.logIORead(addr, val);
lastioaddr = addr;
return val;
}
mmap.regWrite = (addr, val) => {
this.probe.logIOWrite(addr, val);
lastioaddr = addr;
oldregWrite(addr, val);
}
*/
mmap.haveProxied = true;
}
var ppu = this.nes.ppu;