src/mess/machine/snescart.c
| r7789 | r7790 | |
| 132 | 132 | |
| 133 | 133 | if (snes_cart.mode == SNES_MODE_20) |
| 134 | 134 | { |
| 135 | UINT32 size = snes_cart.small_sram ? 0x8000 : 0x10000; |
| 136 | |
| 135 | 137 | /* There could be some larger image needing banks 0x70 to 0x7f at address 0x8000 for ROM |
| 136 | 138 | * mirroring. These should be treated separately or data would be overwritten by SRAM */ |
| 137 | 139 | for (ii = 0; ii < 16; ii++) |
| 138 | 140 | { |
| 139 | 141 | /* loading */ |
| 140 | | memmove(&snes_ram[0x700000 + (ii * 0x010000)], ptr, 0xffff); |
| 142 | memmove(&snes_ram[0x700000 + (ii * 0x010000)], ptr, size); |
| 141 | 143 | /* mirroring */ |
| 142 | | memcpy(&snes_ram[0xf00000 + (ii * 0x010000)], &snes_ram[0x700000 + (ii * 0x010000)], 0xffff); |
| 143 | | ptr += 0xffff; |
| 144 | memcpy(&snes_ram[0xf00000 + (ii * 0x010000)], &snes_ram[0x700000 + (ii * 0x010000)], size); |
| 145 | ptr += size; |
| 144 | 146 | } |
| 145 | 147 | } |
| 146 | 148 | else if (snes_cart.mode == SNES_MODE_21) |
| r7789 | r7790 | |
| 148 | 150 | for (ii = 0; ii < 16; ii++) |
| 149 | 151 | { |
| 150 | 152 | /* loading */ |
| 151 | | memmove(&snes_ram[0x306000 + (ii * 0x010000)], ptr, 0x1fff); |
| 153 | memmove(&snes_ram[0x306000 + (ii * 0x010000)], ptr, 0x2000); |
| 152 | 154 | /* mirroring */ |
| 153 | | memcpy(&snes_ram[0xb06000 + (ii * 0x010000)], &snes_ram[0x306000 + (ii * 0x010000)], 0x1fff); |
| 154 | | ptr += 0x1fff; |
| 155 | memcpy(&snes_ram[0xb06000 + (ii * 0x010000)], &snes_ram[0x306000 + (ii * 0x010000)], 0x2000); |
| 156 | ptr += 0x2000; |
| 155 | 157 | } |
| 156 | 158 | } |
| 157 | 159 | else if (snes_cart.mode == SNES_MODE_25) |
| 158 | 160 | { |
| 159 | 161 | for (ii = 0; ii < 16; ii++) |
| 160 | 162 | { |
| 161 | | memmove(&snes_ram[0xb06000 + (ii * 0x010000)], ptr, 0x1fff); |
| 162 | | ptr += 0x1fff; |
| 163 | memmove(&snes_ram[0xb06000 + (ii * 0x010000)], ptr, 0x2000); |
| 164 | ptr += 0x2000; |
| 163 | 165 | } |
| 164 | 166 | } |
| 165 | 167 | |
| r7789 | r7790 | |
| 177 | 179 | |
| 178 | 180 | if (snes_cart.mode == SNES_MODE_20) |
| 179 | 181 | { |
| 182 | UINT32 size = snes_cart.small_sram ? 0x8000 : 0x10000; |
| 183 | |
| 180 | 184 | for (ii = 0; ii < 16; ii++) |
| 181 | 185 | { |
| 182 | | memmove(ptr, &snes_ram[0x700000 + (ii * 0x010000)], 0x10000); |
| 183 | | ptr += 0x10000; |
| 186 | memmove(ptr, &snes_ram[0x700000 + (ii * 0x010000)], size); |
| 187 | ptr += size; |
| 184 | 188 | } |
| 185 | 189 | } |
| 186 | 190 | else if (snes_cart.mode == SNES_MODE_21) |
| r7789 | r7790 | |
| 675 | 679 | { |
| 676 | 680 | snes_has_addon_chip = HAS_SA1; |
| 677 | 681 | supported_type = 0; |
| 678 | | fatalerror("This is a SA-1 type game, currently unsupported by the driver"); |
| 679 | 682 | } |
| 680 | 683 | break; |
| 681 | 684 | |
| r7789 | r7790 | |
| 757 | 760 | snes_cart.sram = snes_cart.sram_max; |
| 758 | 761 | } |
| 759 | 762 | |
| 763 | /* adjust size for very large carts */ |
| 764 | if (snes_cart.small_sram == SNES_MODE_20 && ((snes_rom_size - offset) > 0x200000 || snes_cart.sram > (32 * 1024))) |
| 765 | snes_cart.small_sram = 1; |
| 766 | else |
| 767 | snes_cart.small_sram = 0; |
| 768 | |
| 769 | |
| 760 | 770 | /* Log snes_cart information */ |
| 761 | 771 | { |
| 762 | 772 | char title[21], rom_id[4], company_id[2]; |