aboutsummaryrefslogtreecommitdiff
path: root/source/apu.cpp
diff options
context:
space:
mode:
authorNebuleon Fumika2013-02-01 00:33:30 -0500
committerNebuleon Fumika2013-02-01 00:33:30 -0500
commitf385752705de73b04cbbda735a71f14c19e241a6 (patch)
tree59aca906a8c3fcbaae402d503e7c6b34643e0199 /source/apu.cpp
parentf0fab191e48f165c551980d724bba2f26a764795 (diff)
downloadsnesemu-f385752705de73b04cbbda735a71f14c19e241a6.tar.gz
snesemu-f385752705de73b04cbbda735a71f14c19e241a6.tar.bz2
snesemu-f385752705de73b04cbbda735a71f14c19e241a6.zip
memcpy vs memmove: memmove correctly handles overlapping source and destination memory buffers, but is slower than memcpy in many implementations. When memory buffers don't overlap, memcpy may be more efficient.
The DS2 SDK is such an implementation, so change many memmoves into memcpys.
Diffstat (limited to 'source/apu.cpp')
-rw-r--r--source/apu.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/apu.cpp b/source/apu.cpp
index 3c1a5d3..d60cc75 100644
--- a/source/apu.cpp
+++ b/source/apu.cpp
@@ -177,8 +177,12 @@ void S9xResetAPU ()
ZeroMemory (IAPU.CachedSamples, 0x40000);
ZeroMemory (APU.OutPorts, 4);
IAPU.DirectPage = IAPU.RAM;
- memmove (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM));
- memmove (APU.ExtraRAM, APUROM, sizeof (APUROM));
+ // memmove converted: Different mallocs [Neb]
+ // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ memcpy (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM));
+ // memmove converted: Different mallocs [Neb]
+ // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ memcpy (APU.ExtraRAM, APUROM, sizeof (APUROM));
IAPU.PC = IAPU.RAM + IAPU.RAM [0xfffe] + (IAPU.RAM [0xffff] << 8);
APU.Cycles = 0;
IAPU.Registers.YA.W = 0;
@@ -874,7 +878,9 @@ void S9xSetAPUControl (uint8 byte)
{
if (!APU.ShowROM)
{
- memmove (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM));
+ // memmove converted: Different mallocs [Neb]
+ // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ memcpy (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM));
APU.ShowROM = TRUE;
}
}
@@ -883,7 +889,9 @@ void S9xSetAPUControl (uint8 byte)
if (APU.ShowROM)
{
APU.ShowROM = FALSE;
- memmove (&IAPU.RAM [0xffc0], APU.ExtraRAM, sizeof (APUROM));
+ // memmove converted: Different mallocs [Neb]
+ // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ memcpy (&IAPU.RAM [0xffc0], APU.ExtraRAM, sizeof (APUROM));
}
}
IAPU.RAM [0xf1] = byte;