1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 1998 BERO
5 * Copyright (C) 2002 Xodnizel
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 static DECLFW(Mapper34_write)
30 case 0x7FFD:ROM_BANK32(V);break;
31 case 0x7FFE:VROM_BANK4(0x0000,V);break;
32 case 0x7fff:VROM_BANK4(0x1000,V);break;
38 void Mapper34_init(void)
41 SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
44 /* I might want to add some code to the mapper 96 PPU hook function
45 to not change CHR banks if the attribute table is being accessed,
46 if I make emulation a little more accurate in the future.
50 static DECLFW(Mapper96_write)
54 setchr4r(0x10,0x0000,(latche&4)|M96LA);
55 setchr4r(0x10,0x1000,(latche&4)|3);
58 static void FP_FASTAPASS(1) M96Hook(uint32 A)
60 if((A&0x3000)!=0x2000) return;
61 //if((A&0x3ff)>=0x3c0) return;
63 setchr4r(0x10,0x0000,(latche&4)|M96LA);
66 static void M96Sync(int v)
68 setprg32(0x8000,latche&3);
69 setchr4r(0x10,0x0000,(latche&4)|M96LA);
70 setchr4r(0x10,0x1000,(latche&4)|3);
73 void Mapper96_init(void)
75 SetWriteHandler(0x8000,0xffff,Mapper96_write);
77 AddExState(&latche, 1, 0, "LATC");
78 AddExState(&M96LA, 1, 0, "LAVA");
79 SetupCartCHRMapping(0x10, MapperExRAM, 32768, 1);
83 GameStateRestore=M96Sync;
86 static DECLFW(M156Write)
88 if(A>=0xc000 && A<=0xC003)
89 VROM_BANK1((A&3)*1024,V);
90 else if(A>=0xc008 && A<=0xc00b)
91 VROM_BANK1(0x1000+(A&3)*1024,V);
92 if(A==0xc010) ROM_BANK16(0x8000,V);
93 // printf("$%04x:$%02x\n",A,V);
96 void Mapper156_init(void)
99 SetWriteHandler(0xc000,0xc010,M156Write);