revert core to 0.98.12

This commit is contained in:
dborth 2008-09-20 01:02:49 +00:00
parent e9f7c8dbd1
commit 1a2018def6
38 changed files with 3922 additions and 3045 deletions

View File

@ -34,7 +34,6 @@ SNES9x GX and Genesis Plus GX projects.
* Zapper now mapped to A and B * Zapper now mapped to A and B
* Fixed auto-save feature * Fixed auto-save feature
* Performance slowdowns on Gamecube should be fixed * Performance slowdowns on Gamecube should be fixed
* Update core to 0.98.13pre
* Will now attempt to load old save states with CRC filename * Will now attempt to load old save states with CRC filename
[What's New 2.0.1] [What's New 2.0.1]

View File

@ -20,176 +20,331 @@
#include "mapinc.h" #include "mapinc.h"
#define CHRRAM (GameMemBlock) static uint8 latche, latcheinit;
static uint8 latche; static uint16 addrreg0, addrreg1;
static void(*WSync)(void);
DECLFW(CPROMWrite) static DECLFW(LatchWrite)
{ {
latche=V&3; // FCEU_printf("bs %04x %02x\n",A,V);
setvram4(0x1000,CHRRAM+((V&3)<<12)); latche=V;
WSync();
} }
static void CPROMReset(void) static void LatchPower(void)
{ {
setprg32(0x8000,0); latche=latcheinit;
setvram8(0); WSync();
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,CPROMWrite); SetWriteHandler(addrreg0,addrreg1,LatchWrite);
} }
static void CPROMRestore(int version) static void StateRestore(int version)
{ {
setvram4(0x1000,CHRRAM+((latche)<<12)); WSync();
}
static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1)
{
latcheinit=init;
addrreg0=adr0;
addrreg1=adr1;
WSync=proc;
info->Power=LatchPower;
GameStateRestore=StateRestore;
AddExState(&latche, 1, 0, "LATC");
}
//------------------ CPROM ---------------------------
static void CPROMSync(void)
{
setchr4(0x0000,0);
setchr4(0x1000,latche&3);
setprg16(0x8000,0);
setprg16(0xC000,1);
} }
void CPROM_Init(CartInfo *info) void CPROM_Init(CartInfo *info)
{ {
info->Power=CPROMReset; Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF);
GameStateRestore=CPROMRestore;
AddExState(&latche, 1, 0, "LATC");
} }
DECLFW(CNROMWrite) //------------------ Map 184 ---------------------------
{
latche=V&3;
setchr8(V&3);
}
static void CNROMReset(void) static void M184Sync(void)
{ {
setchr4(0x0000,latche);
setchr4(0x1000,latche>>4);
setprg16(0x8000,0); setprg16(0x8000,0);
setprg16(0xC000,1); setprg16(0xC000,1);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,CNROMWrite);
} }
static void CNROMRestore(int version) void Mapper184_Init(CartInfo *info)
{ {
setchr8(latche); Latch_Init(info, M184Sync, 0, 0x6000, 0x7FFF);
}
//------------------ CNROM ---------------------------
static void CNROMSync(void)
{
setchr8(latche&3);
setprg16(0x8000,0);
setprg16(0xC000,1);
} }
void CNROM_Init(CartInfo *info) void CNROM_Init(CartInfo *info)
{ {
info->Power=CNROMReset; Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF);
GameStateRestore=CNROMRestore;
AddExState(&latche, 1, 0, "LATC");
} }
static void NROM128Reset(void) //------------------ ANROM ---------------------------
static void ANROMSync()
{ {
setprg16(0x8000,0); setprg32(0x8000,latche&0xf);
setprg16(0xC000,0); setmirror(MI_0+((latche>>4)&1));
setchr8(0); setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
} }
static void NROM256Reset(void) void ANROM_Init(CartInfo *info)
{ {
setprg16(0x8000,0); Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF);
setprg16(0xC000,1);
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
} }
void NROM128_Init(CartInfo *info) //------------------ Map 70 ---------------------------
static void M70Sync()
{ {
info->Power=NROM128Reset; setprg16(0x8000,latche>>4);
setprg16(0xc000,~0);
setchr8(latche&0xf);
} }
void NROM256_Init(CartInfo *info) void Mapper70_Init(CartInfo *info)
{ {
info->Power=NROM256Reset; Latch_Init(info, M70Sync, 0, 0x8000, 0xFFFF);
} }
static DECLFW(MHROMWrite) //------------------ Map 152 ---------------------------
static void M152Sync()
{ {
setprg32(0x8000,V>>4); setprg16(0x8000,(latche>>4)&7);
setchr8(V); setprg16(0xc000,~0);
latche=V; setchr8(latche&0xf);
setmirror(MI_0+((latche>>7)&1)); /* Saint Seiya...hmm. */
} }
static void MHROMReset(void) void Mapper152_Init(CartInfo *info)
{ {
setprg32(0x8000,0); Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF);
setchr8(0);
latche=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
} }
static void MHROMRestore(int version) //------------------ Map 78 ---------------------------
/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
static void M78Sync()
{ {
setprg32(0x8000,latche); setprg16(0x8000,(latche&7));
setchr8(latche); setprg16(0xc000,~0);
SetWriteHandler(0x8000,0xffff,MHROMWrite); setchr8(latche>>4);
setmirror(MI_0+((latche>>3)&1));
}
void Mapper78_Init(CartInfo *info)
{
Latch_Init(info, M78Sync, 0, 0x8000, 0xFFFF);
}
//------------------ MHROM ---------------------------
static void MHROMSync(void)
{
setprg32(0x8000,latche>>4);
setchr8(latche&0xf);
} }
void MHROM_Init(CartInfo *info) void MHROM_Init(CartInfo *info)
{ {
info->Power=MHROMReset; Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF);
AddExState(&latche, 1, 0,"LATC");
PRGmask32[0]&=1;
CHRmask8[0]&=1;
GameStateRestore=MHROMRestore;
} }
static void UNROMRestore(int version) void Mapper140_Init(CartInfo *info)
{ {
setprg16(0x8000,latche); Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF);
} }
static DECLFW(UNROMWrite) void Mapper240_Init(CartInfo *info)
{ {
setprg16(0x8000,V); Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF);
latche=V; // need SRAM.
} }
static void UNROMReset(void) //------------------ Map 87 ---------------------------
static void M87Sync(void)
{ {
setprg16(0x8000,0); setprg16(0x8000,0);
setprg16(0xc000,~0); setprg16(0xC000,1);
setvram8(CHRRAM); setchr8(latche>>1);
SetWriteHandler(0x8000,0xffff,UNROMWrite); }
SetReadHandler(0x8000,0xFFFF,CartBR);
latche=0; void Mapper87_Init(CartInfo *info)
{
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF);
}
//------------------ Map 11 ---------------------------
static void M11Sync(void)
{
setprg32(0x8000,latche&0xf);
setchr8(latche>>4);
}
void Mapper11_Init(CartInfo *info)
{
Latch_Init(info, M11Sync, 0, 0x8000, 0xFFFF);
}
void Mapper144_Init(CartInfo *info)
{
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF);
}
//------------------ UNROM ---------------------------
static void UNROMSync(void)
{
setprg16(0x8000,latche);
setprg16(0xc000,~0);
setchr8(0);
} }
void UNROM_Init(CartInfo *info) void UNROM_Init(CartInfo *info)
{ {
info->Power=UNROMReset; Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF);
PRGmask16[0]&=7;
AddExState(&latche, 1, 0, "LATC");
AddExState(CHRRAM, 8192, 0, "CHRR");
GameStateRestore=UNROMRestore;
} }
static void GNROMSync() //------------------ Map 93 ---------------------------
static void SSUNROMSync(void)
{ {
setchr8(latche&3); setprg16(0x8000,latche>>4);
setprg32(0x8000,(latche>>4)&3); setprg16(0xc000,~0);
setchr8(0);
} }
static DECLFW(GNROMWrite) void SUNSOFT_UNROM_Init(CartInfo *info)
{ {
latche=V&0x33; Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF);
GNROMSync();
} }
static void GNROMStateRestore(int version) //------------------ Map 94 ---------------------------
static void M94Sync(void)
{ {
GNROMSync(); setprg16(0x8000,latche>>2);
setprg16(0xc000,~0);
setchr8(0);
} }
static void GNROMReset(void) void Mapper94_Init(CartInfo *info)
{ {
latche=0; Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF);
GNROMSync();
SetWriteHandler(0x8000,0xffff,GNROMWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
} }
void GNROM_Init(CartInfo *info) //------------------ Map 180 ---------------------------
static void M180Sync(void)
{ {
info->Power=GNROMReset; setprg16(0x8000,0);
AddExState(&latche, 1, 0, "LATC"); setprg16(0xc000,latche);
GameStateRestore=GNROMStateRestore; setchr8(0);
}
void Mapper180_Init(CartInfo *info)
{
Latch_Init(info, M180Sync, 0, 0x8000, 0xFFFF);
}
//------------------ Map 107 ---------------------------
static void M107Sync(void)
{
setprg32(0x8000,(latche>>1)&3);
setchr8(latche&7);
}
void Mapper107_Init(CartInfo *info)
{
Latch_Init(info, M107Sync, ~0, 0x8000, 0xFFFF);
}
//------------------ Map 113 ---------------------------
static void M113Sync(void)
{
setprg32(0x8000,(latche>>3)&7);
setchr8(((latche>>3)&8)|(latche&7));
// setmirror(latche>>7); // only for HES 6in1
}
void Mapper113_Init(CartInfo *info)
{
Latch_Init(info, M113Sync, 0, 0x4100, 0x7FFF);
}
//------------------ A65AS ---------------------------
// actually, there is two cart in one... First have extra mirroring
// mode (one screen) and 32K bankswitching, second one have only
// 16 bankswitching mode and normal mirroring... But there is no any
// correlations between modes and they can be used in one mapper code.
static void BMCA65ASSync(void)
{
if(latche&0x40)
setprg32(0x8000,(latche>>1)&0x0F);
else
{
setprg16(0x8000,((latche&0x30)>>1)|(latche&7));
setprg16(0xC000,((latche&0x30)>>1)|7);
}
setchr8(0);
if(latche&0x80)
setmirror(MI_0+(((latche>>5)&1)));
else
setmirror(((latche>>3)&1)^1);
}
void BMCA65AS_Init(CartInfo *info)
{
Latch_Init(info, BMCA65ASSync, 0, 0x8000, 0xFFFF);
}
//------------------ NROM ---------------------------
#ifdef DEBUG_MAPPER
static DECLFW(WriteHandler)
{
FCEU_printf("bs %04x %02x\n",A,V);
}
#endif
static void NROMPower(void)
{
setprg16(0x8000,0);
setprg16(0xC000,~0);
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
#ifdef DEBUG_MAPPER
SetWriteHandler(0x4020,0xFFFF,WriteHandler);
#endif
}
void NROM_Init(CartInfo *info)
{
info->Power=NROMPower;
} }

View File

@ -416,10 +416,7 @@ void FASTAPASS(1) setmirror(int t)
void SetupCartMirroring(int m, int hard, uint8 *extra) void SetupCartMirroring(int m, int hard, uint8 *extra)
{ {
if(m<4) if(m<4)
{
mirrorhard = 0;
setmirror(m); setmirror(m);
}
else else
{ {
vnapage[0]=NTARAM; vnapage[0]=NTARAM;
@ -428,7 +425,7 @@ void SetupCartMirroring(int m, int hard, uint8 *extra)
vnapage[3]=extra+0x400; vnapage[3]=extra+0x400;
PPUNTARAM=0xF; PPUNTARAM=0xF;
} }
mirrorhard = hard; mirrorhard=hard;
} }
static uint8 *GENIEROM=0; static uint8 *GENIEROM=0;

View File

@ -337,8 +337,8 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
FCEUD_PrintError("Error saving cheats."); FCEUD_PrintError("Error saving cheats.");
cheats=cheatsl=0; cheats=cheatsl=0;
} }
else if(!override) //else if(!override)
remove(fn); // remove(fn);
if(!override) if(!override)
free(fn); free(fn);
} }

View File

@ -60,8 +60,6 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl)
fclose(fp); fclose(fp);
} }
#ifdef FCEUDEF_DEBUGGER
static char *fstrings[12]= static char *fstrings[12]=
{ {
"#$%02X", // immediate "#$%02X", // immediate
@ -520,4 +518,3 @@ void FCEUI_SetCPUCallback(void (*callb)(X6502 *X))
CPUHook=callb; CPUHook=callb;
X6502_Debug(CPUHook,BreakPoints?ReadHandler:0,BreakPoints?WriteHandler:0); X6502_Debug(CPUHook,BreakPoints?ReadHandler:0,BreakPoints?WriteHandler:0);
} }
#endif

View File

