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/globals.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/globals.cpp') diff --git a/source/globals.cpp b/source/globals.cpp index 0103f7e..f00a621 100644 --- a/source/globals.cpp +++ b/source/globals.cpp @@ -157,7 +157,9 @@ uint32 Work32 = 0; signed char Int8 = 0; short Int16 = 0; long Int32 = 0; -unsigned char OpenBus = 0; +#ifndef NO_OPEN_BUS +uint8 OpenBus = 0; +#endif END_EXTERN_C -- cgit v1.2.3 From f29c76dc58689fe55f4ece494a0d3d44c831203f Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Mon, 24 Dec 2012 03:53:20 -0500 Subject: End the use of global variables for CPU emulation. This creates fewer memory store instructions in many SNES, SA1 and APU opcodes. Fix the APU half-carry bug, which may be audible. globals.cpp: Get rid of A1, A2, A3, A4, W1, W2, W3, W4, Int8, Int16, Int32, Work8, Work16, Work32, Ans8, Ans16, Ans32. --- source/globals.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/globals.cpp') diff --git a/source/globals.cpp b/source/globals.cpp index f00a621..ca2b12b 100644 --- a/source/globals.cpp +++ b/source/globals.cpp @@ -147,6 +147,7 @@ CMemory Memory; struct SSNESGameFixes SNESGameFixes; +#if 0 uint8 A1 = 0, A2 = 0, A3 = 0, A4 = 0, W1 = 0, W2 = 0, W3 = 0, W4 = 0; uint8 Ans8 = 0; uint16 Ans16 = 0; @@ -157,6 +158,7 @@ uint32 Work32 = 0; signed char Int8 = 0; short Int16 = 0; long Int32 = 0; +#endif #ifndef NO_OPEN_BUS uint8 OpenBus = 0; #endif -- cgit v1.2.3 From e5869adc4469115c7eac9abf70145fc178e017de Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Wed, 26 Dec 2012 14:42:02 -0500 Subject: Merge Registers structures into their respective CPUs to avoid additional memory addresses being loaded every opcode. --- source/globals.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'source/globals.cpp') diff --git a/source/globals.cpp b/source/globals.cpp index ca2b12b..adb9ab4 100644 --- a/source/globals.cpp +++ b/source/globals.cpp @@ -113,20 +113,14 @@ struct SICPU ICPU; struct SCPUState CPU; -struct SRegisters Registers; - struct SAPU APU; struct SIAPU IAPU; -struct SAPURegisters APURegisters; - struct SSettings Settings; struct SDSP1 DSP1; -struct SSA1Registers SA1Registers; - struct SSA1 SA1; SSoundData SoundData; @@ -361,7 +355,7 @@ struct SNetPlay NetPlay; #endif // Raw SPC700 instruction cycle lengths -int32 S9xAPUCycleLengths [256] = +uint16 S9xAPUCycleLengths [256] = { /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */ /* 00 */ 2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 6, 8, @@ -384,7 +378,7 @@ int32 S9xAPUCycleLengths [256] = // Actual data used by CPU emulation, will be scaled by APUReset routine // to be relative to the 65c816 instruction lengths. -int32 S9xAPUCycles [256] = +uint16 S9xAPUCycles [256] = { /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */ /* 00 */ 2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 6, 8, -- cgit v1.2.3 From 6b36e79013d4c9273a96a9783a2bccdb516f174a Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Thu, 27 Dec 2012 18:02:03 -0500 Subject: Speed up rendering by an unknown amount. gfx.cpp, others: Avoid always checking for Settings.SixteenBit if FOREVER_16_BIT is defined. port.h: Define FOREVER_16_BIT below PIXEL_FORMAT. --- source/globals.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'source/globals.cpp') diff --git a/source/globals.cpp b/source/globals.cpp index adb9ab4..c804318 100644 --- a/source/globals.cpp +++ b/source/globals.cpp @@ -228,7 +228,6 @@ uint32 HIGH_BITS_SHIFTED_TWO_MASK = 0; uint32 current_graphic_format = RGB565; #endif -uint8 GetBank = 0; struct SCheatData Cheat; volatile SoundStatus so; -- cgit v1.2.3