X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=boards%2Fkaraoke.c;h=dfb4cc8492efe1fad12bd2da9d15475f3039b144;hb=386f5371eb984fb9c2860c83e740890a75cd45c1;hp=eccf9c2df89a6ec8ae070f85f059d75cad5155d8;hpb=d97315ac0bca825d2d50a44453bc5652946e2c67;p=fceu.git diff --git a/boards/karaoke.c b/boards/karaoke.c index eccf9c2..dfb4cc8 100644 --- a/boards/karaoke.c +++ b/boards/karaoke.c @@ -15,64 +15,57 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mapinc.h" -static uint8 DReg; -static SFORMAT StateRegs[]= -{ - {&DReg, 1, "DREG"}, - {0} -}; +extern uint32 ROM_size; +static uint8 latche; static void Sync(void) { - if(DReg) + if(latche) { - if(DReg & 0x10) - setprg16(0x8000,(DReg&7)); + if(latche&0x10) + setprg16(0x8000,(latche&7)); else - setprg16(0x8000,(DReg&7)|8); + setprg16(0x8000,(latche&7)|8); } else - setprg16(0x8000,7); -} - -static void StateRestore(int version) -{ - Sync(); + setprg16(0x8000,7+(ROM_size>>4)); } static DECLFW(M188Write) { - DReg=V; + latche=V; Sync(); } -static DECLFR(testr) +static DECLFR(ExtDev) { return(3); } - static void Power(void) { - setchr8(0); - setprg8(0xc000,0xE); - setprg8(0xe000,0xF); - DReg = 0; + latche=0; Sync(); - SetReadHandler(0x6000,0x7FFF,testr); + setchr8(0); + setprg16(0xc000,0x7); + SetReadHandler(0x6000,0x7FFF,ExtDev); SetReadHandler(0x8000,0xFFFF,CartBR); SetWriteHandler(0x8000,0xFFFF,M188Write); } +static void StateRestore(int version) +{ + Sync(); +} void Mapper188_Init(CartInfo *info) { info->Power=Power; GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); + AddExState(&latche, 1, 0, "LATCH"); }