@ -1,7 +1,3 @@
void FCEUI_DumpMem(const char *fname, uint32 start, uint32 end);
void FCEUI_LoadMem(const char *fname, uint32 start, int hl);
#ifdef FCEUDEF_DEBUGGER
/* Type attributes, you can OR them together. */ /* Type attributes, you can OR them together. */
#define BPOINT_READ 1 #define BPOINT_READ 1
@ -10,6 +6,8 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl);
#include "x6502struct.h" #include "x6502struct.h"
void FCEUI_DumpMem(const char *fname, uint32 start, uint32 end);
void FCEUI_LoadMem(const char *fname, uint32 start, int hl);
void FCEUI_SetCPUCallback(void (*callb)(X6502 *X)); void FCEUI_SetCPUCallback(void (*callb)(X6502 *X));
int FCEUI_DeleteBreakPoint(uint32 w); int FCEUI_DeleteBreakPoint(uint32 w);
int FCEUI_ListBreakPoints(int (*callb)(int type, unsigned int A1, unsigned int A2, int FCEUI_ListBreakPoints(int (*callb)(int type, unsigned int A1, unsigned int A2,
@ -20,4 +18,3 @@ int FCEUI_SetBreakPoint(uint32 w, int type, unsigned int A1, unsigned int A2,
void (*Handler)(X6502 *, int type, unsigned int A)); void (*Handler)(X6502 *, int type, unsigned int A));
int FCEUI_AddBreakPoint(int type, unsigned int A1, unsigned int A2, int FCEUI_AddBreakPoint(int type, unsigned int A1, unsigned int A2,
void (*Handler)(X6502 *, int type, unsigned int A)); void (*Handler)(X6502 *, int type, unsigned int A));
#endif

View File

@ -186,8 +186,8 @@ static void CloseGame(void)
{ {
if(FCEUGameInfo) if(FCEUGameInfo)
{ {
if(FCEUnetplay) //if(FCEUnetplay)
FCEUD_NetworkClose(); // FCEUD_NetworkClose();
if(FCEUGameInfo->name) if(FCEUGameInfo->name)
{ {
free(FCEUGameInfo->name); free(FCEUGameInfo->name);
@ -197,7 +197,7 @@ static void CloseGame(void)
FCEU_FlushGameCheats(0,0); FCEU_FlushGameCheats(0,0);
GameInterface(GI_CLOSE); GameInterface(GI_CLOSE);
ResetExState(0,0); ResetExState(0,0);
CloseGenie(); //CloseGenie();
free(FCEUGameInfo); free(FCEUGameInfo);
FCEUGameInfo = 0; FCEUGameInfo = 0;
} }
@ -326,7 +326,6 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
ssize=FlushEmulateSound(); ssize=FlushEmulateSound();
timestampbase += timestamp; timestampbase += timestamp;
timestamp = 0; timestamp = 0;
*pXBuf=skip?0:XBuf; *pXBuf=skip?0:XBuf;

View File

@ -287,7 +287,9 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
{ {
int fd; int fd;
/*** REMOVED GCV1.0
fd = dup(fileno( (FILE *)t)); fd = dup(fileno( (FILE *)t));
REMOVED GCV1.0 ***/
fclose(t); fclose(t);

View File

@ -58,6 +58,7 @@ void SexyFilter(int32 *in, int32 *out, int32 count)
int64 ino=(int64)*in*vmul; int64 ino=(int64)*in*vmul;
acc1+=((ino-acc1)*mul1)>>16; acc1+=((ino-acc1)*mul1)>>16;
acc2+=((ino-acc1-acc2)*mul2)>>16; acc2+=((ino-acc1-acc2)*mul2)>>16;
//printf("%d ",*in);
*in=0; *in=0;
{ {
int32 t=(acc1-ino+acc2)>>16; int32 t=(acc1-ino+acc2)>>16;
@ -133,7 +134,6 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
out++; out++;
count++; count++;
} }
mrindex=x-max; mrindex=x-max;
if(FSettings.soundq==2) if(FSettings.soundq==2)

View File

@ -84,7 +84,7 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
{ {
char *ret=0; char *ret=0;
#ifndef NGC /*** REMOVED GC V1.0
struct stat tmpstat; struct stat tmpstat;
switch(type) switch(type)
@ -164,7 +164,8 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
asprintf(&ret,"%s"PSS"gameinfo"PSS"%s.pal",BaseDirectory,FileBase); asprintf(&ret,"%s"PSS"gameinfo"PSS"%s.pal",BaseDirectory,FileBase);
break; break;
} }
#endif
REMOVED GC V1.0 ***/
return(ret); return(ret);
} }

View File

@ -1,37 +0,0 @@
{ 0xecf78d8a13a030a6LL, "Ai Sensei no Oshiete", INESB_HACKED },
{ 0x10f90ba5bd55c22eLL, "Alien Syndrome", INESB_HACKED },
{ 0x4712856d3e12f21fLL, "Akumajou Densetsu", INESB_HACKED },
{ 0x0d69ab3ad28ad1c2LL, "Banana", INESB_INCOMPLETE },
{ 0x85d2c348a161cdbfLL, "Bio Senshi Dan", INESB_HACKED },
{ 0x18fdb7c16aa8cb5cLL, "Bucky O'Hare", INESB_CORRUPT },
{ 0xe27c48302108d11bLL, "Chibi Maruko Chan", INESB_HACKED },
{ 0x9d1f505c6ba507bfLL, "Contra", INESB_HACKED },
{ 0x60936436d3ea0ab6LL, "Crisis Force", INESB_HACKED },
{ 0xcf31097ddbb03c5dLL, "Crystalis (Prototype)", INESB_CORRUPT },
{ 0x92080a8ce94200eaLL, "Digital Devil Story II", INESB_HACKED },
{ 0x97f133d8bc1c28dbLL, "Dragon Ball", INESB_HACKED },
{ 0x6c2a2f95c2fe4b6eLL, "Dragon Ball", INESB_HACKED },
{ 0x767aaff62963c58fLL, "Dragon Ball", INESB_HACKED },
{ 0x500b267abb323005LL, "Dragon Warrior 4", INESB_CORRUPT },
{ 0x02bdcf375704784bLL, "Erika to Satoru no Yume Bouken", INESB_HACKED },
{ 0xd4fea9d2633b9186LL, "Famista 91", INESB_HACKED },
{ 0xfdf8c812839b61f0LL, "Famista 92", INESB_HACKED },
{ 0xb5bb1d0fb47d0850LL, "Famista 93", INESB_HACKED },
{ 0x30471e773f7cdc89LL, "Famista 94", INESB_HACKED },
{ 0x76c5c44ffb4a0bd7LL, "Fantasy Zone", INESB_HACKED },
{ 0x27da2b0c500dc346LL, "Fire Emblem", INESB_HACKED },
{ 0xb470bfb90e2b1049LL, "Fire Emblem Gaiden", INESB_HACKED },
{ 0x23214fe456fba2ceLL, "Ganbare Goemon 2", INESB_HACKED },
{ 0xbf8b22524e8329d9LL, "Ganbare Goemon Gaiden", INESB_HACKED },
{ 0xa97041c3da0134e3LL, "Gegege no Kitarou 2", INESB_INCOMPLETE },
{ 0x805db49a86db5449LL, "Goonies", INESB_HACKED },
{ 0xc5abdaa65ac49b6bLL, "Gradius 2", INESB_HACKED },
{ 0x04afae4ad480c11cLL, "Gradius 2", INESB_HACKED },
{ 0x9b4bad37b5498992LL, "Gradius 2", INESB_HACKED },
{ 0xb068d4ac10ef848eLL, "Highway Star", INESB_HACKED },
{ 0xbf5175271e5019c3LL, "Kaiketsu Yanchamaru 3", INESB_HACKED },
{ 0xfb4b508a236bbba3LL, "Salamander", INESB_HACKED },
{ 0x3716c4bebf885344LL, "Super Mario Bros.", INESB_HACKED },
{ 0x1895afc6eef26c7dLL, "Super Mario Bros.", INESB_HACKED },
{ 0x103fc85d978b861bLL, "Sweet Home", INESB_CORRUPT },
{ 0xfffda4407d80885aLL, "Sweet Home", INESB_CORRUPT },

View File

@ -1,191 +0,0 @@
{0x9cbadc25,5,8}, /* JustBreed */
{0x6e68e31a,16,8}, /* Dragon Ball 3*/
{0x3f15d20d,153,8}, /* Famicom Jump 2 */
{0x983d8175,157,8}, /* Datach Battle Rush */
{0x894efdbc,157,8}, /* Datach Crayon Shin Chan */
{0x19e81461,157,8}, /* Datach DBZ */
{0xbe06853f,157,8}, /* Datach J-League */
{0x0be0a328,157,8}, /* Datach SD Gundam Wars */
{0x5b457641,157,8}, /* Datach Ultraman Club */
{0xf51a7f46,157,8}, /* Datach Yuu Yuu Hakusho */
{0xe62e3382,71,-1}, /* Mig-29 Soviet Fighter */
{0x21a653c7,4,-1}, /* Super Sky Kid */
{0xdd4d9a62,209,-1}, /* Shin Samurai Spirits 2 */
{0x063b1151,209,-1}, /* Power Rangers 4 */
{0xdd8ced31,209,-1}, /* Power Rangers 3 */
{0x60bfeb0c,90,-1}, /* MK 2*/
{0x0c47946d,210,-1}, /* Chibi Maruko Chan */
{0xbd523011,210,-1}, /* Dream Master */
{0xc247cc80,210,-1}, /* Family Circuit '91 */
{0x6ec51de5,210,-1}, /* Famista '92 */
{0xadffd64f,210,-1}, /* Famista '93 */
{0x429103c9,210,-1}, /* Famista '94 */
{0x81b7f1a8,210,-1}, /* Heisei Tensai Bakabon */
{0x2447e03b,210,-1}, /* Top Striker */
{0x1dc0f740,210,-1}, /* Wagyan Land 2 */
{0xd323b806,210,-1}, /* Wagyan Land 3 */
{0x07eb2c12,208,-1}, /* Street Fighter IV */
{0x96ce586e,189,8}, /* Street Fighter 2 YOKO */
{0x7678f1d5,207,8}, /* Fudou Myouou Den */
{0x276237b3,206,0}, /* Karnov */
{0x4e1c1e3c,206,0}, /* Karnov */
/* Some entries to sort out the minor 33/48 mess. */
{0xaebd6549,48,8}, /* Bakushou!! Jinsei Gekijou 3 */
{0x6cdc0cd9,48,8}, /* Bubble Bobble 2 */
//{0x10e24006,48,8}, /* Flintstones 2 - bad dump? */
{0x40c0ad47,48,8}, /* Flintstones 2 */
{0xa7b0536c,48,8}, /* Don Doko Don 2 */
{0x99c395f9,48,8}, /* Captain Saver */
{0x1500e835,48,8}, /* Jetsons (J) */
{0x637134e8,193,1}, /* Fighting Hero */
{0xcbf4366f,158,8}, /* Alien Syndrome (U.S. unlicensed) */
{0xb19a55dd,64,8}, /* Road Runner */
//{0x3eafd012,116,-1}, /* AV Girl Fighting */
{0x1d0f4d6b,2,1}, /* Black Bass thinging */
{0xf92be3ec,64,-1}, /* Rolling Thunder */
{0x345ee51a,245,-1}, /* DQ4c */
{0xf518dd58,7,8}, /* Captain Skyhawk */
{0x7ccb12a3,43,-1}, /* SMB2j */
{0x6f12afc5,235,-1}, /* Golden Game 150-in-1 */
{0xccc03440,156,-1},
{0xc9ee15a7,3,-1}, /* 3 is probably best. 41 WILL NOT WORK. */
{0x3e1271d5,79,1}, /* Tiles of Fate */
{0x8eab381c,113,1}, /* Death Bots */
{0xd4a76b07,79,0}, /* F-15 City Wars*/
{0xa4fbb438,79,0},
{0x1eb4a920,79,1}, /* Double Strike */
{0x345d3a1a,11,1}, /* Castle of Deceit */
{0x62ef6c79,232,8}, /* Quattro Sports -Aladdin */
{0x5caa3e61,144,1}, /* Death Race */
{0xd2699893,88,0}, /* Dragon Spirit */
{0x2f27cdef,155,8}, /* Tatakae!! Rahmen Man */
{0xcfd4a281,155,8}, /* Money Game. Yay for money! */
{0xd1691028,154,8}, /* Devil Man */
{0xc68363f6,180,0}, /* Crazy Climber */
{0xbe939fce,9,1}, /* Punchout*/
{0x5e66eaea,13,1}, /* Videomation */
{0xaf5d7aa2,-1,0}, /* Clu Clu Land */
{0xc2730c30,34,0}, /* Deadly Towers */
{0x932ff06e,34,1}, /* Classic Concentration */
{0x4c7c1af3,34,1}, /* Caesar's Palace */
{0x15141401,4,8}, /* Asmik Kun Land */
{0x59280bec,4,8}, /* Jackie Chan */
{0x4cccd878,4,8}, /* Cat Ninden Teyandee */
{0x9eefb4b4,4,8}, /* Pachi Slot Adventure 2 */
{0x5337f73c,4,8}, /* Niji no Silk Road */
{0x7474ac92,4,8}, /* Kabuki: Quantum Fighter */
{0xbb7c5f7a,89,8}, /* Mito Koumon or something similar */
/* Probably a Namco MMC3-workalike */
{0xa5e6baf9,4,1|4}, /* Dragon Slayer 4 */
{0xe40b4973,4,1|4}, /* Metro Cross */
{0xd97c31b0,4,1|4}, /* Rasaaru Ishii no Childs Quest */
{0x84382231,9,0}, /* Punch Out (J) */
{0xe28f2596,0,1}, /* Pac Land (J) */
{0xfcdaca80,0,0}, /* Elevator Action */
{0xe492d45a,0,0}, /* Zippy Race */
{0x32fa246f,0,0}, /* Tag Team Pro Wrestling */
{0xc05a365b,0,0}, /* Exed Exes (J) */
{0xb3c30bea,0,0}, /* Xevious (J) */
{0x804f898a,2,1}, /* Dragon Unit */
{0xe1b260da,2,1}, /* Argos no Senshi */
{0x6d65cac6,2,0}, /* Terra Cresta */
{0x9ea1dc76,2,0}, /* Rainbow Islands */
{0x28c11d24,2,1}, /* Sukeban Deka */
{0x02863604,2,1}, /* Sukeban Deka */
{0x2bb6a0f8,2,1}, /* Sherlock Holmes */
{0x55773880,2,1}, /* Gilligan's Island */
{0x419461d0,2,1}, /* Super Cars */
{0x6e0eb43e,2,1}, /* Puss n Boots */
{0x266ce198,2,1}, /* City Adventure Touch */
{0x48349b0b,1,8}, /* Dragon Quest 2 */
{0xd09b74dc,1,8}, /* Great Tank (J) */
{0xe8baa782,1,8}, /* Gun Hed (J) */
{0x970bd9c2,1,8}, /* Hanjuku Hero */
{0xcd7a2fd7,1,8}, /* Hanjuku Hero */
{0x63469396,1,8}, /* Hokuto no Ken 4 */
{0x291bcd7d,1,8}, /* Pachio Kun 2 */
{0xf74dfc91,1,-1}, /* Win, Lose, or Draw */
{0x3f56a392,1,8}, /* Captain Ed (J) */
{0x078ced30,1,8}, /* Choujin - Ultra Baseball */
{0x391aa1b8,1,8}, /* Bloody Warriors (J) */
{0x61a852ea,1,8}, /* Battle Stadium - Senbatsu Pro Yakyuu */
{0xfe364be5,1,8}, /* Deep Dungeon 4 */
{0xd8ee7669,1,8}, /* Adventures of Rad Gravity */
{0xa5e8d2cd,1,8}, /* Breakthru */
{0xf6fa4453,1,8}, /* Bigfoot */
{0x37ba3261,1,8}, /* Back to the Future 2 and 3 */
{0x934db14a,1,-1}, /* All-Pro Basketball */
{0xe94d5181,1,8}, /* Mirai Senshi - Lios */
{0x7156cb4d,1,8}, /* Muppet Adventure Carnival thingy */
{0x5b6ca654,1,8}, /* Barbie rev X*/
{0x57c12280,1,8}, /* Demon Sword */
{0x70f67ab7,1,8}, /* Musashi no Bouken */
{0xa9a4ea4c,1,8}, /* Satomi Hakkenden */
{0xcc3544b0,1,8}, /* Triathron */
{0x1d41cc8c,3,1}, /* Gyruss */
{0xd8eff0df,3,1}, /* Gradius (J) */
{0xdbf90772,3,0}, /* Alpha Mission */
{0xd858033d,3,0}, /* Armored Scrum Object */
{0xcf322bb3,3,1}, /* John Elway's Quarterback */
{0x9bde3267,3,1}, /* Adventures of Dino Riki */
{0x02cc3973,3,1}, /* Ninja Kid */
{0xb5d28ea2,3,1}, /* Mystery Quest - mapper 3?*/
{0xbc065fc3,3,1}, /* Pipe Dream */
{0x5b837e8d,1,8}, /* Alien Syndrome */
{0x283ad224,32,8}, /* Ai Sensei no Oshiete */
{0x5555fca3,32,8}, /* "" "" */
{0x243a8735,32,0x10|4}, /* Major League */
{0x6bc65d7e,66,1}, /* Youkai Club*/
{0xc2df0a00,66,1}, /* Bio Senshi Dan(hacked) */
{0xbde3ae9b,66,1}, /* Doraemon */
{0xd26efd78,66,1}, /* SMB Duck Hunt */
{0x811f06d9,66,1}, /* Dragon Power */
{0x3293afea,66,1}, /* Mississippi Satsujin Jiken */
{0xe84274c5,66,1}, /* "" "" */
{0x9552e8df,66,1}, /* Dragon Ball */
{0xba51ac6f,78,2},
{0x3d1c3137,78,8}, /* Uchuusen - Cosmo Carrier */
{0xbda8f8e4,152,8}, /* Gegege no Kitarou 2 */
{0x026c5fca,152,8}, /* Saint Seiya Ougon Densetsu */
{0x0f141525,152,8}, /* Arkanoid 2 (Japanese) */
{0xb1a94b82,152,8}, /* Pocket Zaurus */
{0xbba58be5,70,-1}, /* Family Trainer - Manhattan Police */
{0x370ceb65,70,-1}, /* Family Trainer - Meiro Dai Sakusen */
{0xdd8ed0f7,70,1}, /* Kamen Rider Club */
{0x90c773c1,118,-1}, /* Goal! 2 */
{0xb9b4d9e0,118,-1}, /* NES Play Action Football */
{0x78b657ac,118,-1}, /* Armadillo */
{0x37b62d04,118,-1}, /* Ys 3 */
{0x07d92c31,118,-1}, /* RPG Jinsei Game */
{0x2705eaeb,234,-1}, /* Maxi 15 */
{0x404b2e8b,4,2}, /* Rad Racer 2 */
{0xa912b064,51|0x800,8}, /* 11-in-1 Ball Games(has CHR ROM when it shouldn't) */
{0,-1,-1}

View File

@ -62,7 +62,7 @@ static int NewiNES_Init(int num);
void (*MapClose)(void); void (*MapClose)(void);
void (*MapperReset)(void); void (*MapperReset)(void);
int MapperNo; int MapperNo = 0;
iNES_HEADER head; iNES_HEADER head;
@ -104,7 +104,7 @@ static void iNESGI(int h)
break; break;
case GI_CLOSE: case GI_CLOSE:
{ {
FCEU_SaveGameSave(&iNESCart); //FCEU_SaveGameSave(&iNESCart);
if(iNESCart.Close) iNESCart.Close(); if(iNESCart.Close) iNESCart.Close();
if(ROM) {free(ROM);ROM=0;} if(ROM) {free(ROM);ROM=0;}
@ -143,7 +143,7 @@ static void SetInput(void)
{0xaf4010ea,SI_GAMEPAD,SI_POWERPADB,-1}, /* World Class Track Meet */ {0xaf4010ea,SI_GAMEPAD,SI_POWERPADB,-1}, /* World Class Track Meet */
{0xd74b2719,SI_GAMEPAD,SI_POWERPADB,-1}, /* Super Team Games */ {0xd74b2719,SI_GAMEPAD,SI_POWERPADB,-1}, /* Super Team Games */
{0x61d86167,SI_GAMEPAD,SI_POWERPADB,-1}, /* Street Cop */ {0x61d86167,SI_GAMEPAD,SI_POWERPADB,-1}, /* Street Cop */
{0x6435c095,SI_GAMEPAD,SI_POWERPADB,-1}, /* Short Order/Eggsplode */ // Bad dump? {0x23040fc4,SI_GAMEPAD,SI_POWERPADB,-1}, /* Short Order/Eggsplode */
{0x47232739,SI_GAMEPAD,SI_GAMEPAD,SIFC_TOPRIDER}, /* Top Rider */ {0x47232739,SI_GAMEPAD,SI_GAMEPAD,SIFC_TOPRIDER}, /* Top Rider */
@ -179,8 +179,6 @@ static void SetInput(void)
{0xbeb8ab01,-1,SI_ZAPPER,0}, /* Gumshoe */ {0xbeb8ab01,-1,SI_ZAPPER,0}, /* Gumshoe */
{0xde8fd935,-1,SI_ZAPPER,0}, /* To the Earth */ {0xde8fd935,-1,SI_ZAPPER,0}, /* To the Earth */
{0xedc3662b,-1,SI_ZAPPER,0}, /* Operation Wolf */ {0xedc3662b,-1,SI_ZAPPER,0}, /* Operation Wolf */
{0x2a6559a1,-1,SI_ZAPPER,0}, /* Operation Wolf (J) */
{0x23d17f5e,SI_GAMEPAD,SI_ZAPPER,0}, /* The Lone Ranger */ {0x23d17f5e,SI_GAMEPAD,SI_ZAPPER,0}, /* The Lone Ranger */
{0xb8b9aca3,-1,SI_ZAPPER,0}, /* Wild Gunman */ {0xb8b9aca3,-1,SI_ZAPPER,0}, /* Wild Gunman */
{0x5112dc21,-1,SI_ZAPPER,0}, /* Wild Gunman */ {0x5112dc21,-1,SI_ZAPPER,0}, /* Wild Gunman */
@ -193,7 +191,6 @@ static void SetInput(void)
{0xd89e5a67,-1,-1,SIFC_ARKANOID}, /* Arkanoid (J) */ {0xd89e5a67,-1,-1,SIFC_ARKANOID}, /* Arkanoid (J) */
{0x0f141525,-1,-1,SIFC_ARKANOID}, /* Arkanoid 2(J) */ {0x0f141525,-1,-1,SIFC_ARKANOID}, /* Arkanoid 2(J) */
{0x912989dc,-1,-1,SIFC_FKB}, /* Playbox BASIC */
{0xf7606810,-1,-1,SIFC_FKB}, /* Family BASIC 2.0A */ {0xf7606810,-1,-1,SIFC_FKB}, /* Family BASIC 2.0A */
{0x895037bc,-1,-1,SIFC_FKB}, /* Family BASIC 2.1a */ {0x895037bc,-1,-1,SIFC_FKB}, /* Family BASIC 2.1a */
{0xb2530afc,-1,-1,SIFC_FKB}, /* Family BASIC 3.0 */ {0xb2530afc,-1,-1,SIFC_FKB}, /* Family BASIC 3.0 */
@ -214,41 +211,6 @@ static void SetInput(void)
} }
} }
#define INESB_INCOMPLETE 1
#define INESB_CORRUPT 2
#define INESB_HACKED 4
struct BADINF {
uint64 md5partial;
char *name;
uint32 type;
};
static struct BADINF BadROMImages[]=
{
#include "ines-bad.h"
};
void CheckBad(uint64 md5partial)
{
int x;
x=0;
//printf("0x%llx\n",md5partial);
while(BadROMImages[x].name)
{
if(BadROMImages[x].md5partial == md5partial)
{
FCEU_PrintError("The copy game you have loaded, \"%s\", is bad, and will not work properly on FCE Ultra.", BadROMImages[x].name);
return;
}
x++;
}
}
struct CHINF { struct CHINF {
uint32 crc32; uint32 crc32;
int32 mapper; int32 mapper;
@ -316,9 +278,182 @@ static void CheckHInfo(void)
}; };
static struct CHINF moo[]= static struct CHINF moo[]=
{ {
#include "ines-correct.h" {0x9cbadc25,5,8}, /* JustBreed */
};
// {0x5f6e8a07,66,0},
{0x983d8175,157,8}, /* Datach Battle Rush */
{0x894efdbc,157,8}, /* Datach Crayon Shin Chan */
{0x19e81461,157,8}, /* Datach DBZ */
{0xbe06853f,157,8}, /* Datach J-League */
{0x0be0a328,157,8}, /* Datach SD Gundam Wars */
{0x5b457641,157,8}, /* Datach Ultraman Club */
{0xf51a7f46,157,8}, /* Datach Yuu Yuu Hakusho */
{0x60bfeb0c,90,-1}, /* MK 2*/
{0xe62e3382,71,-1}, /* Mig-29 Soviet Fighter */
{0x21a653c7,4,-1}, /* Super Sky Kid */
{0xdd4d9a62,209,-1}, /* Shin Samurai Spirits 2 */
{0x063b1151,209,-1}, /* Power Rangers 4 */
{0xdd8ced31,209,-1}, /* Power Rangers 3 */
{0x0c47946d,210,-1}, /* Chibi Maruko Chan */
{0xbd523011,210,-1}, /* Dream Master */
{0xc247cc80,210,-1}, /* Family Circuit '91 */
{0x6ec51de5,210,-1}, /* Famista '92 */
{0xadffd64f,210,-1}, /* Famista '93 */
{0x429103c9,210,-1}, /* Famista '94 */
{0x81b7f1a8,210,-1}, /* Heisei Tensai Bakabon */
{0x2447e03b,210,-1}, /* Top Striker */
{0x1dc0f740,210,-1}, /* Wagyan Land 2 */
{0xd323b806,210,-1}, /* Wagyan Land 3 */
{0x07eb2c12,208,-1}, /* Street Fighter IV */
{0x96ce586e,189,8}, /* Street Fighter 2 YOKO */
{0x7678f1d5,207,8}, /* Fudou Myouou Den */
{0x276237b3,206,0}, /* Karnov */
{0x4e1c1e3c,206,0}, /* Karnov */
/* Some entries to sort out the minor 33/48 mess. */
{0x40c0ad47,48,8}, /* Flintstones 2 */
{0xa7b0536c,48,8}, /* Don Doko Don 2 */
{0x99c395f9,48,8}, /* Captain Saver */
{0x637134e8,193,1}, /* Fighting Hero */
{0xcbf4366f,158,8}, /* Alien Syndrome (U.S. unlicensed) */
{0xb19a55dd,64,8}, /* Road Runner */
//{0x3eafd012,116,-1}, /* AV Girl Fighting */
{0x1d0f4d6b,2,1}, /* Black Bass thinging */
{0xf92be3ec,64,-1}, /* Rolling Thunder */
{0x345ee51a,245,-1}, /* DQ4c */
{0xf518dd58,7,8}, /* Captain Skyhawk */
{0x7ccb12a3,43,-1}, /* SMB2j */
{0x6f12afc5,235,-1}, /* Golden Game 150-in-1 */
{0xccc03440,156,-1},
{0xc9ee15a7,3,-1}, /* 3 is probably best. 41 WILL NOT WORK. */
{0x3e1271d5,79,1}, /* Tiles of Fate */
{0x8eab381c,113,1}, /* Death Bots */
{0xd4a76b07,79,0}, /* F-15 City Wars*/
{0xa4fbb438,79,0},
{0x1eb4a920,79,1}, /* Double Strike */
{0x345d3a1a,11,1}, /* Castle of Deceit */
{0x62ef6c79,232,8}, /* Quattro Sports -Aladdin */
{0x5caa3e61,144,1}, /* Death Race */
{0xd2699893,88,0}, /* Dragon Spirit */
{0x2f27cdef,155,8}, /* Tatakae!! Rahmen Man */
{0xcfd4a281,155,8}, /* Money Game. Yay for money! */
{0xd1691028,154,8}, /* Devil Man */
{0xc68363f6,180,0}, /* Crazy Climber */
{0xbe939fce,9,1}, /* Punchout*/
{0x5e66eaea,13,1}, /* Videomation */
{0xaf5d7aa2,-1,0}, /* Clu Clu Land */
{0xc2730c30,34,0}, /* Deadly Towers */
{0x932ff06e,34,1}, /* Classic Concentration */
{0x4c7c1af3,34,1}, /* Caesar's Palace */
{0x9ea1dc76,2,0}, /* Rainbow Islands */
{0x9eefb4b4,4,8}, /* Pachi Slot Adventure 2 */
{0x5337f73c,4,8}, /* Niji no Silk Road */
{0x7474ac92,4,8}, /* Kabuki: Quantum Fighter */
{0x970bd9c2,1,8}, /* Hanjuku Hero */
{0xbb7c5f7a,89,8}, /* Mito Koumon or something similar */
/* Probably a Namco MMC3-workalike */
{0xa5e6baf9,4,1|4}, /* Dragon Slayer 4 */
{0xe40b4973,4,1|4}, /* Metro Cross */
{0xd97c31b0,4,1|4}, /* Rasaaru Ishii no Childs Quest */
{0x84382231,9,0}, /* Punch Out (J) */
{0xfcdaca80,0,0}, /* Elevator Action */
{0xe492d45a,0,0}, /* Zippy Race */
{0x32fa246f,0,0}, /* Tag Team Pro Wrestling */
{0x6d65cac6,2,0}, /* Terra Cresta */
{0x28c11d24,2,1}, /* Sukeban Deka */
{0x02863604,2,1}, /* Sukeban Deka */
{0x2bb6a0f8,2,1}, /* Sherlock Holmes */
{0x55773880,2,1}, /* Gilligan's Island */
{0x419461d0,2,1}, /* Super Cars */
{0x6e0eb43e,2,1}, /* Puss n Boots */
{0x291bcd7d,1,8}, /* Pachio Kun 2 */
{0xf74dfc91,1,-1}, /* Win, Lose, or Draw */
{0x59280bec,4,8}, /* Jackie Chan */
{0xfe364be5,1,8}, /* Deep Dungeon 4 */
{0xd8ee7669,1,8}, /* Adventures of Rad Gravity */
{0xa5e8d2cd,1,8}, /* Breakthru */
{0xf6fa4453,1,8}, /* Bigfoot */
{0x37ba3261,1,8}, /* Back to the Future 2 and 3 */
{0x934db14a,1,-1}, /* All-Pro Basketball */
{0xe94d5181,1,8}, /* Mirai Senshi - Lios */
{0x7156cb4d,1,8}, /* Muppet Adventure Carnival thingy */
{0x5b6ca654,1,8}, /* Barbie rev X*/
{0x57c12280,1,8}, /* Demon Sword */
{0xdbf90772,3,0}, /* Alpha Mission */
{0xd858033d,3,0}, /* Armored Scrum Object */
{0xcf322bb3,3,1}, /* John Elway's Quarterback */
{0x9bde3267,3,1}, /* Adventures of Dino Riki */
{0x02cc3973,3,1}, /* Ninja Kid */
{0xb5d28ea2,3,1}, /* Mystery Quest - mapper 3?*/
{0xbc065fc3,3,1}, /* Pipe Dream */
{0x5b837e8d,1,8}, /* Alien Syndrome */
{0x283ad224,32,8}, /* Ai Sensei no Oshiete */
{0x5555fca3,32,8}, /* "" "" */
{0x243a8735,32,0x10|4}, /* Major League */
{0x6bc65d7e,66,1}, /* Youkai Club*/
{0xc2df0a00,66,1}, /* Bio Senshi Dan(hacked) */
{0xbde3ae9b,66,1}, /* Doraemon */
{0xd26efd78,66,1}, /* SMB Duck Hunt */
{0x811f06d9,66,1}, /* Dragon Power */
{0x3293afea,66,1}, /* Mississippi Satsujin Jiken */
{0xe84274c5,66,1}, /* "" "" */
{0x9552e8df,66,1}, /* Dragon Ball */
{0x6e68e31a,16,8}, /* Dragon Ball 3*/
{0xba51ac6f,78,2},
{0x3d1c3137,78,8}, /* Uchuusen - Cosmo Carrier */
{0xbda8f8e4,152,8}, /* Gegege no Kitarou 2 */
{0x026c5fca,152,8}, /* Saint Seiya Ougon Densetsu */
{0x0f141525,152,8}, /* Arkanoid 2 (Japanese) */
{0xb1a94b82,152,8}, /* Pocket Zaurus */
{0x3f15d20d,153,8}, /* Famicom Jump 2 */
{0xbba58be5,70,-1}, /* Family Trainer - Manhattan Police */
{0x370ceb65,70,-1}, /* Family Trainer - Meiro Dai Sakusen */
{0xdd8ed0f7,70,1}, /* Kamen Rider Club */
{0x90c773c1,118,-1}, /* Goal! 2 */
{0xb9b4d9e0,118,-1}, /* NES Play Action Football */
{0x78b657ac,118,-1}, /* Armadillo */
{0x37b62d04,118,-1}, /* Ys 3 */
{0x07d92c31,118,-1}, /* RPG Jinsei Game */
{0x2705eaeb,234,-1}, /* Maxi 15 */
{0x404b2e8b,4,2}, /* Rad Racer 2 */
{0xa912b064,51|0x800,8}, /* 11-in-1 Ball Games(has CHR ROM when it shouldn't) */
{0,-1,-1}
};
int tofix=0; int tofix=0;
int x; int x;
uint64 partialmd5=0; uint64 partialmd5=0;
@ -328,7 +463,6 @@ static void CheckHInfo(void)
partialmd5 |= (uint64)iNESCart.MD5[15-x] << (x*8); partialmd5 |= (uint64)iNESCart.MD5[15-x] << (x*8);
//printf("%16llx\n",partialmd5); //printf("%16llx\n",partialmd5);
} }
CheckBad(partialmd5);
x=0; x=0;
@ -711,8 +845,8 @@ void (*MapInitTab[256])(void)=
0, 0,
0,Mapper2_init,Mapper3_init,0, 0,Mapper2_init,Mapper3_init,0,
0,Mapper6_init,Mapper7_init,Mapper8_init, 0,Mapper6_init,Mapper7_init,Mapper8_init,
Mapper9_init,Mapper10_init,Mapper11_init,0, Mapper9_init,Mapper10_init,0,0,
Mapper13_init,0,Mapper15_init,Mapper16_init, Mapper13_init,0,0,Mapper16_init,
Mapper17_init,Mapper18_init,0,0, Mapper17_init,Mapper18_init,0,0,
Mapper21_init,Mapper22_init,Mapper23_init,Mapper24_init, Mapper21_init,Mapper22_init,Mapper23_init,Mapper24_init,
Mapper25_init,Mapper26_init,0,0, Mapper25_init,Mapper26_init,0,0,
@ -723,33 +857,33 @@ void (*MapInitTab[256])(void)=
0,Mapper46_init,0,Mapper48_init,0,Mapper50_init,Mapper51_init,0, 0,Mapper46_init,0,Mapper48_init,0,Mapper50_init,Mapper51_init,0,
0,0,0,0,Mapper57_init,Mapper58_init,Mapper59_init,Mapper60_init, 0,0,0,0,Mapper57_init,Mapper58_init,Mapper59_init,Mapper60_init,
Mapper61_init,Mapper62_init,0,Mapper64_init, Mapper61_init,Mapper62_init,0,Mapper64_init,
Mapper65_init,Mapper66_init,Mapper67_init,Mapper68_init, Mapper65_init,Mapper66_init,Mapper67_init,0,
Mapper69_init,Mapper70_init,Mapper71_init,Mapper72_init, Mapper69_init,0,Mapper71_init,Mapper72_init,
Mapper73_init,0,Mapper75_init,Mapper76_init, Mapper73_init,0,Mapper75_init,Mapper76_init,
Mapper77_init,Mapper78_init,Mapper79_init,Mapper80_init, Mapper77_init,0,Mapper79_init,Mapper80_init,
0,Mapper82_init,Mapper83_init,0, 0,Mapper82_init,Mapper83_init,0,
Mapper85_init,Mapper86_init,Mapper87_init,Mapper88_init, Mapper85_init,Mapper86_init,0,Mapper88_init,
Mapper89_init,0,Mapper91_init,Mapper92_init, Mapper89_init,0,Mapper91_init,Mapper92_init,
Mapper93_init,Mapper94_init,0,Mapper96_init, Mapper93_init,0,0,Mapper96_init,
Mapper97_init,0,Mapper99_init,0, Mapper97_init,0,Mapper99_init,0,
0,0,0,0,0,0,Mapper107_init,0, 0,0,0,0,0,0,0,0,
0,0,0,Mapper112_init,Mapper113_init,Mapper114_init,0,0, 0,0,0,Mapper112_init,0,0,0,0,
Mapper117_init,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,Mapper140_init, 0,0,0,0,0,0,0,Mapper140_init,
0,0,0,Mapper144_init,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,Mapper151_init,Mapper152_init,Mapper153_init,Mapper154_init,0,Mapper156_init, 0,0,Mapper151_init,0,Mapper153_init,Mapper154_init,0,Mapper156_init,
Mapper157_init,Mapper158_init,Mapper159_init,0,0,0,0,0, Mapper157_init,Mapper158_init,Mapper159_init,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,Mapper180_init, 0,0,0,0,0,0,0,0,
0,Mapper182_init,0,Mapper184_init,Mapper185_init,0,0,0, 0,0,0,0,Mapper185_init,0,0,0,
Mapper189_init,0,0,0,Mapper193_init,0,0,0, Mapper189_init,0,0,0,Mapper193_init,0,0,0,
0,0,0,Mapper200_init,Mapper201_init,Mapper202_init,Mapper203_init,0, 0,0,0,Mapper200_init,Mapper201_init,Mapper202_init,Mapper203_init,0,
0,0,Mapper207_init,0,0,0,0,0, 0,0,Mapper207_init,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,Mapper225_init,Mapper226_init,Mapper227_init,Mapper228_init, 0,0,0,0,Mapper225_init,Mapper226_init,Mapper227_init,Mapper228_init,
Mapper229_init,Mapper230_init,Mapper231_init,Mapper232_init,0,Mapper234_init,Mapper235_init,0, Mapper229_init,Mapper230_init,Mapper231_init,Mapper232_init,0,Mapper234_init,Mapper235_init,0,
0,0,0,Mapper240_init,Mapper241_init,Mapper242_init,0,Mapper244_init, 0,0,0,0,Mapper241_init,0,0,Mapper244_init,
0,Mapper246_init,0,Mapper248_init,0,0,0,0,0,0,Mapper255_init 0,Mapper246_init,0,Mapper248_init,0,0,0,0,0,0,Mapper255_init
}; };
@ -879,20 +1013,63 @@ static BMAPPING bmap[] = {
{95, Mapper95_Init}, {95, Mapper95_Init},
{105, Mapper105_Init}, {105, Mapper105_Init},
{115, Mapper115_Init}, {115, Mapper115_Init},
{116, Mapper116_Init}, {116, Mapper116_Init},
{118, Mapper118_Init}, {118, Mapper118_Init},
{119, Mapper119_Init}, /* Has CHR ROM and CHR RAM by default. Hmm. */ {119, Mapper119_Init}, /* Has CHR ROM and CHR RAM by default. Hmm. */
{155, Mapper155_Init}, {155, Mapper155_Init},
{164, Mapper164_Init}, {164, Mapper164_Init},
{187, Mapper187_Init}, {187, Mapper187_Init},
{188, Mapper188_Init},
{206, Mapper206_Init}, {206, Mapper206_Init},
{208, Mapper208_Init}, {208, Mapper208_Init},
{210, Mapper210_Init}, {210, Mapper210_Init},
{245, Mapper245_Init}, {245, Mapper245_Init},
{249, Mapper249_Init}, {249, Mapper249_Init},
{250, Mapper250_Init}, {250, Mapper250_Init},
//¦Û©wmmc3
{205, Mapper205_Init},
{215, Mapper215_Init},
{254, Mapper254_Init},
{198, Mapper198_Init},
{217, Mapper217_Init},
{195, Mapper195_Init},
{194, Mapper194_Init},
{192, Mapper192_Init},
{191, Mapper191_Init},
{182, Mapper182_Init},
{165, Mapper165_Init},
{114, Mapper114_Init},
{37, Mapper37_Init},
//simple
{78, Mapper78_Init},
{70, Mapper70_Init},
{152, Mapper152_Init},
{87, Mapper87_Init},
{11, Mapper11_Init},
{144, Mapper144_Init},
{94, Mapper94_Init},
{180, Mapper180_Init},
{107, Mapper107_Init},
{113, Mapper107_Init},
//199.c
{199, Mapper199_Init},
{240, Mapper240_Init},
//164.c
{164, Mapper164_Init},
{163, Mapper163_Init},
//15.c
{15, Mapper15_init},
//subor.c //warning message
{166, Mapper166_init},
{167, Mapper167_init},
//27.c
{27, Mapper27_init},
//242.c
{242, Mapper242_init},
//252.c
{252, Mapper252_Init},
{0,0} {0,0}
}; };
@ -923,7 +1100,6 @@ static int NewiNES_Init(int num)
return(0); return(0);
} }
/**************************************************************************** /****************************************************************************
** GC V1.0 ** GC V1.0
** **
@ -1079,3 +1255,4 @@ int iNESMemLoad(char *nesrom)
GameInterface=iNESGI; GameInterface=iNESGI;
return 1; return 1;
} }

View File

@ -162,7 +162,7 @@ void Mapper64_init(void);
void Mapper65_init(void); void Mapper65_init(void);
void Mapper66_init(void); void Mapper66_init(void);
void Mapper67_init(void); void Mapper67_init(void);
void Mapper68_init(void); //void Mapper68_init(void);
void Mapper69_init(void); void Mapper69_init(void);
void Mapper70_init(void); void Mapper70_init(void);
void Mapper71_init(void); void Mapper71_init(void);
@ -363,7 +363,6 @@ void Mapper74_Init(CartInfo *);
void Mapper90_Init(CartInfo *); void Mapper90_Init(CartInfo *);
void Mapper165_Init(CartInfo *); void Mapper165_Init(CartInfo *);
void Mapper209_Init(CartInfo *); void Mapper209_Init(CartInfo *);
void Mapper95_Init(CartInfo *); void Mapper95_Init(CartInfo *);
void Mapper105_Init(CartInfo *); void Mapper105_Init(CartInfo *);
void Mapper115_Init(CartInfo *); void Mapper115_Init(CartInfo *);
@ -373,7 +372,6 @@ void Mapper119_Init(CartInfo *);
void Mapper155_Init(CartInfo *); void Mapper155_Init(CartInfo *);
void Mapper164_Init(CartInfo *); void Mapper164_Init(CartInfo *);
void Mapper187_Init(CartInfo *); void Mapper187_Init(CartInfo *);
void Mapper188_Init(CartInfo *);
void Mapper206_Init(CartInfo *); void Mapper206_Init(CartInfo *);
void Mapper208_Init(CartInfo *); void Mapper208_Init(CartInfo *);
void Mapper209_Init(CartInfo *); void Mapper209_Init(CartInfo *);
@ -381,3 +379,41 @@ void Mapper210_Init(CartInfo *);
void Mapper245_Init(CartInfo *); void Mapper245_Init(CartInfo *);
void Mapper249_Init(CartInfo *); void Mapper249_Init(CartInfo *);
void Mapper250_Init(CartInfo *); void Mapper250_Init(CartInfo *);
//
void Mapper205_Init(CartInfo *);
void Mapper215_Init(CartInfo *);
void Mapper254_Init(CartInfo *);
void Mapper78_Init(CartInfo *);
void Mapper184_Init(CartInfo *);
void Mapper70_Init(CartInfo *);
void Mapper152_Init(CartInfo *);
void Mapper87_Init(CartInfo *);
void Mapper11_Init(CartInfo *);
void Mapper144_Init(CartInfo *);
void Mapper94_Init(CartInfo *);
void Mapper180_Init(CartInfo *);
void Mapper107_Init(CartInfo *);
void Mapper113_Init(CartInfo *);
void Mapper199_Init(CartInfo *);
void Mapper198_Init(CartInfo *);
void Mapper217_Init(CartInfo *);
void Mapper195_Init(CartInfo *);
void Mapper194_Init(CartInfo *);
void Mapper192_Init(CartInfo *);
void Mapper191_Init(CartInfo *);
void Mapper182_Init(CartInfo *);
void Mapper165_Init(CartInfo *);
void Mapper114_Init(CartInfo *);
void Mapper37_Init(CartInfo *);
void Mapper240_Init(CartInfo *);
void Mapper164_Init(CartInfo *);
void Mapper163_Init(CartInfo *);
void Mapper15_Init(CartInfo *);
void Mapper166_Init(CartInfo *);
void Mapper167_Init(CartInfo *);
void Mapper27_Init(CartInfo *);
void Mapper242_Init(CartInfo *);
void Mapper252_Init(CartInfo *);

View File

@ -285,20 +285,17 @@ static void M185Sync(int version)
{ {
int x; int x;
//printf("%02x\n",mapbyte1[0]); // DumpMem("out",0x8000,0xFFFF);
//if((mapbyte1[0]&3)==3) // exit(1);
if(VROM_size == 1) // if(mapbyte1[0]==0x15)
if(!(mapbyte1[0]&3))
// if(!(mapbyte1[0]==0x21))
{ {
if((mapbyte1[0]&3) == 1) for(x=0;x<8;x++)
setchr8(0); setchr1r(0x10,x<<10,0);
else }
setchr8r(0x10,0); else
} setchr8(0);
else if(VROM_size == 2)
{
if((mapbyte1[0]&2)) setchr8(mapbyte1[0]&1);
else setchr8r(0x10,0);
}
} }
static DECLFW(Mapper185_write) static DECLFW(Mapper185_write)
@ -310,15 +307,12 @@ static DECLFW(Mapper185_write)
void Mapper185_init(void) void Mapper185_init(void)
{ {
int x; memset(MapperExRAM,0xFF,1024);
for(x=0;x<8192;x++)
MapperExRAM[x]=0xFF;
//memset(MapperExRAM,0xFF,1024);
MapStateRestore=M185Sync; MapStateRestore=M185Sync;
mapbyte1[0]=0; mapbyte1[0]=0;
M185Sync(0); M185Sync(0);
SetupCartCHRMapping(0x10,MapperExRAM,8192,0); SetupCartCHRMapping(0x10,MapperExRAM,1024,0);
SetWriteHandler(0x8000,0xFFFF,Mapper185_write); SetWriteHandler(0x8000,0xFFFF,Mapper185_write);
} }

View File

@ -0,0 +1,69 @@
#include "mapinc.h"
static uint32 regchr[9];
static DECLFW(Mapper27_write)
{
A&=0xF00F;
int regnum;
if((A>=0xB000) && (A<=0xE003)) {
regnum=((((A>>12)+1)&0x03)<<1)|((A&0x02)>>1);
if(A&1)
regchr[regnum]=(regchr[regnum]&0x00F)|(V<<4);
else
regchr[regnum]=(regchr[regnum]&0x1F0)|(V&0xF);
VROM_BANK1(regnum<<10,regchr[regnum]);
}
switch(A)
{
case 0x8000: ROM_BANK8(0x8000|((regchr[8]&2)<<13),V); break;
case 0xA000: ROM_BANK8(0xa000,V); break;
case 0x9000: switch(V&3){
case 0:setmirror(MI_V);break;
case 1:setmirror(MI_H);break;
case 2:setmirror(MI_0);break;
case 3:setmirror(MI_1);break;
}
case 0x9002: regchr[8]=V; break;
case 0xF000: //X6502_IRQEnd(FCEU_IQEXT);
IRQLatch=(IRQLatch&0xF0)|(V&0x0F);
break;
case 0xF001: //X6502_IRQEnd(FCEU_IQEXT);
IRQLatch=(IRQLatch&0x0F)|((V&0xF)<<4);
break;
case 0xF003: IRQa=((IRQa&0x1)<<1)|(IRQa&0x1);
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xF002: IRQa=V&3;
if(IRQa&0x02) IRQCount=IRQLatch-1;
// X6502_IRQEnd(FCEU_IQEXT);
break;
}
// if((A&0xF000)==0xF000) FCEU_printf("$%04x:$%02x, %d\n",A,V, scanline);
}
static void Mapper27_hb(void)
{
// FCEU_printf("%02x-%d,%d,%d\n",scanline,IRQa,IRQCount,IRQLatch);
if(IRQa&0x2){
if(IRQCount==0xFF){
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch+1;
} else {
IRQCount++;
}
}
}
void Mapper27_init(void)
{
int i;
for (i=0; i<9; i++) {
regchr[i]=0;
}
IRQa=0;
IRQCount=IRQLatch=0;
SetWriteHandler(0x8000,0xffff,Mapper27_write);
GameHBIRQHook=Mapper27_hb;
}

View File

@ -24,9 +24,8 @@ static int is48;
static DECLFW(Mapper33_write) static DECLFW(Mapper33_write)
{ {
//printf("%04x:%02x, %d\n",A,V,scanline);
A&=0xF003; A&=0xF003;
if(A>=0xA000 && A<=0xA003) if(A>=0xA000 && A<=0xA003)
VROM_BANK1(0x1000+((A&3)<<10),V); VROM_BANK1(0x1000+((A&3)<<10),V);
else switch(A) else switch(A)

View File

@ -27,9 +27,9 @@ DECLFW(Mapper86_write)
VROM_BANK8((V&3)|((V>>4)&4)); VROM_BANK8((V&3)|((V>>4)&4));
ROM_BANK32((V>>4)&3); ROM_BANK32((V>>4)&3);
} }
//else else
//if(A!=0x6000) //if(A!=0x6000)
// printf("$%04x:$%02x\n",A,V); printf("$%04x:$%02x\n",A,V);
} }
void Mapper86_init(void) void Mapper86_init(void)
{ {

View File

@ -0,0 +1,79 @@
#include "mapinc.h"
static uint8 mode;
static uint8 DRegs[4];
static SFORMAT StateRegs[]=
{
{DRegs, 4, "DREG"},
{0}
};
static void Sync(void)
{
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);
}
}
}
static DECLFW(Mapper167_write)
{
DRegs[(A>>13)&0x03]=V;
Sync();
}
static void StateRestore(int version)
{
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);
}
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);
}

View File

@ -22,62 +22,96 @@
static uint8 cmd; static uint8 cmd;
static uint8 DRegs[8]; static uint8 DRegs[8];
static SFORMAT StateRegs[]= static SFORMAT StateRegs[]=
{ {
{&cmd, 1, "CMD"}, {&cmd, 1, "CMD"},
{DRegs, 8, "DREG"}, {DRegs, 8, "DREG"},
{0} {0}
}; };
static void Sync(void) static void Sync(void)
{ {
setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
setchr8(0);
} }
static void StateRestore(int version) static void StateRestore(int version)
{ {
Sync(); Sync();
} }
static DECLFW(Write) static DECLFW(Write)
{ {
if((A&0x7300)==0x5000) switch (A&0x7300)
setprg32(0x8000,V); {
//else case 0x5100: DRegs[0]=V; Sync(); break;
//if(A==0x5200) case 0x5000: DRegs[1]=V; Sync(); break;
// printf("$%04x:$%02x\n",A,V); }
}
static DECLFW(Write2)
{
// FCEU_printf("bs %04x %02x\n",A,V);
switch (A&0x7300)
{
case 0x5200: DRegs[0]=V; Sync(); break;
case 0x5000: DRegs[1]=V; Sync(); break;
}
} }
static uint8 WRAM[8192]; static uint8 WRAM[8192];
static DECLFR(AWRAM) static DECLFR(AWRAM)
{ {
return(WRAM[A-0x6000]); return(WRAM[A-0x6000]);
} }
static DECLFW(BWRAM) static DECLFW(BWRAM)
{ {
WRAM[A-0x6000]=V; WRAM[A-0x6000]=V;
} }
static void Power(void) static void Power(void)
{ {
setchr8(0); memset(DRegs,0,8);
setprg32(0x8000,~0); DRegs[1]=0xFF;
cmd=0; cmd=0;
memset(DRegs,0,8); SetReadHandler(0x8000,0xFFFF,CartBR);
Sync(); SetWriteHandler(0x4020,0x5FFF,Write);
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x4020,0xFFFF,Write); SetWriteHandler(0x6000,0x7FFF,BWRAM);
SetReadHandler(0x6000,0x7FFF,AWRAM); Sync();
SetWriteHandler(0x6000,0x7FFF,BWRAM);
} }
static void M163HB(void)
{
if(scanline==127&&DRegs[1]&0x80)
setchr4(0x0000,1);
}
static void Power2(void)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0x5FFF,Write2);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
Sync();
}
void Mapper164_Init(CartInfo *info) void Mapper164_Init(CartInfo *info)
{ {
info->Power=Power; info->Power=Power;
GameStateRestore=StateRestore; GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper163_Init(CartInfo *info)
{
info->Power=Power2;
GameHBIRQHook=M163HB;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@ -0,0 +1,95 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 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
*
* Dragon Ball Z 2 - Gekishin Freeza! (C)
* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C)
* San Guo Zhi 2 (C)
*
*/
#include "mapinc.h"
#include "mmc3.h"
static void M199PW(uint32 A, uint8 V)
{
setprg8(A,V);
setprg8(0xC000,EXPREGS[0]);
setprg8(0xE000,EXPREGS[1]);
}
static void M199CW(uint32 A, uint8 V)
{
setchr1r((V<8)?0x10:0x00,A,V);
setchr1r((DRegBuf[0]<8)?0x10:0x00,0x0000,DRegBuf[0]);
setchr1r((EXPREGS[2]<8)?0x10:0x00,0x0400,EXPREGS[2]);
setchr1r((DRegBuf[1]<8)?0x10:0x00,0x0800,DRegBuf[1]);
setchr1r((EXPREGS[3]<8)?0x10:0x00,0x0c00,EXPREGS[3]);
}
static void M199MW(uint8 V)
{
// FCEU_printf("%02x\n",V);
switch(V&3)
{
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static DECLFW(M199Write)
{
if((A==0x8001)&&(MMC3_cmd&8))
{
// FCEU_printf("%02x=>%02x\n",MMC3_cmd,V);
EXPREGS[MMC3_cmd&3]=V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
if(A<0xC000)
MMC3_CMDWrite(A,V);
else
MMC3_IRQWrite(A,V);
}
static void M199Power(void)
{
EXPREGS[0]=~1;
EXPREGS[1]=~0;
EXPREGS[2]=1;
EXPREGS[3]=3;
GenMMC3Power();
SetWriteHandler(0x8000,0xFFFF,M199Write);
}
void Mapper199_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap=M199CW;
pwrap=M199PW;
mwrap=M199MW;
info->Power=M199Power;
int CHRRAMSize=1024*8;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
AddExState(EXPREGS, 4, 0, "EXPR");
}

View File

@ -0,0 +1,95 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 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
*
* Dragon Ball Z 2 - Gekishin Freeza! (C)
* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C)
* San Guo Zhi 2 (C)
*
*/
#include "mapinc.h"
#include "mmc3.h"
static void M252PW(uint32 A, uint8 V)
{
setprg8(A,V);
setprg8(0xC000,EXPREGS[0]);
setprg8(0xE000,EXPREGS[1]);
}
static void M252CW(uint32 A, uint8 V)
{
setchr1r((V<8)?0x10:0x00,A,V);
setchr1r((DRegBuf[0]<8)?0x10:0x00,0x0000,DRegBuf[0]);
setchr1r((EXPREGS[2]<8)?0x10:0x00,0x0400,EXPREGS[2]);
setchr1r((DRegBuf[1]<8)?0x10:0x00,0x0800,DRegBuf[1]);
setchr1r((EXPREGS[3]<8)?0x10:0x00,0x0c00,EXPREGS[3]);
}
static void M252MW(uint8 V)
{
// FCEU_printf("%02x\n",V);
switch(V&3)
{
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static DECLFW(M252Write)
{
if((A==0x8001)&&(MMC3_cmd&8))
{
// FCEU_printf("%02x=>%02x\n",MMC3_cmd,V);
EXPREGS[MMC3_cmd&3]=V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
if(A<0xC000)
MMC3_CMDWrite(A,V);
else
MMC3_IRQWrite(A,V);
}
static void M252Power(void)
{
EXPREGS[0]=~1;
EXPREGS[1]=~0;
EXPREGS[2]=1;
EXPREGS[3]=3;
GenMMC3Power();
SetWriteHandler(0x8000,0xFFFF,M252Write);
}
void Mapper252_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 128, 8, info->battery);
cwrap=M252CW;
pwrap=M252PW;
mwrap=M252MW;
info->Power=M252Power;
int CHRRAMSize=1024*8;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
AddExState(EXPREGS, 4, 0, "EXPR");
}

View File

@ -1,80 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 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
* 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 DReg;
static SFORMAT StateRegs[]=
{
{&DReg, 1, "DREG"},
{0}
};
static void Sync(void)
{
//if(!DReg)
//printf("%02x\n",DReg);
if(DReg)
{
if(DReg & 0x10)
setprg16(0x8000, (DReg & 0x7));
else
setprg16(0x8000, (DReg&0x7) | 0x8);
}
else
setprg16(0x8000, 0x7);
}
static void StateRestore(int version)
{
Sync();
}
static DECLFW(M188Write)
{
DReg = V;
Sync();
}
static DECLFR(testr)
{
return(3);
}
static void Power(void)
{
setchr8(0);
setprg8(0xc000,0xE);
setprg8(0xe000,0xF);
DReg = 0;
Sync();
SetReadHandler(0x6000,0x7FFF,testr);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M188Write);
}
void Mapper188_Init(CartInfo *info)
{
info->Power=Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
extern uint8 MMC3_cmd;
extern uint8 *WRAM;
extern uint8 *CHRRAM;
extern uint8 EXPREGS[8];
extern uint8 DRegBuf[8];
#undef IRQCount
#undef IRQLatch
#undef IRQa
extern uint8 IRQCount,IRQLatch,IRQa;
extern uint8 IRQReload;
extern void (*pwrap)(uint32 A, uint8 V);
extern void (*cwrap)(uint32 A, uint8 V);
extern void (*mwrap)(uint8 V);
void GenMMC3Power(void);
void GenMMC3Restore(int version);
void MMC3RegReset(void);
void FixMMC3PRG(int V);
void FixMMC3CHR(int V);
DECLFW(MMC3_CMDWrite);
DECLFW(MMC3_IRQWrite);
void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery);

View File

@ -30,11 +30,11 @@ void MMC5RunSoundHQ(void);
static INLINE void MMC5SPRVROM_BANK1(uint32 A,uint32 V) static INLINE void MMC5SPRVROM_BANK1(uint32 A,uint32 V)
{ {
if(CHRptr[0]) if(CHRptr[0])
{ {
V&=CHRmask1[0]; V&=CHRmask1[0];
MMC5SPRVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A); MMC5SPRVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);
} }
} }
static INLINE void MMC5BGVROM_BANK1(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask1[0];MMC5BGVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);}} static INLINE void MMC5BGVROM_BANK1(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask1[0];MMC5BGVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);}}
@ -52,7 +52,7 @@ static uint8 PRGBanks[4];
static uint8 WRAMPage; static uint8 WRAMPage;
static uint8 CHRBanksA[8], CHRBanksB[4]; static uint8 CHRBanksA[8], CHRBanksB[4];
static uint8 WRAMMaskEnable[2]; static uint8 WRAMMaskEnable[2];
static uint8 ABMode; /* A=0, B=1 */ static uint8 ABMode; /* A=0, B=1 */
static uint8 IRQScanline,IRQEnable; static uint8 IRQScanline,IRQEnable;
static uint8 CHRMode, NTAMirroring, NTFill, ATFill; static uint8 CHRMode, NTAMirroring, NTFill, ATFill;
@ -76,8 +76,8 @@ static void MMC5CHRA(void);
static void MMC5CHRB(void); static void MMC5CHRB(void);
typedef struct __cartdata { typedef struct __cartdata {
uint32 crc32; uint32 crc32;
uint8 size; uint8 size;
} cartdata; } cartdata;
@ -87,316 +87,300 @@ typedef struct __cartdata {
#define MMC5_NOCARTS 14 #define MMC5_NOCARTS 14
cartdata MMC5CartList[MMC5_NOCARTS]= cartdata MMC5CartList[MMC5_NOCARTS]=
{ {
{0x9c18762b,2}, /* L'Empereur */ {0x9c18762b,2}, /* L'Empereur */
{0x26533405,2}, {0x26533405,2},
{0x6396b988,2}, {0x6396b988,2},
{0xaca15643,2}, /* Uncharted Waters */ {0xaca15643,2}, /* Uncharted Waters */
{0xfe3488d1,2}, /* Dai Koukai Jidai */ {0xfe3488d1,2}, /* Dai Koukai Jidai */
{0x15fe6d0f,2}, /* BKAC */ {0x15fe6d0f,2}, /* BKAC */
{0x39f2ce4b,2}, /* Suikoden */ {0x39f2ce4b,2}, /* Suikoden */
{0x8ce478db,2}, /* Nobunaga's Ambition 2 */ {0x8ce478db,2}, /* Nobunaga's Ambition 2 */
{0xeee9a682,2}, {0xeee9a682,2},
{0x1ced086f,2}, /* Ishin no Arashi */ {0x1ced086f,2}, /* Ishin no Arashi */
{0xf540677b,4}, /* Nobunaga...Bushou Fuuun Roku */ {0xf540677b,4}, /* Nobunaga...Bushou Fuuun Roku */
{0x6f4e4312,4}, /* Aoki Ookami..Genchou */ {0x6f4e4312,4}, /* Aoki Ookami..Genchou */
{0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */ {0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */
{0x184c2124,4}, /* Sangokushi 2 */ {0x184c2124,4}, /* Sangokushi 2 */
}; };
int DetectMMC5WRAMSize(uint32 crc32) int DetectMMC5WRAMSize(uint32 crc32)
{ {
int x; int x;
for(x=0;x<MMC5_NOCARTS;x++)
for(x=0;x<MMC5_NOCARTS;x++) if(crc32==MMC5CartList[x].crc32)
if(crc32==MMC5CartList[x].crc32) {
{ FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n"); return(MMC5CartList[x].size*8);
return(MMC5CartList[x].size*8); }
} return(8);
return(8);
} }
static void BuildWRAMSizeTable(void) static void BuildWRAMSizeTable(void)
{ {
int x; int x;
for(x=0;x<8;x++)
for(x=0;x<8;x++)
{
switch(MMC5WRAMsize)
{ {
case 0:MMC5WRAMIndex[x]=255;break; switch(MMC5WRAMsize)
case 1:MMC5WRAMIndex[x]=(x>3)?255:0;break; {
case 2:MMC5WRAMIndex[x]=(x&4)>>2;break; case 0: MMC5WRAMIndex[x]=255; break;
case 4:MMC5WRAMIndex[x]=(x>3)?255:(x&3);break; case 1: MMC5WRAMIndex[x]=(x>3)?255:0; break;
case 2: MMC5WRAMIndex[x]=(x&4)>>2; break;
case 4: MMC5WRAMIndex[x]=(x>3)?255:(x&3); break;
}
} }
}
} }
static void MMC5CHRA(void) static void MMC5CHRA(void)
{ {
int x; int x;
switch(mmc5vsize&3) switch(mmc5vsize&3)
{ {
case 0:setchr8(CHRBanksA[7]); case 0: setchr8(CHRBanksA[7]);
MMC5SPRVROM_BANK8(CHRBanksA[7]); MMC5SPRVROM_BANK8(CHRBanksA[7]);
break; break;
case 1:setchr4(0x0000,CHRBanksA[3]); case 1: setchr4(0x0000,CHRBanksA[3]);
setchr4(0x1000,CHRBanksA[7]); setchr4(0x1000,CHRBanksA[7]);
MMC5SPRVROM_BANK4(0x0000,CHRBanksA[3]); MMC5SPRVROM_BANK4(0x0000,CHRBanksA[3]);
MMC5SPRVROM_BANK4(0x1000,CHRBanksA[7]); MMC5SPRVROM_BANK4(0x1000,CHRBanksA[7]);
break; break;
case 2:setchr2(0x0000,CHRBanksA[1]); case 2: setchr2(0x0000,CHRBanksA[1]);
setchr2(0x0800,CHRBanksA[3]); setchr2(0x0800,CHRBanksA[3]);
setchr2(0x1000,CHRBanksA[5]); setchr2(0x1000,CHRBanksA[5]);
setchr2(0x1800,CHRBanksA[7]); setchr2(0x1800,CHRBanksA[7]);
MMC5SPRVROM_BANK2(0x0000,CHRBanksA[1]); MMC5SPRVROM_BANK2(0x0000,CHRBanksA[1]);
MMC5SPRVROM_BANK2(0x0800,CHRBanksA[3]); MMC5SPRVROM_BANK2(0x0800,CHRBanksA[3]);
MMC5SPRVROM_BANK2(0x1000,CHRBanksA[5]); MMC5SPRVROM_BANK2(0x1000,CHRBanksA[5]);
MMC5SPRVROM_BANK2(0x1800,CHRBanksA[7]); MMC5SPRVROM_BANK2(0x1800,CHRBanksA[7]);
break; break;
case 3: case 3: for(x=0;x<8;x++)
for(x=0;x<8;x++) {
{ setchr1(x<<10,CHRBanksA[x]);
setchr1(x<<10,CHRBanksA[x]); MMC5SPRVROM_BANK1(x<<10,CHRBanksA[x]);
MMC5SPRVROM_BANK1(x<<10,CHRBanksA[x]); }
} break;
break; }
}
} }
static void MMC5CHRB(void) static void MMC5CHRB(void)
{ {
int x; int x;
switch(mmc5vsize&3) switch(mmc5vsize&3)
{ {
case 0: case 0: setchr8(CHRBanksB[3]);
setchr8(CHRBanksB[3]); MMC5BGVROM_BANK8(CHRBanksB[3]);
MMC5BGVROM_BANK8(CHRBanksB[3]); break;
break; case 1: setchr4(0x0000,CHRBanksB[3]);
setchr4(0x1000,CHRBanksB[3]);
case 1: MMC5BGVROM_BANK4(0x0000,CHRBanksB[3]);
setchr4(0x0000,CHRBanksB[3]); MMC5BGVROM_BANK4(0x1000,CHRBanksB[3]);
setchr4(0x1000,CHRBanksB[3]); break;
MMC5BGVROM_BANK4(0x0000,CHRBanksB[3]); case 2: setchr2(0x0000,CHRBanksB[1]);
MMC5BGVROM_BANK4(0x1000,CHRBanksB[3]); setchr2(0x0800,CHRBanksB[3]);
break; setchr2(0x1000,CHRBanksB[1]);
setchr2(0x1800,CHRBanksB[3]);
case 2: MMC5BGVROM_BANK2(0x0000,CHRBanksB[1]);
setchr2(0x0000,CHRBanksB[1]); MMC5BGVROM_BANK2(0x0800,CHRBanksB[3]);
setchr2(0x0800,CHRBanksB[3]); MMC5BGVROM_BANK2(0x1000,CHRBanksB[1]);
setchr2(0x1000,CHRBanksB[1]); MMC5BGVROM_BANK2(0x1800,CHRBanksB[3]);
setchr2(0x1800,CHRBanksB[3]); break;
MMC5BGVROM_BANK2(0x0000,CHRBanksB[1]); case 3: for(x=0;x<8;x++)
MMC5BGVROM_BANK2(0x0800,CHRBanksB[3]); {
MMC5BGVROM_BANK2(0x1000,CHRBanksB[1]); setchr1(x<<10,CHRBanksB[x&3]);
MMC5BGVROM_BANK2(0x1800,CHRBanksB[3]); MMC5BGVROM_BANK1(x<<10,CHRBanksB[x&3]);
break; }
case 3: break;
for(x=0;x<8;x++) }
{
setchr1(x<<10,CHRBanksB[x&3]);
MMC5BGVROM_BANK1(x<<10,CHRBanksB[x&3]);
}
break;
}
} }
static void FASTAPASS(2) MMC5WRAM(uint32 A, uint32 V) static void FASTAPASS(2) MMC5WRAM(uint32 A, uint32 V)
{ {
//printf("%02x\n",V); //printf("%02x\n",V);
V=MMC5WRAMIndex[V&7]; V=MMC5WRAMIndex[V&7];
if(V!=255) if(V!=255)
{ {
setprg8r(0x10,A,V); setprg8r(0x10,A,V);
MMC5MemIn[(A-0x6000)>>13]=1; MMC5MemIn[(A-0x6000)>>13]=1;
} }
else else
MMC5MemIn[(A-0x6000)>>13]=0; MMC5MemIn[(A-0x6000)>>13]=0;
} }
static void MMC5PRG(void) static void MMC5PRG(void)
{ {
int x; int x;
switch(mmc5psize&3)
switch(mmc5psize&3) {
{ case 0: MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=
case 0: MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]= setprg32(0x8000,((PRGBanks[1]&0x7F)>>2));
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1; for(x=0;x<4;x++)
setprg32(0x8000,((PRGBanks[1]&0x7F)>>2)); MMC5MemIn[1+x]=1;
for(x=0;x<4;x++) break;
MMC5MemIn[1+x]=1; case 1: if(PRGBanks[1]&0x80)
break; {
case 1: MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
if(PRGBanks[1]&0x80) setprg16(0x8000,(PRGBanks[1]>>1));
{ MMC5MemIn[1]=MMC5MemIn[2]=1;
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1; }
setprg16(0x8000,(PRGBanks[1]>>1)); else
MMC5MemIn[1]=MMC5MemIn[2]=1; {
} MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
else MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
{ MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0; }
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE); MMC5MemIn[3]=MMC5MemIn[4]=1;
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1); MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
} setprg16(0xC000,(PRGBanks[3]&0x7F)>>1);
MMC5MemIn[3]=MMC5MemIn[4]=1; break;
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1; case 2: if(PRGBanks[1]&0x80)
setprg16(0xC000,(PRGBanks[3]&0x7F)>>1); {
break; MMC5MemIn[1]=MMC5MemIn[2]=1;
case 2: MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
if(PRGBanks[1]&0x80) setprg16(0x8000,(PRGBanks[1]&0x7F)>>1);
{ }
MMC5MemIn[1]=MMC5MemIn[2]=1; else
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1; {
setprg16(0x8000,(PRGBanks[1]&0x7F)>>1); MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
} MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
else MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
{ }
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0; if(PRGBanks[2]&0x80)
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE); {
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1); MMC5ROMWrProtect[2]=1;
} MMC5MemIn[3]=1;
if(PRGBanks[2]&0x80) setprg8(0xC000,PRGBanks[2]&0x7F);
{MMC5ROMWrProtect[2]=1;MMC5MemIn[3]=1;setprg8(0xC000,PRGBanks[2]&0x7F);} }
else else
{MMC5ROMWrProtect[2]=0;MMC5WRAM(0xC000,PRGBanks[2]&7);} {
MMC5MemIn[4]=1; MMC5ROMWrProtect[2]=0;
MMC5ROMWrProtect[3]=1; MMC5WRAM(0xC000,PRGBanks[2]&7);
setprg8(0xE000,PRGBanks[3]&0x7F); }
break; MMC5MemIn[4]=1;
case 3: MMC5ROMWrProtect[3]=1;
for(x=0;x<3;x++) setprg8(0xE000,PRGBanks[3]&0x7F);
if(PRGBanks[x]&0x80) break;
{ case 3: for(x=0;x<3;x++)
MMC5ROMWrProtect[x]=1; if(PRGBanks[x]&0x80)
setprg8(0x8000+(x<<13),PRGBanks[x]&0x7F); {
MMC5MemIn[1+x]=1; MMC5ROMWrProtect[x]=1;
} setprg8(0x8000+(x<<13),PRGBanks[x]&0x7F);
else MMC5MemIn[1+x]=1;
{ }
MMC5ROMWrProtect[x]=0; else
MMC5WRAM(0x8000+(x<<13),PRGBanks[x]&7); {
} MMC5ROMWrProtect[x]=0;
MMC5MemIn[4]=1; MMC5WRAM(0x8000+(x<<13),PRGBanks[x]&7);
MMC5ROMWrProtect[3]=1; }
setprg8(0xE000,PRGBanks[3]&0x7F); MMC5MemIn[4]=1;
break; MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
} }
} }
static DECLFW(Mapper5_write) static DECLFW(Mapper5_write)
{ {
if(A >= 0x5120 && A<=0x5127) if(A>=0x5120&&A<=0x5127)
{ {
ABMode = 0; ABMode = 0;
CHRBanksA[A&7]=V; CHRBanksA[A&7]=V;
MMC5CHRA(); MMC5CHRA();
} }
else switch(A) else switch(A)
{ {
default: case 0x5105: {
//printf("$%04x, $%02x\n",A,V); int x;
break; for(x=0;x<4;x++)
case 0x5105: {
{ switch((V>>(x<<1))&3)
int x; {
for(x=0;x<4;x++) case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break;
{ case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break;
switch((V>>(x<<1))&3) case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
{ case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break; }
case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break; }
case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
} }
} NTAMirroring=V;
} break;
NTAMirroring=V; case 0x5113: WRAMPage=V;MMC5WRAM(0x6000,V&7);break;
break; case 0x5100: mmc5psize=V;MMC5PRG();break;
case 0x5101: mmc5vsize=V;
case 0x5113:WRAMPage=V;MMC5WRAM(0x6000,V&7);break; if(!ABMode)
case 0x5100:mmc5psize=V;MMC5PRG();break; { MMC5CHRB();MMC5CHRA();}
case 0x5101:mmc5vsize=V; else
if(!ABMode) { MMC5CHRA();MMC5CHRB();}
{MMC5CHRB();MMC5CHRA();} break;
else case 0x5114:
{MMC5CHRA();MMC5CHRB();} case 0x5115:
break; case 0x5116:
case 0x5117: PRGBanks[A&3]=V;MMC5PRG();break;
case 0x5114: case 0x5128:
case 0x5115: case 0x5129:
case 0x5116: case 0x512a:
case 0x5117: case 0x512b: ABMode=1;
PRGBanks[A&3]=V;MMC5PRG();break; CHRBanksB[A&3]=V;
case 0x5128: MMC5CHRB();
case 0x5129: break;
case 0x512a: case 0x5102: WRAMMaskEnable[0]=V;break;
case 0x512b:ABMode=1; case 0x5103: WRAMMaskEnable[1]=V;break;
CHRBanksB[A&3]=V; case 0x5104: CHRMode=V;MMC5HackCHRMode=V&3;break;
MMC5CHRB(); case 0x5106: if(V!=NTFill)
break; {
case 0x5102:WRAMMaskEnable[0]=V;break; uint32 t;
case 0x5103:WRAMMaskEnable[1]=V;break; t=V|(V<<8)|(V<<16)|(V<<24);
case 0x5104:CHRMode=V;MMC5HackCHRMode=V&3;break; FCEU_dwmemset(MMC5fill,t,0x3c0);
case 0x5106:if(V!=NTFill) }
{ NTFill=V;
uint32 t; break;
t=V|(V<<8)|(V<<16)|(V<<24); case 0x5107: if(V!=ATFill)
FCEU_dwmemset(MMC5fill,t,0x3c0); {
} unsigned char moop;
NTFill=V; uint32 t;
break; moop=V|(V<<2)|(V<<4)|(V<<6);
case 0x5107:if(V!=ATFill) t=moop|(moop<<8)|(moop<<16)|(moop<<24);
{ FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
unsigned char moop; }
uint32 t; ATFill=V;
moop=V|(V<<2)|(V<<4)|(V<<6); break;
t=moop|(moop<<8)|(moop<<16)|(moop<<24); case 0x5200: MMC5HackSPMode=V;break;
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40); case 0x5201: MMC5HackSPScroll=(V>>3)&0x1F;break;
} case 0x5202: MMC5HackSPPage=V&0x3F;break;
ATFill=V; case 0x5203: X6502_IRQEnd(FCEU_IQEXT);IRQScanline=V;break;
break; case 0x5204: X6502_IRQEnd(FCEU_IQEXT);IRQEnable=V&0x80;break;
case 0x5200:MMC5HackSPMode=V;break; case 0x5205: mul[0]=V;break;
case 0x5201:MMC5HackSPScroll=(V>>3)&0x1F;break; case 0x5206: mul[1]=V;break;
case 0x5202:MMC5HackSPPage=V&0x3F;break;
case 0x5203:X6502_IRQEnd(FCEU_IQEXT);IRQScanline=V;break;
case 0x5204:X6502_IRQEnd(FCEU_IQEXT);IRQEnable=V&0x80;break;
case 0x5205:mul[0]=V;break;
case 0x5206:mul[1]=V;break;
} }
} }
static DECLFR(MMC5_ReadROMRAM) static DECLFR(MMC5_ReadROMRAM)
{ {
if(MMC5MemIn[(A-0x6000)>>13]) if(MMC5MemIn[(A-0x6000)>>13])
return Page[A>>11][A]; return Page[A>>11][A];
else else
return X.DB; return X.DB;
} }
static DECLFW(MMC5_WriteROMRAM) static DECLFW(MMC5_WriteROMRAM)
{ {
if(A>=0x8000) if(A>=0x8000)
if(MMC5ROMWrProtect[(A-0x8000)>>13]) if(MMC5ROMWrProtect[(A-0x8000)>>13]) return;
return; if(MMC5MemIn[(A-0x6000)>>13])
if(MMC5MemIn[(A-0x6000)>>13]) if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6) Page[A>>11][A]=V;
if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6)
Page[A>>11][A]=V;
} }
static DECLFW(MMC5_ExRAMWr) static DECLFW(MMC5_ExRAMWr)
{ {
if(MMC5HackCHRMode!=3) if(MMC5HackCHRMode!=3)
ExRAM[A&0x3ff]=V; ExRAM[A&0x3ff]=V;
} }
static DECLFR(MMC5_ExRAMRd) static DECLFR(MMC5_ExRAMRd)
@ -410,60 +394,59 @@ static DECLFR(MMC5_ExRAMRd)
static DECLFR(MMC5_read) static DECLFR(MMC5_read)
{ {
switch(A) switch(A)
{ {
//default:printf("$%04x\n",A);break; case 0x5204: X6502_IRQEnd(FCEU_IQEXT);
case 0x5204:X6502_IRQEnd(FCEU_IQEXT); {
{ uint8 x;
uint8 x; x=MMC5IRQR;
x=MMC5IRQR; if(!fceuindbg)
if(!fceuindbg) MMC5IRQR&=0x40;
MMC5IRQR&=0x40; return x;
return x; }
} case 0x5205: return (mul[0]*mul[1]);
case 0x5205:return (mul[0]*mul[1]); case 0x5206: return ((mul[0]*mul[1])>>8);
case 0x5206:return ((mul[0]*mul[1])>>8); }
} return(X.DB);
return(X.DB);
} }
void MMC5Synco(void) void MMC5Synco(void)
{ {
int x; int x;
MMC5PRG(); MMC5PRG();
for(x=0;x<4;x++) for(x=0;x<4;x++)
{ {
switch((NTAMirroring>>(x<<1))&3) switch((NTAMirroring>>(x<<1))&3)
{ {
case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break; case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break;
case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break; case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break;
case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break; case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break; case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
} }
} }
MMC5WRAM(0x6000,WRAMPage&7); MMC5WRAM(0x6000,WRAMPage&7);
if(!ABMode) if(!ABMode)
{ {
MMC5CHRB(); MMC5CHRB();
MMC5CHRA(); MMC5CHRA();
} }
else else
{ {
MMC5CHRA(); MMC5CHRA();
MMC5CHRB(); MMC5CHRB();
} }
{ {
uint32 t; uint32 t;
t=NTFill|(NTFill<<8)|(NTFill<<16)|(NTFill<<24); t=NTFill|(NTFill<<8)|(NTFill<<16)|(NTFill<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0); FCEU_dwmemset(MMC5fill,t,0x3c0);
} }
{ {
unsigned char moop; unsigned char moop;
uint32 t; uint32 t;
moop=ATFill|(ATFill<<2)|(ATFill<<4)|(ATFill<<6); moop=ATFill|(ATFill<<2)|(ATFill<<4)|(ATFill<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24); t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40); FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
} }
X6502_IRQEnd(FCEU_IQEXT); X6502_IRQEnd(FCEU_IQEXT);
MMC5HackCHRMode=CHRMode&3; MMC5HackCHRMode=CHRMode&3;
@ -471,47 +454,41 @@ void MMC5Synco(void)
void MMC5_hb(int scanline) void MMC5_hb(int scanline)
{ {
//printf("%d:%d, ",scanline,MMC5LineCounter);
if(scanline==240) if(scanline==240)
{ {
// printf("\n%d:%d\n",scanline,MMC5LineCounter); MMC5LineCounter=0;
MMC5LineCounter=0; MMC5IRQR=0x40;
MMC5IRQR=0x40; return;
return;
} }
if(MMC5LineCounter<240) if(MMC5LineCounter<240)
{ {
if(MMC5LineCounter==IRQScanline) if(MMC5LineCounter==IRQScanline)
{ {
MMC5IRQR|=0x80; MMC5IRQR|=0x80;
if(IRQEnable&0x80) if(IRQEnable&0x80)
X6502_IRQBegin(FCEU_IQEXT); X6502_IRQBegin(FCEU_IQEXT);
} }
MMC5LineCounter++; MMC5LineCounter++;
} }
// printf("%d:%d\n",MMC5LineCounter,scanline); if(MMC5LineCounter==240)
if(MMC5LineCounter==240) MMC5IRQR=0;
MMC5IRQR=0;
} }
void MMC5_StateRestore(int version) void MMC5_StateRestore(int version)
{ {
MMC5Synco(); MMC5Synco();
} }
typedef struct { typedef struct {
uint16 wl[2]; uint16 wl[2];
uint8 env[2]; uint8 env[2];
uint8 enable; uint8 enable;
uint8 running; uint8 running;
uint8 raw; uint8 raw;
uint8 rawcontrol; uint8 rawcontrol;
int32 dcount[2];
int32 dcount[2]; int32 BC[3];
int32 vcount[2];
int32 BC[3];
int32 vcount[2];
} MMC5APU; } MMC5APU;
static MMC5APU MMC5Sound; static MMC5APU MMC5Sound;
@ -519,65 +496,65 @@ static MMC5APU MMC5Sound;
static void Do5PCM() static void Do5PCM()
{ {
int32 V; int32 V;
int32 start,end; int32 start,end;
start=MMC5Sound.BC[2]; start=MMC5Sound.BC[2];
end=(SOUNDTS<<16)/soundtsinc; end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return; if(end<=start) return;
MMC5Sound.BC[2]=end; MMC5Sound.BC[2]=end;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw) if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
for(V=start;V<end;V++) for(V=start;V<end;V++)
Wave[V>>4]+=MMC5Sound.raw<<1; Wave[V>>4]+=MMC5Sound.raw<<1;
} }
static void Do5PCMHQ() static void Do5PCMHQ()
{ {
int32 V; int32 V;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw) if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
for(V=MMC5Sound.BC[2];V<SOUNDTS;V++) for(V=MMC5Sound.BC[2];V<SOUNDTS;V++)
WaveHi[V]+=MMC5Sound.raw<<5; WaveHi[V]+=MMC5Sound.raw<<5;
MMC5Sound.BC[2]=SOUNDTS; MMC5Sound.BC[2]=SOUNDTS;
} }
static DECLFW(Mapper5_SW) static DECLFW(Mapper5_SW)
{ {
A&=0x1F; A&=0x1F;
GameExpSound.Fill=MMC5RunSound; GameExpSound.Fill=MMC5RunSound;
GameExpSound.HiFill=MMC5RunSoundHQ; GameExpSound.HiFill=MMC5RunSoundHQ;
switch(A) switch(A)
{ {
case 0x10:if(psfun) psfun();MMC5Sound.rawcontrol=V;break; case 0x10:if(psfun) psfun();MMC5Sound.rawcontrol=V;break;
case 0x11:if(psfun) psfun();MMC5Sound.raw=V;break; case 0x11:if(psfun) psfun();MMC5Sound.raw=V;break;
case 0x0: case 0x0:
case 0x4://printf("%04x:$%02x\n",A,V&0x30); case 0x4://printf("%04x:$%02x\n",A,V&0x30);
if(sfun) sfun(A>>2); if(sfun) sfun(A>>2);
MMC5Sound.env[A>>2]=V; MMC5Sound.env[A>>2]=V;
break; break;
case 0x2: case 0x2:
case 0x6:if(sfun) sfun(A>>2); case 0x6: if(sfun) sfun(A>>2);
MMC5Sound.wl[A>>2]&=~0x00FF; MMC5Sound.wl[A>>2]&=~0x00FF;
MMC5Sound.wl[A>>2]|=V&0xFF; MMC5Sound.wl[A>>2]|=V&0xFF;
break; break;
case 0x3: case 0x3:
case 0x7://printf("%04x:$%02x\n",A,V>>3); case 0x7://printf("%04x:$%02x\n",A,V>>3);
MMC5Sound.wl[A>>2]&=~0x0700; MMC5Sound.wl[A>>2]&=~0x0700;
MMC5Sound.wl[A>>2]|=(V&0x07)<<8; MMC5Sound.wl[A>>2]|=(V&0x07)<<8;
MMC5Sound.running|=1<<(A>>2); MMC5Sound.running|=1<<(A>>2);
break; break;
case 0x15:if(sfun) case 0x15:if(sfun)
{ {
sfun(0); sfun(0);
sfun(1); sfun(1);
} }
MMC5Sound.running&=V; MMC5Sound.running&=V;
MMC5Sound.enable=V; MMC5Sound.enable=V;
//printf("%02x\n",V); //printf("%02x\n",V);
break; break;
} }
} }
@ -763,20 +740,20 @@ static SFORMAT MMC5_StateRegs[]={
{ CHRBanksA, 8, "CHRA"}, { CHRBanksA, 8, "CHRA"},
{ CHRBanksB, 4, "CHRB"}, { CHRBanksB, 4, "CHRB"},
{ &WRAMPage, 1, "WRMP"}, { &WRAMPage, 1, "WRMP"},
{ WRAMMaskEnable, 2, "WRME"}, { WRAMMaskEnable, 2, "WRME"},
{ &ABMode, 1, "ABMD"}, { &ABMode, 1, "ABMD"},
{ &IRQScanline, 1, "IRQS"}, { &IRQScanline, 1, "IRQS"},
{ &IRQEnable, 1, "IRQE"}, { &IRQEnable, 1, "IRQE"},
{ &CHRMode, 1, "CHRM"}, { &CHRMode, 1, "CHRM"},
{ &NTAMirroring, 1, "NTAM"}, { &NTAMirroring, 1, "NTAM"},
{ &NTFill, 1, "NTFL"}, { &NTFill, 1, "NTFL"},
{ &ATFill, 1, "ATFL"}, { &ATFill, 1, "ATFL"},
{ &MMC5Sound.wl[0], 2|FCEUSTATE_RLSB, "SDW0"}, { &MMC5Sound.wl[0], 2|FCEUSTATE_RLSB, "SDW0"},
{ &MMC5Sound.wl[1], 2|FCEUSTATE_RLSB, "SDW1"}, { &MMC5Sound.wl[1], 2|FCEUSTATE_RLSB, "SDW1"},
{ MMC5Sound.env, 2, "SDEV"}, { MMC5Sound.env, 2, "SDEV"},
{ &MMC5Sound.enable, 1, "SDEN"}, { &MMC5Sound.enable, 1, "SDEN"},
{ &MMC5Sound.running, 1, "SDRU"}, { &MMC5Sound.running, 1, "SDRU"},
{ &MMC5Sound.raw, 1, "SDRW"}, { &MMC5Sound.raw, 1, "SDRW"},
{ &MMC5Sound.rawcontrol, 1, "SDRC"}, { &MMC5Sound.rawcontrol, 1, "SDRC"},
{0} {0}

View File

@ -191,21 +191,18 @@ void FCEUMOV_AddJoy(uint8 *js)
tmp &= 0x3; tmp &= 0x3;
ti=0; ti=0;
{ int tmpfix = tmp;
int tmpfix = tmp; while(tmp--) { nextts |= fgetc(slots[-1 - current]) << (ti * 8); ti++; }
while(tmp--) { nextts |= fgetc(slots[-1 - current]) << (ti * 8); ti++; }
// This fixes a bug in movies recorded before version 0.98.11 // This fixes a bug in movies recorded before version 0.98.11
// It's probably not necessary, but it may keep away CRAZY PEOPLE who recorded // It's probably not necessary, but it may keep away CRAZY PEOPLE who recorded
// movies on <= 0.98.10 and don't work on playback. // movies on <= 0.98.10 and don't work on playback.
if(tmpfix == 1 && !nextts) if(tmpfix == 1 && !nextts)
{nextts |= fgetc(slots[-1 - current])<<8; } {nextts |= fgetc(slots[-1 - current])<<8; }
else if(tmpfix == 2 && !nextts) {nextts |= fgetc(slots[-1 - current])<<16; } else if(tmpfix == 2 && !nextts) {nextts |= fgetc(slots[-1 - current])<<16; }
framets = 0;
nextd = d;
}
framets = 0;
nextd = d;
} }
memcpy(js,joop,4); memcpy(js,joop,4);
} }

