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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 * TXC mappers, originally much complex banksitching
\r
22 * 01-22111-000 (05-00002-010) (132, 22211) - MGC-001 Qi Wang
\r
23 * 01-22110-000 (52S ) - MGC-002 2-in-1 Gun
\r
24 * 01-22111-100 (02-00002-010) (173 ) - MGC-008 Mahjong Block
\r
25 * (079 ) - MGC-012 Poke Block
\r
26 * 01-22110-200 (05-00002-010) (036 ) - MGC-014 Strike Wolf
\r
27 * 01-22000-400 (05-00002-010) (036 ) - MGC-015 Policeman
\r
28 * 01-22017-000 (05-PT017-080) (189 ) - MGC-017 Thunder Warrior
\r
29 * 01-22270-000 (05-00002-010) (132, 22211) - MGC-xxx Creatom
\r
30 * 01-22200-400 (------------) (079 ) - ET.03 F-15 City War
\r
31 * (172 ) - 1991 Du Ma Racing
\r
37 static uint8 reg[4], cmd, is172, is173;
\r
38 static SFORMAT StateRegs[]=
\r
45 static void Sync(void)
\r
47 setprg32(0x8000,(reg[2]>>2)&1);
\r
49 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
50 // rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary
\r
55 static DECLFW(UNL22211WriteLo)
\r
57 // FCEU_printf("bs %04x %02x\n",A,V);
\r
61 static DECLFW(UNL22211WriteHi)
\r
63 // FCEU_printf("bs %04x %02x\n",A,V);
\r
68 static DECLFR(UNL22211ReadLo)
\r
70 return (reg[1]^reg[2])|(is173?0x01:0x40);
\r
77 static void UNL22211Power(void)
\r
80 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
81 SetReadHandler(0x4100,0x4100,UNL22211ReadLo);
\r
82 SetWriteHandler(0x4100,0x4103,UNL22211WriteLo);
\r
83 SetWriteHandler(0x8000,0xFFFF,UNL22211WriteHi);
\r
86 static void StateRestore(int version)
\r
91 void UNL22211_Init(CartInfo *info)
\r
95 info->Power=UNL22211Power;
\r
96 GameStateRestore=StateRestore;
\r
97 AddExState(&StateRegs, ~0, 0, 0);
\r
100 void Mapper172_Init(CartInfo *info)
\r
104 info->Power=UNL22211Power;
\r
105 GameStateRestore=StateRestore;
\r
106 AddExState(&StateRegs, ~0, 0, 0);
\r
109 void Mapper173_Init(CartInfo *info)
\r
113 info->Power=UNL22211Power;
\r
114 GameStateRestore=StateRestore;
\r
115 AddExState(&StateRegs, ~0, 0, 0);
\r