diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 12984abd8..27e395826 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -3719,9 +3719,11 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val) T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, fw_transfer(&MMU.fw, (u8)val)); return; - case 2 : - //printf("%08X\n",MMU.SPI_CMD); - switch(MMU.SPI_CMD&0xFC) + case 2: + { + int channel = (MMU.SPI_CMD&0x70)>>4; + //printf("%08X\n",channel); + switch(channel) { case TSC_MEASURE_TEMP1: if(spicnt & 0x800) @@ -3805,8 +3807,9 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val) else val = 0; break; + } + break; } - break; case 3 : /* NOTICE: Device 3 of SPI is reserved (unused and unusable) */ diff --git a/desmume/src/registers.h b/desmume/src/registers.h index 319fa5469..77e7a1a97 100644 --- a/desmume/src/registers.h +++ b/desmume/src/registers.h @@ -406,13 +406,13 @@ #define IRQ_MASK_ARM7_SPI (1<<23) #define IRQ_MASK_ARM7_WIFI (1<<24) -#define TSC_MEASURE_TEMP1 0x84 -#define TSC_MEASURE_Y 0x90 -#define TSC_MEASURE_BATTERY 0xA4 -#define TSC_MEASURE_Z1 0xB4 -#define TSC_MEASURE_Z2 0xC4 -#define TSC_MEASURE_X 0xD0 -#define TSC_MEASURE_AUX 0xE4 -#define TSC_MEASURE_TEMP2 0xF4 +#define TSC_MEASURE_TEMP1 0 +#define TSC_MEASURE_Y 1 +#define TSC_MEASURE_BATTERY 2 +#define TSC_MEASURE_Z1 3 +#define TSC_MEASURE_Z2 4 +#define TSC_MEASURE_X 5 +#define TSC_MEASURE_AUX 6 +#define TSC_MEASURE_TEMP2 7 #endif