From 1dd0871f208e59792aff088ea41f471673eeaa7e Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 20 Sep 2017 23:43:38 +0300 Subject: [PATCH] memory: allow SRAM word writes Was allowing both low and high byte writes by byte, but not word, which was stupid. --- pico/memory.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pico/memory.c b/pico/memory.c index 4f38e5e2..5be66f5c 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; } } } -- 2.39.5