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
* Fixed auto-save feature
* Performance slowdowns on Gamecube should be fixed
* Update core to 0.98.13pre
* Will now attempt to load old save states with CRC filename
[What's New 2.0.1]

View File

@ -20,176 +20,331 @@
#include "mapinc.h"
#define CHRRAM (GameMemBlock)
static uint8 latche;
static uint8 latche, latcheinit;
static uint16 addrreg0, addrreg1;
static void(*WSync)(void);
DECLFW(CPROMWrite)
static DECLFW(LatchWrite)
{
latche=V&3;
setvram4(0x1000,CHRRAM+((V&3)<<12));
// FCEU_printf("bs %04x %02x\n",A,V);
latche=V;
WSync();
}
static void CPROMReset(void)
static void LatchPower(void)
{
setprg32(0x8000,0);
setvram8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,CPROMWrite);
latche=latcheinit;
WSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
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)
{
info->Power=CPROMReset;
GameStateRestore=CPROMRestore;
AddExState(&latche, 1, 0, "LATC");
Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF);
}
DECLFW(CNROMWrite)
{
latche=V&3;
setchr8(V&3);
}
//------------------ Map 184 ---------------------------
static void CNROMReset(void)
static void M184Sync(void)
{
setchr4(0x0000,latche);
setchr4(0x1000,latche>>4);
setprg16(0x8000,0);
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)
{
info->Power=CNROMReset;
GameStateRestore=CNROMRestore;
AddExState(&latche, 1, 0, "LATC");
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF);
}
static void NROM128Reset(void)
//------------------ ANROM ---------------------------
static void ANROMSync()
{
setprg16(0x8000,0);
setprg16(0xC000,0);
setprg32(0x8000,latche&0xf);
setmirror(MI_0+((latche>>4)&1));
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
static void NROM256Reset(void)
void ANROM_Init(CartInfo *info)
{
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF);
}
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);
setchr8(V);
latche=V;
setprg16(0x8000,(latche>>4)&7);
setprg16(0xc000,~0);
setchr8(latche&0xf);
setmirror(MI_0+((latche>>7)&1)); /* Saint Seiya...hmm. */
}
static void MHROMReset(void)
void Mapper152_Init(CartInfo *info)
{
setprg32(0x8000,0);
setchr8(0);
latche=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF);
}
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);
setchr8(latche);
SetWriteHandler(0x8000,0xffff,MHROMWrite);
setprg16(0x8000,(latche&7));
setprg16(0xc000,~0);
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)
{
info->Power=MHROMReset;
AddExState(&latche, 1, 0,"LATC");
PRGmask32[0]&=1;
CHRmask8[0]&=1;
GameStateRestore=MHROMRestore;
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF);
}
static void UNROMRestore(int version)
{
setprg16(0x8000,latche);
void Mapper140_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF);
}
static DECLFW(UNROMWrite)
{
setprg16(0x8000,V);
latche=V;
void Mapper240_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF);
// need SRAM.
}
static void UNROMReset(void)
//------------------ Map 87 ---------------------------
static void M87Sync(void)
{
setprg16(0x8000,0);
setprg16(0xc000,~0);
setvram8(CHRRAM);
SetWriteHandler(0x8000,0xffff,UNROMWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
latche=0;
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(latche>>1);
}
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)
{
info->Power=UNROMReset;
PRGmask16[0]&=7;
AddExState(&latche, 1, 0, "LATC");
AddExState(CHRRAM, 8192, 0, "CHRR");
GameStateRestore=UNROMRestore;
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF);
}
static void GNROMSync()
//------------------ Map 93 ---------------------------
static void SSUNROMSync(void)
{
setchr8(latche&3);
setprg32(0x8000,(latche>>4)&3);
setprg16(0x8000,latche>>4);
setprg16(0xc000,~0);
setchr8(0);
}
static DECLFW(GNROMWrite)
void SUNSOFT_UNROM_Init(CartInfo *info)
{
latche=V&0x33;
GNROMSync();
Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF);
}
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;
GNROMSync();
SetWriteHandler(0x8000,0xffff,GNROMWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF);
}
void GNROM_Init(CartInfo *info)
//------------------ Map 180 ---------------------------
static void M180Sync(void)
{
info->Power=GNROMReset;
AddExState(&latche, 1, 0, "LATC");
GameStateRestore=GNROMStateRestore;
setprg16(0x8000,0);
setprg16(0xc000,latche);
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)
{
if(m<4)
{
mirrorhard = 0;
setmirror(m);
}
else
{
vnapage[0]=NTARAM;
@ -428,7 +425,7 @@ void SetupCartMirroring(int m, int hard, uint8 *extra)
vnapage[3]=extra+0x400;
PPUNTARAM=0xF;
}
mirrorhard = hard;
mirrorhard=hard;
}
static uint8 *GENIEROM=0;

View File

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

File diff suppressed because it is too large Load Diff

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. */
#define BPOINT_READ 1
@ -10,6 +6,8 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl);
#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));
int FCEUI_DeleteBreakPoint(uint32 w);
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));
int FCEUI_AddBreakPoint(int type, unsigned int A1, unsigned int A2,
void (*Handler)(X6502 *, int type, unsigned int A));
#endif

File diff suppressed because it is too large Load Diff

View File

