1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2006 CaH4e3
\r
6 * This program is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 2 of the License, or
\r
9 * (at your option) any later version.
\r
11 * This program is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program; if not, write to the Free Software
\r
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\r
24 static uint8 reg[4], cmd, is172, is173;
\r
25 static SFORMAT StateRegs[]=
\r
32 static void Sync(void)
\r
34 setprg32(0x8000,(reg[2]>>2)&1);
\r
36 setchr8((((cmd^reg[2])>>3)&2)|(((cmd^reg[2])>>5)&1)); // 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to
\r
37 // rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary
\r
42 static DECLFW(UNL22211WriteLo)
\r
44 // FCEU_printf("bs %04x %02x\n",A,V);
\r
48 static DECLFW(UNL22211WriteHi)
\r
50 // FCEU_printf("bs %04x %02x\n",A,V);
\r
55 static DECLFR(UNL22211ReadLo)
\r
57 return (reg[1]^reg[2])|(is173?0x01:0x40);
\r
64 static void UNL22211Power(void)
\r
67 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
68 SetReadHandler(0x4100,0x4100,UNL22211ReadLo);
\r
69 SetWriteHandler(0x4100,0x4103,UNL22211WriteLo);
\r
70 SetWriteHandler(0x8000,0xFFFF,UNL22211WriteHi);
\r
73 static void StateRestore(int version)
\r
78 void UNL22211_Init(CartInfo *info)
\r
82 info->Power=UNL22211Power;
\r
83 GameStateRestore=StateRestore;
\r
84 AddExState(&StateRegs, ~0, 0, 0);
\r
87 void Mapper172_Init(CartInfo *info)
\r
91 info->Power=UNL22211Power;
\r
92 GameStateRestore=StateRestore;
\r
93 AddExState(&StateRegs, ~0, 0, 0);
\r
96 void Mapper173_Init(CartInfo *info)
\r
100 info->Power=UNL22211Power;
\r
101 GameStateRestore=StateRestore;
\r
102 AddExState(&StateRegs, ~0, 0, 0);
\r