aboutsummaryrefslogtreecommitdiff
path: root/source/sa1.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/sa1.cpp
parentf0fab191e48f165c551980d724bba2f26a764795 (diff)
downloadsnes9x2005-f385752705de73b04cbbda735a71f14c19e241a6.tar.gz
snes9x2005-f385752705de73b04cbbda735a71f14c19e241a6.tar.bz2
snes9x2005-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/sa1.cpp')
-rw-r--r--source/sa1.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/sa1.cpp b/source/sa1.cpp
index 4dbf9b0..addeed7 100644
--- a/source/sa1.cpp
+++ b/source/sa1.cpp
@@ -742,7 +742,8 @@ void S9xSetSA1 (uint8 byte, uint32 address)
if ((Memory.FillRAM [0x2230] & 0xb0) == 0xa0)
{
// Char conversion 2 DMA enabled
- memmove (&Memory.ROM [CMemory::MAX_ROM_SIZE - 0x10000] + SA1.in_char_dma * 16,
+ // memmove converted: Same malloc but constant non-overlapping addresses [Neb]
+ memcpy (&Memory.ROM [CMemory::MAX_ROM_SIZE - 0x10000] + SA1.in_char_dma * 16,
&Memory.FillRAM [0x2240], 16);
SA1.in_char_dma = (SA1.in_char_dma + 1) & 7;
if ((SA1.in_char_dma & 3) == 0)
@@ -895,6 +896,7 @@ static void S9xSA1DMA ()
len &= 0x3ff;
d = &Memory.FillRAM [0x3000] + dst;
}
+ // memmove required: Can overlap arbitrarily [Neb]
memmove (d, s, len);
Memory.FillRAM [0x2301] |= 0x20;