View File

@ -173,7 +173,9 @@ static FILE *FetchFile(uint32 remlen)
if(!FCEUD_RecvData(cbuf, clen)) if(!FCEUD_RecvData(cbuf, clen))
{ {
NetError(); NetError();
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
fclose(fp); fclose(fp);
free(cbuf); free(cbuf);
free(fn); free(fn);
@ -184,7 +186,9 @@ static FILE *FetchFile(uint32 remlen)
if(len > 500000) // Another sanity check if(len > 500000) // Another sanity check
{ {
NetError(); NetError();
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
fclose(fp); fclose(fp);
free(cbuf); free(cbuf);
free(fn); free(fn);
@ -196,7 +200,9 @@ static FILE *FetchFile(uint32 remlen)
fwrite(buf, 1, len, fp); fwrite(buf, 1, len, fp);
free(buf); free(buf);
fseek(fp, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
free(fn); free(fn);
return(fp); return(fp);
} }
@ -283,18 +289,24 @@ void NetplayUpdate(uint8 *joyp)
fclose(fp); fclose(fp);
if(!FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn)) if(!FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn))
{ {
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
free(fn); free(fn);
return; return;
} }
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
free(fn); free(fn);
} }
else else
{ {
fclose(fp); fclose(fp);
FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy? Now!"); FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy? Now!");
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
free(fn); free(fn);
return; return;
} }

