From 20318b98590909382901bfffd4695c6de8621a21 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Wed, 28 Aug 2019 15:21:33 -0400 Subject: [PATCH] nes: IO read/write for registers --- src/platform/nes.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/platform/nes.ts b/src/platform/nes.ts index bec7a5c4..6197d694 100644 --- a/src/platform/nes.ts +++ b/src/platform/nes.ts @@ -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;