trunk/src/mame/machine/snes.c
| r18390 | r18391 | |
| 1044 | 1044 | } |
| 1045 | 1045 | else if ((state->m_cart[0].mode & 5) && (address < 0x8000)) /* Mode 20 & 22 */ |
| 1046 | 1046 | { |
| 1047 | | if (state->m_cart[0].sram > 0) |
| 1047 | if (state->m_cart[0].sram > 0x8000) |
| 1048 | 1048 | { |
| 1049 | // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. |
| 1050 | int mask = (state->m_cart[0].sram << 1) - 1; |
| 1051 | mask &= ~0x8000; |
| 1052 | value = snes_ram[0x700000 + (offset & mask)]; |
| 1053 | } |
| 1054 | else if (state->m_cart[0].sram > 0) |
| 1055 | { |
| 1049 | 1056 | int mask = state->m_cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1050 | 1057 | value = snes_ram[0x700000 + (offset & mask)]; |
| 1051 | 1058 | } |
| r18390 | r18391 | |
| 1320 | 1327 | snes_ram[0xf00000 + offset] = data; |
| 1321 | 1328 | else if ((state->m_cart[0].mode & 5) && (address < 0x8000)) /* Mode 20 & 22 */ |
| 1322 | 1329 | { |
| 1323 | | if (state->m_cart[0].sram > 0) |
| 1330 | if (state->m_cart[0].sram > 0x8000) |
| 1324 | 1331 | { |
| 1332 | // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. |
| 1333 | int mask = (state->m_cart[0].sram << 1) - 1; |
| 1334 | mask &= ~0x8000; |
| 1335 | snes_ram[0x700000 + (offset & mask)] = data; |
| 1336 | } |
| 1337 | else if (state->m_cart[0].sram > 0) |
| 1338 | { |
| 1325 | 1339 | int mask = state->m_cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1326 | 1340 | snes_ram[0x700000 + (offset & mask)] = data; |
| 1327 | 1341 | } |