View File

@ -350,22 +350,22 @@ case 0xAB: LD_IM(_A|=0xEE;AND;_X=_A);
case 0xCB: LD_IM(AXS); case 0xCB: LD_IM(AXS);
/* DCP */ /* DCP */
case 0xC7: RMW_ZP(DEC;CMP); case 0xC7: LD_ZP(DEC;CMP);
case 0xD7: RMW_ZPX(DEC;CMP); case 0xD7: LD_ZPX(DEC;CMP);
case 0xCF: RMW_AB(DEC;CMP); case 0xCF: LD_AB(DEC;CMP);
case 0xDF: RMW_ABX(DEC;CMP); case 0xDF: LD_ABX(DEC;CMP);
case 0xDB: RMW_ABY(DEC;CMP); case 0xDB: LD_ABY(DEC;CMP);
case 0xC3: RMW_IX(DEC;CMP); case 0xC3: LD_IX(DEC;CMP);
case 0xD3: RMW_IY(DEC;CMP); case 0xD3: LD_IY(DEC;CMP);
/* ISB */ /* ISC */
case 0xE7: RMW_ZP(INC;SBC); case 0xE7: LD_ZP(INC;SBC);
case 0xF7: RMW_ZPX(INC;SBC); case 0xF7: LD_ZPX(INC;SBC);
case 0xEF: RMW_AB(INC;SBC); case 0xEF: LD_AB(INC;SBC);
case 0xFF: RMW_ABX(INC;SBC); case 0xFF: LD_ABX(INC;SBC);
case 0xFB: RMW_ABY(INC;SBC); case 0xFB: LD_ABY(INC;SBC);
case 0xE3: RMW_IX(INC;SBC); case 0xE3: LD_IX(INC;SBC);
case 0xF3: RMW_IY(INC;SBC); case 0xF3: LD_IY(INC;SBC);
/* DOP */ /* DOP */

