1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Ben Parnell
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
23 #define cmd mapbyte1[0]
24 #define mir mapbyte1[1]
25 #define rmode mapbyte1[2]
26 #define regsl mapbyte2
27 #define regsh mapbyte3
29 static void RAMBO1_hb(void)
39 // printf("IRQ: %d\n",scanline);
41 X6502_IRQBegin(FCEU_IQEXT);
47 static void Synco(void)
53 setchr1(0x0000,regsl[0]);
54 setchr1(0x0800,regsl[1]);
55 setchr1(0x0400,regsh[0]);
56 setchr1(0x0c00,regsh[1]);
60 setchr2(0x0000,regsl[0]>>1);
61 setchr2(0x0800,regsl[1]>>1);
65 setchr1(0x1000+x*0x400,regsl[2+x]);
67 setprg8(0x8000,regsl[6]);
68 setprg8(0xA000,regsl[7]);
70 setprg8(0xC000,regsh[7]);
74 static DECLFW(RAMBO1_write)
76 //if(A>=0xC000 && A<=0xFFFF) printf("$%04x:$%02x, %d, %d\n",A,V,scanline,timestamp);
91 case 0xc000:IRQLatch=V;
100 case 0xE000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);
111 static void RAMBO1_Restore(int version)
117 x=mapbyte1[1]; // was MMC3_cmd
120 regsl[0]=CHRBankList[0];
121 regsl[1]=CHRBankList[2];
122 regsh[0]=CHRBankList[1];
123 regsh[1]=CHRBankList[3];
126 regsl[2+x]=CHRBankList[4+x];
128 regsl[6]=PRGBankList[0];
129 regsl[7]=PRGBankList[1];
130 regsh[7]=PRGBankList[2];
137 void Mapper64_init(void)
142 regsl[x]=regsh[x]=~0;
147 GameHBIRQHook=RAMBO1_hb;
148 GameStateRestore=RAMBO1_Restore;
149 SetWriteHandler(0x8000,0xffff,RAMBO1_write);