From e708c127fa51beab567a9ce0e3ab53b58c997773 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Tue, 18 Dec 2012 22:53:49 -0500 Subject: Un-inline a bunch of stuff. With the MIPS instruction cache, this means that two consecutive SNES CPU instructions using e.g. the same addressing style or the same opcode have a chance that the second one will use the first one's code and that it will be cached. --- source/getset.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/getset.h') diff --git a/source/getset.h b/source/getset.h index 2368ac2..f04bf95 100644 --- a/source/getset.h +++ b/source/getset.h @@ -103,7 +103,7 @@ extern "C" extern uint8 OpenBus; } -INLINE uint8 S9xGetByte (uint32 Address) +uint8 S9xGetByte (uint32 Address) { int block; uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK]; @@ -197,7 +197,7 @@ INLINE uint8 S9xGetByte (uint32 Address) } } -INLINE uint16 S9xGetWord (uint32 Address) +uint16 S9xGetWord (uint32 Address) { if ((Address & 0x0fff) == 0x0fff) { @@ -320,7 +320,7 @@ INLINE uint16 S9xGetWord (uint32 Address) } } -INLINE void S9xSetByte (uint8 Byte, uint32 Address) +void S9xSetByte (uint8 Byte, uint32 Address) { #if defined(CPU_SHUTDOWN) CPU.WaitAddress = NULL; @@ -436,7 +436,7 @@ INLINE void S9xSetByte (uint8 Byte, uint32 Address) } } -INLINE void S9xSetWord (uint16 Word, uint32 Address) +void S9xSetWord (uint16 Word, uint32 Address) { if((Address & 0x0FFF)==0x0FFF) { @@ -594,7 +594,7 @@ INLINE void S9xSetWord (uint16 Word, uint32 Address) } } -INLINE uint8 *GetBasePointer (uint32 Address) +uint8 *GetBasePointer (uint32 Address) { uint8 *GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK]; if (GetAddress >= (uint8 *) CMemory::MAP_LAST) @@ -660,7 +660,7 @@ INLINE uint8 *GetBasePointer (uint32 Address) } } -INLINE uint8 *S9xGetMemPointer (uint32 Address) +uint8 *S9xGetMemPointer (uint32 Address) { uint8 *GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK]; if (GetAddress >= (uint8 *) CMemory::MAP_LAST) @@ -714,7 +714,7 @@ INLINE uint8 *S9xGetMemPointer (uint32 Address) } } -INLINE void S9xSetPCBase (uint32 Address) +void S9xSetPCBase (uint32 Address) { int block; uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK]; -- cgit v1.2.3 From 80858801300a2f48ad250721a79ebc7b1b0aba92 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Thu, 20 Dec 2012 18:10:38 -0500 Subject: 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. --- source/getset.h | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'source/getset.h') 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 } } -- cgit v1.2.3