trunk/src/mame/machine/snes.c
| r18274 | r18275 | |
| 922 | 922 | { |
| 923 | 923 | /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ |
| 924 | 924 | /* 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)]; |
| 927 | 927 | } |
| 928 | 928 | else |
| 929 | 929 | { |
| r18274 | r18275 | |
| 1082 | 1082 | value = space.read_byte(offset); |
| 1083 | 1083 | else if ((offset >= 0x300000) && (state->m_cart[0].sram > 0)) |
| 1084 | 1084 | { |
| 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)]; |
| 1087 | 1087 | } |
| 1088 | 1088 | else /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */ |
| 1089 | 1089 | { |
| r18274 | r18275 | |
| 1249 | 1249 | { |
| 1250 | 1250 | /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ |
| 1251 | 1251 | /* 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; |
| 1254 | 1254 | } |
| 1255 | 1255 | else |
| 1256 | 1256 | logerror("snes_w_bank2: Attempt to write to reserved address: %X = %02x\n", offset + 0x300000, data); |
| r18274 | r18275 | |
| 1353 | 1353 | space.write_byte(offset, data); |
| 1354 | 1354 | else if ((offset >= 0x300000) && (state->m_cart[0].sram > 0)) |
| 1355 | 1355 | { |
| 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; |
| 1358 | 1358 | } |
| 1359 | 1359 | else /* Area in 0x6000-0x8000 && offset < 0x300000 is Reserved! */ |
| 1360 | 1360 | logerror("snes_w_bank6: Attempt to write to reserved address: %X = %02x\n", offset + 0x800000, data); |