X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=boards%2Fsubor.c;h=8edf323c1bf14b308f83b1b4ca7f8d5653510859;hb=0d6a66c2a80f50ae51327cd406f9df14d99ad02e;hp=31e5b65829c92c9a36e3a83c9b4cc25b0c4afc77;hpb=d97315ac0bca825d2d50a44453bc5652946e2c67;p=fceu.git diff --git a/boards/subor.c b/boards/subor.c index 31e5b65..8edf323 100644 --- a/boards/subor.c +++ b/boards/subor.c @@ -1,3 +1,23 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2005 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 + */ + #include "mapinc.h" static uint8 mode; @@ -5,75 +25,75 @@ static uint8 DRegs[4]; static SFORMAT StateRegs[]= { - {DRegs, 4, "DREG"}, - {0} + {DRegs, 4, "DREG"}, + {0} }; static void Sync(void) { - int base, bank; - base = ((DRegs[0]^DRegs[1])&0x10)<<1; - bank = (DRegs[2]^DRegs[3])&0x1f; + int base, bank; + base = ((DRegs[0]^DRegs[1])&0x10)<<1; + bank = (DRegs[2]^DRegs[3])&0x1f; - if(DRegs[1]&0x08) - { - bank &= 0xfe; - if(mode==0) - { - setprg16(0x8000,base+bank+1); - setprg16(0xC000,base+bank+0); - } - else - { - setprg16(0x8000,base+bank+0); - setprg16(0xC000,base+bank+1); - } - } - else - { - if(DRegs[1]&0x04) - { - setprg16(0x8000,0x1f); - setprg16(0xC000,base+bank); - } - else - { - setprg16(0x8000,base+bank); - if(mode==0) - setprg16(0xC000,0x20); - else - setprg16(0xC000,0x07); - } - } + if(DRegs[1]&0x08) + { + bank &= 0xfe; + if(mode==0) + { + setprg16(0x8000,base+bank+1); + setprg16(0xC000,base+bank+0); + } + else + { + setprg16(0x8000,base+bank+0); + setprg16(0xC000,base+bank+1); + } + } + else + { + if(DRegs[1]&0x04) + { + setprg16(0x8000,0x1f); + setprg16(0xC000,base+bank); + } + else + { + setprg16(0x8000,base+bank); + if(mode==0) + setprg16(0xC000,0x20); + else + setprg16(0xC000,0x07); + } + } } static DECLFW(Mapper167_write) { - DRegs[(A>>13)&0x03]=V; - Sync(); + DRegs[(A>>13)&0x03]=V; + Sync(); } static void StateRestore(int version) { - Sync(); + Sync(); } void Mapper166_init(void) { - mode=1; - DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0; - Sync(); - SetWriteHandler(0x8000,0xFFFF,Mapper167_write); - GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); + mode=1; + DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0; + Sync(); + SetWriteHandler(0x8000,0xFFFF,Mapper167_write); + GameStateRestore=StateRestore; + AddExState(&StateRegs, ~0, 0, 0); } void Mapper167_init(void) { - mode=0; - DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0; - Sync(); - SetWriteHandler(0x8000,0xFFFF,Mapper167_write); - GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); + mode=0; + DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0; + Sync(); + SetWriteHandler(0x8000,0xFFFF,Mapper167_write); + GameStateRestore=StateRestore; + AddExState(&StateRegs, ~0, 0, 0); }