src/mame/machine/snes.c
| r9551 | r9552 | |
| 1005 | 1005 | } |
| 1006 | 1006 | else if ((state->cart[0].mode == SNES_MODE_21) && (state->cart[0].sram > 0)) |
| 1007 | 1007 | { |
| 1008 | | // int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1009 | | value = snes_ram[0x300000 + offset]; |
| 1008 | /* Donkey Kong Country checks this */ |
| 1009 | int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1010 | value = snes_ram[0x300000 + (offset & mask)]; |
| 1010 | 1011 | } |
| 1011 | 1012 | else |
| 1012 | 1013 | { |
| r9551 | r9552 | |
| 1176 | 1177 | value = space->read_byte(offset); |
| 1177 | 1178 | else if ((offset >= 0x300000) && (state->cart[0].sram > 0)) |
| 1178 | 1179 | { |
| 1179 | | // int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1180 | | value = snes_ram[0x800000 + offset]; |
| 1180 | int mask = (state->cart[0].sram - 1) | 0xff0000; /* Limit SRAM size to what's actually present */ |
| 1181 | value = snes_ram[0x800000 + (offset & mask)]; |
| 1181 | 1182 | } |
| 1182 | 1183 | else /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */ |
| 1183 | 1184 | { |
| r9551 | r9552 | |
| 1344 | 1345 | } |
| 1345 | 1346 | else if ((state->cart[0].mode == SNES_MODE_21) && (state->cart[0].sram > 0)) |
| 1346 | 1347 | { |
| 1347 | | // int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1348 | | snes_ram[0x300000 + offset] = data; |
| 1348 | /* Donkey Kong Country checks this */ |
| 1349 | int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1350 | snes_ram[0x300000 + (offset & mask)] = data; |
| 1349 | 1351 | } |
| 1350 | 1352 | else |
| 1351 | 1353 | logerror("snes_w_bank2: Attempt to write to reserved address: %X = %02x\n", offset + 0x300000, data); |
| r9551 | r9552 | |
| 1414 | 1416 | if (state->cart[0].sram > 0) |
| 1415 | 1417 | { |
| 1416 | 1418 | int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1417 | | snes_ram[0x700000 + + (offset & mask)] = data; |
| 1419 | snes_ram[0x700000 + (offset & mask)] = data; |
| 1418 | 1420 | } |
| 1419 | 1421 | else |
| 1420 | 1422 | logerror("snes_w_bank5: Attempt to write to reserved address: %X = %02x\n", offset + 0x700000, data); |
| r9551 | r9552 | |
| 1449 | 1451 | space->write_byte(offset, data); |
| 1450 | 1452 | else if ((offset >= 0x300000) && (state->cart[0].sram > 0)) |
| 1451 | 1453 | { |
| 1454 | int mask = (state->cart[0].sram - 1) | 0xff0000; /* Limit SRAM size to what's actually present */ |
| 1452 | 1455 | // int mask = state->cart[0].sram - 1; /* Limit SRAM size to what's actually present */ |
| 1453 | | snes_ram[0x800000 + offset] = data; |
| 1456 | snes_ram[0x800000 + (offset & mask)] = data; |
| 1454 | 1457 | } |
| 1455 | 1458 | else /* Area in 0x6000-0x8000 && offset < 0x300000 is Reserved! */ |
| 1456 | 1459 | logerror("snes_w_bank6: Attempt to write to reserved address: %X = %02x\n", offset + 0x800000, data); |