View File

@ -153,10 +153,7 @@ static DECLFR(A2002)
FCEUPPU_LineUpdate(); FCEUPPU_LineUpdate();
ret = PPU_status; ret = PPU_status;
ret|=PPUGenLatch&0x1F; ret|=PPUGenLatch&0x1F;
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg) if(!fceuindbg)
#endif
{ {
vtoggle=0; vtoggle=0;
PPU_status&=0x7F; PPU_status&=0x7F;
@ -205,9 +202,7 @@ static DECLFR(A2007)
ret=VRAMBuffer; ret=VRAMBuffer;
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg) if(!fceuindbg)
#endif
{ {
if(PPU_hook) PPU_hook(tmp); if(PPU_hook) PPU_hook(tmp);
PPUGenLatch=VRAMBuffer; PPUGenLatch=VRAMBuffer;
@ -220,9 +215,7 @@ static DECLFR(A2007)
VRAMBuffer=vnapage[(tmp>>10)&0x3][tmp&0x3FF]; VRAMBuffer=vnapage[(tmp>>10)&0x3][tmp&0x3FF];
} }
} }
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg) if(!fceuindbg)
#endif
{ {
if (INC32) RefreshAddr+=32; if (INC32) RefreshAddr+=32;
else RefreshAddr++; else RefreshAddr++;
@ -381,7 +374,6 @@ static int tofix=0;
static void ResetRL(uint8 *target) static void ResetRL(uint8 *target)
{ {
memset(target,0xFF,256);
if(InputScanlineHook) if(InputScanlineHook)
InputScanlineHook(0,0,0,0); InputScanlineHook(0,0,0,0);
Plinef=target; Plinef=target;
@ -396,14 +388,11 @@ static uint8 sprlinebuf[256+8];
void FCEUPPU_LineUpdate(void) void FCEUPPU_LineUpdate(void)
{ {
#ifdef FCEUDEF_DEBUGGER if(Pline && !fceuindbg)
if(!fceuindbg) {
#endif int l=GETLASTPIXEL;
if(Pline) RefreshLine(l);
{ }
int l=GETLASTPIXEL;
RefreshLine(l);
}
} }
static int tileview=0; static int tileview=0;
@ -473,20 +462,14 @@ static void CheckSpriteHit(int p)
int x; int x;
if(sphitx==0x100) return; if(sphitx==0x100) return;
for(x=sphitx;x<(sphitx+8) && x<l;x++) for(x=sphitx;x<(sphitx+8) && x<l;x++)
{
if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64)) if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64))
{ {
PPU_status|=0x40; PPU_status|=0x40;
//printf("Ha: %d, %d, Hita: %d, %d, %d, %d, %d\n",p,p&~7,scanline,GETLASTPIXEL-16,&Plinef[x],Pline,Pline-Plinef); //printf("Ha: %d, %d, Hita: %d, %d, %d, %d, %d\n",p,p&~7,scanline,GETLASTPIXEL-16,&Plinef[x],Pline,Pline-Plinef);
//printf("%d\n",GETLASTPIXEL-16);
//if(Plinef[x] == 0xFF)
//printf("PL: %d, %02x\n",scanline, Plinef[x]);
sphitx=0x100; sphitx=0x100;
break; break;
} }
}
} }
static int spork=0; /* spork the world. Any sprites on this line? static int spork=0; /* spork the world. Any sprites on this line?
Then this will be set to 1. Needed for zapper Then this will be set to 1. Needed for zapper
@ -514,16 +497,6 @@ static void FASTAPASS(1) RefreshLine(int lastpixel)
function. */ function. */
if(norecurse) return; if(norecurse) return;
if(sphitx != 0x100 && !(PPU_status&0x40))
{
if((sphitx < (lastpixel-16)) && !(sphitx < ((lasttile - 2)*8)))
{
//printf("OK: %d\n",scanline);
lasttile++;
}
}
if(lasttile>34) lasttile=34; if(lasttile>34) lasttile=34;
numtiles=lasttile-firsttile; numtiles=lasttile-firsttile;
@ -687,11 +660,7 @@ static void FASTAPASS(1) RefreshLine(int lastpixel)
tofix=0; tofix=0;
} }
//CheckSpriteHit(lasttile*8); //lasttile*8); //lastpixel); CheckSpriteHit(lasttile*8); //lasttile*8); //lastpixel);
CheckSpriteHit(lastpixel); /* This only works right because
of a hack earlier in this function.
*/
if(InputScanlineHook && (lastpixel-16)>=0) if(InputScanlineHook && (lastpixel-16)>=0)
{ {
InputScanlineHook(Plinef,spork?sprlinebuf:0,linestartts,lasttile*8-16); InputScanlineHook(Plinef,spork?sprlinebuf:0,linestartts,lasttile*8-16);
@ -995,25 +964,19 @@ static void RefreshSprites(void)
FCEU_dwmemset(sprlinebuf,0x80808080,256); FCEU_dwmemset(sprlinebuf,0x80808080,256);
numsprites--; numsprites--;
spr = (SPRB*)SPRBUF+numsprites; spr = (SPRB*)SPRBUF+numsprites;
for(n=numsprites;n>=0;n--,spr--) for(n=numsprites;n>=0;n--,spr--)
{ {
//#ifdef C80x86 register uint32 pixdata;
//register uint32 pixdata asm ("eax"); register uint8 J,atr;
//register uint8 J, atr; int x=spr->x;
//#else uint8 *C;
register uint32 pixdata; uint8 *VB;
register uint8 J,atr;
//#endif
int x=spr->x; pixdata=ppulut1[spr->ca[0]]|ppulut2[spr->ca[1]];
uint8 *C; J=spr->ca[0]|spr->ca[1];
uint8 *VB; atr=spr->atr;
pixdata=ppulut1[spr->ca[0]]|ppulut2[spr->ca[1]];
J=spr->ca[0]|spr->ca[1];
atr=spr->atr;
if(J) if(J)
{ {
@ -1110,7 +1073,7 @@ static void RefreshSprites(void)
} }
} }
SpriteBlurp=0; SpriteBlurp=0;
spork=1; spork=1;
} }
static void CopySprites(uint8 *target) static void CopySprites(uint8 *target)
@ -1122,7 +1085,6 @@ static void CopySprites(uint8 *target)
spork=0; spork=0;
if(rendis & 1) return; /* User asked to not display sprites. */ if(rendis & 1) return; /* User asked to not display sprites. */
loopskie: loopskie:
{ {
uint32 t=*(uint32 *)(sprlinebuf+n); uint32 t=*(uint32 *)(sprlinebuf+n);
@ -1132,25 +1094,25 @@ static void CopySprites(uint8 *target)
#ifdef LSB_FIRST #ifdef LSB_FIRST
if(!(t&0x80)) if(!(t&0x80))
{ {
if(!(t&0x40) || (P[n]&0x40)) // Normal sprite || behind bg sprite if(!(t&0x40) || (P[n]&64)) // Normal sprite || behind bg sprite
P[n]=sprlinebuf[n]; P[n]=sprlinebuf[n];
} }
if(!(t&0x8000)) if(!(t&0x8000))
{ {
if(!(t&0x4000) || (P[n+1]&0x40)) // Normal sprite || behind bg sprite if(!(t&0x4000) || (P[n+1]&64)) // Normal sprite || behind bg sprite
P[n+1]=(sprlinebuf+1)[n]; P[n+1]=(sprlinebuf+1)[n];
} }
if(!(t&0x800000)) if(!(t&0x800000))
{ {
if(!(t&0x400000) || (P[n+2]&0x40)) // Normal sprite || behind bg sprite if(!(t&0x400000) || (P[n+2]&64)) // Normal sprite || behind bg sprite
P[n+2]=(sprlinebuf+2)[n]; P[n+2]=(sprlinebuf+2)[n];
} }
if(!(t&0x80000000)) if(!(t&0x80000000))
{ {
if(!(t&0x40000000) || (P[n+3]&0x40)) // Normal sprite || behind bg sprite if(!(t&0x40000000) || (P[n+3]&64)) // Normal sprite || behind bg sprite
P[n+3]=(sprlinebuf+3)[n]; P[n+3]=(sprlinebuf+3)[n];
} }
#else #else

View File

@ -21,60 +21,6 @@
pixdata|=ppulut3[XOffset|(atlatch<<3)]; pixdata|=ppulut3[XOffset|(atlatch<<3)];
//printf("%02x ",ppulut3[XOffset|(atlatch<<3)]); //printf("%02x ",ppulut3[XOffset|(atlatch<<3)]);
#ifdef C80x86
asm volatile(
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, (%%edi)\n\t"
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, 1(%%edi)\n\t"
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, 2(%%edi)\n\t"
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, 3(%%edi)\n\t"
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, 4(%%edi)\n\t"
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, 5(%%edi)\n\t"
"movl %%ebx,%%eax\n\t"
"andl $15,%%eax\n\t"
"movb (%%esi,%%eax),%%cl\n\t"
"shrl $4, %%ebx\n\t"
"movb %%cl, 6(%%edi)\n\t"
//"movl %%ebx,%%eax\n\t"
//"andl $15,%%eax\n\t"
//"movb (%%esi,%%eax),%%cl\n\t"
//"movb %%cl, 7(%%edi)\n\t"
"movb (%%esi, %%ebx),%%cl\n\t"
"movb %%cl, 7(%%edi)\n\t"
:
: "S" (S), "D" (P), "b" (pixdata)
: "eax", "cl" );
#else
P[0]=S[pixdata&0xF]; P[0]=S[pixdata&0xF];
pixdata>>=4; pixdata>>=4;
P[1]=S[pixdata&0xF]; P[1]=S[pixdata&0xF];
@ -90,7 +36,6 @@
P[6]=S[pixdata&0xF]; P[6]=S[pixdata&0xF];
pixdata>>=4; pixdata>>=4;
P[7]=S[pixdata&0xF]; P[7]=S[pixdata&0xF];
#endif
P+=8; P+=8;
} }