@ -286,8 +286,10 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
else /* Probably gzip */
{
int fd;
/*** REMOVED GCV1.0
fd = dup(fileno( (FILE *)t));
REMOVED GCV1.0 ***/
fclose(t);

View File

@ -58,8 +58,9 @@ void SexyFilter(int32 *in, int32 *out, int32 count)
int64 ino=(int64)*in*vmul;
acc1+=((ino-acc1)*mul1)>>16;
acc2+=((ino-acc1-acc2)*mul2)>>16;
//printf("%d ",*in);
*in=0;
{
{
int32 t=(acc1-ino+acc2)>>16;
//if(t>32767 || t<-32768) printf("Flow: %d\n",t);
if(t>32767) t=32767;
@ -127,13 +128,12 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
acc+=(S[c]**D)>>6;
acc2+=(S[1+c]**D)>>6;
}
acc=((int64)acc*(65536-(x&65535))+(int64)acc2*(x&65535))>>(16+11);
*out=acc;
out++;
count++;
}
mrindex=x-max;
if(FSettings.soundq==2)

View File

@ -83,8 +83,8 @@ static int asprintf(char **strp, const char *fmt, ...)
char *FCEU_MakeFName(int type, int id1, char *cd1)
{
char *ret=0;
#ifndef NGC
/*** REMOVED GC V1.0
struct stat tmpstat;
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);
break;
}
#endif
REMOVED GC V1.0 ***/
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

@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 1998 BERO
* Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
@ -62,11 +62,11 @@ static int NewiNES_Init(int num);
void (*MapClose)(void);
void (*MapperReset)(void);
int MapperNo;
int MapperNo = 0;
iNES_HEADER head;
/* MapperReset() is called when the NES is reset(with the reset button).
/* MapperReset() is called when the NES is reset(with the reset button).
Mapperxxx_init is called when the NES has been powered on.
*/
@ -104,7 +104,7 @@ static void iNESGI(int h)
break;
case GI_CLOSE:
{
FCEU_SaveGameSave(&iNESCart);
//FCEU_SaveGameSave(&iNESCart);
if(iNESCart.Close) iNESCart.Close();
if(ROM) {free(ROM);ROM=0;}
@ -143,7 +143,7 @@ static void SetInput(void)
{0xaf4010ea,SI_GAMEPAD,SI_POWERPADB,-1}, /* World Class Track Meet */
{0xd74b2719,SI_GAMEPAD,SI_POWERPADB,-1}, /* Super Team Games */
{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 */
@ -179,8 +179,6 @@ static void SetInput(void)
{0xbeb8ab01,-1,SI_ZAPPER,0}, /* Gumshoe */
{0xde8fd935,-1,SI_ZAPPER,0}, /* To the Earth */
{0xedc3662b,-1,SI_ZAPPER,0}, /* Operation Wolf */
{0x2a6559a1,-1,SI_ZAPPER,0}, /* Operation Wolf (J) */
{0x23d17f5e,SI_GAMEPAD,SI_ZAPPER,0}, /* The Lone Ranger */
{0xb8b9aca3,-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) */
{0x0f141525,-1,-1,SIFC_ARKANOID}, /* Arkanoid 2(J) */
{0x912989dc,-1,-1,SIFC_FKB}, /* Playbox BASIC */
{0xf7606810,-1,-1,SIFC_FKB}, /* Family BASIC 2.0A */
{0x895037bc,-1,-1,SIFC_FKB}, /* Family BASIC 2.1a */
{0xb2530afc,-1,-1,SIFC_FKB}, /* Family BASIC 3.0 */
@ -214,43 +211,8 @@ 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 {
uint32 crc32;
uint32 crc32;
int32 mapper;
int32 mirror;
};
@ -268,7 +230,7 @@ static void CheckHInfo(void)
{
0x498c10dc463cfe95LL, /* Battle Fleet */
0x6917ffcaca2d8466LL, /* Famista '90 */
0xd63dcc68c2b20adcLL, /* Final Fantasy J */
0x012df596e2b31174LL, /* Final Fantasy 1+2 */
0xf6b359a720549ecdLL, /* Final Fantasy 2 */
@ -306,7 +268,7 @@ static void CheckHInfo(void)
0x94b9484862a26cbaLL, /* Legend of Zelda */
0x04a31647de80fdabLL, /* "" */
0x9aa1dc16c05e7de5LL, /* Startropics */
0x1b084107d0878bd0LL, /* Startropics 2*/
@ -316,9 +278,182 @@ static void CheckHInfo(void)
};
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 x;
uint64 partialmd5=0;
@ -328,7 +463,6 @@ static void CheckHInfo(void)
partialmd5 |= (uint64)iNESCart.MD5[15-x] << (x*8);
//printf("%16llx\n",partialmd5);
}
CheckBad(partialmd5);
x=0;
@ -402,7 +536,7 @@ static void CheckHInfo(void)
/* Four-screen mirroring implicitly set. */
if(MapperNo==99)
Mirroring=2;
Mirroring=2;
if(tofix)
{
@ -416,7 +550,7 @@ static void CheckHInfo(void)
sprintf(gigastr+strlen(gigastr),"Mirroring should be set to \"%s\". ",mstr[Mirroring&3]);
}
if(tofix&4)
strcat(gigastr,"The battery-backed bit should be set. ");
strcat(gigastr,"The battery-backed bit should be set. ");
if(tofix&8)
strcat(gigastr,"This game should not have any CHR ROM. ");
strcat(gigastr,"\n");
@ -480,8 +614,8 @@ int iNESLoad(const char *name, FCEUFILE *fp)
if(!(ROM=(uint8 *)FCEU_malloc(ROM_size<<14)))
return 0;
if (VROM_size)
if (VROM_size)
if(!(VROM=(uint8 *)FCEU_malloc(VROM_size<<13)))
{
free(ROM);
@ -507,7 +641,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
if(VROM_size)
FCEU_fread(VROM,0x2000,head.VROM_size,fp);
md5_starts(&md5);
md5_starts(&md5);
md5_update(&md5,ROM,ROM_size<<14);
iNESGameCRC32=CalcCRC32(0,ROM,ROM_size<<14);
@ -528,7 +662,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
{
int x;
FCEU_printf(" ROM MD5: 0x");
for(x=0;x<16;x++)
for(x=0;x<16;x++)
FCEU_printf("%02x",iNESCart.MD5[x]);
FCEU_printf("\n");
}
@ -545,7 +679,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
for(x=0;x<8;x++)
{
partialmd5 |= (uint64)iNESCart.MD5[7-x] << (x*8);
}
}
FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring);
}
@ -561,7 +695,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
SetupCartMirroring(2+(Mirroring&1),1,0);
else
SetupCartMirroring(Mirroring&1,(Mirroring&4)>>2,0);
iNESCart.battery=(head.ROM_type&2)?1:0;
iNESCart.mirror=Mirroring;
@ -599,7 +733,7 @@ void FASTAPASS(2) VRAM_BANK1(uint32 A, uint8 V)
CHRBankList[(A)>>10]=V;
VPage[(A)>>10]=&CHRRAM[V<<10]-(A);
}
void FASTAPASS(2) VRAM_BANK4(uint32 A, uint32 V)
{
V&=1;
@ -615,7 +749,7 @@ void FASTAPASS(2) VROM_BANK1(uint32 A,uint32 V)
setchr1(A,V);
CHRBankList[(A)>>10]=V;
}
void FASTAPASS(2) VROM_BANK2(uint32 A,uint32 V)
{
setchr2(A,V);
@ -651,16 +785,16 @@ void FASTAPASS(2) ROM_BANK8(uint32 A, uint32 V)
if(A>=0x8000)
PRGBankList[((A-0x8000)>>13)]=V;
}
void FASTAPASS(2) ROM_BANK16(uint32 A, uint32 V)
{
setprg16(A,V);
if(A>=0x8000)
if(A>=0x8000)
{
PRGBankList[((A-0x8000)>>13)]=V<<1;
PRGBankList[((A-0x8000)>>13)+1]=(V<<1)+1;
}
}
}
void FASTAPASS(1) ROM_BANK32(uint32 V)
{
@ -700,7 +834,7 @@ static void NONE_init(void)
ROM_BANK16(0x8000,0);
ROM_BANK16(0xC000,~0);
if(VROM_size)
if(VROM_size)
VROM_BANK8(0);
else
setvram8(CHRRAM);
@ -711,8 +845,8 @@ void (*MapInitTab[256])(void)=
0,
0,Mapper2_init,Mapper3_init,0,
0,Mapper6_init,Mapper7_init,Mapper8_init,
Mapper9_init,Mapper10_init,Mapper11_init,0,
Mapper13_init,0,Mapper15_init,Mapper16_init,
Mapper9_init,Mapper10_init,0,0,
Mapper13_init,0,0,Mapper16_init,
Mapper17_init,Mapper18_init,0,0,
Mapper21_init,Mapper22_init,Mapper23_init,Mapper24_init,
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,0,0,0,Mapper57_init,Mapper58_init,Mapper59_init,Mapper60_init,
Mapper61_init,Mapper62_init,0,Mapper64_init,
Mapper65_init,Mapper66_init,Mapper67_init,Mapper68_init,
Mapper69_init,Mapper70_init,Mapper71_init,Mapper72_init,
Mapper65_init,Mapper66_init,Mapper67_init,0,
Mapper69_init,0,Mapper71_init,Mapper72_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,
Mapper85_init,Mapper86_init,Mapper87_init,Mapper88_init,
Mapper85_init,Mapper86_init,0,Mapper88_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,
0,0,0,0,0,0,Mapper107_init,0,
0,0,0,Mapper112_init,Mapper113_init,Mapper114_init,0,0,
Mapper117_init,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,Mapper112_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,Mapper140_init,
0,0,0,Mapper144_init,0,0,0,0,
0,0,Mapper151_init,Mapper152_init,Mapper153_init,Mapper154_init,0,Mapper156_init,
0,0,0,0,0,0,0,0,
0,0,Mapper151_init,0,Mapper153_init,Mapper154_init,0,Mapper156_init,
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,Mapper180_init,
0,Mapper182_init,0,Mapper184_init,Mapper185_init,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,Mapper185_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,Mapper207_init,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,
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
};
@ -767,14 +901,14 @@ void (*MapStateRestore)(int version);
void iNESStateRestore(int version)
{
int x;
if(!MapperNo) return;
for(x=0;x<4;x++)
setprg8(0x8000+x*8192,PRGBankList[x]);
if(VROM_size)
for(x=0;x<8;x++)
for(x=0;x<8;x++)
setchr1(0x400*x,CHRBankList[x]);
if(0) switch(Mirroring)
@ -829,7 +963,7 @@ static void iNESPower(void)
if(head.ROM_type&8)
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
/* Exclude some mappers whose emulation code handle save state stuff
/* Exclude some mappers whose emulation code handle save state stuff
themselves. */
if(type && type!=13 && type!=96)
{
@ -842,7 +976,7 @@ static void iNESPower(void)
for(x=0;x<8;x++)
{
char tak[8];
sprintf(tak,"CBL%d",x);
sprintf(tak,"CBL%d",x);
AddExState(&CHRBankList[x], 2, 1,tak);
}
}
@ -856,7 +990,7 @@ static void iNESPower(void)
typedef struct {
int number;
int number;
void (*init)(CartInfo *);
} BMAPPING;
@ -879,20 +1013,63 @@ static BMAPPING bmap[] = {
{95, Mapper95_Init},
{105, Mapper105_Init},
{115, Mapper115_Init},
{116, Mapper116_Init},
{115, Mapper115_Init},
{116, Mapper116_Init},
{118, Mapper118_Init},
{119, Mapper119_Init}, /* Has CHR ROM and CHR RAM by default. Hmm. */
{155, Mapper155_Init},
{164, Mapper164_Init},
{187, Mapper187_Init},
{188, Mapper188_Init},
{187, Mapper187_Init},
{206, Mapper206_Init},
{208, Mapper208_Init},
{208, Mapper208_Init},
{210, Mapper210_Init},
{245, Mapper245_Init},
{249, Mapper249_Init},
{250, Mapper250_Init},
{245, Mapper245_Init},
{249, Mapper249_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}
};
@ -923,7 +1100,6 @@ static int NewiNES_Init(int num)
return(0);
}
/****************************************************************************
** GC V1.0
**
@ -1079,3 +1255,4 @@ int iNESMemLoad(char *nesrom)
GameInterface=iNESGI;
return 1;
}

View File

@ -162,7 +162,7 @@ void Mapper64_init(void);
void Mapper65_init(void);
void Mapper66_init(void);
void Mapper67_init(void);
void Mapper68_init(void);
//void Mapper68_init(void);
void Mapper69_init(void);
void Mapper70_init(void);
void Mapper71_init(void);
@ -363,7 +363,6 @@ void Mapper74_Init(CartInfo *);
void Mapper90_Init(CartInfo *);
void Mapper165_Init(CartInfo *);
void Mapper209_Init(CartInfo *);
void Mapper95_Init(CartInfo *);
void Mapper105_Init(CartInfo *);
void Mapper115_Init(CartInfo *);
@ -373,7 +372,6 @@ void Mapper119_Init(CartInfo *);
void Mapper155_Init(CartInfo *);
void Mapper164_Init(CartInfo *);
void Mapper187_Init(CartInfo *);
void Mapper188_Init(CartInfo *);
void Mapper206_Init(CartInfo *);
void Mapper208_Init(CartInfo *);
void Mapper209_Init(CartInfo *);
@ -381,3 +379,41 @@ void Mapper210_Init(CartInfo *);
void Mapper245_Init(CartInfo *);
void Mapper249_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;
//printf("%02x\n",mapbyte1[0]);
//if((mapbyte1[0]&3)==3)
if(VROM_size == 1)
// DumpMem("out",0x8000,0xFFFF);
// exit(1);
// if(mapbyte1[0]==0x15)
if(!(mapbyte1[0]&3))
// if(!(mapbyte1[0]==0x21))
{
if((mapbyte1[0]&3) == 1)
setchr8(0);
else
setchr8r(0x10,0);
}
else if(VROM_size == 2)
{
if((mapbyte1[0]&2)) setchr8(mapbyte1[0]&1);
else setchr8r(0x10,0);
}
for(x=0;x<8;x++)
setchr1r(0x10,x<<10,0);
}
else
setchr8(0);
}
static DECLFW(Mapper185_write)
@ -310,15 +307,12 @@ static DECLFW(Mapper185_write)
void Mapper185_init(void)
{
int x;
for(x=0;x<8192;x++)
MapperExRAM[x]=0xFF;
//memset(MapperExRAM,0xFF,1024);
memset(MapperExRAM,0xFF,1024);
MapStateRestore=M185Sync;
mapbyte1[0]=0;
M185Sync(0);
SetupCartCHRMapping(0x10,MapperExRAM,8192,0);
SetupCartCHRMapping(0x10,MapperExRAM,1024,0);
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)
{
//printf("%04x:%02x, %d\n",A,V,scanline);
A&=0xF003;
if(A>=0xA000 && A<=0xA003)
VROM_BANK1(0x1000+((A&3)<<10),V);
else switch(A)

View File

@ -27,9 +27,9 @@ DECLFW(Mapper86_write)
VROM_BANK8((V&3)|((V>>4)&4));
ROM_BANK32((V>>4)&3);
}
//else
else
//if(A!=0x6000)
// printf("$%04x:$%02x\n",A,V);
printf("$%04x:$%02x\n",A,V);
}
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 DRegs[8];
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{DRegs, 8, "DREG"},
{0}
{&cmd, 1, "CMD"},
{DRegs, 8, "DREG"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
setchr8(0);
}
static void StateRestore(int version)
{
Sync();
Sync();
}
static DECLFW(Write)
{
if((A&0x7300)==0x5000)
setprg32(0x8000,V);
//else
//if(A==0x5200)
// printf("$%04x:$%02x\n",A,V);
switch (A&0x7300)
{
case 0x5100: DRegs[0]=V; Sync(); break;
case 0x5000: DRegs[1]=V; Sync(); break;
}
}
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 DECLFR(AWRAM)
{
return(WRAM[A-0x6000]);
return(WRAM[A-0x6000]);
}
static DECLFW(BWRAM)
{
WRAM[A-0x6000]=V;
WRAM[A-0x6000]=V;
}
static void Power(void)
{
setchr8(0);
setprg32(0x8000,~0);
cmd=0;
memset(DRegs,0,8);
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xFFFF,Write);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
memset(DRegs,0,8);
DRegs[1]=0xFF;
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0x5FFF,Write);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
Sync();
}
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)
{
info->Power=Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
info->Power=Power;
GameStateRestore=StateRestore;
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

@ -28,13 +28,13 @@ static void (*psfun)(void);
void MMC5RunSound(int Count);
void MMC5RunSoundHQ(void);
static INLINE void MMC5SPRVROM_BANK1(uint32 A,uint32 V)
static INLINE void MMC5SPRVROM_BANK1(uint32 A,uint32 V)
{
if(CHRptr[0])
{
V&=CHRmask1[0];
MMC5SPRVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);
}
if(CHRptr[0])
{
V&=CHRmask1[0];
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);}}
@ -52,7 +52,7 @@ static uint8 PRGBanks[4];
static uint8 WRAMPage;
static uint8 CHRBanksA[8], CHRBanksB[4];
static uint8 WRAMMaskEnable[2];
static uint8 ABMode; /* A=0, B=1 */
static uint8 ABMode; /* A=0, B=1 */
static uint8 IRQScanline,IRQEnable;
static uint8 CHRMode, NTAMirroring, NTFill, ATFill;
@ -76,8 +76,8 @@ static void MMC5CHRA(void);
static void MMC5CHRB(void);
typedef struct __cartdata {
uint32 crc32;
uint8 size;
uint32 crc32;
uint8 size;
} cartdata;
@ -87,316 +87,300 @@ typedef struct __cartdata {
#define MMC5_NOCARTS 14
cartdata MMC5CartList[MMC5_NOCARTS]=
{
{0x9c18762b,2}, /* L'Empereur */
{0x26533405,2},
{0x6396b988,2},
{0x9c18762b,2}, /* L'Empereur */
{0x26533405,2},
{0x6396b988,2},
{0xaca15643,2}, /* Uncharted Waters */
{0xfe3488d1,2}, /* Dai Koukai Jidai */
{0xaca15643,2}, /* Uncharted Waters */
{0xfe3488d1,2}, /* Dai Koukai Jidai */
{0x15fe6d0f,2}, /* BKAC */
{0x39f2ce4b,2}, /* Suikoden */
{0x15fe6d0f,2}, /* BKAC */
{0x39f2ce4b,2}, /* Suikoden */
{0x8ce478db,2}, /* Nobunaga's Ambition 2 */
{0xeee9a682,2},
{0x8ce478db,2}, /* Nobunaga's Ambition 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 */
{0x184c2124,4}, /* Sangokushi 2 */
{0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */
{0x184c2124,4}, /* Sangokushi 2 */
};
int DetectMMC5WRAMSize(uint32 crc32)
{
int x;
for(x=0;x<MMC5_NOCARTS;x++)
if(crc32==MMC5CartList[x].crc32)
{
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
return(MMC5CartList[x].size*8);
}
return(8);
int x;
for(x=0;x<MMC5_NOCARTS;x++)
if(crc32==MMC5CartList[x].crc32)
{
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
return(MMC5CartList[x].size*8);
}
return(8);
}
static void BuildWRAMSizeTable(void)
{
int x;
for(x=0;x<8;x++)
{
switch(MMC5WRAMsize)
int x;
for(x=0;x<8;x++)
{
case 0:MMC5WRAMIndex[x]=255;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;
switch(MMC5WRAMsize)
{
case 0: MMC5WRAMIndex[x]=255; 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)
{
int x;
switch(mmc5vsize&3)
{
case 0:setchr8(CHRBanksA[7]);
MMC5SPRVROM_BANK8(CHRBanksA[7]);
break;
case 1:setchr4(0x0000,CHRBanksA[3]);
setchr4(0x1000,CHRBanksA[7]);
MMC5SPRVROM_BANK4(0x0000,CHRBanksA[3]);
MMC5SPRVROM_BANK4(0x1000,CHRBanksA[7]);
break;
case 2:setchr2(0x0000,CHRBanksA[1]);
setchr2(0x0800,CHRBanksA[3]);
setchr2(0x1000,CHRBanksA[5]);
setchr2(0x1800,CHRBanksA[7]);
MMC5SPRVROM_BANK2(0x0000,CHRBanksA[1]);
MMC5SPRVROM_BANK2(0x0800,CHRBanksA[3]);
MMC5SPRVROM_BANK2(0x1000,CHRBanksA[5]);
MMC5SPRVROM_BANK2(0x1800,CHRBanksA[7]);
break;
case 3:
for(x=0;x<8;x++)
{
setchr1(x<<10,CHRBanksA[x]);
MMC5SPRVROM_BANK1(x<<10,CHRBanksA[x]);
}
break;
}
int x;
switch(mmc5vsize&3)
{
case 0: setchr8(CHRBanksA[7]);
MMC5SPRVROM_BANK8(CHRBanksA[7]);
break;
case 1: setchr4(0x0000,CHRBanksA[3]);
setchr4(0x1000,CHRBanksA[7]);
MMC5SPRVROM_BANK4(0x0000,CHRBanksA[3]);
MMC5SPRVROM_BANK4(0x1000,CHRBanksA[7]);
break;
case 2: setchr2(0x0000,CHRBanksA[1]);
setchr2(0x0800,CHRBanksA[3]);
setchr2(0x1000,CHRBanksA[5]);
setchr2(0x1800,CHRBanksA[7]);
MMC5SPRVROM_BANK2(0x0000,CHRBanksA[1]);
MMC5SPRVROM_BANK2(0x0800,CHRBanksA[3]);
MMC5SPRVROM_BANK2(0x1000,CHRBanksA[5]);
MMC5SPRVROM_BANK2(0x1800,CHRBanksA[7]);
break;
case 3: for(x=0;x<8;x++)
{
setchr1(x<<10,CHRBanksA[x]);
MMC5SPRVROM_BANK1(x<<10,CHRBanksA[x]);
}
break;
}
}
static void MMC5CHRB(void)
{
int x;
switch(mmc5vsize&3)
{
case 0:
setchr8(CHRBanksB[3]);
MMC5BGVROM_BANK8(CHRBanksB[3]);
break;
case 1:
setchr4(0x0000,CHRBanksB[3]);
setchr4(0x1000,CHRBanksB[3]);
MMC5BGVROM_BANK4(0x0000,CHRBanksB[3]);
MMC5BGVROM_BANK4(0x1000,CHRBanksB[3]);
break;
case 2:
setchr2(0x0000,CHRBanksB[1]);
setchr2(0x0800,CHRBanksB[3]);
setchr2(0x1000,CHRBanksB[1]);
setchr2(0x1800,CHRBanksB[3]);
MMC5BGVROM_BANK2(0x0000,CHRBanksB[1]);
MMC5BGVROM_BANK2(0x0800,CHRBanksB[3]);
MMC5BGVROM_BANK2(0x1000,CHRBanksB[1]);
MMC5BGVROM_BANK2(0x1800,CHRBanksB[3]);
break;
case 3:
for(x=0;x<8;x++)
{
setchr1(x<<10,CHRBanksB[x&3]);
MMC5BGVROM_BANK1(x<<10,CHRBanksB[x&3]);
}
break;
}
int x;
switch(mmc5vsize&3)
{
case 0: setchr8(CHRBanksB[3]);
MMC5BGVROM_BANK8(CHRBanksB[3]);
break;
case 1: setchr4(0x0000,CHRBanksB[3]);
setchr4(0x1000,CHRBanksB[3]);
MMC5BGVROM_BANK4(0x0000,CHRBanksB[3]);
MMC5BGVROM_BANK4(0x1000,CHRBanksB[3]);
break;
case 2: setchr2(0x0000,CHRBanksB[1]);
setchr2(0x0800,CHRBanksB[3]);
setchr2(0x1000,CHRBanksB[1]);
setchr2(0x1800,CHRBanksB[3]);
MMC5BGVROM_BANK2(0x0000,CHRBanksB[1]);
MMC5BGVROM_BANK2(0x0800,CHRBanksB[3]);
MMC5BGVROM_BANK2(0x1000,CHRBanksB[1]);
MMC5BGVROM_BANK2(0x1800,CHRBanksB[3]);
break;
case 3: 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)
{
//printf("%02x\n",V);
V=MMC5WRAMIndex[V&7];
if(V!=255)
{
//printf("%02x\n",V);
V=MMC5WRAMIndex[V&7];
if(V!=255)
{
setprg8r(0x10,A,V);
MMC5MemIn[(A-0x6000)>>13]=1;
}
else
}
else
MMC5MemIn[(A-0x6000)>>13]=0;
}
static void MMC5PRG(void)
{
int x;
switch(mmc5psize&3)
{
case 0:
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
setprg32(0x8000,((PRGBanks[1]&0x7F)>>2));
for(x=0;x<4;x++)
MMC5MemIn[1+x]=1;
break;
case 1:
if(PRGBanks[1]&0x80)
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
setprg16(0x8000,(PRGBanks[1]>>1));
MMC5MemIn[1]=MMC5MemIn[2]=1;
}
else
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
}
MMC5MemIn[3]=MMC5MemIn[4]=1;
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
setprg16(0xC000,(PRGBanks[3]&0x7F)>>1);
break;
case 2:
if(PRGBanks[1]&0x80)
{
MMC5MemIn[1]=MMC5MemIn[2]=1;
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
setprg16(0x8000,(PRGBanks[1]&0x7F)>>1);
}
else
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
}
if(PRGBanks[2]&0x80)
{MMC5ROMWrProtect[2]=1;MMC5MemIn[3]=1;setprg8(0xC000,PRGBanks[2]&0x7F);}
else
{MMC5ROMWrProtect[2]=0;MMC5WRAM(0xC000,PRGBanks[2]&7);}
MMC5MemIn[4]=1;
MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
case 3:
for(x=0;x<3;x++)
if(PRGBanks[x]&0x80)
{
MMC5ROMWrProtect[x]=1;
setprg8(0x8000+(x<<13),PRGBanks[x]&0x7F);
MMC5MemIn[1+x]=1;
}
else
{
MMC5ROMWrProtect[x]=0;
MMC5WRAM(0x8000+(x<<13),PRGBanks[x]&7);
}
MMC5MemIn[4]=1;
MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
int x;
switch(mmc5psize&3)
{
case 0: MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
setprg32(0x8000,((PRGBanks[1]&0x7F)>>2));
for(x=0;x<4;x++)
MMC5MemIn[1+x]=1;
break;
case 1: if(PRGBanks[1]&0x80)
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
setprg16(0x8000,(PRGBanks[1]>>1));
MMC5MemIn[1]=MMC5MemIn[2]=1;
}
else
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
}
MMC5MemIn[3]=MMC5MemIn[4]=1;
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
setprg16(0xC000,(PRGBanks[3]&0x7F)>>1);
break;
case 2: if(PRGBanks[1]&0x80)
{
MMC5MemIn[1]=MMC5MemIn[2]=1;
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
setprg16(0x8000,(PRGBanks[1]&0x7F)>>1);
}
else
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
}
if(PRGBanks[2]&0x80)
{
MMC5ROMWrProtect[2]=1;
MMC5MemIn[3]=1;
setprg8(0xC000,PRGBanks[2]&0x7F);
}
else
{
MMC5ROMWrProtect[2]=0;
MMC5WRAM(0xC000,PRGBanks[2]&7);
}
MMC5MemIn[4]=1;
MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
case 3: for(x=0;x<3;x++)
if(PRGBanks[x]&0x80)
{
MMC5ROMWrProtect[x]=1;
setprg8(0x8000+(x<<13),PRGBanks[x]&0x7F);
MMC5MemIn[1+x]=1;
}
else
{
MMC5ROMWrProtect[x]=0;
MMC5WRAM(0x8000+(x<<13),PRGBanks[x]&7);
}
MMC5MemIn[4]=1;
MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
}
}
static DECLFW(Mapper5_write)
{
if(A >= 0x5120 && A<=0x5127)
{
ABMode = 0;
CHRBanksA[A&7]=V;
MMC5CHRA();
}
else switch(A)
{
default:
//printf("$%04x, $%02x\n",A,V);
break;
case 0x5105:
{
int x;
for(x=0;x<4;x++)
{
switch((V>>(x<<1))&3)
{
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;
if(A>=0x5120&&A<=0x5127)
{
ABMode = 0;
CHRBanksA[A&7]=V;
MMC5CHRA();
}
else switch(A)
{
case 0x5105: {
int x;
for(x=0;x<4;x++)
{
switch((V>>(x<<1))&3)
{
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;
case 0x5113:WRAMPage=V;MMC5WRAM(0x6000,V&7);break;
case 0x5100:mmc5psize=V;MMC5PRG();break;
case 0x5101:mmc5vsize=V;
if(!ABMode)
{MMC5CHRB();MMC5CHRA();}
else
{MMC5CHRA();MMC5CHRB();}
break;
case 0x5114:
case 0x5115:
case 0x5116:
case 0x5117:
PRGBanks[A&3]=V;MMC5PRG();break;
case 0x5128:
case 0x5129:
case 0x512a:
case 0x512b:ABMode=1;
CHRBanksB[A&3]=V;
MMC5CHRB();
break;
case 0x5102:WRAMMaskEnable[0]=V;break;
case 0x5103:WRAMMaskEnable[1]=V;break;
case 0x5104:CHRMode=V;MMC5HackCHRMode=V&3;break;
case 0x5106:if(V!=NTFill)
{
uint32 t;
t=V|(V<<8)|(V<<16)|(V<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0);
}
NTFill=V;
break;
case 0x5107:if(V!=ATFill)
{
unsigned char moop;
uint32 t;
moop=V|(V<<2)|(V<<4)|(V<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
}
ATFill=V;
break;
case 0x5200:MMC5HackSPMode=V;break;
case 0x5201:MMC5HackSPScroll=(V>>3)&0x1F;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;
NTAMirroring=V;
break;
case 0x5113: WRAMPage=V;MMC5WRAM(0x6000,V&7);break;
case 0x5100: mmc5psize=V;MMC5PRG();break;
case 0x5101: mmc5vsize=V;
if(!ABMode)
{ MMC5CHRB();MMC5CHRA();}
else
{ MMC5CHRA();MMC5CHRB();}
break;
case 0x5114:
case 0x5115:
case 0x5116:
case 0x5117: PRGBanks[A&3]=V;MMC5PRG();break;
case 0x5128:
case 0x5129:
case 0x512a:
case 0x512b: ABMode=1;
CHRBanksB[A&3]=V;
MMC5CHRB();
break;
case 0x5102: WRAMMaskEnable[0]=V;break;
case 0x5103: WRAMMaskEnable[1]=V;break;
case 0x5104: CHRMode=V;MMC5HackCHRMode=V&3;break;
case 0x5106: if(V!=NTFill)
{
uint32 t;
t=V|(V<<8)|(V<<16)|(V<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0);
}
NTFill=V;
break;
case 0x5107: if(V!=ATFill)
{
unsigned char moop;
uint32 t;
moop=V|(V<<2)|(V<<4)|(V<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
}
ATFill=V;
break;
case 0x5200: MMC5HackSPMode=V;break;
case 0x5201: MMC5HackSPScroll=(V>>3)&0x1F;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)
{
if(MMC5MemIn[(A-0x6000)>>13])
return Page[A>>11][A];
else
return X.DB;
if(MMC5MemIn[(A-0x6000)>>13])
return Page[A>>11][A];
else
return X.DB;
}
static DECLFW(MMC5_WriteROMRAM)
{
if(A>=0x8000)
if(MMC5ROMWrProtect[(A-0x8000)>>13])
return;
if(MMC5MemIn[(A-0x6000)>>13])
if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6)
Page[A>>11][A]=V;
if(A>=0x8000)
if(MMC5ROMWrProtect[(A-0x8000)>>13]) return;
if(MMC5MemIn[(A-0x6000)>>13])
if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6) Page[A>>11][A]=V;
}
static DECLFW(MMC5_ExRAMWr)
{
if(MMC5HackCHRMode!=3)
ExRAM[A&0x3ff]=V;
if(MMC5HackCHRMode!=3)
ExRAM[A&0x3ff]=V;
}
static DECLFR(MMC5_ExRAMRd)
@ -410,60 +394,59 @@ static DECLFR(MMC5_ExRAMRd)
static DECLFR(MMC5_read)
{
switch(A)
{
//default:printf("$%04x\n",A);break;
case 0x5204:X6502_IRQEnd(FCEU_IQEXT);
{
uint8 x;
x=MMC5IRQR;
if(!fceuindbg)
MMC5IRQR&=0x40;
return x;
}
case 0x5205:return (mul[0]*mul[1]);
case 0x5206:return ((mul[0]*mul[1])>>8);
}
return(X.DB);
switch(A)
{
case 0x5204: X6502_IRQEnd(FCEU_IQEXT);
{
uint8 x;
x=MMC5IRQR;
if(!fceuindbg)
MMC5IRQR&=0x40;
return x;
}
case 0x5205: return (mul[0]*mul[1]);
case 0x5206: return ((mul[0]*mul[1])>>8);
}
return(X.DB);
}
void MMC5Synco(void)
{
int x;
int x;
MMC5PRG();
for(x=0;x<4;x++)
{
switch((NTAMirroring>>(x<<1))&3)
{
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;
}
}
MMC5WRAM(0x6000,WRAMPage&7);
if(!ABMode)
{
MMC5CHRB();
MMC5CHRA();
}
else
{
MMC5CHRA();
MMC5CHRB();
}
MMC5PRG();
for(x=0;x<4;x++)
{
switch((NTAMirroring>>(x<<1))&3)
{
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;
}
}
MMC5WRAM(0x6000,WRAMPage&7);
if(!ABMode)
{
MMC5CHRB();
MMC5CHRA();
}
else
{
MMC5CHRA();
MMC5CHRB();
}
{
uint32 t;
t=NTFill|(NTFill<<8)|(NTFill<<16)|(NTFill<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0);
}
{
unsigned char moop;
uint32 t;
moop=ATFill|(ATFill<<2)|(ATFill<<4)|(ATFill<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
unsigned char moop;
uint32 t;
moop=ATFill|(ATFill<<2)|(ATFill<<4)|(ATFill<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
}
X6502_IRQEnd(FCEU_IQEXT);
MMC5HackCHRMode=CHRMode&3;
@ -471,47 +454,41 @@ void MMC5Synco(void)
void MMC5_hb(int scanline)
{
//printf("%d:%d, ",scanline,MMC5LineCounter);
if(scanline==240)
{
// printf("\n%d:%d\n",scanline,MMC5LineCounter);
MMC5LineCounter=0;
MMC5IRQR=0x40;
return;
MMC5LineCounter=0;
MMC5IRQR=0x40;
return;
}
if(MMC5LineCounter<240)
{
if(MMC5LineCounter==IRQScanline)
{
MMC5IRQR|=0x80;
if(IRQEnable&0x80)
X6502_IRQBegin(FCEU_IQEXT);
}
MMC5LineCounter++;
if(MMC5LineCounter==IRQScanline)
{
MMC5IRQR|=0x80;
if(IRQEnable&0x80)
X6502_IRQBegin(FCEU_IQEXT);
}
MMC5LineCounter++;
}
// printf("%d:%d\n",MMC5LineCounter,scanline);
if(MMC5LineCounter==240)
MMC5IRQR=0;
if(MMC5LineCounter==240)
MMC5IRQR=0;
}
void MMC5_StateRestore(int version)
{
MMC5Synco();
MMC5Synco();
}
typedef struct {
uint16 wl[2];
uint8 env[2];
uint8 enable;
uint8 running;
uint8 raw;
uint8 rawcontrol;
int32 dcount[2];
int32 BC[3];
int32 vcount[2];
uint16 wl[2];
uint8 env[2];
uint8 enable;
uint8 running;
uint8 raw;
uint8 rawcontrol;
int32 dcount[2];
int32 BC[3];
int32 vcount[2];
} MMC5APU;
static MMC5APU MMC5Sound;
@ -519,88 +496,88 @@ static MMC5APU MMC5Sound;
static void Do5PCM()
{
int32 V;
int32 start,end;
int32 V;
int32 start,end;
start=MMC5Sound.BC[2];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
MMC5Sound.BC[2]=end;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
start=MMC5Sound.BC[2];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
MMC5Sound.BC[2]=end;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
for(V=start;V<end;V++)
Wave[V>>4]+=MMC5Sound.raw<<1;
Wave[V>>4]+=MMC5Sound.raw<<1;
}
static void Do5PCMHQ()
{
int32 V;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
int32 V;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
for(V=MMC5Sound.BC[2];V<SOUNDTS;V++)
WaveHi[V]+=MMC5Sound.raw<<5;
MMC5Sound.BC[2]=SOUNDTS;
}
WaveHi[V]+=MMC5Sound.raw<<5;
MMC5Sound.BC[2]=SOUNDTS;
}
static DECLFW(Mapper5_SW)
{
A&=0x1F;
A&=0x1F;
GameExpSound.Fill=MMC5RunSound;
GameExpSound.HiFill=MMC5RunSoundHQ;
GameExpSound.Fill=MMC5RunSound;
GameExpSound.HiFill=MMC5RunSoundHQ;
switch(A)
{
case 0x10:if(psfun) psfun();MMC5Sound.rawcontrol=V;break;
case 0x11:if(psfun) psfun();MMC5Sound.raw=V;break;
switch(A)
{
case 0x10:if(psfun) psfun();MMC5Sound.rawcontrol=V;break;
case 0x11:if(psfun) psfun();MMC5Sound.raw=V;break;
case 0x0:
case 0x4://printf("%04x:$%02x\n",A,V&0x30);
if(sfun) sfun(A>>2);
MMC5Sound.env[A>>2]=V;
case 0x0:
case 0x4://printf("%04x:$%02x\n",A,V&0x30);
if(sfun) sfun(A>>2);
MMC5Sound.env[A>>2]=V;
break;
case 0x2:
case 0x6: if(sfun) sfun(A>>2);
MMC5Sound.wl[A>>2]&=~0x00FF;
MMC5Sound.wl[A>>2]|=V&0xFF;
break;
case 0x3:
case 0x7://printf("%04x:$%02x\n",A,V>>3);
MMC5Sound.wl[A>>2]&=~0x0700;
MMC5Sound.wl[A>>2]|=(V&0x07)<<8;
MMC5Sound.running|=1<<(A>>2);
break;
case 0x2:
case 0x6:if(sfun) sfun(A>>2);
MMC5Sound.wl[A>>2]&=~0x00FF;
MMC5Sound.wl[A>>2]|=V&0xFF;
break;
case 0x3:
case 0x7://printf("%04x:$%02x\n",A,V>>3);
MMC5Sound.wl[A>>2]&=~0x0700;
MMC5Sound.wl[A>>2]|=(V&0x07)<<8;
MMC5Sound.running|=1<<(A>>2);
break;
case 0x15:if(sfun)
{
sfun(0);
sfun(1);
}
MMC5Sound.running&=V;
MMC5Sound.running&=V;
MMC5Sound.enable=V;
//printf("%02x\n",V);
//printf("%02x\n",V);
break;
}
}
static void Do5SQ(int P)
{
{
static int tal[4]={1,2,4,6};
int32 V,amp,rthresh,wl;
int32 start,end;
start=MMC5Sound.BC[P];
end=(SOUNDTS<<16)/soundtsinc;
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
MMC5Sound.BC[P]=end;
wl=MMC5Sound.wl[P]+1;
amp=(MMC5Sound.env[P]&0xF)<<4;
rthresh=tal[(MMC5Sound.env[P]&0xC0)>>6];
if(wl>=8 && (MMC5Sound.running&(P+1)))
{
int dc,vc;
{
int dc,vc;
wl<<=18;
dc=MMC5Sound.dcount[P];
vc=MMC5Sound.vcount[P];
@ -610,7 +587,7 @@ static void Do5SQ(int P)
if(dc<rthresh)
Wave[V>>4]+=amp;
vc-=nesincsize;
while(vc<=0)
while(vc<=0)
{
vc+=wl;
dc=(dc+1)&7;
@ -625,18 +602,18 @@ static void Do5SQHQ(int P)
{
static int tal[4]={1,2,4,6};
int32 V,amp,rthresh,wl;
wl=MMC5Sound.wl[P]+1;
amp=((MMC5Sound.env[P]&0xF)<<8);
rthresh=tal[(MMC5Sound.env[P]&0xC0)>>6];
if(wl>=8 && (MMC5Sound.running&(P+1)))
{
int dc,vc;
wl<<=1;
dc=MMC5Sound.dcount[P];
dc=MMC5Sound.dcount[P];
vc=MMC5Sound.vcount[P];
for(V=MMC5Sound.BC[P];V<SOUNDTS;V++)
{
@ -648,7 +625,7 @@ static void Do5SQHQ(int P)
vc=wl;
dc=(dc+1)&7;
}
}
}
MMC5Sound.dcount[P]=dc;
MMC5Sound.vcount[P]=vc;
}
@ -656,7 +633,7 @@ static void Do5SQHQ(int P)
}
void MMC5RunSoundHQ(void)
{
{
Do5SQHQ(0);
Do5SQHQ(1);
Do5PCMHQ();
@ -686,7 +663,7 @@ void Mapper5_ESI(void)
if(FSettings.soundq>=1)
{
sfun=Do5SQHQ;
psfun=Do5PCMHQ;
psfun=Do5PCMHQ;
}
else
{
@ -711,7 +688,7 @@ void NSFMMC5_Init(void)
ExRAM=(uint8*)FCEU_gmalloc(1024);
Mapper5_ESI();
SetWriteHandler(0x5c00,0x5fef,MMC5_ExRAMWr);
SetReadHandler(0x5c00,0x5fef,MMC5_ExRAMRd);
SetReadHandler(0x5c00,0x5fef,MMC5_ExRAMRd);
MMC5HackCHRMode=2;
SetWriteHandler(0x5000,0x5015,Mapper5_SW);
SetWriteHandler(0x5205,0x5206,Mapper5_write);
@ -762,21 +739,21 @@ static SFORMAT MMC5_StateRegs[]={
{ PRGBanks, 4, "PRGB"},
{ CHRBanksA, 8, "CHRA"},
{ CHRBanksB, 4, "CHRB"},
{ &WRAMPage, 1, "WRMP"},
{ WRAMMaskEnable, 2, "WRME"},
{ &ABMode, 1, "ABMD"},
{ &IRQScanline, 1, "IRQS"},
{ &IRQEnable, 1, "IRQE"},
{ &CHRMode, 1, "CHRM"},
{ &NTAMirroring, 1, "NTAM"},
{ &NTFill, 1, "NTFL"},
{ &ATFill, 1, "ATFL"},
{ &WRAMPage, 1, "WRMP"},
{ WRAMMaskEnable, 2, "WRME"},
{ &ABMode, 1, "ABMD"},
{ &IRQScanline, 1, "IRQS"},
{ &IRQEnable, 1, "IRQE"},
{ &CHRMode, 1, "CHRM"},
{ &NTAMirroring, 1, "NTAM"},
{ &NTFill, 1, "NTFL"},
{ &ATFill, 1, "ATFL"},
{ &MMC5Sound.wl[0], 2|FCEUSTATE_RLSB, "SDW0"},
{ &MMC5Sound.wl[1], 2|FCEUSTATE_RLSB, "SDW1"},
{ MMC5Sound.env, 2, "SDEV"},
{ &MMC5Sound.enable, 1, "SDEN"},
{ &MMC5Sound.running, 1, "SDRU"},
{ &MMC5Sound.running, 1, "SDRU"},
{ &MMC5Sound.raw, 1, "SDRW"},
{ &MMC5Sound.rawcontrol, 1, "SDRC"},
{0}
@ -801,7 +778,7 @@ static void GenMMC5_Init(CartInfo *info, int wsize, int battery)
AddExState(&MMC5HackSPScroll, 1, 0, "SPLS");
AddExState(&MMC5HackSPPage, 1, 0, "SPLP");
MMC5WRAMsize=wsize/8;
MMC5WRAMsize=wsize/8;
BuildWRAMSizeTable();
GameStateRestore=MMC5_StateRestore;
info->Power=GenMMC5Reset;

View File

@ -191,21 +191,18 @@ void FCEUMOV_AddJoy(uint8 *js)
tmp &= 0x3;
ti=0;
{
int tmpfix = tmp;
while(tmp--) { nextts |= fgetc(slots[-1 - current]) << (ti * 8); ti++; }
int tmpfix = tmp;
while(tmp--) { nextts |= fgetc(slots[-1 - current]) << (ti * 8); ti++; }
// 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
// movies on <= 0.98.10 and don't work on playback.
if(tmpfix == 1 && !nextts)
{nextts |= fgetc(slots[-1 - current])<<8; }
else if(tmpfix == 2 && !nextts) {nextts |= fgetc(slots[-1 - current])<<16; }
framets = 0;
nextd = d;
}
// 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
// movies on <= 0.98.10 and don't work on playback.
if(tmpfix == 1 && !nextts)
{nextts |= fgetc(slots[-1 - current])<<8; }
else if(tmpfix == 2 && !nextts) {nextts |= fgetc(slots[-1 - current])<<16; }
framets = 0;
nextd = d;
}
memcpy(js,joop,4);
}

View File

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

View File

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

View File

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

View File

@ -21,60 +21,6 @@
pixdata|=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];
pixdata>>=4;
P[1]=S[pixdata&0xF];
@ -90,7 +36,6 @@
P[6]=S[pixdata&0xF];
pixdata>>=4;
P[7]=S[pixdata&0xF];
#endif
P+=8;
}

View File

@ -46,20 +46,20 @@ static uint8 TriMode;
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 RawDALatch; /* $4011 0xxxxxxx */
static uint8 RawDALatch; /* $4011 0xxxxxxx */
uint8 EnabledChannels; /* Byte written to $4015 */
uint8 EnabledChannels; /* Byte written to $4015 */
typedef struct {
uint8 Speed;
uint8 Mode; /* Fixed volume(1), and loop(2) */
uint8 DecCountTo1;
uint8 decvolume;
int reloaddec;
uint8 Speed;
uint8 Mode; /* Fixed volume(1), and loop(2) */
uint8 DecCountTo1;
uint8 decvolume;
int reloaddec;
} ENVUNIT;
static ENVUNIT EnvUnits[3];
@ -71,7 +71,7 @@ static uint8 sweepon[2];
static int32 curfreq[2];
static uint8 SweepCount[2];
static uint16 nreg;
static uint16 nreg;
static uint8 fcnt;
static int32 fhcnt;
@ -86,7 +86,7 @@ uint32 soundtsi;
static int32 sqacc[2];
/* LQ variables segment ends. */
static int32 lengthcount[4];
static int32 lengthcount[4];
static const uint8 lengthtable[0x20]=
{
0x5*2,0x7f*2,0xA*2,0x1*2,0x14*2,0x2*2,0x28*2,0x3*2,0x50*2,0x4*2,0x1E*2,0x5*2,0x7*2,0x6*2,0x0E*2,0x7*2,
@ -106,29 +106,29 @@ static const uint32 NTSCDMCTable[0x10]=
static const uint32 PALDMCTable[0x10]=
{
397, 353, 315, 297, 265, 235, 209, 198,
176, 148, 131, 118, 98, 78, 66, 50,
397, 353, 315, 297, 265, 235, 209, 198,
176, 148, 131, 118, 98, 78, 66, 50,
};
// $4010 - Frequency
// $4011 - Actual data outputted
// $4012 - Address register: $c000 + V*64
// $4013 - Size register: Size in bytes = (V+1)*64
// $4010 - Frequency
// $4011 - Actual data outputted
// $4012 - Address register: $c000 + V*64
// $4013 - Size register: Size in bytes = (V+1)*64
static int32 DMCacc=1;
static int32 DMCPeriod;
static uint8 DMCBitCount=0;
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 int32 DMCSize=0;
static uint8 DMCShift=0;
static uint8 DMCShift=0;
static uint8 SIRQStat=0;
static char DMCHaveDMA=0;
static uint8 DMCDMABuf=0;
static uint8 DMCDMABuf=0;
static char DMCHaveSample=0;
static void Dummyfunc(void) {};
@ -170,22 +170,22 @@ static int FASTAPASS(2) CheckFreq(uint32 cf, uint8 sr)
static void SQReload(int x, uint8 V)
{
if(EnabledChannels&(1<<x))
{
if(x)
DoSQ2();
else
DoSQ1();
lengthcount[x]=lengthtable[(V>>3)&0x1f];
}
if(EnabledChannels&(1<<x))
{
if(x)
DoSQ2();
else
DoSQ1();
lengthcount[x]=lengthtable[(V>>3)&0x1f];
}
sweepon[x]=PSG[(x<<2)|1]&0x80;
curfreq[x]=PSG[(x<<2)|0x2]|((V&7)<<8);
SweepCount[x]=((PSG[(x<<2)|0x1]>>4)&7)+1;
sweepon[x]=PSG[(x<<2)|1]&0x80;
curfreq[x]=PSG[(x<<2)|0x2]|((V&7)<<8);
SweepCount[x]=((PSG[(x<<2)|0x1]>>4)&7)+1;
RectDutyCount[x]=7;
EnvUnits[x].reloaddec=1;
//reloadfreq[x]=1;
RectDutyCount[x]=7;
EnvUnits[x].reloaddec=1;
//reloadfreq[x]=1;
}
static DECLFW(Write_PSG)
@ -194,68 +194,68 @@ static DECLFW(Write_PSG)
switch(A)
{
case 0x0:DoSQ1();
EnvUnits[0].Mode=(V&0x30)>>4;
EnvUnits[0].Speed=(V&0xF);
break;
EnvUnits[0].Mode=(V&0x30)>>4;
EnvUnits[0].Speed=(V&0xF);
break;
case 0x1:
sweepon[0]=V&0x80;
break;
sweepon[0]=V&0x80;
break;
case 0x2:
DoSQ1();
curfreq[0]&=0xFF00;
curfreq[0]|=V;
break;
DoSQ1();
curfreq[0]&=0xFF00;
curfreq[0]|=V;
break;
case 0x3:
SQReload(0,V);
break;
case 0x4:
DoSQ2();
EnvUnits[1].Mode=(V&0x30)>>4;
EnvUnits[1].Speed=(V&0xF);
break;
case 0x5:
sweepon[1]=V&0x80;
break;
SQReload(0,V);
break;
case 0x4:
DoSQ2();
EnvUnits[1].Mode=(V&0x30)>>4;
EnvUnits[1].Speed=(V&0xF);
break;
case 0x5:
sweepon[1]=V&0x80;
break;
case 0x6:DoSQ2();
curfreq[1]&=0xFF00;
curfreq[1]|=V;
break;
case 0x7:
SQReload(1,V);
break;
curfreq[1]&=0xFF00;
curfreq[1]|=V;
break;
case 0x7:
SQReload(1,V);
break;
case 0xa:DoTriangle();
break;
break;
case 0xb:
DoTriangle();
if(EnabledChannels&0x4)
lengthcount[2]=lengthtable[(V>>3)&0x1f];
TriMode=1; // Load mode
break;
DoTriangle();
if(EnabledChannels&0x4)
lengthcount[2]=lengthtable[(V>>3)&0x1f];
TriMode=1; // Load mode
break;
case 0xC:DoNoise();
EnvUnits[2].Mode=(V&0x30)>>4;
EnvUnits[2].Speed=(V&0xF);
break;
EnvUnits[2].Mode=(V&0x30)>>4;
EnvUnits[2].Speed=(V&0xF);
break;
case 0xE:DoNoise();
break;
break;
case 0xF:
DoNoise();
if(EnabledChannels&0x8)
lengthcount[3]=lengthtable[(V>>3)&0x1f];
EnvUnits[2].reloaddec=1;
break;
DoNoise();
if(EnabledChannels&0x8)
lengthcount[3]=lengthtable[(V>>3)&0x1f];
EnvUnits[2].reloaddec=1;
break;
case 0x10:DoPCM();
LoadDMCPeriod(V&0xF);
LoadDMCPeriod(V&0xF);
if(SIRQStat&0x80)
{
if(!(V&0x80))
{
X6502_IRQEnd(FCEU_IQDPCM);
SIRQStat&=~0x80;
}
else X6502_IRQBegin(FCEU_IQDPCM);
}
break;
if(SIRQStat&0x80)
{
if(!(V&0x80))
{
X6502_IRQEnd(FCEU_IQDPCM);
SIRQStat&=~0x80;
}
else X6502_IRQBegin(FCEU_IQDPCM);
}
break;
}
PSG[A]=V;
}
@ -267,22 +267,22 @@ static DECLFW(Write_DMCRegs)
switch(A)
{
case 0x00:DoPCM();
LoadDMCPeriod(V&0xF);
LoadDMCPeriod(V&0xF);
if(SIRQStat&0x80)
{
if(!(V&0x80))
{
X6502_IRQEnd(FCEU_IQDPCM);
SIRQStat&=~0x80;
}
else X6502_IRQBegin(FCEU_IQDPCM);
}
DMCFormat=V;
break;
if(SIRQStat&0x80)
{
if(!(V&0x80))
{
X6502_IRQEnd(FCEU_IQDPCM);
SIRQStat&=~0x80;
}
else X6502_IRQBegin(FCEU_IQDPCM);
}
DMCFormat=V;
break;
case 0x01:DoPCM();
RawDALatch=V&0x7F;
break;
RawDALatch=V&0x7F;
break;
case 0x02:DMCAddressLatch=V;break;
case 0x03:DMCSizeLatch=V;break;
}
@ -292,28 +292,28 @@ static DECLFW(Write_DMCRegs)
static DECLFW(StatusWrite)
{
int x;
int x;
DoSQ1();
DoSQ2();
DoTriangle();
DoNoise();
DoPCM();
for(x=0;x<4;x++)
if(!(V&(1<<x))) lengthcount[x]=0; /* Force length counters to 0. */
DoSQ1();
DoSQ2();
DoTriangle();
DoNoise();
DoPCM();
for(x=0;x<4;x++)
if(!(V&(1<<x))) lengthcount[x]=0; /* Force length counters to 0. */
if(V&0x10)
{
if(!DMCSize)
PrepDPCM();
}
else
{
DMCSize=0;
}
SIRQStat&=~0x80;
X6502_IRQEnd(FCEU_IQDPCM);
EnabledChannels=V&0x1F;
if(V&0x10)
{
if(!DMCSize)
PrepDPCM();
}
else
{
DMCSize=0;
}
SIRQStat&=~0x80;
X6502_IRQEnd(FCEU_IQDPCM);
EnabledChannels=V&0x1F;
}
static DECLFR(StatusRead)
@ -351,15 +351,15 @@ static void FASTAPASS(1) FrameSoundStuff(int V)
if(lengthcount[2]>0)
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)
lengthcount[3]--;
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)
lengthcount[P]--;
lengthcount[P]--;
/* Frequency Sweep Code Here */
/* xxxx 0000 */
@ -368,13 +368,13 @@ static void FASTAPASS(1) FrameSoundStuff(int V)
{
int32 mod=0;
if(SweepCount[P]>0) SweepCount[P]--;
if(SweepCount[P]>0) SweepCount[P]--;
if(SweepCount[P]<=0)
{
SweepCount[P]=((PSG[(P<<2)+0x1]>>4)&7)+1; //+1;
if(PSG[(P<<2)+0x1]&0x8)
{
mod-=(P^1)+((curfreq[P])>>(PSG[(P<<2)+0x1]&7));
mod-=(P^1)+((curfreq[P])>>(PSG[(P<<2)+0x1]&7));
if(curfreq[P] && (PSG[(P<<2)+0x1]&7)/* && sweepon[P]&0x80*/)
{
curfreq[P]+=mod;
@ -392,16 +392,16 @@ static void FASTAPASS(1) FrameSoundStuff(int V)
{
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]|=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))
{
SIRQStat|=0x40;
X6502_IRQBegin(FCEU_IQFCOUNT);
SIRQStat|=0x40;
X6502_IRQBegin(FCEU_IQFCOUNT);
}
if(fcnt==3)
{
if(IRQFrameMode&0x2)
fhcnt+=fhinc;
if(IRQFrameMode&0x2)
fhcnt+=fhinc;
}
FrameSoundStuff(fcnt);
fcnt=(fcnt+1)&3;
@ -472,7 +472,7 @@ static INLINE void tester(void)
DMCShift=DMCDMABuf;
DMCHaveDMA=0;
}
}
}
}
static INLINE void DMCDMA(void)
@ -519,7 +519,7 @@ void FASTAPASS(1) FCEU_SoundCPUHook(int cycles)
uint8 bah=RawDALatch;
int t=((DMCShift&1)<<2)-2;
/* Unbelievably ugly hack */
/* Unbelievably ugly hack */
if(FSettings.SndRate)
{
soundtsoffs+=DMCacc;
@ -533,7 +533,7 @@ void FASTAPASS(1) FCEU_SoundCPUHook(int cycles)
DMCacc+=DMCPeriod;
DMCBitCount=(DMCBitCount+1)&7;
DMCShift>>=1;
DMCShift>>=1;
tester();
}
}
@ -577,7 +577,7 @@ static INLINE void RDoSQ(int x)
D=&WaveHi[ChannelBC[x]];
V=SOUNDTS-ChannelBC[x];
currdc=RectDutyCount[x];
cf=(curfreq[x]+1)*2;
rc=wlcount[x];
@ -594,8 +594,8 @@ static INLINE void RDoSQ(int x)
}
V--;
D++;
}
}
RectDutyCount[x]=currdc;
wlcount[x]=rc;
@ -613,9 +613,9 @@ static void RDoSQ2(void)
RDoSQ(1);
}
static void RDoSQLQ(void)
static void RDoSQLQ(void)
{
int32 start,end;
int32 start,end;
int32 V;
int32 amp[2];
int32 rthresh[2];
@ -648,7 +648,7 @@ static void RDoSQLQ(void)
else
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];
@ -667,7 +667,7 @@ static void RDoSQLQ(void)
if(!inie[0] && !inie[1])
{
for(V=start;V<end;V++)
for(V=start;V<end;V++)
Wave[V>>4]+=totalout;
}
else
@ -684,7 +684,7 @@ static void RDoSQLQ(void)
Wave[V>>4]+=totalout; //tmpamp;
sqacc[0]-=inie[0];
sqacc[1]-=inie[1];
sqacc[1]-=inie[1];
if(sqacc[0]<=0)
{
@ -713,10 +713,10 @@ static void RDoTriangle(void)
tcout=(tristep&0xF);
if(!(tristep&0x10)) tcout^=0xF;
tcout=(tcout*3) << 16; //(tcout<<1);
tcout=(tcout*3) << 16; //(tcout<<1);
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 count = SOUNDTS - ChannelBC[2];
while(count--)
@ -765,7 +765,7 @@ static void RDoTriangleNoisePCMLQ(void)
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
ChannelBC[2]=end;
inie[0]=inie[1]=nesincsize;
freq[0]=(((PSG[0xa]|((PSG[0xb]&7)<<8))+1));
@ -774,7 +774,7 @@ static void RDoTriangleNoisePCMLQ(void)
inie[0]=0;
freq[0]<<=17;
if(EnvUnits[2].Mode&0x1)
if(EnvUnits[2].Mode&0x1)
amptab[0]=EnvUnits[2].Speed;
else
amptab[0]=EnvUnits[2].decvolume;
@ -782,10 +782,10 @@ static void RDoTriangleNoisePCMLQ(void)
amptab[0]<<=1;
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];
if(PSG[0xE]&0x80)
nshift=8;
else
@ -796,37 +796,37 @@ static void RDoTriangleNoisePCMLQ(void)
if(inie[0] && inie[1])
{
for(V=start;V<end;V++)
{
for(V=start;V<end;V++)
{
Wave[V>>4]+=totalout;
triacc-=inie[0];
noiseacc-=inie[1];
triacc-=inie[0];
noiseacc-=inie[1];
if(triacc<=0)
{
rea:
triacc+=freq[0]; //t;
tristep=(tristep+1)&0x1F;
if(triacc<=0) goto rea;
tcout=(tristep&0xF);
if(!(tristep&0x10)) tcout^=0xF;
tcout=tcout*3;
if(triacc<=0)
{
rea:
triacc+=freq[0]; //t;
tristep=(tristep+1)&0x1F;
if(triacc<=0) goto rea;
tcout=(tristep&0xF);
if(!(tristep&0x10)) tcout^=0xF;
tcout=tcout*3;
totalout = wlookup2[tcout+noiseout+RawDALatch];
}
}
if(noiseacc<=0)
{
rea2:
noiseacc+=NoiseFreqTable[PSG[0xE]&0xF]<<(16+2);
nreg=(nreg<<1)+(((nreg>>nshift)^(nreg>>14))&1);
nreg&=0x7fff;
noiseout=amptab[(nreg>>0xe)];
if(noiseacc<=0) goto rea2;
if(noiseacc<=0)
{
rea2:
noiseacc+=NoiseFreqTable[PSG[0xE]&0xF]<<(16+2);
nreg=(nreg<<1)+(((nreg>>nshift)^(nreg>>14))&1);
nreg&=0x7fff;
noiseout=amptab[(nreg>>0xe)];
if(noiseacc<=0) goto rea2;
totalout = wlookup2[tcout+noiseout+RawDALatch];
} /* noiseacc<=0 */
} /* for(V=... */
}
} /* noiseacc<=0 */
} /* for(V=... */
}
else if(inie[0])
{
for(V=start;V<end;V++)
@ -897,7 +897,7 @@ static void RDoNoise(void)
outo=amptab[0]=0;
}
if(PSG[0xE]&0x80) // "short" noise
if(PSG[0xE]&0x80) // "short" noise
for(V=ChannelBC[3];V<SOUNDTS;V++)
{
WaveHi[V]+=outo;
@ -930,11 +930,11 @@ static void RDoNoise(void)
ChannelBC[3]=SOUNDTS;
}
static DECLFW(Write_IRQFM)
DECLFW(Write_IRQFM)
{
V=(V&0xC0)>>6;
fcnt=0;
if(V&0x2)
if(V&0x2)
FrameSoundUpdate();
fcnt=1;
fhcnt=fhinc;
@ -944,7 +944,7 @@ static DECLFW(Write_IRQFM)
}
void SetNESSoundMap(void)
{
{
SetWriteHandler(0x4000,0x400F,Write_PSG);
SetWriteHandler(0x4010,0x4013,Write_DMCRegs);
SetWriteHandler(0x4017,0x4017,Write_IRQFM);
@ -982,7 +982,7 @@ int FlushEmulateSound(void)
for(x=timestamp;x;x--)
{
uint32 b=*tmpo;
uint32 b=*tmpo;
*tmpo=(b&65535)+wlookup2[(b>>16)&255]+wlookup1[b>>24];
tmpo++;
}
@ -1025,7 +1025,7 @@ int FlushEmulateSound(void)
inbuf=end;
FCEU_WriteWaveData(WaveFinal, end); /* This function will just return
if sound recording is off. */
if sound recording is off. */
return(end);
}
@ -1041,68 +1041,68 @@ due to that whole MegaMan 2 Game Genie thing.
void FCEUSND_Reset(void)
{
int x;
int x;
IRQFrameMode=0x0;
fhcnt=fhinc;
fcnt=0;
IRQFrameMode=0x0;
fhcnt=fhinc;
fcnt=0;
nreg=1;
for(x=0;x<2;x++)
{
wlcount[x]=2048;
if(nesincsize) // lq mode
sqacc[x]=((uint32)2048<<17)/nesincsize;
else
sqacc[x]=1;
sweepon[x]=0;
curfreq[x]=0;
}
wlcount[2]=1; //2048;
wlcount[3]=2048;
DMCHaveDMA=DMCHaveSample=0;
SIRQStat=0x00;
nreg=1;
for(x=0;x<2;x++)
{
wlcount[x]=2048;
if(nesincsize) // lq mode
sqacc[x]=((uint32)2048<<17)/nesincsize;
else
sqacc[x]=1;
sweepon[x]=0;
curfreq[x]=0;
}
wlcount[2]=1; //2048;
wlcount[3]=2048;
DMCHaveDMA=DMCHaveSample=0;
SIRQStat=0x00;
RawDALatch=0x00;
TriCount=0;
TriMode=0;
tristep=0;
EnabledChannels=0;
for(x=0;x<4;x++)
lengthcount[x]=0;
RawDALatch=0x00;
TriCount=0;
TriMode=0;
tristep=0;
EnabledChannels=0;
for(x=0;x<4;x++)
lengthcount[x]=0;
DMCAddressLatch=0;
DMCSizeLatch=0;
DMCFormat=0;
DMCAddress=0;
DMCSize=0;
DMCShift=0;
DMCAddressLatch=0;
DMCSizeLatch=0;
DMCFormat=0;
DMCAddress=0;
DMCSize=0;
DMCShift=0;
}
void FCEUSND_Power(void)
{
int x;
SetNESSoundMap();
memset(PSG,0x00,sizeof(PSG));
FCEUSND_Reset();
int x;
memset(Wave,0,sizeof(Wave));
memset(WaveHi,0,sizeof(WaveHi));
memset(&EnvUnits,0,sizeof(EnvUnits));
SetNESSoundMap();
memset(PSG,0x00,sizeof(PSG));
FCEUSND_Reset();
for(x=0;x<5;x++)
ChannelBC[x]=0;
soundtsoffs=0;
LoadDMCPeriod(DMCFormat&0xF);
memset(Wave,0,sizeof(Wave));
memset(WaveHi,0,sizeof(WaveHi));
memset(&EnvUnits,0,sizeof(EnvUnits));
for(x=0;x<5;x++)
ChannelBC[x]=0;
soundtsoffs=0;
LoadDMCPeriod(DMCFormat&0xF);
}
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;
if(FSettings.SndRate)
@ -1136,7 +1136,7 @@ void SetSoundVariables(void)
DoNoise=RDoTriangleNoisePCMLQ;
DoPCM=RDoTriangleNoisePCMLQ;
}
}
}
else
{
DoNoise=DoTriangle=DoPCM=DoSQ1=DoSQ2=Dummyfunc;
@ -1152,7 +1152,7 @@ void SetSoundVariables(void)
memset(sqacc,0,sizeof(sqacc));
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));
}
@ -1183,7 +1183,7 @@ void FCEUI_SetSoundVolume(uint32 volume)
SFORMAT FCEUSND_STATEINFO[]={
{ &fhcnt, 4|FCEUSTATE_RLSB,"FHCN"},
{ &fcnt, 1, "FCNT"},
{ &fcnt, 1, "FCNT"},
{ PSG, 0x10, "PSG"},
{ &EnabledChannels, 1, "ENCH"},
{ &IRQFrameMode, 1, "IQFM"},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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