aboutsummaryrefslogtreecommitdiff
path: root/source/cpuops.cpp
diff options
context:
space:
mode:
authorNebuleon Fumika2012-12-20 18:10:38 -0500
committerNebuleon Fumika2012-12-20 18:14:24 -0500
commit80858801300a2f48ad250721a79ebc7b1b0aba92 (patch)
treea64d661a5e40b759a083a653841dff2ae82fa130 /source/cpuops.cpp
parent83426640a6079021815e611ff0519d27ca3f9ce4 (diff)
downloadsnes9x2005-80858801300a2f48ad250721a79ebc7b1b0aba92.tar.gz
snes9x2005-80858801300a2f48ad250721a79ebc7b1b0aba92.tar.bz2
snes9x2005-80858801300a2f48ad250721a79ebc7b1b0aba92.zip
Remove the SNES Open Bus behaviour by default. Also simplify translation again.
SNES Open Bus is a quirk of the memory subsystem that allow reads of invalid addresses to return the last byte read from memory. However, it is seldom needed by a game, and it costs 1 to 3 MIPS instructions per SNES instruction to emulate. If you need SNES Open Bus, you can remove -DNO_OPEN_BUS from the Makefile.
Diffstat (limited to 'source/cpuops.cpp')
-rw-r--r--source/cpuops.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/source/cpuops.cpp b/source/cpuops.cpp
index c5adc67..967ca9f 100644
--- a/source/cpuops.cpp
+++ b/source/cpuops.cpp
@@ -3556,7 +3556,9 @@ static void Op00 (void)
PushW (CPU.PC - CPU.PCBase + 1);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3572,7 +3574,9 @@ static void Op00 (void)
PushW (CPU.PC - CPU.PCBase);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3607,7 +3611,9 @@ void S9xOpcode_IRQ (void)
PushW (CPU.PC - CPU.PCBase);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3632,7 +3638,9 @@ void S9xOpcode_IRQ (void)
PushW (CPU.PC - CPU.PCBase);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3669,7 +3677,9 @@ void S9xOpcode_NMI (void)
PushW (CPU.PC - CPU.PCBase);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3694,7 +3704,9 @@ void S9xOpcode_NMI (void)
PushW (CPU.PC - CPU.PCBase);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3730,7 +3742,9 @@ static void Op02 (void)
PushW (CPU.PC - CPU.PCBase + 1);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3746,7 +3760,9 @@ static void Op02 (void)
PushW (CPU.PC - CPU.PCBase);
S9xPackStatus ();
PushB (Registers.PL);
+#ifndef NO_OPEN_BUS
OpenBus = Registers.PL;
+#endif
ClearDecimal ();
SetIRQ ();
@@ -3905,7 +3921,10 @@ static void Op54X1 (void)
Registers.DB = *CPU.PC++;
ICPU.ShiftedDB = Registers.DB << 16;
- OpenBus = SrcBank = *CPU.PC++;
+#ifndef NO_OPEN_BUS
+ OpenBus =
+#endif
+ SrcBank = *CPU.PC++;
S9xSetByte (S9xGetByte ((SrcBank << 16) + Registers.X.W),
ICPU.ShiftedDB + Registers.Y.W);
@@ -3927,7 +3946,10 @@ static void Op54X0 (void)
Registers.DB = *CPU.PC++;
ICPU.ShiftedDB = Registers.DB << 16;
- OpenBus = SrcBank = *CPU.PC++;
+#ifndef NO_OPEN_BUS
+ OpenBus =
+#endif
+ SrcBank = *CPU.PC++;
S9xSetByte (S9xGetByte ((SrcBank << 16) + Registers.X.W),
ICPU.ShiftedDB + Registers.Y.W);
@@ -3948,7 +3970,10 @@ static void Op44X1 (void)
#endif
Registers.DB = *CPU.PC++;
ICPU.ShiftedDB = Registers.DB << 16;
- OpenBus = SrcBank = *CPU.PC++;
+#ifndef NO_OPEN_BUS
+ OpenBus =
+#endif
+ SrcBank = *CPU.PC++;
S9xSetByte (S9xGetByte ((SrcBank << 16) + Registers.X.W),
ICPU.ShiftedDB + Registers.Y.W);
@@ -3968,7 +3993,10 @@ static void Op44X0 (void)
#endif
Registers.DB = *CPU.PC++;
ICPU.ShiftedDB = Registers.DB << 16;
- OpenBus = SrcBank = *CPU.PC++;
+#ifndef NO_OPEN_BUS
+ OpenBus =
+#endif
+ SrcBank = *CPU.PC++;
S9xSetByte (S9xGetByte ((SrcBank << 16) + Registers.X.W),
ICPU.ShiftedDB + Registers.Y.W);