View File

@ -46,20 +46,20 @@ static uint8 TriMode;
static int32 tristep; static int32 tristep;
static int32 wlcount[4]; /* Wave length counters. */ static int32 wlcount[4]; /* Wave length counters. */
static uint8 IRQFrameMode; /* $4017 / xx000000 */ static uint8 IRQFrameMode; /* $4017 / xx000000 */
static uint8 PSG[0x10]; static uint8 PSG[0x10];
static uint8 RawDALatch; /* $4011 0xxxxxxx */ static uint8 RawDALatch; /* $4011 0xxxxxxx */
uint8 EnabledChannels; /* Byte written to $4015 */ uint8 EnabledChannels; /* Byte written to $4015 */
typedef struct { typedef struct {
uint8 Speed; uint8 Speed;
uint8 Mode; /* Fixed volume(1), and loop(2) */ uint8 Mode; /* Fixed volume(1), and loop(2) */
uint8 DecCountTo1; uint8 DecCountTo1;
uint8 decvolume; uint8 decvolume;
int reloaddec; int reloaddec;
} ENVUNIT; } ENVUNIT;
static ENVUNIT EnvUnits[3]; static ENVUNIT EnvUnits[3];
@ -110,17 +110,17 @@ static const uint32 PALDMCTable[0x10]=
176, 148, 131, 118, 98, 78, 66, 50, 176, 148, 131, 118, 98, 78, 66, 50,
}; };
// $4010 - Frequency // $4010 - Frequency
// $4011 - Actual data outputted // $4011 - Actual data outputted
// $4012 - Address register: $c000 + V*64 // $4012 - Address register: $c000 + V*64
// $4013 - Size register: Size in bytes = (V+1)*64 // $4013 - Size register: Size in bytes = (V+1)*64
static int32 DMCacc=1; static int32 DMCacc=1;
static int32 DMCPeriod; static int32 DMCPeriod;
static uint8 DMCBitCount=0; static uint8 DMCBitCount=0;
static uint8 DMCAddressLatch,DMCSizeLatch; /* writes to 4012 and 4013 */ static uint8 DMCAddressLatch,DMCSizeLatch; /* writes to 4012 and 4013 */
static uint8 DMCFormat; /* Write to $4010 */ static uint8 DMCFormat; /* Write to $4010 */
static uint32 DMCAddress=0; static uint32 DMCAddress=0;
static int32 DMCSize=0; static int32 DMCSize=0;
@ -170,22 +170,22 @@ static int FASTAPASS(2) CheckFreq(uint32 cf, uint8 sr)
static void SQReload(int x, uint8 V) static void SQReload(int x, uint8 V)
{ {
if(EnabledChannels&(1<<x)) if(EnabledChannels&(1<<x))
{ {
if(x) if(x)
DoSQ2(); DoSQ2();
else else
DoSQ1(); DoSQ1();
lengthcount[x]=lengthtable[(V>>3)&0x1f]; lengthcount[x]=lengthtable[(V>>3)&0x1f];
} }
sweepon[x]=PSG[(x<<2)|1]&0x80; sweepon[x]=PSG[(x<<2)|1]&0x80;
curfreq[x]=PSG[(x<<2)|0x2]|((V&7)<<8); curfreq[x]=PSG[(x<<2)|0x2]|((V&7)<<8);
SweepCount[x]=((PSG[(x<<2)|0x1]>>4)&7)+1; SweepCount[x]=((PSG[(x<<2)|0x1]>>4)&7)+1;
RectDutyCount[x]=7; RectDutyCount[x]=7;
EnvUnits[x].reloaddec=1; EnvUnits[x].reloaddec=1;
//reloadfreq[x]=1; //reloadfreq[x]=1;
} }
static DECLFW(Write_PSG) static DECLFW(Write_PSG)
@ -194,68 +194,68 @@ static DECLFW(Write_PSG)
switch(A) switch(A)
{ {
case 0x0:DoSQ1(); case 0x0:DoSQ1();
EnvUnits[0].Mode=(V&0x30)>>4; EnvUnits[0].Mode=(V&0x30)>>4;
EnvUnits[0].Speed=(V&0xF); EnvUnits[0].Speed=(V&0xF);
break; break;
case 0x1: case 0x1:
sweepon[0]=V&0x80; sweepon[0]=V&0x80;
break; break;
case 0x2: case 0x2:
DoSQ1(); DoSQ1();
curfreq[0]&=0xFF00; curfreq[0]&=0xFF00;
curfreq[0]|=V; curfreq[0]|=V;
break; break;
case 0x3: case 0x3:
SQReload(0,V); SQReload(0,V);
break; break;
case 0x4: case 0x4:
DoSQ2(); DoSQ2();
EnvUnits[1].Mode=(V&0x30)>>4; EnvUnits[1].Mode=(V&0x30)>>4;
EnvUnits[1].Speed=(V&0xF); EnvUnits[1].Speed=(V&0xF);
break; break;
case 0x5: case 0x5:
sweepon[1]=V&0x80; sweepon[1]=V&0x80;
break; break;
case 0x6:DoSQ2(); case 0x6:DoSQ2();
curfreq[1]&=0xFF00; curfreq[1]&=0xFF00;
curfreq[1]|=V; curfreq[1]|=V;
break; break;
case 0x7: case 0x7:
SQReload(1,V); SQReload(1,V);
break; break;
case 0xa:DoTriangle(); case 0xa:DoTriangle();
break; break;
case 0xb: case 0xb:
DoTriangle(); DoTriangle();
if(EnabledChannels&0x4) if(EnabledChannels&0x4)
lengthcount[2]=lengthtable[(V>>3)&0x1f]; lengthcount[2]=lengthtable[(V>>3)&0x1f];
TriMode=1; // Load mode TriMode=1; // Load mode
break; break;
case 0xC:DoNoise(); case 0xC:DoNoise();
EnvUnits[2].Mode=(V&0x30)>>4; EnvUnits[2].Mode=(V&0x30)>>4;
EnvUnits[2].Speed=(V&0xF); EnvUnits[2].Speed=(V&0xF);
break; break;
case 0xE:DoNoise(); case 0xE:DoNoise();
break; break;
case 0xF: case 0xF:
DoNoise(); DoNoise();
if(EnabledChannels&0x8) if(EnabledChannels&0x8)
lengthcount[3]=lengthtable[(V>>3)&0x1f]; lengthcount[3]=lengthtable[(V>>3)&0x1f];
EnvUnits[2].reloaddec=1; EnvUnits[2].reloaddec=1;
break; break;
case 0x10:DoPCM(); case 0x10:DoPCM();
LoadDMCPeriod(V&0xF); LoadDMCPeriod(V&0xF);
if(SIRQStat&0x80) if(SIRQStat&0x80)
{ {
if(!(V&0x80)) if(!(V&0x80))
{ {
X6502_IRQEnd(FCEU_IQDPCM); X6502_IRQEnd(FCEU_IQDPCM);
SIRQStat&=~0x80; SIRQStat&=~0x80;
} }
else X6502_IRQBegin(FCEU_IQDPCM); else X6502_IRQBegin(FCEU_IQDPCM);
} }
break; break;
} }
PSG[A]=V; PSG[A]=V;
} }
@ -267,22 +267,22 @@ static DECLFW(Write_DMCRegs)
switch(A) switch(A)
{ {
case 0x00:DoPCM(); case 0x00:DoPCM();
LoadDMCPeriod(V&0xF); LoadDMCPeriod(V&0xF);
if(SIRQStat&0x80) if(SIRQStat&0x80)
{ {
if(!(V&0x80)) if(!(V&0x80))
{ {
X6502_IRQEnd(FCEU_IQDPCM); X6502_IRQEnd(FCEU_IQDPCM);
SIRQStat&=~0x80; SIRQStat&=~0x80;
} }
else X6502_IRQBegin(FCEU_IQDPCM); else X6502_IRQBegin(FCEU_IQDPCM);
} }
DMCFormat=V; DMCFormat=V;
break; break;
case 0x01:DoPCM(); case 0x01:DoPCM();
RawDALatch=V&0x7F; RawDALatch=V&0x7F;
break; break;
case 0x02:DMCAddressLatch=V;break; case 0x02:DMCAddressLatch=V;break;
case 0x03:DMCSizeLatch=V;break; case 0x03:DMCSizeLatch=V;break;
} }
@ -292,28 +292,28 @@ static DECLFW(Write_DMCRegs)
static DECLFW(StatusWrite) static DECLFW(StatusWrite)
{ {
int x; int x;
DoSQ1(); DoSQ1();
DoSQ2(); DoSQ2();
DoTriangle(); DoTriangle();
DoNoise(); DoNoise();
DoPCM(); DoPCM();
for(x=0;x<4;x++) for(x=0;x<4;x++)
if(!(V&(1<<x))) lengthcount[x]=0; /* Force length counters to 0. */ if(!(V&(1<<x))) lengthcount[x]=0; /* Force length counters to 0. */
if(V&0x10) if(V&0x10)
{ {
if(!DMCSize) if(!DMCSize)
PrepDPCM(); PrepDPCM();
} }
else else
{ {
DMCSize=0; DMCSize=0;
} }
SIRQStat&=~0x80; SIRQStat&=~0x80;
X6502_IRQEnd(FCEU_IQDPCM); X6502_IRQEnd(FCEU_IQDPCM);
EnabledChannels=V&0x1F; EnabledChannels=V&0x1F;
} }
static DECLFR(StatusRead) static DECLFR(StatusRead)
@ -351,13 +351,13 @@ static void FASTAPASS(1) FrameSoundStuff(int V)
if(lengthcount[2]>0) if(lengthcount[2]>0)
lengthcount[2]--; lengthcount[2]--;
if(!(PSG[0xC]&0x20)) /* Make sure loop flag is not set. */ if(!(PSG[0xC]&0x20)) /* Make sure loop flag is not set. */
if(lengthcount[3]>0) if(lengthcount[3]>0)
lengthcount[3]--; lengthcount[3]--;
for(P=0;P<2;P++) for(P=0;P<2;P++)
{ {
if(!(PSG[P<<2]&0x20)) /* Make sure loop flag is not set. */ if(!(PSG[P<<2]&0x20)) /* Make sure loop flag is not set. */
if(lengthcount[P]>0) if(lengthcount[P]>0)
lengthcount[P]--; lengthcount[P]--;
@ -392,13 +392,13 @@ static void FASTAPASS(1) FrameSoundStuff(int V)
{ {
if(curfreq[P] && (PSG[(P<<2)+0x1]&7)/* && sweepon[P]&0x80*/) if(curfreq[P] && (PSG[(P<<2)+0x1]&7)/* && sweepon[P]&0x80*/)
{ {
curfreq[P]+=mod; curfreq[P]+=mod;
} }
} }
} }
} }
} }
else /* Sweeping is disabled: */ else /* Sweeping is disabled: */
{ {
//curfreq[P]&=0xFF00; //curfreq[P]&=0xFF00;
//curfreq[P]|=PSG[(P<<2)|0x2]; //|((PSG[(P<<2)|3]&7)<<8); //curfreq[P]|=PSG[(P<<2)|0x2]; //|((PSG[(P<<2)|3]&7)<<8);
@ -446,14 +446,14 @@ void FrameSoundUpdate(void)
if(!fcnt && !(IRQFrameMode&0x3)) if(!fcnt && !(IRQFrameMode&0x3))
{ {
SIRQStat|=0x40; SIRQStat|=0x40;
X6502_IRQBegin(FCEU_IQFCOUNT); X6502_IRQBegin(FCEU_IQFCOUNT);
} }
if(fcnt==3) if(fcnt==3)
{ {
if(IRQFrameMode&0x2) if(IRQFrameMode&0x2)
fhcnt+=fhinc; fhcnt+=fhinc;
} }
FrameSoundStuff(fcnt); FrameSoundStuff(fcnt);
fcnt=(fcnt+1)&3; fcnt=(fcnt+1)&3;
@ -648,7 +648,7 @@ static void RDoSQLQ(void)
else else
amp[x]=EnvUnits[x].decvolume; amp[x]=EnvUnits[x].decvolume;
if(!inie[x]) amp[x]=0; /* Correct? Buzzing in MM2, others otherwise... */ if(!inie[x]) amp[x]=0; /* Correct? Buzzing in MM2, others otherwise... */
rthresh[x]=RectDuties[(PSG[x*4]&0xC0)>>6]; rthresh[x]=RectDuties[(PSG[x*4]&0xC0)>>6];
@ -667,7 +667,7 @@ static void RDoSQLQ(void)
if(!inie[0] && !inie[1]) if(!inie[0] && !inie[1])
{ {
for(V=start;V<end;V++) for(V=start;V<end;V++)
Wave[V>>4]+=totalout; Wave[V>>4]+=totalout;
} }
else else
@ -713,10 +713,10 @@ static void RDoTriangle(void)
tcout=(tristep&0xF); tcout=(tristep&0xF);
if(!(tristep&0x10)) tcout^=0xF; if(!(tristep&0x10)) tcout^=0xF;
tcout=(tcout*3) << 16; //(tcout<<1); tcout=(tcout*3) << 16; //(tcout<<1);
if(!lengthcount[2] || !TriCount) if(!lengthcount[2] || !TriCount)
{ /* Counter is halted, but we still need to output. */ { /* Counter is halted, but we still need to output. */
int32 *start = &WaveHi[ChannelBC[2]]; int32 *start = &WaveHi[ChannelBC[2]];
int32 count = SOUNDTS - ChannelBC[2]; int32 count = SOUNDTS - ChannelBC[2];
while(count--) while(count--)
@ -782,7 +782,7 @@ static void RDoTriangleNoisePCMLQ(void)
amptab[0]<<=1; amptab[0]<<=1;
if(!lengthcount[3]) if(!lengthcount[3])
amptab[0]=inie[1]=0; /* Quick hack speedup, set inie[1] to 0 */ amptab[0]=inie[1]=0; /* Quick hack speedup, set inie[1] to 0 */
noiseout=amptab[(nreg>>0xe)&1]; noiseout=amptab[(nreg>>0xe)&1];
@ -796,37 +796,37 @@ static void RDoTriangleNoisePCMLQ(void)
if(inie[0] && inie[1]) if(inie[0] && inie[1])
{ {
for(V=start;V<end;V++) for(V=start;V<end;V++)
{ {
Wave[V>>4]+=totalout; Wave[V>>4]+=totalout;
triacc-=inie[0]; triacc-=inie[0];
noiseacc-=inie[1]; noiseacc-=inie[1];
if(triacc<=0) if(triacc<=0)
{ {
rea: rea:
triacc+=freq[0]; //t; triacc+=freq[0]; //t;
tristep=(tristep+1)&0x1F; tristep=(tristep+1)&0x1F;
if(triacc<=0) goto rea; if(triacc<=0) goto rea;
tcout=(tristep&0xF); tcout=(tristep&0xF);
if(!(tristep&0x10)) tcout^=0xF; if(!(tristep&0x10)) tcout^=0xF;
tcout=tcout*3; tcout=tcout*3;
totalout = wlookup2[tcout+noiseout+RawDALatch]; totalout = wlookup2[tcout+noiseout+RawDALatch];
} }
if(noiseacc<=0) if(noiseacc<=0)
{ {
rea2: rea2:
noiseacc+=NoiseFreqTable[PSG[0xE]&0xF]<<(16+2); noiseacc+=NoiseFreqTable[PSG[0xE]&0xF]<<(16+2);
nreg=(nreg<<1)+(((nreg>>nshift)^(nreg>>14))&1); nreg=(nreg<<1)+(((nreg>>nshift)^(nreg>>14))&1);
nreg&=0x7fff; nreg&=0x7fff;
noiseout=amptab[(nreg>>0xe)]; noiseout=amptab[(nreg>>0xe)];
if(noiseacc<=0) goto rea2; if(noiseacc<=0) goto rea2;
totalout = wlookup2[tcout+noiseout+RawDALatch]; totalout = wlookup2[tcout+noiseout+RawDALatch];
} /* noiseacc<=0 */ } /* noiseacc<=0 */
} /* for(V=... */ } /* for(V=... */
} }
else if(inie[0]) else if(inie[0])
{ {
for(V=start;V<end;V++) for(V=start;V<end;V++)
@ -897,7 +897,7 @@ static void RDoNoise(void)
outo=amptab[0]=0; outo=amptab[0]=0;
} }
if(PSG[0xE]&0x80) // "short" noise if(PSG[0xE]&0x80) // "short" noise
for(V=ChannelBC[3];V<SOUNDTS;V++) for(V=ChannelBC[3];V<SOUNDTS;V++)
{ {
WaveHi[V]+=outo; WaveHi[V]+=outo;
@ -930,7 +930,7 @@ static void RDoNoise(void)
ChannelBC[3]=SOUNDTS; ChannelBC[3]=SOUNDTS;
} }
static DECLFW(Write_IRQFM) DECLFW(Write_IRQFM)
{ {
V=(V&0xC0)>>6; V=(V&0xC0)>>6;
fcnt=0; fcnt=0;
@ -1025,7 +1025,7 @@ int FlushEmulateSound(void)
inbuf=end; inbuf=end;
FCEU_WriteWaveData(WaveFinal, end); /* This function will just return FCEU_WriteWaveData(WaveFinal, end); /* This function will just return
if sound recording is off. */ if sound recording is off. */
return(end); return(end);
} }
@ -1041,60 +1041,60 @@ due to that whole MegaMan 2 Game Genie thing.
void FCEUSND_Reset(void) void FCEUSND_Reset(void)
{ {
int x; int x;
IRQFrameMode=0x0; IRQFrameMode=0x0;
fhcnt=fhinc; fhcnt=fhinc;
fcnt=0; fcnt=0;
nreg=1; nreg=1;
for(x=0;x<2;x++) for(x=0;x<2;x++)
{ {
wlcount[x]=2048; wlcount[x]=2048;
if(nesincsize) // lq mode if(nesincsize) // lq mode
sqacc[x]=((uint32)2048<<17)/nesincsize; sqacc[x]=((uint32)2048<<17)/nesincsize;
else else
sqacc[x]=1; sqacc[x]=1;
sweepon[x]=0; sweepon[x]=0;
curfreq[x]=0; curfreq[x]=0;
} }
wlcount[2]=1; //2048; wlcount[2]=1; //2048;
wlcount[3]=2048; wlcount[3]=2048;
DMCHaveDMA=DMCHaveSample=0; DMCHaveDMA=DMCHaveSample=0;
SIRQStat=0x00; SIRQStat=0x00;
RawDALatch=0x00; RawDALatch=0x00;
TriCount=0; TriCount=0;
TriMode=0; TriMode=0;
tristep=0; tristep=0;
EnabledChannels=0; EnabledChannels=0;
for(x=0;x<4;x++) for(x=0;x<4;x++)
lengthcount[x]=0; lengthcount[x]=0;
DMCAddressLatch=0; DMCAddressLatch=0;
DMCSizeLatch=0; DMCSizeLatch=0;
DMCFormat=0; DMCFormat=0;
DMCAddress=0; DMCAddress=0;
DMCSize=0; DMCSize=0;
DMCShift=0; DMCShift=0;
} }
void FCEUSND_Power(void) void FCEUSND_Power(void)
{ {
int x; int x;
SetNESSoundMap(); SetNESSoundMap();
memset(PSG,0x00,sizeof(PSG)); memset(PSG,0x00,sizeof(PSG));
FCEUSND_Reset(); FCEUSND_Reset();
memset(Wave,0,sizeof(Wave)); memset(Wave,0,sizeof(Wave));
memset(WaveHi,0,sizeof(WaveHi)); memset(WaveHi,0,sizeof(WaveHi));
memset(&EnvUnits,0,sizeof(EnvUnits)); memset(&EnvUnits,0,sizeof(EnvUnits));
for(x=0;x<5;x++) for(x=0;x<5;x++)
ChannelBC[x]=0; ChannelBC[x]=0;
soundtsoffs=0; soundtsoffs=0;
LoadDMCPeriod(DMCFormat&0xF); LoadDMCPeriod(DMCFormat&0xF);
} }
@ -1102,7 +1102,7 @@ void SetSoundVariables(void)
{ {
int x; int x;
fhinc=PAL?16626:14915; // *2 CPU clock rate fhinc=PAL?16626:14915; // *2 CPU clock rate
fhinc*=24; fhinc*=24;
if(FSettings.SndRate) if(FSettings.SndRate)
@ -1152,7 +1152,7 @@ void SetSoundVariables(void)
memset(sqacc,0,sizeof(sqacc)); memset(sqacc,0,sizeof(sqacc));
memset(ChannelBC,0,sizeof(ChannelBC)); memset(ChannelBC,0,sizeof(ChannelBC));
LoadDMCPeriod(DMCFormat&0xF); // For changing from PAL to NTSC LoadDMCPeriod(DMCFormat&0xF); // For changing from PAL to NTSC
soundtsinc=(uint32)((uint64)(PAL?(long double)PAL_CPU*65536:(long double)NTSC_CPU*65536)/(FSettings.SndRate * 16)); soundtsinc=(uint32)((uint64)(PAL?(long double)PAL_CPU*65536:(long double)NTSC_CPU*65536)/(FSettings.SndRate * 16));
} }

View File

@ -79,6 +79,11 @@ SFORMAT SFCPUC[]={
{ 0 } { 0 }
}; };
void cleanSFMDATA()
{
memset(&SFMDATA[0], 0, sizeof(SFMDATA) * 64 );
}
static int SubWrite(FILE *st, SFORMAT *sf) static int SubWrite(FILE *st, SFORMAT *sf)
{ {
uint32 acc=0; uint32 acc=0;
@ -446,7 +451,9 @@ void FCEUI_LoadState(char *fname)
FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn); FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn);
} }
else fclose(fp); else fclose(fp);
/*** REMOVED GC V1.0
unlink(fn); unlink(fn);
REMOVED GC V1.0 ***/
} }
free(fn); free(fn);
} }
@ -461,7 +468,3 @@ void FCEU_DrawSaveStates(uint8 *XBuf)
StateShow--; StateShow--;
} }
void cleanSFMDATA()
{
memset(&SFMDATA[0], 0, sizeof(SFMDATA) * 64 );
}

