make invalid SPI memory commands return 0xFF. fixes #1366 (Dementium II checks the results of RDSR, RDID and cmd 00 to determine what kind of backup memory is present)

This commit is contained in:
Arisotura 2022-03-14 18:08:29 +01:00
parent 5415f8a746
commit 3756f3cb1f
2 changed files with 8 additions and 7 deletions

View File

@ -529,17 +529,17 @@ u8 CartRetail::SPIWrite(u8 val, u32 pos, bool last)
{ {
case 0x04: // write disable case 0x04: // write disable
SRAMStatus &= ~(1<<1); SRAMStatus &= ~(1<<1);
break; return 0;
case 0x06: // write enable case 0x06: // write enable
SRAMStatus |= (1<<1); SRAMStatus |= (1<<1);
break; return 0;
default: default:
SRAMCmd = val; SRAMCmd = val;
SRAMAddr = 0; SRAMAddr = 0;
} }
return 0; return 0xFF;
} }
switch (SRAMType) switch (SRAMType)
@ -547,7 +547,7 @@ u8 CartRetail::SPIWrite(u8 val, u32 pos, bool last)
case 1: return SRAMWrite_EEPROMTiny(val, pos, last); case 1: return SRAMWrite_EEPROMTiny(val, pos, last);
case 2: return SRAMWrite_EEPROM(val, pos, last); case 2: return SRAMWrite_EEPROM(val, pos, last);
case 3: return SRAMWrite_FLASH(val, pos, last); case 3: return SRAMWrite_FLASH(val, pos, last);
default: return 0; default: return 0xFF;
} }
} }
@ -628,7 +628,7 @@ u8 CartRetail::SRAMWrite_EEPROMTiny(u8 val, u32 pos, bool last)
default: default:
if (pos == 1) if (pos == 1)
printf("unknown tiny EEPROM save command %02X\n", SRAMCmd); printf("unknown tiny EEPROM save command %02X\n", SRAMCmd);
return 0; return 0xFF;
} }
} }
@ -694,7 +694,7 @@ u8 CartRetail::SRAMWrite_EEPROM(u8 val, u32 pos, bool last)
default: default:
if (pos == 1) if (pos == 1)
printf("unknown EEPROM save command %02X\n", SRAMCmd); printf("unknown EEPROM save command %02X\n", SRAMCmd);
return 0; return 0xFF;
} }
} }
@ -838,7 +838,7 @@ u8 CartRetail::SRAMWrite_FLASH(u8 val, u32 pos, bool last)
default: default:
if (pos == 1) if (pos == 1)
printf("unknown FLASH save command %02X\n", SRAMCmd); printf("unknown FLASH save command %02X\n", SRAMCmd);
return 0; return 0xFF;
} }
} }

View File

@ -564,6 +564,7 @@ void Write(u8 val, u32 hold)
default: default:
printf("unknown firmware SPI command %02X\n", CurCmd); printf("unknown firmware SPI command %02X\n", CurCmd);
Data = 0xFF;
break; break;
} }