void fme7_sync() { int i; //special case prg page if(prg[0] & 0x40) if(prg[0] & 0x80) mem_setsram8(6,0); else mem_unsetcpu8(6); else mem_setprg8(6,prg[0] & 0x3F); //set prg pages mem_setprg8(0x8,prg[1]); mem_setprg8(0xA,prg[2]); mem_setprg8(0xC,prg[3]); mem_setprg8(0xE,-1); //set chr pages for(i=0;i<8;i++) mem_setchr1(i,chr[i]); switch(mirror) { case 0: ppu_setmirroring(MIRROR_V); break; case 1: ppu_setmirroring(MIRROR_H); break; case 2: ppu_setmirroring(MIRROR_1L); break; case 3: ppu_setmirroring(MIRROR_1H); break; } }
static void reset(int hard) { reg = 0; mmc3_reset(C_MMC3,sync,hard); mem_unsetcpu8(6); mem_setwritefunc(6,write67); mem_setwritefunc(7,write67); }
static void syncprg() { if((bankmode & 0x80) == 0) //dont map in rom at $6000-7FFF mem_unsetcpu8(6); switch(bankmode & 7) { case 0: mem_setprg8(0x6,(prg[3] << 2) + 3); mem_setprg8(0x8,0xFC); mem_setprg8(0xA,0xFD); mem_setprg8(0xC,0xFE); mem_setprg8(0xE,0xFF); break; case 1: mem_setprg8(0x6,(prg[3] << 1) + 1); mem_setprg8(0x8,prg[1]); mem_setprg8(0xA,prg[1] + 1); mem_setprg8(0xC,0xFE); mem_setprg8(0xE,0xFF); break; case 2: mem_setprg8(0x6,prg[3]); mem_setprg8(0x8,prg[0]); mem_setprg8(0xA,prg[1]); mem_setprg8(0xC,prg[2]); mem_setprg8(0xE,0xFF); break; case 3: mem_setprg8(0x6,reverse(prg[3])); mem_setprg8(0x8,reverse(prg[0])); mem_setprg8(0xA,reverse(prg[1])); mem_setprg8(0xC,reverse(prg[2])); mem_setprg8(0xE,0xFF); break; case 4: mem_setprg8(0x6,(prg[3] << 2) + 3); mem_setprg8(0x8,0xFC); mem_setprg8(0xA,0xFD); mem_setprg8(0xC,0xFE); mem_setprg8(0xE,0xFF); break; case 5: mem_setprg8(0x6,(prg[3] << 1) + 1); mem_setprg8(0x8,prg[1]); mem_setprg8(0xA,prg[1] + 1); mem_setprg8(0xC,prg[3]); mem_setprg8(0xE,prg[3] + 1); break; case 6: mem_setprg8(0x6,prg[3]); mem_setprg8(0x8,prg[0]); mem_setprg8(0xA,prg[1]); mem_setprg8(0xC,prg[2]); mem_setprg8(0xE,prg[3]); break; case 7: mem_setprg8(0x6,reverse(prg[3])); mem_setprg8(0x8,reverse(prg[0])); mem_setprg8(0xA,reverse(prg[1])); mem_setprg8(0xC,reverse(prg[2])); mem_setprg8(0xE,reverse(prg[3])); break; } }