| 1 | /* FCE Ultra - NES/Famicom Emulator |
| 2 | * |
| 3 | * Copyright notice for this file: |
| 4 | * Copyright (C) 2006 CaH4e3 |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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 |
| 19 | */ |
| 20 | |
| 21 | #include "mapinc.h" |
| 22 | |
| 23 | static uint8 reg[8]; |
| 24 | /* |
| 25 | static uint8 *WRAM=NULL; |
| 26 | static uint32 WRAMSIZE; |
| 27 | static uint8 *CHRRAM=NULL; |
| 28 | static uint32 CHRRAMSIZE; |
| 29 | */ |
| 30 | |
| 31 | static SFORMAT StateRegs[]= |
| 32 | { |
| 33 | {reg, 8, "REGS"}, |
| 34 | {0} |
| 35 | }; |
| 36 | |
| 37 | static void Sync(void) |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | static DECLFW(MNNNWrite) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | static void MNNNPower(void) |
| 46 | { |
| 47 | SetReadHandler(0x8000,0xFFFF,CartBR); |
| 48 | SetWriteHandler(0x8000,0xFFFF,MNNNWrite); |
| 49 | } |
| 50 | |
| 51 | static void MNNNReset(void) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | /* |
| 56 | static void MNNNClose(void) |
| 57 | { |
| 58 | if(WRAM) |
| 59 | FCEU_gfree(WRAM); |
| 60 | if(CHRRAM) |
| 61 | FCEU_gfree(CHRRAM); |
| 62 | WRAM=CHRRAM=NULL; |
| 63 | } |
| 64 | */ |
| 65 | |
| 66 | static void MNNNIRQHook(void) |
| 67 | { |
| 68 | X6502_IRQBegin(FCEU_IQEXT); |
| 69 | } |
| 70 | |
| 71 | static void StateRestore(int version) |
| 72 | { |
| 73 | Sync(); |
| 74 | } |
| 75 | |
| 76 | void MapperNNN_Init(CartInfo *info) |
| 77 | { |
| 78 | info->Reset=MNNNReset; |
| 79 | info->Power=MNNNPower; |
| 80 | // info->Close=MNNNClose; |
| 81 | GameHBIRQHook=MNNNIRQHook; |
| 82 | GameStateRestore=StateRestore; |
| 83 | /* |
| 84 | CHRRAMSIZE=8192; |
| 85 | CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE); |
| 86 | SetupCartPRGMapping(0x10,CHRRAM,CHRRAMSIZE,1); |
| 87 | AddExState(CHRRAM, CHRRAMSIZE, 0, "WRAM"); |
| 88 | */ |
| 89 | /* |
| 90 | WRAMSIZE=8192; |
| 91 | WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); |
| 92 | SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); |
| 93 | AddExState(WRAM, WRAMSIZE, 0, "WRAM"); |
| 94 | */ |
| 95 | AddExState(&StateRegs, ~0, 0, 0); |
| 96 | } |
| 97 | |