summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Firshman <ben@firshman.co.uk>2010-06-04 23:28:59 +0100
committerBen Firshman <ben@firshman.co.uk>2010-06-04 23:28:59 +0100
commit0d60ae021b40a9be4ca17e637fdbe0c384396644 (patch)
tree93e6ad71a9a74aecf91012706afe053ec088a5c9
parent6b9a2b1a5accde7ad452eada50583978573fc70b (diff)
downloadjsnes-0d60ae021b40a9be4ca17e637fdbe0c384396644.zip
jsnes-0d60ae021b40a9be4ca17e637fdbe0c384396644.tar.gz
jsnes-0d60ae021b40a9be4ca17e637fdbe0c384396644.tar.bz2
Restored performance in Chrome. This makes it run 5x faster. Goddamn you Chrome.
-rw-r--r--js/cpu.js32
-rw-r--r--js/papu.js3
-rw-r--r--js/ppu.js73
3 files changed, 106 insertions, 2 deletions
diff --git a/js/cpu.js b/js/cpu.js
index a0c85a5..bde3f2a 100644
--- a/js/cpu.js
+++ b/js/cpu.js
@@ -1,5 +1,33 @@
NES.CPU = function(nes) {
this.nes = nes;
+
+ // Keep Chrome happy
+ this.mem = null;
+ this.REG_ACC = null;
+ this.REG_X = null;
+ this.REG_Y = null;
+ this.REG_SP = null;
+ this.REG_PC = null;
+ this.REG_PC_NEW = null;
+ this.REG_STATUS = null;
+ this.F_CARRY = null;
+ this.F_DECIMAL = null;
+ this.F_INTERRUPT = null;
+ this.F_INTERRUPT_NEW = null;
+ this.F_OVERFLOW = null;
+ this.F_SIGN = null;
+ this.F_ZERO = null;
+ this.F_NOTUSED = null;
+ this.F_NOTUSED_NEW = null;
+ this.F_BRK = null;
+ this.F_BRK_NEW = null;
+ this.palCnt = null;
+ this.opdata = null;
+ this.cyclesToHalt = null;
+ this.crash = null;
+ this.irqRequested = null;
+ this.irqType = null;
+
this.reset();
}
@@ -56,7 +84,7 @@ NES.CPU.prototype = {
this.F_BRK_NEW = 1;
this.palCnt = 0;
- this.opdata = this.opdata = new NES.CPU.OpData();
+ this.opdata = new NES.CPU.OpData().opdata;
this.cyclesToHalt = 0;
// Reset crash flag:
@@ -116,7 +144,7 @@ NES.CPU.prototype = {
this.irqRequested = false;
}
- var opinf = this.opdata.opdata[this.nes.mmap.load(this.REG_PC+1)];
+ var opinf = this.opdata[this.nes.mmap.load(this.REG_PC+1)];
var cycleCount = (opinf>>24);
var cycleAdd = 0;
diff --git a/js/papu.js b/js/papu.js
index f737ca7..ab8d3a0 100644
--- a/js/papu.js
+++ b/js/papu.js
@@ -72,6 +72,9 @@ NES.PAPU = function(nes) {
this.extraCycles = null;
+ this.maxSample = null;
+ this.minSample = null;
+
// Panning:
this.panning = new Array(
80,
diff --git a/js/ppu.js b/js/ppu.js
index 5cb78de..f49d250 100644
--- a/js/ppu.js
+++ b/js/ppu.js
@@ -1,6 +1,79 @@
NES.PPU = function(nes) {
this.nes = nes;
+ // Keep Chrome happy
+ this.vramMem = null;
+ this.spriteMem = null;
+ this.vramAddress = null;
+ this.vramTmpAddress = null;
+ this.vramBufferedReadValue = null;
+ this.firstWrite = null;
+ this.sramAddress = null;
+ this.mapperIrqCounter = null;
+ this.currentMirroring = null;
+ this.requestEndFrame = null;
+ this.nmiOk = null;
+ this.dummyCycleToggle = null;
+ this.validTileData = null;
+ this.nmiCounter = null;
+ this.scanlineAlreadyRendered = null;
+ this.f_nmiOnVblank = null;
+ this.f_spriteSize = null;
+ this.f_bgPatternTable = null;
+ this.f_spPatternTable = null;
+ this.f_addrInc = null;
+ this.f_nTblAddress = null;
+ this.f_color = null;
+ this.f_spVisibility = null;
+ this.f_bgVisibility = null;
+ this.f_spClipping = null;
+ this.f_bgClipping = null;
+ this.f_dispType = null;
+ this.cntFV = null;
+ this.cntV = null;
+ this.cntH = null;
+ this.cntVT = null;
+ this.cntHT = null;
+ this.regFV = null;
+ this.regV = null;
+ this.regH = null;
+ this.regVT = null;
+ this.regHT = null;
+ this.regFH = null;
+ this.regS = null;
+ this.curNt = null;
+ this.attrib = null;
+ this.buffer = null;
+ this.prevBuffer = null;
+ this.bgbuffer = null;
+ this.pixrendered = null;
+ this.spr0dummybuffer = null;
+ this.dummyPixPriTable = null;
+ this.validTileData = null;
+ this.scantile = null;
+ this.scanline = null;
+ this.lastRenderedScanline = null;
+ this.curX = null;
+ this.sprX = null;
+ this.sprY = null;
+ this.sprTile = null;
+ this.sprCol = null;
+ this.vertFlip = null;
+ this.horiFlip = null;
+ this.bgPriority = null;
+ this.spr0HitX = null;
+ this.spr0HitY = null;
+ this.hitSpr0 = null;
+ this.sprPalette = null;
+ this.imgPalette = null;
+ this.ptTile = null;
+ this.ntable1 = null;
+ this.currentMirroring = null;
+ this.nameTable = null;
+ this.vramMirrorTable = null;
+ this.palTable = null;
+
+
// Rendering Options:
this.showSpr0Hit = false;
this.clipToTvSize = true;