From: notaz Date: Wed, 20 Sep 2017 20:43:38 +0000 (+0300) Subject: memory: allow SRAM word writes X-Git-Tag: v1.92~39 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=1dd0871f208e59792aff088ea41f471673eeaa7e;p=picodrive.git memory: allow SRAM word writes Was allowing both low and high byte writes by byte, but not word, which was stupid. --- diff --git a/pico/memory.c b/pico/memory.c index 4f38e5e..5be66f5 100644 --- a/pico/memory.c +++ b/pico/memory.c @@ -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; } } }