diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp index 0c628c5e2..6245405a6 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp @@ -40,7 +40,7 @@ CMipsMemoryVM::CMipsMemoryVM( CMipsMemory_CallBack * CallBack, bool SavesReadOnl m_IMEM = NULL; } -static unsigned long swap32by8(unsigned long word) +unsigned long swap32by8(unsigned long word) { const unsigned long swapped = #if defined(_MSC_VER) diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.h b/Source/Project64/N64 System/Mips/Memory Virtual Mem.h index 4f11f477c..34ff27fc2 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.h +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.h @@ -10,6 +10,8 @@ ****************************************************************************/ #pragma once +extern unsigned long swap32by8(unsigned long word); + class CMipsMemoryVM : public CMipsMemory, public CTransVaddr, diff --git a/Source/Project64/N64 System/Mips/Pif Ram.cpp b/Source/Project64/N64 System/Mips/Pif Ram.cpp index 3dacf5796..db011df2e 100644 --- a/Source/Project64/N64 System/Mips/Pif Ram.cpp +++ b/Source/Project64/N64 System/Mips/Pif Ram.cpp @@ -302,34 +302,14 @@ void CPifRam::SI_DMA_READ() } else { -#ifdef _M_IX86 - _asm + size_t i; + + for (i = 0; i < 64; i += 4) { - mov edi, dword ptr [SI_DRAM_ADDR_REG] - mov edi, dword ptr [edi] - add edi, RDRAM - mov ecx, PifRamPos - mov edx, 0 - memcpyloop: - mov eax, dword ptr [ecx + edx] - bswap eax - mov dword ptr [edi + edx],eax - mov eax, dword ptr [ecx + edx + 4] - bswap eax - mov dword ptr [edi + edx + 4],eax - mov eax, dword ptr [ecx + edx + 8] - bswap eax - mov dword ptr [edi + edx + 8],eax - mov eax, dword ptr [ecx + edx + 12] - bswap eax - mov dword ptr [edi + edx + 12],eax - add edx, 16 - cmp edx, 64 - jb memcpyloop + *(unsigned __int32 *)&RDRAM[SI_DRAM_ADDR_REG + i] = swap32by8( + *(unsigned __int32 *)&PifRamPos[i] + ); } -#else - g_Notify->BreakPoint(__FILEW__,__LINE__); -#endif } if (LogOptions.LogPRDMAMemStores) @@ -413,34 +393,14 @@ void CPifRam::SI_DMA_WRITE() } else { -#ifdef _M_IX86 - _asm + size_t i; + + for (i = 0; i < 64; i += 4) { - mov ecx, dword ptr [SI_DRAM_ADDR_REG] - mov ecx, dword ptr [ecx] - add ecx, RDRAM - mov edi, PifRamPos - mov edx, 0 - memcpyloop: - mov eax, dword ptr [ecx + edx] - bswap eax - mov dword ptr [edi + edx],eax - mov eax, dword ptr [ecx + edx + 4] - bswap eax - mov dword ptr [edi + edx + 4],eax - mov eax, dword ptr [ecx + edx + 8] - bswap eax - mov dword ptr [edi + edx + 8],eax - mov eax, dword ptr [ecx + edx + 12] - bswap eax - mov dword ptr [edi + edx + 12],eax - add edx, 16 - cmp edx, 64 - jb memcpyloop + *(unsigned __int32 *)&PifRamPos[i] = swap32by8( + *(unsigned __int32 *)&RDRAM[SI_DRAM_ADDR_REG + i] + ); } -#else - g_Notify->BreakPoint(__FILEW__,__LINE__); -#endif } if (LogOptions.LogPRDMAMemLoads)