Previous 199869 Revisions Next

r18275 Thursday 4th October, 2012 at 06:11:20 UTC by Fabio Priuli
(MESS) snes.c: fixed SRAM issues. [Fabio Priuli]
[src/mame/machine]snes.c

trunk/src/mame/machine/snes.c
r18274r18275
922922      {
923923         /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
924924         /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
925         int mask = (state->m_cart[0].sram - 1) | 0xffe000; /* Limit SRAM size to what's actually present */
926         value = snes_ram[0x300000 + (offset & mask)];
925         int mask = (state->m_cart[0].sram - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
926         value = snes_ram[0x306000 + ((offset - 0x6000) & mask)];
927927      }
928928      else
929929      {
r18274r18275
10821082            value = space.read_byte(offset);
10831083         else if ((offset >= 0x300000) && (state->m_cart[0].sram > 0))
10841084         {
1085            int mask = (state->m_cart[0].sram - 1) | 0xff0000; /* Limit SRAM size to what's actually present */
1086            value = snes_ram[0x800000 + (offset & mask)];
1085            int mask = (state->m_cart[0].sram - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1086            value = snes_ram[0xb06000 + ((offset - 0x6000) & mask)];
10871087         }
10881088         else                  /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */
10891089         {
r18274r18275
12491249      {
12501250         /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
12511251         /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
1252         int mask = (state->m_cart[0].sram - 1) | 0xffe000; /* Limit SRAM size to what's actually present */
1253         snes_ram[0x300000 + (offset & mask)] = data;
1252         int mask = (state->m_cart[0].sram - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1253         snes_ram[0x306000 + ((offset - 0x6000) & mask)] = data;
12541254      }
12551255      else
12561256         logerror("snes_w_bank2: Attempt to write to reserved address: %X = %02x\n", offset + 0x300000, data);
r18274r18275
13531353            space.write_byte(offset, data);
13541354         else if ((offset >= 0x300000) && (state->m_cart[0].sram > 0))
13551355         {
1356            int mask = (state->m_cart[0].sram - 1) | 0xff0000; /* Limit SRAM size to what's actually present */
1357            snes_ram[0x800000 + (offset & mask)] = data;
1356            int mask = (state->m_cart[0].sram - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1357            snes_ram[0xb06000 + ((offset - 0x6000) & mask)] = data;
13581358         }
13591359         else   /* Area in 0x6000-0x8000 && offset < 0x300000 is Reserved! */
13601360            logerror("snes_w_bank6: Attempt to write to reserved address: %X = %02x\n", offset + 0x800000, data);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team