From 3564bfe8134ce6e1294a59212484e9ee487ab4f5 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Sun, 2 Nov 2014 11:44:50 +0100 Subject: start hooking up blargg's apu implementation to use as a reference. (not yet working) --- source/cpuexec.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/cpuexec.c') diff --git a/source/cpuexec.c b/source/cpuexec.c index ccd38ff..2c1b67a 100644 --- a/source/cpuexec.c +++ b/source/cpuexec.c @@ -203,8 +203,10 @@ void S9xMainLoop_SA1_SFX(void) ICPU.Registers.PC = CPU.PC - CPU.PCBase; S9xPackStatus(); +#ifndef USE_BLARGG_APU IAPU.Registers.PC = IAPU.PC - IAPU.RAM; S9xAPUPackStatus(); +#endif if (CPU.Flags & SCAN_KEYS_FLAG) { S9xSyncSpeed(); @@ -287,8 +289,10 @@ void S9xMainLoop_SA1_NoSFX(void) ICPU.Registers.PC = CPU.PC - CPU.PCBase; S9xPackStatus(); +#ifndef USE_BLARGG_APU IAPU.Registers.PC = IAPU.PC - IAPU.RAM; S9xAPUPackStatus(); +#endif if (CPU.Flags & SCAN_KEYS_FLAG) { S9xSyncSpeed(); @@ -360,8 +364,10 @@ void S9xMainLoop_NoSA1_SFX(void) ICPU.Registers.PC = CPU.PC - CPU.PCBase; S9xPackStatus(); +#ifndef USE_BLARGG_APU IAPU.Registers.PC = IAPU.PC - IAPU.RAM; S9xAPUPackStatus(); +#endif if (CPU.Flags & SCAN_KEYS_FLAG) { S9xSyncSpeed(); @@ -442,8 +448,10 @@ void S9xMainLoop_NoSA1_NoSFX(void) ICPU.Registers.PC = CPU.PC - CPU.PCBase; S9xPackStatus(); +#ifndef USE_BLARGG_APU IAPU.Registers.PC = IAPU.PC - IAPU.RAM; S9xAPUPackStatus(); +#endif if (CPU.Flags & SCAN_KEYS_FLAG) { S9xSyncSpeed(); @@ -504,6 +512,7 @@ void S9xDoHBlankProcessing_SFX() case HBLANK_END_EVENT: S9xSuperFXExec(); +#ifndef USE_BLARGG_APU #ifndef STORM if (Settings.SoundSync) S9xGenerateSound(); @@ -519,7 +528,11 @@ void S9xDoHBlankProcessing_SFX() } else APU.Cycles = 0; - +#else + S9xAPUExecute(); + CPU.Cycles -= Settings.H_Max; + S9xAPUSetReferenceTime(CPU.Cycles); +#endif CPU.NextEvent = -1; ICPU.Scanline++; -- cgit v1.2.3