Previous 15994 Revisions Next

r7790 Monday 12th April, 2010 at 07:40:06 UTC by Fabio Priuli
[SNES] Fixed SRAM mapping for LoROM large carts
[src/mame/includes]snes.h
[src/mess/machine]snescart.c

src/mame/includes/snes.h
r7789r7790
644644   UINT8  mode;      /* ROM memory mode */
645645   UINT32 sram;      /* Amount of sram in cart */
646646   UINT32 sram_max;   /* Maximum amount sram in cart (based on ROM mode) */
647   int    small_sram;
647648};
648649
649650extern struct snes_cart_info snes_cart;
src/mess/machine/snescart.c
r7789r7790
132132
133133   if (snes_cart.mode == SNES_MODE_20)
134134   {
135      UINT32 size = snes_cart.small_sram ? 0x8000 : 0x10000;
136
135137      /* There could be some larger image needing banks 0x70 to 0x7f at address 0x8000 for ROM
136138         * mirroring. These should be treated separately or data would be overwritten by SRAM */
137139      for (ii = 0; ii < 16; ii++)
138140      {
139141         /* loading */
140         memmove(&snes_ram[0x700000 + (ii * 0x010000)], ptr, 0xffff);
142         memmove(&snes_ram[0x700000 + (ii * 0x010000)], ptr, size);
141143         /* 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;
144146      }
145147   }
146148   else if (snes_cart.mode == SNES_MODE_21)
r7789r7790
148150      for (ii = 0; ii < 16; ii++)
149151      {
150152         /* loading */
151         memmove(&snes_ram[0x306000 + (ii * 0x010000)], ptr, 0x1fff);
153         memmove(&snes_ram[0x306000 + (ii * 0x010000)], ptr, 0x2000);
152154         /* 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;
155157      }
156158   }
157159   else if (snes_cart.mode == SNES_MODE_25)
158160   {
159161      for (ii = 0; ii < 16; ii++)
160162      {
161         memmove(&snes_ram[0xb06000 + (ii * 0x010000)], ptr, 0x1fff);
162         ptr += 0x1fff;
163         memmove(&snes_ram[0xb06000 + (ii * 0x010000)], ptr, 0x2000);
164         ptr += 0x2000;
163165      }
164166   }
165167
r7789r7790
177179
178180   if (snes_cart.mode == SNES_MODE_20)
179181   {
182      UINT32 size = snes_cart.small_sram ? 0x8000 : 0x10000;
183
180184      for (ii = 0; ii < 16; ii++)
181185      {
182         memmove(ptr, &snes_ram[0x700000 + (ii * 0x010000)], 0x10000);
183         ptr += 0x10000;
186         memmove(ptr, &snes_ram[0x700000 + (ii * 0x010000)], size);
187         ptr += size;
184188      }
185189   }
186190   else if (snes_cart.mode == SNES_MODE_21)
r7789r7790
675679            {
676680               snes_has_addon_chip = HAS_SA1;
677681               supported_type = 0;
678               fatalerror("This is a SA-1 type game, currently unsupported by the driver");
679682            }
680683            break;
681684
r7789r7790
757760         snes_cart.sram = snes_cart.sram_max;
758761   }
759762
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
760770   /* Log snes_cart information */
761771   {
762772      char title[21], rom_id[4], company_id[2];

Previous 15994 Revisions Next


© 1998-2018 The MESS Team