1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2003 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
26 static uint8 DRegs[8];
27 static uint32 count=0;
32 static void Sync(void)
37 if(cmd&0x80) base=0x1000;
38 setchr2(0x0000^base,(0x100|DRegs[0])>>1);
39 setchr2(0x0800^base,(0x100|DRegs[1])>>1);
41 setchr1((0x1000^base)+x*0x400,DRegs[2+x]);
46 setprg32(0x8000,(ExtMode&0x1F)>>1);
49 setprg16(0x8000,(ExtMode&0x1F));
50 setprg16(0xc000,(ExtMode&0x1F));
55 setprg8(0x8000,DRegs[6]);
56 setprg8(0xa000,DRegs[7]);
62 static DECLFW(M187Write)
64 // FCEU_printf("Write: %04x:%04x (%04x,%d)\n",A,V,X.PC,scanline);
71 static DECLFW(M187HWrite)
73 // FCEU_printf("Write: %04x:%04x (%04x,%d)\n",A,V,X.PC,scanline);
74 //if(A==0x8003 && X.PC<0x800) FCEUI_DumpMem("dmp",0x0000,0xFFFF);
75 //printf("$%04x:$%02x, %04x\n",A,V,X.PC);
80 // if(V==0x28 || V==0x2A)
83 else if(A==0x8000) poofish=0;
87 case 0xc000:IRQLatch=IRQCount=V;break;
88 case 0xc001:IRQCount=IRQLatch;last=count=0;break;
89 case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
90 case 0xe001:IRQa=1;break;
91 case 0xa000:MIRROR_SET(V&1);break;
93 case 0x8000:cmd=V;safe=1;break;
97 //printf("Cmd: %d, %02x, %04x\n",cmd&0x7,V,X.PC);
103 setprg8(0xC000,0x17);
104 else if(poofish==0x2A)
105 setprg8(0xA000,0x0F);
111 static DECLFR(ProtRead)
116 case 0x0: return(0x83);
117 case 0x2: return(0x42);
124 static void M187Power(void)
126 Write_IRQFM(0x4017,0x40);
127 SetWriteHandler(0x5000,0x5fff,M187Write);
128 SetWriteHandler(0x8000,0xFFFF,M187HWrite);
129 SetReadHandler(0x5000,0x5FFF,ProtRead);
130 SetWriteHandler(0x6000,0x7FFF,M187Write);
131 SetReadHandler(0x8000,0xffff,CartBR);
144 X6502_IRQBegin(FCEU_IQEXT);
150 static void FP_FASTAPASS(1) foo(uint32 A)
152 if((A&0x2000) && !(last&0x2000))
164 void Mapper187_Init(CartInfo *info)
166 info->Power=M187Power;