1 /* FCE Ultra - NES/Famicom Emulator
\r
3 * Copyright notice for this file:
\r
4 * Copyright (C) 2009 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
23 static uint8 regs[8];
\r
24 static uint8 *WRAM = NULL;
\r
25 static uint32 WRAMSIZE;
\r
27 static SFORMAT StateRegs[]=
\r
33 static void Sync(void)
\r
35 setprg2r(0x10,0x0800,0);
\r
36 setprg2r(0x10,0x1000,1);
\r
37 setprg2r(0x10,0x1800,2);
\r
38 setprg8r(0x10,0x6000,1);
\r
40 setprg16(0xC000,~0);
\r
44 //static DECLFW(SSSNROMWrite)
\r
49 static DECLFW(SSSNROMWrite)
\r
51 //FCEU_printf("write %04x %02x\n",A,V);
\r
55 static DECLFR(SSSNROMRead)
\r
57 //FCEU_printf("read %04x\n",A);
\r
59 case 0: return regs[0]=0xff; // clear all exceptions
\r
60 case 2: return 0xc0; // DIP selftest + freeplay
\r
61 case 3: return 0x00; // 0, 1 - attract
\r
64 // 8 - self check and game casette check
\r
66 // 20 - game title & count display
\r
67 case 7: return 0x22; // TV type, key not turned, relay B
\r
72 static void SSSNROMPower(void)
\r
74 regs[0]=regs[1]=regs[2]=regs[3]=regs[4]=regs[5]=regs[6]=0;
\r
77 memset(WRAM,0x00,WRAMSIZE);
\r
78 // SetWriteHandler(0x0000,0x1FFF,SSSNROMRamWrite);
\r
79 SetReadHandler(0x0800,0x1FFF,CartBR);
\r
80 SetWriteHandler(0x0800,0x1FFF,CartBW);
\r
81 SetReadHandler(0x5000,0x5FFF,SSSNROMRead);
\r
82 SetWriteHandler(0x5000,0x5FFF,SSSNROMWrite);
\r
83 SetReadHandler(0x6000,0x7FFF,CartBR);
\r
84 SetWriteHandler(0x6000,0x7FFF,CartBW);
\r
85 SetReadHandler(0x8000,0xFFFF,CartBR);
\r
88 static void SSSNROMReset(void)
\r
90 regs[1]=regs[2]=regs[3]=regs[4]=regs[5]=regs[6]=0;
\r
93 static void SSSNROMClose(void)
\r
100 static void SSSNROMIRQHook(void)
\r
102 // X6502_IRQBegin(FCEU_IQEXT);
\r
105 static void StateRestore(int version)
\r
110 void SSSNROM_Init(CartInfo *info)
\r
112 info->Reset=SSSNROMReset;
\r
113 info->Power=SSSNROMPower;
\r
114 info->Close=SSSNROMClose;
\r
115 GameHBIRQHook=SSSNROMIRQHook;
\r
116 GameStateRestore=StateRestore;
\r
119 WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
\r
120 SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
\r
122 AddExState(WRAM, WRAMSIZE, 0, "WRAM");
\r
123 AddExState(&StateRegs, ~0, 0, 0);
\r