From b2547e767be23e604b10477128fd4d00ffeec2b7 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Thu, 29 Mar 2012 21:01:24 +0000 Subject: [PATCH] core: - fix swi 0x03 (CRC16) R3 contains the last processed halfword; --- desmume/src/bios.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desmume/src/bios.cpp b/desmume/src/bios.cpp index d0c2c933e..ae761f996 100644 --- a/desmume/src/bios.cpp +++ b/desmume/src/bios.cpp @@ -1053,12 +1053,13 @@ TEMPLATE static u32 getCRC16() u16 crc = (u16)cpu->R[0]; u32 datap = cpu->R[1]; u32 size = cpu->R[2]>>1; + u16 currVal = 0; const u16 val[] = { 0x0000,0xCC01,0xD801,0x1400,0xF001,0x3C00,0x2800,0xE401,0xA001,0x6C00,0x7800,0xB401,0x5000,0x9C01,0x8801,0x4400}; for(u32 i = 0; i < size; i++) { - u16 currVal = _MMU_read16(datap + i*2); + currVal = _MMU_read16(datap + i*2); for(int j=0;j<4;j++) { @@ -1073,6 +1074,8 @@ TEMPLATE static u32 getCRC16() } cpu->R[0] = crc; + // R3 contains the last processed halfword + cpu->R[3] = currVal; return 1; }