X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=mappers%2F15.c;h=e649af6de5fccfd5ee248525ed1c172ef9af153e;hp=e3ad005edbc8c7bb57049f382f59b577ce96e665;hb=d97315ac0bca825d2d50a44453bc5652946e2c67;hpb=890e37ba2b8ea1c7593dc05926d7431e3bd00bfb diff --git a/mappers/15.c b/mappers/15.c index e3ad005..e649af6 100644 --- a/mappers/15.c +++ b/mappers/15.c @@ -1,8 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 1998 BERO - * Copyright (C) 2002 Ben Parnell + * Copyright (C) 2003 Xodnizel * * 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 @@ -21,71 +20,54 @@ #include "mapinc.h" +static void Sync(void) +{ + int x; + + setmirror(((mapbyte1[0]>>6)&1)^1); + switch(mapbyte1[1]&0x3) + { + case 0x0: + for(x=0;x<4;x++) + setprg8(0x8000+x*8192,(((mapbyte1[0]&0x7F)<<1)+x)^(mapbyte1[0]>>7)); + break; + case 0x2: + for(x=0;x<4;x++) + setprg8(0x8000+x*8192,((mapbyte1[0]&0x7F)<<1)+(mapbyte1[0]>>7)); + break; + case 0x1: + case 0x3: + for(x=0;x<4;x++) + { + unsigned int b; + b=mapbyte1[0]&0x7F; + if(x>=2 && !(mapbyte1[1]&0x2)) + b=0x7F; + setprg8(0x8000+x*8192,(x&1)+((b<<1)^(mapbyte1[0]>>7))); + } + break; + } +} -DECLFW(Mapper15_write) +static DECLFW(Mapper15_write) { -switch(A) - { - case 0x8000: - if(V&0x80) - { - ROM_BANK8(0x8000,(V<<1)+1); - ROM_BANK8(0xA000,(V<<1)); - ROM_BANK8(0xC000,(V<<1)+2); - ROM_BANK8(0xE000,(V<<1)+1); - } - else - { - ROM_BANK16(0x8000,V); - ROM_BANK16(0xC000,V+1); - } - MIRROR_SET((V>>6)&1); - X6502_Rebase(); - break; - case 0x8001: - MIRROR_SET(0); - ROM_BANK16(0x8000,V); - ROM_BANK16(0xc000,~0); - X6502_Rebase(); - break; - case 0x8002: - if(V&0x80) - { - ROM_BANK8(0x8000,((V<<1)+1)); - ROM_BANK8(0xA000,((V<<1)+1)); - ROM_BANK8(0xC000,((V<<1)+1)); - ROM_BANK8(0xE000,((V<<1)+1)); - } - else - { - ROM_BANK8(0x8000,(V<<1)); - ROM_BANK8(0xA000,(V<<1)); - ROM_BANK8(0xC000,(V<<1)); - ROM_BANK8(0xE000,(V<<1)); - } - X6502_Rebase(); - break; - case 0x8003: - MIRROR_SET((V>>6)&1); - if(V&0x80) - { - ROM_BANK8(0xC000,(V<<1)+1); - ROM_BANK8(0xE000,(V<<1)); - } - else - { - ROM_BANK16(0xC000,V); - } - X6502_Rebase(); - break; - } + mapbyte1[0]=V; + mapbyte1[1]=A&3; + Sync(); +} + +static void StateRestore(int version) +{ + Sync(); } void Mapper15_init(void) { - ROM_BANK32(0); - SetWriteHandler(0x8000,0xFFFF,Mapper15_write); + mapbyte1[0]=mapbyte1[1]=0; + Sync(); + GameStateRestore=StateRestore; + SetWriteHandler(0x8000,0xFFFF,Mapper15_write); }