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 * Dragon Ball Z 2 - Gekishin Freeza! (C)
\r
21 * Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C)
\r
29 static uint8 *CHRRAM=NULL;
\r
30 static uint32 CHRRAMSIZE;
\r
32 static void M199PW(uint32 A, uint8 V)
\r
35 setprg8(0xC000,EXPREGS[0]);
\r
36 setprg8(0xE000,EXPREGS[1]);
\r
39 static void M199CW(uint32 A, uint8 V)
\r
41 setchr1r((V<8)?0x10:0x00,A,V);
\r
42 setchr1r((DRegBuf[0]<8)?0x10:0x00,0x0000,DRegBuf[0]);
\r
43 setchr1r((EXPREGS[2]<8)?0x10:0x00,0x0400,EXPREGS[2]);
\r
44 setchr1r((DRegBuf[1]<8)?0x10:0x00,0x0800,DRegBuf[1]);
\r
45 setchr1r((EXPREGS[3]<8)?0x10:0x00,0x0c00,EXPREGS[3]);
\r
48 static void M199MW(uint8 V)
\r
50 // FCEU_printf("%02x\n",V);
\r
53 case 0: setmirror(MI_V); break;
\r
54 case 1: setmirror(MI_H); break;
\r
55 case 2: setmirror(MI_0); break;
\r
56 case 3: setmirror(MI_1); break;
\r
60 static DECLFW(M199Write)
\r
62 if((A==0x8001)&&(MMC3_cmd&8))
\r
64 EXPREGS[MMC3_cmd&3]=V;
\r
65 FixMMC3PRG(MMC3_cmd);
\r
66 FixMMC3CHR(MMC3_cmd);
\r
75 static void M199Power(void)
\r
82 SetWriteHandler(0x8000,0xFFFF,M199Write);
\r
85 static void M199Close(void)
\r
92 void Mapper199_Init(CartInfo *info)
\r
94 GenMMC3_Init(info, 512, 256, 8, info->battery);
\r
98 info->Power=M199Power;
\r
99 info->Close=M199Close;
\r
102 CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
\r
103 SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
\r
104 AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
\r
106 AddExState(EXPREGS, 4, 0, "EXPR");
\r