diff options
author | Nebuleon Fumika | 2012-12-20 18:10:38 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2012-12-20 18:14:24 -0500 |
commit | 80858801300a2f48ad250721a79ebc7b1b0aba92 (patch) | |
tree | a64d661a5e40b759a083a653841dff2ae82fa130 /source/getset.h | |
parent | 83426640a6079021815e611ff0519d27ca3f9ce4 (diff) | |
download | snes9x2005-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/getset.h')
-rw-r--r-- | source/getset.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/source/getset.h b/source/getset.h index f04bf95..9b94b22 100644 --- a/source/getset.h +++ b/source/getset.h @@ -98,10 +98,12 @@ #include "obc1.h" #include "seta.h" +#ifndef NO_OPEN_BUS extern "C" { extern uint8 OpenBus; } +#endif uint8 S9xGetByte (uint32 Address) { @@ -178,8 +180,11 @@ uint8 S9xGetByte (uint32 Address) #ifdef DEBUGGER printf ("DEBUG R(B) %06x\n", Address); #endif - return OpenBus; - +#ifndef NO_OPEN_BUS + return OpenBus; +#else + return 0; // Arbitrarily chosen value [Neb] +#endif default: @@ -193,7 +198,11 @@ uint8 S9xGetByte (uint32 Address) #ifdef DEBUGGER printf ("R(B) %06x\n", Address); #endif +#ifndef NO_OPEN_BUS return OpenBus; +#else + return 0; // Arbitrarily chosen value [Neb] +#endif } } @@ -201,8 +210,13 @@ uint16 S9xGetWord (uint32 Address) { if ((Address & 0x0fff) == 0x0fff) { - OpenBus=S9xGetByte (Address); +#ifndef NO_OPEN_BUS + OpenBus = S9xGetByte (Address); return (OpenBus | (S9xGetByte (Address + 1) << 8)); +#else + uint8 Split = S9xGetByte (Address); + return (Split | (S9xGetByte (Address + 1) << 8)); +#endif } int block; uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK]; @@ -302,8 +316,11 @@ uint16 S9xGetWord (uint32 Address) #ifdef DEBUGGER printf ("DEBUG R(W) %06x\n", Address); #endif - return (OpenBus | (OpenBus<<8)); - +#ifndef NO_OPEN_BUS + return (OpenBus | (OpenBus<<8)); +#else + return 0; // Arbitrarily chosen value [Neb] +#endif default: case CMemory::MAP_NONE: @@ -316,7 +333,11 @@ uint16 S9xGetWord (uint32 Address) #ifdef DEBUGGER printf ("R(W) %06x\n", Address); #endif +#ifndef NO_OPEN_BUS return (OpenBus | (OpenBus<<8)); +#else + return 0; // Arbitrarily chosen value [Neb] +#endif } } |