memory: allow SRAM word writes

Was allowing both low and high byte writes by byte, but not word,
which was stupid.
This commit is contained in:
notaz 2017-09-20 23:43:38 +03:00
parent 2b15cea82e
commit 1dd0871f20

View file

@ -448,11 +448,14 @@ static void PicoWrite16_sram(u32 a, u32 d)
EEPROM_write16(d);
}
else {
// XXX: hardware could easily use MSB too..
u8 *pm = (u8 *)(SRam.data - SRam.start + a);
if (*pm != (u8)d) {
if (pm[0] != (u8)(d >> 8)) {
SRam.changed = 1;
*pm = (u8)d;
pm[0] = (u8)(d >> 8);
}
if (pm[1] != (u8)d) {
SRam.changed = 1;
pm[1] = (u8)d;
}
}
}