View File

@ -41,6 +41,7 @@ typedef uint32_t uint32;
typedef long long int64; typedef long long int64;
#define INLINE inline #define INLINE inline
#define GINLINE inline #define GINLINE inline
#define PSS_STYLE 3
#elif MSVC #elif MSVC
typedef __int64 int64; typedef __int64 int64;
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;

View File

@ -371,12 +371,14 @@ static BMAPPING bmap[] = {
{ "CPROM", CPROM_Init,0}, { "CPROM", CPROM_Init,0},
{ "CNROM", CNROM_Init,0}, { "CNROM", CNROM_Init,0},
{ "GNROM", GNROM_Init,0},
{ "NROM", NROM256_Init,0 }, //{ "GNROM", GNROM_Init,0},
{ "RROM", NROM128_Init,0 }, //{ "NROM", NROM256_Init,0 },
{ "RROM-128", NROM128_Init,0 }, //{ "RROM", NROM128_Init,0 },
{ "NROM-128", NROM128_Init,0 }, //{ "RROM-128", NROM128_Init,0 },
{ "NROM-256", NROM256_Init,0 }, //{ "NROM-128", NROM128_Init,0 },
//{ "NROM-256", NROM256_Init,0 },
{ "MHROM", MHROM_Init,0}, { "MHROM", MHROM_Init,0},
{ "UNROM", UNROM_Init,0}, { "UNROM", UNROM_Init,0},
{ "MARIO1-MALEE2", MALEE_Init,0}, { "MARIO1-MALEE2", MALEE_Init,0},

View File

@ -27,9 +27,7 @@
X6502 X; X6502 X;
#ifdef FCEUDEF_DEBUGGER
void (*X6502_Run)(int32 cycles); void (*X6502_Run)(int32 cycles);
#endif
uint32 timestamp; uint32 timestamp;
void FP_FASTAPASS(1) (*MapIRQHook)(int a); void FP_FASTAPASS(1) (*MapIRQHook)(int a);
@ -65,7 +63,6 @@ static INLINE void WrMemNorm(unsigned int A, uint8 V)
BWrite[A](A,V); BWrite[A](A,V);
} }
#ifdef FCEUDEF_DEBUGGER
X6502 XSave; /* This is getting ugly. */ X6502 XSave; /* This is getting ugly. */
//#define RdMemHook(A) ( X.ReadHook?(_DB=X.ReadHook(&X,A)):(_DB=ARead[A](A)) ) //#define RdMemHook(A) ( X.ReadHook?(_DB=X.ReadHook(&X,A)):(_DB=ARead[A](A)) )
//#define WrMemHook(A,V) { if(X.WriteHook) X.WriteHook(&X,A,V); else BWrite[A](A,V); } //#define WrMemHook(A,V) { if(X.WriteHook) X.WriteHook(&X,A,V); else BWrite[A](A,V); }
@ -85,7 +82,6 @@ static INLINE void WrMemHook(unsigned int A, uint8 V)
else else
BWrite[A](A,V); BWrite[A](A,V);
} }
#endif
//#define RdRAMFast(A) (_DB=RAM[(A)]) //#define RdRAMFast(A) (_DB=RAM[(A)])
//#define WrRAMFast(A,V) RAM[(A)]=(V) //#define WrRAMFast(A,V) RAM[(A)]=(V)
@ -133,19 +129,18 @@ static uint8 ZNTable[256];
if(cond) \ if(cond) \
{ \ { \
uint32 tmp; \ uint32 tmp; \
int32 disp; \ int8 disp; \
disp=(int8)RdMem(_PC); \ disp=RdMem(_PC); \
_PC++; \ _PC++; \
ADDCYC(1); \ ADDCYC(1); \
tmp=_PC; \ tmp=_PC; \
_PC+=disp; \ _PC+=disp; \
if((tmp^_PC)&0x100) \ if((tmp^_PC)&0x100) \
ADDCYC(1); \ ADDCYC(1); \
} \ } \
else _PC++; \ else _PC++; \
} }
#define LDA _A=x;X_ZN(_A) #define LDA _A=x;X_ZN(_A)
#define LDX _X=x;X_ZN(_X) #define LDX _X=x;X_ZN(_X)
#define LDY _Y=x;X_ZN(_Y) #define LDY _Y=x;X_ZN(_Y)
@ -398,7 +393,6 @@ void TriggerNMI2(void)
_IRQlow|=FCEU_IQNMI2; _IRQlow|=FCEU_IQNMI2;
} }
#ifdef FCEUDEF_DEBUGGER
/* Called from debugger. */ /* Called from debugger. */
void FCEUI_NMI(void) void FCEUI_NMI(void)
{ {
@ -410,6 +404,11 @@ void FCEUI_IRQ(void)
_IRQlow|=FCEU_IQTEMP; _IRQlow|=FCEU_IQTEMP;
} }
void X6502_Reset(void)
{
_IRQlow=FCEU_IQRESET;
}
void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi) void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi)
{ {
fceuindbg=1; fceuindbg=1;
@ -422,14 +421,8 @@ void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi)
*irq|=RdMemNorm(0xFFFF)<<8; *irq|=RdMemNorm(0xFFFF)<<8;
fceuindbg=0; fceuindbg=0;
} }
static int debugmode; static int debugmode;
#endif
void X6502_Reset(void)
{
_IRQlow=FCEU_IQRESET;
}
void X6502_Init(void) void X6502_Init(void)
{ {
int x; int x;
@ -439,9 +432,7 @@ void X6502_Init(void)
if(!x) ZNTable[x]=Z_FLAG; if(!x) ZNTable[x]=Z_FLAG;
else if (x&0x80) ZNTable[x]=N_FLAG; else if (x&0x80) ZNTable[x]=N_FLAG;
else ZNTable[x]=0; else ZNTable[x]=0;
#ifdef FCEUDEF_DEBUGGER
X6502_Debug(0,0,0); X6502_Debug(0,0,0);
#endif
} }
void X6502_Power(void) void X6502_Power(void)
@ -451,7 +442,6 @@ void X6502_Power(void)
X6502_Reset(); X6502_Reset();
} }
#ifdef FCEUDEF_DEBUGGER
static void X6502_RunDebug(int32 cycles) static void X6502_RunDebug(int32 cycles)
{ {
#define RdRAM RdMemHook #define RdRAM RdMemHook
@ -575,9 +565,6 @@ static void X6502_RunDebug(int32 cycles)
} }
static void X6502_RunNormal(int32 cycles) static void X6502_RunNormal(int32 cycles)
#else
void X6502_Run(int32 cycles)
#endif
{ {
#define RdRAM RdRAMFast #define RdRAM RdRAMFast
#define WrRAM WrRAMFast #define WrRAM WrRAMFast
@ -663,13 +650,15 @@ void X6502_Run(int32 cycles)
_PI=_P; _PI=_P;
b1=RdMem(_PC); b1=RdMem(_PC);
//printf("$%04x, $%02x\n",_PC,b1);
ADDCYC(CycTable[b1]); ADDCYC(CycTable[b1]);
//PPUHack();
temp=_tcount; temp=_tcount;
_tcount=0; _tcount=0;
if(MapIRQHook) MapIRQHook(temp); if(MapIRQHook) MapIRQHook(temp);
FCEU_SoundCPUHook(temp); FCEU_SoundCPUHook(temp);
//printf("%04x\n",X.PC); //printf("%04x\n",X.PC);
X.PC=pbackus; X.PC=pbackus;
_PC++; _PC++;
@ -686,7 +675,6 @@ void X6502_Run(int32 cycles)
#undef WrRAM #undef WrRAM
} }
#ifdef FCEUDEF_DEBUGGER
void X6502_Debug(void (*CPUHook)(X6502 *), void X6502_Debug(void (*CPUHook)(X6502 *),
uint8 (*ReadHook)(X6502 *, unsigned int), uint8 (*ReadHook)(X6502 *, unsigned int),
void (*WriteHook)(X6502 *, unsigned int, uint8)) void (*WriteHook)(X6502 *, unsigned int, uint8))
@ -701,5 +689,3 @@ void X6502_Debug(void (*CPUHook)(X6502 *),
else else
X6502_Run=X6502_RunDebug; X6502_Run=X6502_RunDebug;
} }
#endif

