X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=boards%2F96.c;fp=boards%2F96.c;h=aa9d8a7308a0c37740988855953d6329ec52179d;hp=0000000000000000000000000000000000000000;hb=43725da7349c85fa13e828fdbf20cc7ac8d298d6;hpb=386f5371eb984fb9c2860c83e740890a75cd45c1 diff --git a/boards/96.c b/boards/96.c new file mode 100644 index 0000000..aa9d8a7 --- /dev/null +++ b/boards/96.c @@ -0,0 +1,84 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 1998 BERO + * Copyright (C) 2002 Xodnizel + * Copyright (C) 2012 CaH4e3 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Oeka-kids board + * + * I might want to add some code to the mapper 96 PPU hook function + * to not change CHR banks if the attribute table is being accessed, + * if I make emulation a little more accurate in the future. + * + */ + +#include "mapinc.h" + +static uint8 reg, ppulatch; + +static SFORMAT StateRegs[]= +{ + {®, 1, "REG"}, + {&ppulatch, 1, "PPUL"}, + {0} +}; + +static void Sync(void) +{ + setmirror(MI_0); + setprg32(0x8000,reg & 3); + setchr4(0x0000,(reg & 4) | ppulatch); + setchr4(0x1000,(reg & 4) | 3); +} + +static DECLFW(M96Write) +{ + reg = V; + Sync(); +} + +static void FP_FASTAPASS(1) M96Hook(uint32 A) +{ + if((A & 0x3000) == 0x2000) + { + ppulatch = (A>>8) & 3; + Sync(); + } +} + +static void M96Power(void) +{ + reg = ppulatch = 0; + Sync(); + SetReadHandler(0x8000,0xffff,CartBR); + SetWriteHandler(0x8000,0xffff,M96Write); +} + +static void StateRestore(int version) +{ + Sync(); +} + +void Mapper96_Init(CartInfo *info) +{ + info->Power=M96Power; + PPU_hook=M96Hook; + GameStateRestore=StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} +