1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-29 14:51:17 +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) { if (!mmap.haveProxied) {
var oldload = mmap.load.bind(mmap); var oldload = mmap.load.bind(mmap);
var oldwrite = mmap.write.bind(mmap); var oldwrite = mmap.write.bind(mmap);
//var oldregLoad = mmap.regLoad.bind(mmap); var oldregLoad = mmap.regLoad.bind(mmap);
//var oldregWrite = mmap.regWrite.bind(mmap); var oldregWrite = mmap.regWrite.bind(mmap);
var lastioaddr = -1;
mmap.load = (addr) => { mmap.load = (addr) => {
var val = oldload(addr); var val = oldload(addr);
this.probe.logRead(addr, val); if (addr != lastioaddr) this.probe.logRead(addr, val);
return val; return val;
} }
mmap.write = (addr, val) => { mmap.write = (addr, val) => {
this.probe.logWrite(addr, val); if (addr != lastioaddr) this.probe.logWrite(addr, val);
oldwrite(addr, val); oldwrite(addr, val);
} }
/* // try not to read/write then IOread/IOwrite at same time
mmap.regLoad = (addr) => { mmap.regLoad = (addr) => {
var val = oldregLoad(addr); var val = oldregLoad(addr);
this.probe.logIORead(addr, val); this.probe.logIORead(addr, val);
lastioaddr = addr;
return val; return val;
} }
mmap.regWrite = (addr, val) => { mmap.regWrite = (addr, val) => {
this.probe.logIOWrite(addr, val); this.probe.logIOWrite(addr, val);
lastioaddr = addr;
oldregWrite(addr, val); oldregWrite(addr, val);
} }
*/
mmap.haveProxied = true; mmap.haveProxied = true;
} }
var ppu = this.nes.ppu; var ppu = this.nes.ppu;