View File

@ -22,18 +22,13 @@
#include "x6502struct.h" #include "x6502struct.h"
#ifdef FCEUDEF_DEBUGGER
void X6502_Debug(void (*CPUHook)(X6502 *), void X6502_Debug(void (*CPUHook)(X6502 *),
uint8 (*ReadHook)(X6502 *, unsigned int), uint8 (*ReadHook)(X6502 *, unsigned int),
void (*WriteHook)(X6502 *, unsigned int, uint8)); void (*WriteHook)(X6502 *, unsigned int, uint8));
extern void (*X6502_Run)(int32 cycles);
#else
void X6502_Run(int32 cycles);
#endif
extern uint32 timestamp; extern uint32 timestamp;
extern X6502 X; extern X6502 X;
extern void (*X6502_Run)(int32 cycles);
#define N_FLAG 0x80 #define N_FLAG 0x80
#define V_FLAG 0x40 #define V_FLAG 0x40

View File

@ -14,13 +14,9 @@ typedef struct __X6502 {
uint8 DB; /* Data bus "cache" for reads from certain areas */ uint8 DB; /* Data bus "cache" for reads from certain areas */
int preexec; /* Pre-exec'ing for debug breakpoints. */ int preexec; /* Pre-exec'ing for debug breakpoints. */
#ifdef FCEUDEF_DEBUGGER
void (*CPUHook)(struct __X6502 *); void (*CPUHook)(struct __X6502 *);
uint8 (*ReadHook)(struct __X6502 *, unsigned int); uint8 (*ReadHook)(struct __X6502 *, unsigned int);
void (*WriteHook)(struct __X6502 *, unsigned int, uint8); void (*WriteHook)(struct __X6502 *, unsigned int, uint8);
#endif
} X6502; } X6502;
#define _X6502STRUCTH #define _X6502STRUCTH
#endif #endif