1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Xodnizel
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 /* None of this code should use any of the iNES bank switching wrappers. */
25 static void (*sfun)(int P);
26 static void (*psfun)(void);
28 void MMC5RunSound(int Count);
29 void MMC5RunSoundHQ(void);
31 static INLINE void MMC5SPRVROM_BANK1(uint32 A,uint32 V)
36 MMC5SPRVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);
40 static INLINE void MMC5BGVROM_BANK1(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask1[0];MMC5BGVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);}}
42 static INLINE void MMC5SPRVROM_BANK2(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask2[0];MMC5SPRVPage[(A)>>10]=MMC5SPRVPage[((A)>>10)+1]=&CHRptr[0][(V)<<11]-(A);}}
43 static INLINE void MMC5BGVROM_BANK2(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask2[0];MMC5BGVPage[(A)>>10]=MMC5BGVPage[((A)>>10)+1]=&CHRptr[0][(V)<<11]-(A);}}
45 static INLINE void MMC5SPRVROM_BANK4(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask4[0];MMC5SPRVPage[(A)>>10]=MMC5SPRVPage[((A)>>10)+1]= MMC5SPRVPage[((A)>>10)+2]=MMC5SPRVPage[((A)>>10)+3]=&CHRptr[0][(V)<<12]-(A);}}
46 static INLINE void MMC5BGVROM_BANK4(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask4[0];MMC5BGVPage[(A)>>10]=MMC5BGVPage[((A)>>10)+1]=MMC5BGVPage[((A)>>10)+2]=MMC5BGVPage[((A)>>10)+3]=&CHRptr[0][(V)<<12]-(A);}}
48 static INLINE void MMC5SPRVROM_BANK8(uint32 V) {if(CHRptr[0]){V&=CHRmask8[0];MMC5SPRVPage[0]=MMC5SPRVPage[1]=MMC5SPRVPage[2]=MMC5SPRVPage[3]=MMC5SPRVPage[4]=MMC5SPRVPage[5]=MMC5SPRVPage[6]=MMC5SPRVPage[7]=&CHRptr[0][(V)<<13];}}
49 static INLINE void MMC5BGVROM_BANK8(uint32 V) {if(CHRptr[0]){V&=CHRmask8[0];MMC5BGVPage[0]=MMC5BGVPage[1]=MMC5BGVPage[2]=MMC5BGVPage[3]=MMC5BGVPage[4]=MMC5BGVPage[5]=MMC5BGVPage[6]=MMC5BGVPage[7]=&CHRptr[0][(V)<<13];}}
51 static uint8 PRGBanks[4];
52 static uint8 WRAMPage;
53 static uint8 CHRBanksA[8], CHRBanksB[4];
54 static uint8 WRAMMaskEnable[2];
55 static uint8 ABMode; /* A=0, B=1 */
57 static uint8 IRQScanline,IRQEnable;
58 static uint8 CHRMode, NTAMirroring, NTFill, ATFill;
60 static uint8 MMC5IRQR;
61 static uint8 MMC5LineCounter;
62 static uint8 mmc5psize, mmc5vsize;
65 static uint8 *WRAM=NULL;
66 static uint8 *MMC5fill=NULL;
67 static uint8 *ExRAM=NULL;
69 static uint8 MMC5WRAMsize;
70 static uint8 MMC5WRAMIndex[8];
72 static uint8 MMC5ROMWrProtect[4];
73 static uint8 MMC5MemIn[5];
75 static void MMC5CHRA(void);
76 static void MMC5CHRB(void);
78 typedef struct __cartdata {
84 // ETROM seems to have 16KB of WRAM, ELROM seems to have 8KB
85 // EWROM seems to have 32KB of WRAM
87 cartdata MMC5CartList[]=
89 {0x9c18762b,2}, /* L'Empereur */
93 {0xaca15643,2}, /* Uncharted Waters */
94 {0xfe3488d1,2}, /* Dai Koukai Jidai */
96 {0x15fe6d0f,2}, /* BKAC */
97 {0x39f2ce4b,2}, /* Suikoden */
99 {0x8ce478db,2}, /* Nobunaga's Ambition 2 */
103 {0x1ced086f,2}, /* Ishin no Arashi */
105 {0xf540677b,4}, /* Nobunaga...Bushou Fuuun Roku */
107 {0x6f4e4312,4}, /* Aoki Ookami..Genchou */
109 {0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */
110 {0x184c2124,4}, /* Sangokushi 2 */
114 #define MMC5_NOCARTS (sizeof(MMC5CartList)/sizeof(MMC5CartList[0]))
115 int DetectMMC5WRAMSize(uint32 crc32)
118 for(x=0;x<MMC5_NOCARTS;x++)
119 if(crc32==MMC5CartList[x].crc32)
121 FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
122 return(MMC5CartList[x].size*8);
127 static void BuildWRAMSizeTable(void)
134 case 0: MMC5WRAMIndex[x]=255; break;
135 case 1: MMC5WRAMIndex[x]=(x>3)?255:0; break;
136 case 2: MMC5WRAMIndex[x]=(x&4)>>2; break;
137 case 4: MMC5WRAMIndex[x]=(x>3)?255:(x&3); break;
142 static void MMC5CHRA(void)
147 case 0: setchr8(CHRBanksA[7]);
148 MMC5SPRVROM_BANK8(CHRBanksA[7]);
150 case 1: setchr4(0x0000,CHRBanksA[3]);
151 setchr4(0x1000,CHRBanksA[7]);
152 MMC5SPRVROM_BANK4(0x0000,CHRBanksA[3]);
153 MMC5SPRVROM_BANK4(0x1000,CHRBanksA[7]);
155 case 2: setchr2(0x0000,CHRBanksA[1]);
156 setchr2(0x0800,CHRBanksA[3]);
157 setchr2(0x1000,CHRBanksA[5]);
158 setchr2(0x1800,CHRBanksA[7]);
159 MMC5SPRVROM_BANK2(0x0000,CHRBanksA[1]);
160 MMC5SPRVROM_BANK2(0x0800,CHRBanksA[3]);
161 MMC5SPRVROM_BANK2(0x1000,CHRBanksA[5]);
162 MMC5SPRVROM_BANK2(0x1800,CHRBanksA[7]);
164 case 3: for(x=0;x<8;x++)
166 setchr1(x<<10,CHRBanksA[x]);
167 MMC5SPRVROM_BANK1(x<<10,CHRBanksA[x]);
173 static void MMC5CHRB(void)
178 case 0: setchr8(CHRBanksB[3]);
179 MMC5BGVROM_BANK8(CHRBanksB[3]);
181 case 1: setchr4(0x0000,CHRBanksB[3]);
182 setchr4(0x1000,CHRBanksB[3]);
183 MMC5BGVROM_BANK4(0x0000,CHRBanksB[3]);
184 MMC5BGVROM_BANK4(0x1000,CHRBanksB[3]);
186 case 2: setchr2(0x0000,CHRBanksB[1]);
187 setchr2(0x0800,CHRBanksB[3]);
188 setchr2(0x1000,CHRBanksB[1]);
189 setchr2(0x1800,CHRBanksB[3]);
190 MMC5BGVROM_BANK2(0x0000,CHRBanksB[1]);
191 MMC5BGVROM_BANK2(0x0800,CHRBanksB[3]);
192 MMC5BGVROM_BANK2(0x1000,CHRBanksB[1]);
193 MMC5BGVROM_BANK2(0x1800,CHRBanksB[3]);
195 case 3: for(x=0;x<8;x++)
197 setchr1(x<<10,CHRBanksB[x&3]);
198 MMC5BGVROM_BANK1(x<<10,CHRBanksB[x&3]);
204 static void FASTAPASS(2) MMC5WRAM(uint32 A, uint32 V)
206 //printf("%02x\n",V);
207 V=MMC5WRAMIndex[V&7];
211 MMC5MemIn[(A-0x6000)>>13]=1;
214 MMC5MemIn[(A-0x6000)>>13]=0;
217 static void MMC5PRG(void)
222 case 0: MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=
223 MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
224 setprg32(0x8000,((PRGBanks[1]&0x7F)>>2));
228 case 1: if(PRGBanks[1]&0x80)
230 MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
231 setprg16(0x8000,(PRGBanks[1]>>1));
232 MMC5MemIn[1]=MMC5MemIn[2]=1;
236 MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
237 MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
238 MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
240 MMC5MemIn[3]=MMC5MemIn[4]=1;
241 MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
242 setprg16(0xC000,(PRGBanks[3]&0x7F)>>1);
244 case 2: if(PRGBanks[1]&0x80)
246 MMC5MemIn[1]=MMC5MemIn[2]=1;
247 MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
248 setprg16(0x8000,(PRGBanks[1]&0x7F)>>1);
252 MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
253 MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
254 MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
258 MMC5ROMWrProtect[2]=1;
260 setprg8(0xC000,PRGBanks[2]&0x7F);
264 MMC5ROMWrProtect[2]=0;
265 MMC5WRAM(0xC000,PRGBanks[2]&7);
268 MMC5ROMWrProtect[3]=1;
269 setprg8(0xE000,PRGBanks[3]&0x7F);
271 case 3: for(x=0;x<3;x++)
274 MMC5ROMWrProtect[x]=1;
275 setprg8(0x8000+(x<<13),PRGBanks[x]&0x7F);
280 MMC5ROMWrProtect[x]=0;
281 MMC5WRAM(0x8000+(x<<13),PRGBanks[x]&7);
284 MMC5ROMWrProtect[3]=1;
285 setprg8(0xE000,PRGBanks[3]&0x7F);
290 static DECLFW(Mapper5_write)
292 if(A>=0x5120&&A<=0x5127)
304 switch((V>>(x<<1))&3)
306 case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break;
307 case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break;
308 case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
309 case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
315 case 0x5113: WRAMPage=V;MMC5WRAM(0x6000,V&7);break;
316 case 0x5100: mmc5psize=V;MMC5PRG();break;
317 case 0x5101: mmc5vsize=V;
319 { MMC5CHRB();MMC5CHRA();}
321 { MMC5CHRA();MMC5CHRB();}
326 case 0x5117: PRGBanks[A&3]=V;MMC5PRG();break;
330 case 0x512b: ABMode=1;
334 case 0x5102: WRAMMaskEnable[0]=V;break;
335 case 0x5103: WRAMMaskEnable[1]=V;break;
336 case 0x5104: CHRMode=V;MMC5HackCHRMode=V&3;break;
337 case 0x5106: if(V!=NTFill)
340 t=V|(V<<8)|(V<<16)|(V<<24);
341 FCEU_dwmemset(MMC5fill,t,0x3c0);
345 case 0x5107: if(V!=ATFill)
349 moop=V|(V<<2)|(V<<4)|(V<<6);
350 t=moop|(moop<<8)|(moop<<16)|(moop<<24);
351 FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
355 case 0x5200: MMC5HackSPMode=V;break;
356 case 0x5201: MMC5HackSPScroll=(V>>3)&0x1F;break;
357 case 0x5202: MMC5HackSPPage=V&0x3F;break;
358 case 0x5203: X6502_IRQEnd(FCEU_IQEXT);IRQScanline=V;break;
359 case 0x5204: X6502_IRQEnd(FCEU_IQEXT);IRQEnable=V&0x80;break;
360 case 0x5205: mul[0]=V;break;
361 case 0x5206: mul[1]=V;break;
365 static DECLFR(MMC5_ReadROMRAM)
367 if(MMC5MemIn[(A-0x6000)>>13])
368 return Page[A>>11][A];
373 static DECLFW(MMC5_WriteROMRAM)
376 if(MMC5ROMWrProtect[(A-0x8000)>>13]) return;
377 if(MMC5MemIn[(A-0x6000)>>13])
378 if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6) Page[A>>11][A]=V;
381 static DECLFW(MMC5_ExRAMWr)
383 if(MMC5HackCHRMode!=3)
387 static DECLFR(MMC5_ExRAMRd)
389 /* Not sure if this is correct, so I'll comment it out for now. */
390 //if(MMC5HackCHRMode>=2)
391 return ExRAM[A&0x3ff];
396 static DECLFR(MMC5_read)
400 case 0x5204: X6502_IRQEnd(FCEU_IQEXT);
404 #ifdef FCEUDEF_DEBUGGER
410 case 0x5205: return (mul[0]*mul[1]);
411 case 0x5206: return ((mul[0]*mul[1])>>8);
423 switch((NTAMirroring>>(x<<1))&3)
425 case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break;
426 case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break;
427 case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
428 case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
431 MMC5WRAM(0x6000,WRAMPage&7);
444 t=NTFill|(NTFill<<8)|(NTFill<<16)|(NTFill<<24);
445 FCEU_dwmemset(MMC5fill,t,0x3c0);
450 moop=ATFill|(ATFill<<2)|(ATFill<<4)|(ATFill<<6);
451 t=moop|(moop<<8)|(moop<<16)|(moop<<24);
452 FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
454 X6502_IRQEnd(FCEU_IQEXT);
455 MMC5HackCHRMode=CHRMode&3;
458 void MMC5_hb(int scanline)
466 if(MMC5LineCounter<240)
468 if(MMC5LineCounter==IRQScanline)
472 X6502_IRQBegin(FCEU_IQEXT);
476 if(MMC5LineCounter==240)
480 void MMC5_StateRestore(int version)
497 static MMC5APU MMC5Sound;
505 start=MMC5Sound.BC[2];
506 end=(SOUNDTS<<16)/soundtsinc;
507 if(end<=start) return;
510 if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
511 for(V=start;V<end;V++)
512 Wave[V>>4]+=MMC5Sound.raw<<1;
515 static void Do5PCMHQ()
518 if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
519 for(V=MMC5Sound.BC[2];V<SOUNDTS;V++)
520 WaveHi[V]+=MMC5Sound.raw<<5;
521 MMC5Sound.BC[2]=SOUNDTS;
525 static DECLFW(Mapper5_SW)
529 GameExpSound.Fill=MMC5RunSound;
530 GameExpSound.HiFill=MMC5RunSoundHQ;
534 case 0x10:if(psfun) psfun();MMC5Sound.rawcontrol=V;break;
535 case 0x11:if(psfun) psfun();MMC5Sound.raw=V;break;
538 case 0x4://printf("%04x:$%02x\n",A,V&0x30);
540 MMC5Sound.env[A>>2]=V;
543 case 0x6: if(sfun) sfun(A>>2);
544 MMC5Sound.wl[A>>2]&=~0x00FF;
545 MMC5Sound.wl[A>>2]|=V&0xFF;
548 case 0x7://printf("%04x:$%02x\n",A,V>>3);
549 MMC5Sound.wl[A>>2]&=~0x0700;
550 MMC5Sound.wl[A>>2]|=(V&0x07)<<8;
551 MMC5Sound.running|=1<<(A>>2);
558 MMC5Sound.running&=V;
560 //printf("%02x\n",V);
565 static void Do5SQ(int P)
567 static int tal[4]={1,2,4,6};
568 int32 V,amp,rthresh,wl;
571 start=MMC5Sound.BC[P];
572 end=(SOUNDTS<<16)/soundtsinc;
573 if(end<=start) return;
576 wl=MMC5Sound.wl[P]+1;
577 amp=(MMC5Sound.env[P]&0xF)<<4;
578 rthresh=tal[(MMC5Sound.env[P]&0xC0)>>6];
580 if(wl>=8 && (MMC5Sound.running&(P+1)))
585 dc=MMC5Sound.dcount[P];
586 vc=MMC5Sound.vcount[P];
588 for(V=start;V<end;V++)
599 MMC5Sound.dcount[P]=dc;
600 MMC5Sound.vcount[P]=vc;
604 static void Do5SQHQ(int P)
606 static int tal[4]={1,2,4,6};
607 int32 V,amp,rthresh,wl;
609 wl=MMC5Sound.wl[P]+1;
610 amp=((MMC5Sound.env[P]&0xF)<<8);
611 rthresh=tal[(MMC5Sound.env[P]&0xC0)>>6];
613 if(wl>=8 && (MMC5Sound.running&(P+1)))
619 dc=MMC5Sound.dcount[P];
620 vc=MMC5Sound.vcount[P];
621 for(V=MMC5Sound.BC[P];V<SOUNDTS;V++)
626 if(vc<=0) /* Less than zero when first started. */
632 MMC5Sound.dcount[P]=dc;
633 MMC5Sound.vcount[P]=vc;
635 MMC5Sound.BC[P]=SOUNDTS;
638 void MMC5RunSoundHQ(void)
645 void MMC5HiSync(int32 ts)
648 for(x=0;x<3;x++) MMC5Sound.BC[x]=ts;
651 void MMC5RunSound(int Count)
658 MMC5Sound.BC[x]=Count;
661 void Mapper5_ESI(void)
663 GameExpSound.RChange=Mapper5_ESI;
664 if(FSettings.SndRate)
666 if(FSettings.soundq>=1)
682 memset(MMC5Sound.BC,0,sizeof(MMC5Sound.BC));
683 memset(MMC5Sound.vcount,0,sizeof(MMC5Sound.vcount));
684 GameExpSound.HiSync=MMC5HiSync;
687 void NSFMMC5_Init(void)
689 memset(&MMC5Sound,0,sizeof(MMC5Sound));
691 ExRAM=(uint8*)FCEU_gmalloc(1024);
693 SetWriteHandler(0x5c00,0x5fef,MMC5_ExRAMWr);
694 SetReadHandler(0x5c00,0x5fef,MMC5_ExRAMRd);
696 SetWriteHandler(0x5000,0x5015,Mapper5_SW);
697 SetWriteHandler(0x5205,0x5206,Mapper5_write);
698 SetReadHandler(0x5205,0x5206,MMC5_read);
701 void NSFMMC5_Close(void)
707 static void GenMMC5Reset(void)
711 for(x=0;x<4;x++) PRGBanks[x]=~0;
712 for(x=0;x<8;x++) CHRBanksA[x]=~0;
713 for(x=0;x<4;x++) CHRBanksB[x]=~0;
714 WRAMMaskEnable[0]=WRAMMaskEnable[1]=~0;
716 mmc5psize=mmc5vsize=3;
719 NTAMirroring=NTFill=ATFill=0xFF;
723 SetWriteHandler(0x4020,0x5bff,Mapper5_write);
724 SetReadHandler(0x4020,0x5bff,MMC5_read);
726 SetWriteHandler(0x5c00,0x5fff,MMC5_ExRAMWr);
727 SetReadHandler(0x5c00,0x5fff,MMC5_ExRAMRd);
729 SetWriteHandler(0x6000,0xFFFF,MMC5_WriteROMRAM);
730 SetReadHandler(0x6000,0xFFFF,MMC5_ReadROMRAM);
732 SetWriteHandler(0x5000,0x5015,Mapper5_SW);
733 SetWriteHandler(0x5205,0x5206,Mapper5_write);
734 SetReadHandler(0x5205,0x5206,MMC5_read);
736 //GameHBIRQHook=MMC5_hb;
737 FCEU_CheatAddRAM(8,0x6000,WRAM);
738 FCEU_CheatAddRAM(1,0x5c00,ExRAM);
741 static SFORMAT MMC5_StateRegs[]={
742 { PRGBanks, 4, "PRGB"},
743 { CHRBanksA, 8, "CHRA"},
744 { CHRBanksB, 4, "CHRB"},
745 { &WRAMPage, 1, "WRMP"},
746 { WRAMMaskEnable, 2, "WRME"},
747 { &ABMode, 1, "ABMD"},
748 { &IRQScanline, 1, "IRQS"},
749 { &IRQEnable, 1, "IRQE"},
750 { &CHRMode, 1, "CHRM"},
751 { &NTAMirroring, 1, "NTAM"},
752 { &NTFill, 1, "NTFL"},
753 { &ATFill, 1, "ATFL"},
755 { &MMC5Sound.wl[0], 2|FCEUSTATE_RLSB, "SDW0"},
756 { &MMC5Sound.wl[1], 2|FCEUSTATE_RLSB, "SDW1"},
757 { MMC5Sound.env, 2, "SDEV"},
758 { &MMC5Sound.enable, 1, "SDEN"},
759 { &MMC5Sound.running, 1, "SDRU"},
760 { &MMC5Sound.raw, 1, "SDRW"},
761 { &MMC5Sound.rawcontrol, 1, "SDRC"},
765 static void GenMMC5_Init(CartInfo *info, int wsize, int battery)
769 WRAM=(uint8*)FCEU_gmalloc(wsize*1024);
770 SetupCartPRGMapping(0x10,WRAM,wsize*1024,1);
771 AddExState(WRAM, wsize*1024, 0, "WRAM");
774 MMC5fill=(uint8*)FCEU_gmalloc(1024);
775 ExRAM=(uint8*)FCEU_gmalloc(1024);
777 AddExState(MMC5_StateRegs, ~0, 0, 0);
778 AddExState(WRAM, wsize*1024, 0, "WRAM");
779 AddExState(ExRAM, 1024, 0, "ERAM");
780 AddExState(&MMC5HackSPMode, 1, 0, "SPLM");
781 AddExState(&MMC5HackSPScroll, 1, 0, "SPLS");
782 AddExState(&MMC5HackSPPage, 1, 0, "SPLP");
784 MMC5WRAMsize=wsize/8;
785 BuildWRAMSizeTable();
786 GameStateRestore=MMC5_StateRestore;
787 info->Power=GenMMC5Reset;
791 info->SaveGame[0]=WRAM;
793 info->SaveGameLen[0]=8192;
795 info->SaveGameLen[0]=32768;
798 MMC5HackVROMMask=CHRmask4[0];
799 MMC5HackExNTARAMPtr=ExRAM;
801 MMC5HackVROMPTR=CHRptr[0];
803 MMC5HackSPMode=MMC5HackSPScroll=MMC5HackSPPage=0;
807 void Mapper5_Init(CartInfo *info)
809 GenMMC5_Init(info, DetectMMC5WRAMSize(info->CRC32), info->battery);
812 // ELROM seems to have 0KB of WRAM
813 // EKROM seems to have 8KB of WRAM
814 // ETROM seems to have 16KB of WRAM
815 // EWROM seems to have 32KB of WRAM
817 // ETROM and EWROM are battery-backed, EKROM isn't.
819 void ETROM_Init(CartInfo *info)
821 GenMMC5_Init(info, 16,info->battery);
824 void ELROM_Init(CartInfo *info)
826 GenMMC5_Init(info,0,0);
829 void EWROM_Init(CartInfo *info)
831 GenMMC5_Init(info,32,info->battery);
834 void EKROM_Init(CartInfo *info)
836 GenMMC5_Init(info,8,info->battery);