update core to 0.98.13pre

This commit is contained in:
dborth 2008-09-19 05:33:26 +00:00
parent 2c9e6b1412
commit e2fe1444ae
46 changed files with 3048 additions and 5126 deletions

View File

@ -33,6 +33,8 @@ SNES9x GX and Genesis Plus GX projects.
* Fixed network freeze-up problem
* Zapper now mapped to A and B
* Fixed auto-save feature
* Performance slowdowns 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,331 +20,176 @@
#include "mapinc.h"
static uint8 latche, latcheinit;
static uint16 addrreg0, addrreg1;
static void(*WSync)(void);
#define CHRRAM (GameMemBlock)
static uint8 latche;
static DECLFW(LatchWrite)
DECLFW(CPROMWrite)
{
// FCEU_printf("bs %04x %02x\n",A,V);
latche=V;
WSync();
latche=V&3;
setvram4(0x1000,CHRRAM+((V&3)<<12));
}
static void LatchPower(void)
static void CPROMReset(void)
{
latche=latcheinit;
WSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(addrreg0,addrreg1,LatchWrite);
setprg32(0x8000,0);
setvram8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,CPROMWrite);
}
static void StateRestore(int version)
static void CPROMRestore(int version)
{
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);
setvram4(0x1000,CHRRAM+((latche)<<12));
}
void CPROM_Init(CartInfo *info)
{
Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF);
info->Power=CPROMReset;
GameStateRestore=CPROMRestore;
AddExState(&latche, 1, 0, "LATC");
}
//------------------ Map 184 ---------------------------
static void M184Sync(void)
DECLFW(CNROMWrite)
{
latche=V&3;
setchr8(V&3);
}
static void CNROMReset(void)
{
setchr4(0x0000,latche);
setchr4(0x1000,latche>>4);
setprg16(0x8000,0);
setprg16(0xC000,1);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,CNROMWrite);
}
void Mapper184_Init(CartInfo *info)
static void CNROMRestore(int version)
{
Latch_Init(info, M184Sync, 0, 0x6000, 0x7FFF);
}
//------------------ CNROM ---------------------------
static void CNROMSync(void)
{
setchr8(latche&3);
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(latche);
}
void CNROM_Init(CartInfo *info)
{
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF);
info->Power=CNROMReset;
GameStateRestore=CNROMRestore;
AddExState(&latche, 1, 0, "LATC");
}
//------------------ ANROM ---------------------------
static void ANROMSync()
static void NROM128Reset(void)
{
setprg32(0x8000,latche&0xf);
setmirror(MI_0+((latche>>4)&1));
setprg16(0x8000,0);
setprg16(0xC000,0);
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
void ANROM_Init(CartInfo *info)
static void NROM256Reset(void)
{
Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF);
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
//------------------ Map 70 ---------------------------
static void M70Sync()
void NROM128_Init(CartInfo *info)
{
setprg16(0x8000,latche>>4);
setprg16(0xc000,~0);
setchr8(latche&0xf);
info->Power=NROM128Reset;
}
void Mapper70_Init(CartInfo *info)
void NROM256_Init(CartInfo *info)
{
Latch_Init(info, M70Sync, 0, 0x8000, 0xFFFF);
info->Power=NROM256Reset;
}
//------------------ Map 152 ---------------------------
static void M152Sync()
static DECLFW(MHROMWrite)
{
setprg16(0x8000,(latche>>4)&7);
setprg16(0xc000,~0);
setchr8(latche&0xf);
setmirror(MI_0+((latche>>7)&1)); /* Saint Seiya...hmm. */
setprg32(0x8000,V>>4);
setchr8(V);
latche=V;
}
void Mapper152_Init(CartInfo *info)
static void MHROMReset(void)
{
Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF);
setprg32(0x8000,0);
setchr8(0);
latche=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
}
//------------------ Map 78 ---------------------------
/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
static void M78Sync()
static void MHROMRestore(int version)
{
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);
setprg32(0x8000,latche);
setchr8(latche);
SetWriteHandler(0x8000,0xffff,MHROMWrite);
}
void MHROM_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF);
info->Power=MHROMReset;
AddExState(&latche, 1, 0,"LATC");
PRGmask32[0]&=1;
CHRmask8[0]&=1;
GameStateRestore=MHROMRestore;
}
void Mapper140_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF);
}
void Mapper240_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF);
// need SRAM.
}
//------------------ Map 87 ---------------------------
static void M87Sync(void)
static void UNROMRestore(int version)
{
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(latche>>1);
setprg16(0x8000,latche);
}
void Mapper87_Init(CartInfo *info)
{
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF);
}
//------------------ Map 11 ---------------------------
static void M11Sync(void)
static DECLFW(UNROMWrite)
{
setprg32(0x8000,latche&0xf);
setchr8(latche>>4);
setprg16(0x8000,V);
latche=V;
}
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)
static void UNROMReset(void)
{
setprg16(0x8000,latche);
setprg16(0xc000,~0);
setchr8(0);
setprg16(0x8000,0);
setprg16(0xc000,~0);
setvram8(CHRRAM);
SetWriteHandler(0x8000,0xffff,UNROMWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
latche=0;
}
void UNROM_Init(CartInfo *info)
{
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF);
info->Power=UNROMReset;
PRGmask16[0]&=7;
AddExState(&latche, 1, 0, "LATC");
AddExState(CHRRAM, 8192, 0, "CHRR");
GameStateRestore=UNROMRestore;
}
//------------------ Map 93 ---------------------------
static void SSUNROMSync(void)
static void GNROMSync()
{
setprg16(0x8000,latche>>4);
setprg16(0xc000,~0);
setchr8(0);
setchr8(latche&3);
setprg32(0x8000,(latche>>4)&3);
}
void SUNSOFT_UNROM_Init(CartInfo *info)
static DECLFW(GNROMWrite)
{
Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF);
latche=V&0x33;
GNROMSync();
}
//------------------ Map 94 ---------------------------
static void M94Sync(void)
static void GNROMStateRestore(int version)
{
setprg16(0x8000,latche>>2);
setprg16(0xc000,~0);
setchr8(0);
GNROMSync();
}
void Mapper94_Init(CartInfo *info)
static void GNROMReset(void)
{
Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF);
latche=0;
GNROMSync();
SetWriteHandler(0x8000,0xffff,GNROMWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
//------------------ Map 180 ---------------------------
static void M180Sync(void)
void GNROM_Init(CartInfo *info)
{
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;
info->Power=GNROMReset;
AddExState(&latche, 1, 0, "LATC");
GameStateRestore=GNROMStateRestore;
}

View File

@ -416,7 +416,10 @@ 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;
@ -425,7 +428,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,3 +1,7 @@
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
@ -6,8 +10,6 @@
#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,
@ -18,3 +20,4 @@ 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,10 +286,8 @@ 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,9 +58,8 @@ 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;
@ -128,12 +127,13 @@ 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;
/*** REMOVED GC V1.0
#ifndef NGC
struct stat tmpstat;
switch(type)
@ -164,8 +164,7 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
asprintf(&ret,"%s"PSS"gameinfo"PSS"%s.pal",BaseDirectory,FileBase);
break;
}
REMOVED GC V1.0 ***/
#endif
return(ret);
}

View File

@ -0,0 +1,37 @@
{ 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

@ -0,0 +1,191 @@
{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 = 0;
int MapperNo;
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 */
// Bad dump? {0x23040fc4,SI_GAMEPAD,SI_POWERPADB,-1}, /* Short Order/Eggsplode */
{0x6435c095,SI_GAMEPAD,SI_POWERPADB,-1}, /* Short Order/Eggsplode */
{0x47232739,SI_GAMEPAD,SI_GAMEPAD,SIFC_TOPRIDER}, /* Top Rider */
@ -179,6 +179,8 @@ 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 */
@ -191,6 +193,7 @@ 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 */
@ -211,8 +214,43 @@ 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;
};
@ -230,7 +268,7 @@ static void CheckHInfo(void)
{
0x498c10dc463cfe95LL, /* Battle Fleet */
0x6917ffcaca2d8466LL, /* Famista '90 */
0xd63dcc68c2b20adcLL, /* Final Fantasy J */
0x012df596e2b31174LL, /* Final Fantasy 1+2 */
0xf6b359a720549ecdLL, /* Final Fantasy 2 */
@ -268,7 +306,7 @@ static void CheckHInfo(void)
0x94b9484862a26cbaLL, /* Legend of Zelda */
0x04a31647de80fdabLL, /* "" */
0x9aa1dc16c05e7de5LL, /* Startropics */
0x1b084107d0878bd0LL, /* Startropics 2*/
@ -278,182 +316,9 @@ static void CheckHInfo(void)
};
static struct CHINF moo[]=
{
{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}
};
{
#include "ines-correct.h"
};
int tofix=0;
int x;
uint64 partialmd5=0;
@ -463,6 +328,7 @@ static void CheckHInfo(void)
partialmd5 |= (uint64)iNESCart.MD5[15-x] << (x*8);
//printf("%16llx\n",partialmd5);
}
CheckBad(partialmd5);
x=0;
@ -536,7 +402,7 @@ static void CheckHInfo(void)
/* Four-screen mirroring implicitly set. */
if(MapperNo==99)
Mirroring=2;
Mirroring=2;
if(tofix)
{
@ -550,7 +416,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");
@ -614,8 +480,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);
@ -641,7 +507,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);
@ -662,7 +528,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");
}
@ -679,7 +545,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);
}
@ -695,7 +561,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;
@ -733,7 +599,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;
@ -749,7 +615,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);
@ -785,16 +651,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)
{
@ -834,7 +700,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);
@ -845,8 +711,8 @@ void (*MapInitTab[256])(void)=
0,
0,Mapper2_init,Mapper3_init,0,
0,Mapper6_init,Mapper7_init,Mapper8_init,
Mapper9_init,Mapper10_init,0,0,
Mapper13_init,0,0,Mapper16_init,
Mapper9_init,Mapper10_init,Mapper11_init,0,
Mapper13_init,0,Mapper15_init,Mapper16_init,
Mapper17_init,Mapper18_init,0,0,
Mapper21_init,Mapper22_init,Mapper23_init,Mapper24_init,
Mapper25_init,Mapper26_init,0,0,
@ -857,33 +723,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,0,
Mapper69_init,0,Mapper71_init,Mapper72_init,
Mapper65_init,Mapper66_init,Mapper67_init,Mapper68_init,
Mapper69_init,Mapper70_init,Mapper71_init,Mapper72_init,
Mapper73_init,0,Mapper75_init,Mapper76_init,
Mapper77_init,0,Mapper79_init,Mapper80_init,
Mapper77_init,Mapper78_init,Mapper79_init,Mapper80_init,
0,Mapper82_init,Mapper83_init,0,
Mapper85_init,Mapper86_init,0,Mapper88_init,
Mapper85_init,Mapper86_init,Mapper87_init,Mapper88_init,
Mapper89_init,0,Mapper91_init,Mapper92_init,
Mapper93_init,0,0,Mapper96_init,
Mapper93_init,Mapper94_init,0,Mapper96_init,
Mapper97_init,0,Mapper99_init,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,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,0,0,0,0,Mapper140_init,
0,0,0,0,0,0,0,0,
0,0,Mapper151_init,0,Mapper153_init,Mapper154_init,0,Mapper156_init,
0,0,0,Mapper144_init,0,0,0,0,
0,0,Mapper151_init,Mapper152_init,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,0,
0,0,0,0,Mapper185_init,0,0,0,
0,0,0,0,0,0,0,Mapper180_init,
0,Mapper182_init,0,Mapper184_init,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,0,Mapper241_init,0,0,Mapper244_init,
0,0,0,Mapper240_init,Mapper241_init,Mapper242_init,0,Mapper244_init,
0,Mapper246_init,0,Mapper248_init,0,0,0,0,0,0,Mapper255_init
};
@ -901,14 +767,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)
@ -963,7 +829,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)
{
@ -976,7 +842,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);
}
}
@ -990,7 +856,7 @@ static void iNESPower(void)
typedef struct {
int number;
int number;
void (*init)(CartInfo *);
} BMAPPING;
@ -1013,63 +879,20 @@ 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},
{187, Mapper187_Init},
{188, Mapper188_Init},
{206, Mapper206_Init},
{208, Mapper208_Init},
{208, Mapper208_Init},
{210, Mapper210_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},
{245, Mapper245_Init},
{249, Mapper249_Init},
{250, Mapper250_Init},
{0,0}
};
@ -1100,6 +923,7 @@ static int NewiNES_Init(int num)
return(0);
}
/****************************************************************************
** GC V1.0
**
@ -1255,4 +1079,3 @@ 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,6 +363,7 @@ 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 *);
@ -372,6 +373,7 @@ 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 *);
@ -379,41 +381,3 @@ 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

@ -1,26 +0,0 @@
/* wchar_t type related definitions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _BITS_WCHAR_H
#define _BITS_WCHAR_H 1
#define __WCHAR_MIN (-2147483647l - 1l)
#define __WCHAR_MAX (2147483647l)
#endif /* bits/wchar.h */

View File

@ -1,19 +0,0 @@
/* Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define __WORDSIZE 32

View File

@ -1,340 +0,0 @@
/* Copyright (C) 1991-1993,1995-2003,2004,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _FEATURES_H
#define _FEATURES_H 1
/* These are defined by the user (or the compiler)
to specify the desired environment:
__STRICT_ANSI__ ISO Standard C.
_ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
_POSIX_SOURCE IEEE Std 1003.1.
_POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
if >=199309L, add IEEE Std 1003.1b-1993;
if >=199506L, add IEEE Std 1003.1c-1995;
if >=200112L, all of IEEE 1003.1-2004
_XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
Single Unix conformance is wanted, to 600 for the
upcoming sixth revision.
_XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
_LARGEFILE_SOURCE Some more functions for correct standard I/O.
_LARGEFILE64_SOURCE Additional functionality from LFS for large files.
_FILE_OFFSET_BITS=N Select default filesystem interface.
_BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
_SVID_SOURCE ISO C, POSIX, and SVID things.
_GNU_SOURCE All of the above, plus GNU extensions.
_REENTRANT Select additionally reentrant object.
_THREAD_SAFE Same as _REENTRANT, often used by other systems.
_FORTIFY_SOURCE If set to numeric value > 0 additional security
measures are defined, according to level.
The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
If none of these are defined, the default is to have _SVID_SOURCE,
_BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
199506L. If more than one of these are defined, they accumulate.
For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
together give you ISO C, 1003.1, and 1003.2, but nothing else.
These are defined by this file and are used by the
header files to decide what to declare or define:
__USE_ISOC99 Define ISO C99 things.
__USE_POSIX Define IEEE Std 1003.1 things.
__USE_POSIX2 Define IEEE Std 1003.2 things.
__USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
__USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
__USE_XOPEN Define XPG things.
__USE_XOPEN_EXTENDED Define X/Open Unix things.
__USE_UNIX98 Define Single Unix V2 things.
__USE_XOPEN2K Define XPG6 things.
__USE_LARGEFILE Define correct standard I/O things.
__USE_LARGEFILE64 Define LFS things with separate names.
__USE_FILE_OFFSET64 Define 64bit interface as default.
__USE_BSD Define 4.3BSD things.
__USE_SVID Define SVID things.
__USE_MISC Define things common to BSD and System V Unix.
__USE_GNU Define GNU extensions.
__USE_REENTRANT Define reentrant/thread-safe *_r functions.
__USE_FORTIFY_LEVEL Additional security measures used, according to level.
__FAVOR_BSD Favor 4.3BSD things in cases of conflict.
The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
defined by this file unconditionally. `__GNU_LIBRARY__' is provided
only for compatibility. All new code should use the other symbols
to test for features.
All macros listed above as possibly being defined by this file are
explicitly undefined if they are not explicitly defined.
Feature-test macros that are not defined by the user or compiler
but are implied by the other feature-test macros defined (or by the
lack of any definitions) are defined by the file. */
/* Undefine everything, so we get a clean slate. */
#undef __USE_ISOC99
#undef __USE_POSIX
#undef __USE_POSIX2
#undef __USE_POSIX199309
#undef __USE_POSIX199506
#undef __USE_XOPEN
#undef __USE_XOPEN_EXTENDED
#undef __USE_UNIX98
#undef __USE_XOPEN2K
#undef __USE_LARGEFILE
#undef __USE_LARGEFILE64
#undef __USE_FILE_OFFSET64
#undef __USE_BSD
#undef __USE_SVID
#undef __USE_MISC
#undef __USE_GNU
#undef __USE_REENTRANT
#undef __USE_FORTIFY_LEVEL
#undef __FAVOR_BSD
#undef __KERNEL_STRICT_NAMES
/* Suppress kernel-name space pollution unless user expressedly asks
for it. */
#ifndef _LOOSE_KERNEL_NAMES
# define __KERNEL_STRICT_NAMES
#endif
/* Always use ISO C things. */
#define __USE_ANSI 1
/* Convenience macros to test the versions of glibc and gcc.
Use them like this:
#if __GNUC_PREREQ (2,8)
... code requiring gcc 2.8 or later ...
#endif
Note - they won't work for gcc1 or glibc1, since the _MINOR macros
were not defined then. */
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
# define __GNUC_PREREQ(maj, min) 0
#endif
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD 1
#endif
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
#ifdef _GNU_SOURCE
# undef _ISOC99_SOURCE
# define _ISOC99_SOURCE 1
# undef _POSIX_SOURCE
# define _POSIX_SOURCE 1
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 199506L
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
# undef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
# undef _LARGEFILE64_SOURCE
# define _LARGEFILE64_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
# define _SVID_SOURCE 1
#endif
/* If nothing (other than _GNU_SOURCE) is defined,
define _BSD_SOURCE and _SVID_SOURCE. */
#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
!defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
!defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
!defined _BSD_SOURCE && !defined _SVID_SOURCE)
# define _BSD_SOURCE 1
# define _SVID_SOURCE 1
#endif
/* This is to enable the ISO C99 extension. Also recognize the old macro
which was used prior to the standard acceptance. This macro will
eventually go away and the features enabled by default once the ISO C99
standard is widely adopted. */
#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
# define __USE_ISOC99 1
#endif
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
(and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */
#if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \
!defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
# define _POSIX_SOURCE 1
# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
# define _POSIX_C_SOURCE 2
# else
# define _POSIX_C_SOURCE 199506L
# endif
#endif
#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
# define __USE_POSIX 1
#endif
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
# define __USE_POSIX2 1
#endif
#if (_POSIX_C_SOURCE - 0) >= 199309L
# define __USE_POSIX199309 1
#endif
#if (_POSIX_C_SOURCE - 0) >= 199506L
# define __USE_POSIX199506 1
#endif
#if (_POSIX_C_SOURCE - 0) >= 200112L
# define __USE_XOPEN2K 1
#endif
#ifdef _XOPEN_SOURCE
# define __USE_XOPEN 1
# if (_XOPEN_SOURCE - 0) >= 500
# define __USE_XOPEN_EXTENDED 1
# define __USE_UNIX98 1
# undef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# if (_XOPEN_SOURCE - 0) >= 600
# define __USE_XOPEN2K 1
# undef __USE_ISOC99
# define __USE_ISOC99 1
# endif
# else
# ifdef _XOPEN_SOURCE_EXTENDED
# define __USE_XOPEN_EXTENDED 1
# endif
# endif
#endif
#ifdef _LARGEFILE_SOURCE
# define __USE_LARGEFILE 1
#endif
#ifdef _LARGEFILE64_SOURCE
# define __USE_LARGEFILE64 1
#endif
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
# define __USE_FILE_OFFSET64 1
#endif
#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC 1
#endif
#ifdef _BSD_SOURCE
# define __USE_BSD 1
#endif
#ifdef _SVID_SOURCE
# define __USE_SVID 1
#endif
#ifdef _GNU_SOURCE
# define __USE_GNU 1
#endif
#if defined _REENTRANT || defined _THREAD_SAFE
# define __USE_REENTRANT 1
#endif
#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
&& (__GNUC_PREREQ (4, 1) \
|| (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \
|| (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \
&& __GNUC_MINOR__ == 4 \
&& (__GNUC_PATCHLEVEL__ > 2 \
|| (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8))))
# if _FORTIFY_SOURCE == 1
# define __USE_FORTIFY_LEVEL 1
# elif _FORTIFY_SOURCE > 1
# define __USE_FORTIFY_LEVEL 2
# endif
#endif
/* We do support the IEC 559 math functionality, real and complex. */
#define __STDC_IEC_559__ 1
#define __STDC_IEC_559_COMPLEX__ 1
/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */
#define __STDC_ISO_10646__ 200009L
/* This macro indicates that the installed library is the GNU C Library.
For historic reasons the value now is 6 and this will stay from now
on. The use of this variable is deprecated. Use __GLIBC__ and
__GLIBC_MINOR__ now (see below) when you want to test for a specific
GNU C library version and use the values in <gnu/lib-names.h> to get
the sonames of the shared libraries. */
#undef __GNU_LIBRARY__
#define __GNU_LIBRARY__ 6
/* Major and minor version number of the GNU C library package. Use
these macros to test for features in specific releases. */
#define __GLIBC__ 2
#define __GLIBC_MINOR__ 3
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
/* Decide whether a compiler supports the long long datatypes. */
#if defined __GNUC__ \
|| (defined __PGI && defined __i386__ ) \
|| (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
# define __GLIBC_HAVE_LONG_LONG 1
#endif
/* This is here only because every header file already includes this one. */
#ifndef __ASSEMBLER__
# ifndef _SYS_CDEFS_H
# include <sys/cdefs.h>
# endif
/* If we don't have __REDIRECT, prototypes will be missing if
__USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
# define __USE_LARGEFILE 1
# define __USE_LARGEFILE64 1
# endif
#endif /* !ASSEMBLER */
/* Decide whether we can define 'extern inline' functions in headers. */
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
# define __USE_EXTERN_INLINES 1
#endif
/* This is here only because every header file already includes this one.
Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
<gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
that will always return failure (and set errno to ENOSYS). */
#include <gnu/stubs.h>
#endif /* features.h */

View File

@ -1,24 +0,0 @@
/* This file is automatically generated.
It defines a symbol `__stub_FUNCTION' for each function
in the C library which is a stub, meaning it will fail
every time called, usually setting errno to ENOSYS. */
#ifdef _LIBC
#error Applications may not define the macro _LIBC
#endif
#define __stub___kernel_cosl
#define __stub___kernel_sinl
#define __stub___kernel_tanl
#define __stub_chflags
#define __stub_fattach
#define __stub_fchflags
#define __stub_fdetach
#define __stub_gtty
#define __stub_lchmod
#define __stub_lutimes
#define __stub_revoke
#define __stub_setlogin
#define __stub_sigreturn
#define __stub_sstk
#define __stub_stty

View File

@ -1,12 +0,0 @@
/* This file selects the right generated file of `__stub_FUNCTION' macros
based on the architecture being compiled for. */
#include <bits/wordsize.h>
#if __WORDSIZE == 32
# include <gnu/stubs-32.h>
#elif __WORDSIZE == 64
# include <gnu/stubs-64.h>
#else
# error "unexpected value for __WORDSIZE macro"
#endif

View File

@ -1,461 +0,0 @@
/* Copyright (C) 1997-2001, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/*
* ISO C99: 7.8 Format conversion of integer types <inttypes.h>
*/
#ifndef _INTTYPES_H
#define _INTTYPES_H 1
#include <features.h>
/* Get the type definitions. */
#include <stdint.h>
/* Get a definition for wchar_t. But we must not define wchar_t itself. */
#ifndef ____gwchar_t_defined
# ifdef __cplusplus
# define __gwchar_t wchar_t
# elif defined __WCHAR_TYPE__
typedef __WCHAR_TYPE__ __gwchar_t;
# else
# define __need_wchar_t
# include <stddef.h>
typedef wchar_t __gwchar_t;
# endif
# define ____gwchar_t_defined 1
#endif
/* The ISO C99 standard specifies that these macros must only be
defined if explicitly requested. */
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
# else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
# endif
/* Macros for printing format specifiers. */
/* Decimal notation. */
# define PRId8 "d"
# define PRId16 "d"
# define PRId32 "d"
# define PRId64 __PRI64_PREFIX "d"
# define PRIdLEAST8 "d"
# define PRIdLEAST16 "d"
# define PRIdLEAST32 "d"
# define PRIdLEAST64 __PRI64_PREFIX "d"
# define PRIdFAST8 "d"
# define PRIdFAST16 __PRIPTR_PREFIX "d"
# define PRIdFAST32 __PRIPTR_PREFIX "d"
# define PRIdFAST64 __PRI64_PREFIX "d"
# define PRIi8 "i"
# define PRIi16 "i"
# define PRIi32 "i"
# define PRIi64 __PRI64_PREFIX "i"
# define PRIiLEAST8 "i"
# define PRIiLEAST16 "i"
# define PRIiLEAST32 "i"
# define PRIiLEAST64 __PRI64_PREFIX "i"
# define PRIiFAST8 "i"
# define PRIiFAST16 __PRIPTR_PREFIX "i"
# define PRIiFAST32 __PRIPTR_PREFIX "i"
# define PRIiFAST64 __PRI64_PREFIX "i"
/* Octal notation. */
# define PRIo8 "o"
# define PRIo16 "o"
# define PRIo32 "o"
# define PRIo64 __PRI64_PREFIX "o"
# define PRIoLEAST8 "o"
# define PRIoLEAST16 "o"
# define PRIoLEAST32 "o"
# define PRIoLEAST64 __PRI64_PREFIX "o"
# define PRIoFAST8 "o"
# define PRIoFAST16 __PRIPTR_PREFIX "o"
# define PRIoFAST32 __PRIPTR_PREFIX "o"
# define PRIoFAST64 __PRI64_PREFIX "o"
/* Unsigned integers. */
# define PRIu8 "u"
# define PRIu16 "u"
# define PRIu32 "u"
# define PRIu64 __PRI64_PREFIX "u"
# define PRIuLEAST8 "u"
# define PRIuLEAST16 "u"
# define PRIuLEAST32 "u"
# define PRIuLEAST64 __PRI64_PREFIX "u"
# define PRIuFAST8 "u"
# define PRIuFAST16 __PRIPTR_PREFIX "u"
# define PRIuFAST32 __PRIPTR_PREFIX "u"
# define PRIuFAST64 __PRI64_PREFIX "u"
/* lowercase hexadecimal notation. */
# define PRIx8 "x"
# define PRIx16 "x"
# define PRIx32 "x"
# define PRIx64 __PRI64_PREFIX "x"
# define PRIxLEAST8 "x"
# define PRIxLEAST16 "x"
# define PRIxLEAST32 "x"
# define PRIxLEAST64 __PRI64_PREFIX "x"
# define PRIxFAST8 "x"
# define PRIxFAST16 __PRIPTR_PREFIX "x"
# define PRIxFAST32 __PRIPTR_PREFIX "x"
# define PRIxFAST64 __PRI64_PREFIX "x"
/* UPPERCASE hexadecimal notation. */
# define PRIX8 "X"
# define PRIX16 "X"
# define PRIX32 "X"
# define PRIX64 __PRI64_PREFIX "X"
# define PRIXLEAST8 "X"
# define PRIXLEAST16 "X"
# define PRIXLEAST32 "X"
# define PRIXLEAST64 __PRI64_PREFIX "X"
# define PRIXFAST8 "X"
# define PRIXFAST16 __PRIPTR_PREFIX "X"
# define PRIXFAST32 __PRIPTR_PREFIX "X"
# define PRIXFAST64 __PRI64_PREFIX "X"
/* Macros for printing `intmax_t' and `uintmax_t'. */
# define PRIdMAX __PRI64_PREFIX "d"
# define PRIiMAX __PRI64_PREFIX "i"
# define PRIoMAX __PRI64_PREFIX "o"
# define PRIuMAX __PRI64_PREFIX "u"
# define PRIxMAX __PRI64_PREFIX "x"
# define PRIXMAX __PRI64_PREFIX "X"
/* Macros for printing `intptr_t' and `uintptr_t'. */
# define PRIdPTR __PRIPTR_PREFIX "d"
# define PRIiPTR __PRIPTR_PREFIX "i"
# define PRIoPTR __PRIPTR_PREFIX "o"
# define PRIuPTR __PRIPTR_PREFIX "u"
# define PRIxPTR __PRIPTR_PREFIX "x"
# define PRIXPTR __PRIPTR_PREFIX "X"
/* Macros for scanning format specifiers. */
/* Signed decimal notation. */
# define SCNd8 "hhd"
# define SCNd16 "hd"
# define SCNd32 "d"
# define SCNd64 __PRI64_PREFIX "d"
# define SCNdLEAST8 "hhd"
# define SCNdLEAST16 "hd"
# define SCNdLEAST32 "d"
# define SCNdLEAST64 __PRI64_PREFIX "d"
# define SCNdFAST8 "hhd"
# define SCNdFAST16 __PRIPTR_PREFIX "d"
# define SCNdFAST32 __PRIPTR_PREFIX "d"
# define SCNdFAST64 __PRI64_PREFIX "d"
/* Signed decimal notation. */
# define SCNi8 "hhi"
# define SCNi16 "hi"
# define SCNi32 "i"
# define SCNi64 __PRI64_PREFIX "i"
# define SCNiLEAST8 "hhi"
# define SCNiLEAST16 "hi"
# define SCNiLEAST32 "i"
# define SCNiLEAST64 __PRI64_PREFIX "i"
# define SCNiFAST8 "hhi"
# define SCNiFAST16 __PRIPTR_PREFIX "i"
# define SCNiFAST32 __PRIPTR_PREFIX "i"
# define SCNiFAST64 __PRI64_PREFIX "i"
/* Unsigned decimal notation. */
# define SCNu8 "hhu"
# define SCNu16 "hu"
# define SCNu32 "u"
# define SCNu64 __PRI64_PREFIX "u"
# define SCNuLEAST8 "hhu"
# define SCNuLEAST16 "hu"
# define SCNuLEAST32 "u"
# define SCNuLEAST64 __PRI64_PREFIX "u"
# define SCNuFAST8 "hhu"
# define SCNuFAST16 __PRIPTR_PREFIX "u"
# define SCNuFAST32 __PRIPTR_PREFIX "u"
# define SCNuFAST64 __PRI64_PREFIX "u"
/* Octal notation. */
# define SCNo8 "hho"
# define SCNo16 "ho"
# define SCNo32 "o"
# define SCNo64 __PRI64_PREFIX "o"
# define SCNoLEAST8 "hho"
# define SCNoLEAST16 "ho"
# define SCNoLEAST32 "o"
# define SCNoLEAST64 __PRI64_PREFIX "o"
# define SCNoFAST8 "hho"
# define SCNoFAST16 __PRIPTR_PREFIX "o"
# define SCNoFAST32 __PRIPTR_PREFIX "o"
# define SCNoFAST64 __PRI64_PREFIX "o"
/* Hexadecimal notation. */
# define SCNx8 "hhx"
# define SCNx16 "hx"
# define SCNx32 "x"
# define SCNx64 __PRI64_PREFIX "x"
# define SCNxLEAST8 "hhx"
# define SCNxLEAST16 "hx"
# define SCNxLEAST32 "x"
# define SCNxLEAST64 __PRI64_PREFIX "x"
# define SCNxFAST8 "hhx"
# define SCNxFAST16 __PRIPTR_PREFIX "x"
# define SCNxFAST32 __PRIPTR_PREFIX "x"
# define SCNxFAST64 __PRI64_PREFIX "x"
/* Macros for scanning `intmax_t' and `uintmax_t'. */
# define SCNdMAX __PRI64_PREFIX "d"
# define SCNiMAX __PRI64_PREFIX "i"
# define SCNoMAX __PRI64_PREFIX "o"
# define SCNuMAX __PRI64_PREFIX "u"
# define SCNxMAX __PRI64_PREFIX "x"
/* Macros for scaning `intptr_t' and `uintptr_t'. */
# define SCNdPTR __PRIPTR_PREFIX "d"
# define SCNiPTR __PRIPTR_PREFIX "i"
# define SCNoPTR __PRIPTR_PREFIX "o"
# define SCNuPTR __PRIPTR_PREFIX "u"
# define SCNxPTR __PRIPTR_PREFIX "x"
#endif /* C++ && format macros */
__BEGIN_DECLS
#if __WORDSIZE == 64
/* We have to define the `uintmax_t' type using `ldiv_t'. */
typedef struct
{
long int quot; /* Quotient. */
long int rem; /* Remainder. */
} imaxdiv_t;
#else
/* We have to define the `uintmax_t' type using `lldiv_t'. */
typedef struct
{
long long int quot; /* Quotient. */
long long int rem; /* Remainder. */
} imaxdiv_t;
#endif
/* Compute absolute value of N. */
extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__));
/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */
extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
__THROW __attribute__ ((__const__));
/* Like `strtol' but convert to `intmax_t'. */
extern intmax_t strtoimax (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) __THROW;
/* Like `strtoul' but convert to `uintmax_t'. */
extern uintmax_t strtoumax (__const char *__restrict __nptr,
char ** __restrict __endptr, int __base) __THROW;
/* Like `wcstol' but convert to `intmax_t'. */
extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
__gwchar_t **__restrict __endptr, int __base)
__THROW;
/* Like `wcstoul' but convert to `uintmax_t'. */
extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
__gwchar_t ** __restrict __endptr, int __base)
__THROW;
#ifdef __USE_EXTERN_INLINES
# if __WORDSIZE == 64
/* Like `strtol' but convert to `intmax_t'. */
# ifndef __strtol_internal_defined
extern long int __strtol_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) __THROW;
# define __strtol_internal_defined 1
# endif
extern __inline intmax_t
(strtoimax (__const char *__restrict nptr, char **__restrict endptr,
int base))
{
return __strtol_internal (nptr, endptr, base, 0);
}
/* Like `strtoul' but convert to `uintmax_t'. */
# ifndef __strtoul_internal_defined
extern unsigned long int __strtoul_internal (__const char *
__restrict __nptr,
char ** __restrict __endptr,
int __base, int __group) __THROW;
# define __strtoul_internal_defined 1
# endif
extern __inline uintmax_t
(strtoumax (__const char *__restrict nptr, char **__restrict endptr,
int base))
{
return __strtoul_internal (nptr, endptr, base, 0);
}
/* Like `wcstol' but convert to `intmax_t'. */
# ifndef __wcstol_internal_defined
extern long int __wcstol_internal (__const __gwchar_t * __restrict __nptr,
__gwchar_t **__restrict __endptr,
int __base, int __group) __THROW;
# define __wcstol_internal_defined 1
# endif
extern __inline intmax_t
(wcstoimax (__const __gwchar_t *__restrict nptr,
__gwchar_t **__restrict endptr, int base))
{
return __wcstol_internal (nptr, endptr, base, 0);
}
/* Like `wcstoul' but convert to `uintmax_t'. */
# ifndef __wcstoul_internal_defined
extern unsigned long int __wcstoul_internal (__const __gwchar_t *
__restrict __nptr,
__gwchar_t **
__restrict __endptr,
int __base, int __group) __THROW;
# define __wcstoul_internal_defined 1
# endif
extern __inline uintmax_t
(wcstoumax (__const __gwchar_t *__restrict nptr,
__gwchar_t **__restrict endptr, int base))
{
return __wcstoul_internal (nptr, endptr, base, 0);
}
# else /* __WORDSIZE == 32 */
/* Like `strtol' but convert to `intmax_t'. */
# ifndef __strtoll_internal_defined
__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) __THROW;
# define __strtoll_internal_defined 1
# endif
extern __inline intmax_t
(strtoimax (__const char *__restrict nptr, char **__restrict endptr,
int base))
{
return __strtoll_internal (nptr, endptr, base, 0);
}
/* Like `strtoul' but convert to `uintmax_t'. */
# ifndef __strtoull_internal_defined
__extension__
extern unsigned long long int __strtoull_internal (__const char *
__restrict __nptr,
char **
__restrict __endptr,
int __base,
int __group) __THROW;
# define __strtoull_internal_defined 1
# endif
extern __inline uintmax_t
(strtoumax (__const char *__restrict nptr, char **__restrict endptr,
int base))
{
return __strtoull_internal (nptr, endptr, base, 0);
}
/* Like `wcstol' but convert to `intmax_t'. */
# ifndef __wcstoll_internal_defined
__extension__
extern long long int __wcstoll_internal (__const __gwchar_t *
__restrict __nptr,
__gwchar_t **__restrict __endptr,
int __base, int __group) __THROW;
# define __wcstoll_internal_defined 1
# endif
extern __inline intmax_t
(wcstoimax (__const __gwchar_t *__restrict nptr,
__gwchar_t **__restrict endptr, int base))
{
return __wcstoll_internal (nptr, endptr, base, 0);
}
/* Like `wcstoul' but convert to `uintmax_t'. */
# ifndef __wcstoull_internal_defined
__extension__
extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
__restrict __nptr,
__gwchar_t **
__restrict __endptr,
int __base,
int __group) __THROW;
# define __wcstoull_internal_defined 1
# endif
extern __inline uintmax_t
(wcstoumax (__const __gwchar_t *__restrict nptr,
__gwchar_t **__restrict endptr, int base))
{
return __wcstoull_internal (nptr, endptr, base, 0);
}
# endif /* __WORDSIZE == 32 */
#endif /* Use extern inlines. */
__END_DECLS
#endif /* inttypes.h */

View File

@ -1,320 +0,0 @@
/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/*
* ISO C99: 7.18 Integer types <stdint.h>
*/
#ifndef _STDINT_H
#define _STDINT_H 1
#include <features.h>
#include <bits/wchar.h>
#include <bits/wordsize.h>
/* Exact integral types. */
/* Signed. */
/* There is some amount of overlap with <sys/types.h> as known by inet code */
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
# if __WORDSIZE == 64
typedef long int int64_t;
# else
__extension__
typedef long long int int64_t;
# endif
#endif
/* Unsigned. */
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
#ifndef __uint32_t_defined
typedef unsigned int uint32_t;
# define __uint32_t_defined
#endif
#if __WORDSIZE == 64
typedef unsigned long int uint64_t;
#else
__extension__
typedef unsigned long long int uint64_t;
#endif
/* Small types. */
/* Signed. */
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;
#if __WORDSIZE == 64
typedef long int int_least64_t;
#else
__extension__
typedef long long int int_least64_t;
#endif
/* Unsigned. */
typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;
#if __WORDSIZE == 64
typedef unsigned long int uint_least64_t;
#else
__extension__
typedef unsigned long long int uint_least64_t;
#endif
/* Fast types. */
/* Signed. */
typedef signed char int_fast8_t;
#if __WORDSIZE == 64
typedef long int int_fast16_t;
typedef long int int_fast32_t;
typedef long int int_fast64_t;
#else
typedef int int_fast16_t;
typedef int int_fast32_t;
__extension__
typedef long long int int_fast64_t;
#endif
/* Unsigned. */
typedef unsigned char uint_fast8_t;
#if __WORDSIZE == 64
typedef unsigned long int uint_fast16_t;
typedef unsigned long int uint_fast32_t;
typedef unsigned long int uint_fast64_t;
#else
typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
__extension__
typedef unsigned long long int uint_fast64_t;
#endif
/* Types for `void *' pointers. */
#if __WORDSIZE == 64
# ifndef __intptr_t_defined
typedef long int intptr_t;
# define __intptr_t_defined
# endif
typedef unsigned long int uintptr_t;
#else
# ifndef __intptr_t_defined
typedef int intptr_t;
# define __intptr_t_defined
# endif
typedef unsigned int uintptr_t;
#endif
/* Largest integral types. */
#if __WORDSIZE == 64
typedef long int intmax_t;
typedef unsigned long int uintmax_t;
#else
__extension__
typedef long long int intmax_t;
__extension__
typedef unsigned long long int uintmax_t;
#endif
/* The ISO C99 standard specifies that in C++ implementations these
macros should only be defined if explicitly requested. */
#if !defined __cplusplus || defined __STDC_LIMIT_MACROS
# if __WORDSIZE == 64
# define __INT64_C(c) c ## L
# define __UINT64_C(c) c ## UL
# else
# define __INT64_C(c) c ## LL
# define __UINT64_C(c) c ## ULL
# endif
/* Limits of integral types. */
/* Minimum of signed integral types. */
# define INT8_MIN (-128)
# define INT16_MIN (-32767-1)
# define INT32_MIN (-2147483647-1)
# define INT64_MIN (-__INT64_C(9223372036854775807)-1)
/* Maximum of signed integral types. */
# define INT8_MAX (127)
# define INT16_MAX (32767)
# define INT32_MAX (2147483647)
# define INT64_MAX (__INT64_C(9223372036854775807))
/* Maximum of unsigned integral types. */
# define UINT8_MAX (255)
# define UINT16_MAX (65535)
# define UINT32_MAX (4294967295U)
# define UINT64_MAX (__UINT64_C(18446744073709551615))
/* Minimum of signed integral types having a minimum size. */
# define INT_LEAST8_MIN (-128)
# define INT_LEAST16_MIN (-32767-1)
# define INT_LEAST32_MIN (-2147483647-1)
# define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1)
/* Maximum of signed integral types having a minimum size. */
# define INT_LEAST8_MAX (127)
# define INT_LEAST16_MAX (32767)
# define INT_LEAST32_MAX (2147483647)
# define INT_LEAST64_MAX (__INT64_C(9223372036854775807))
/* Maximum of unsigned integral types having a minimum size. */
# define UINT_LEAST8_MAX (255)
# define UINT_LEAST16_MAX (65535)
# define UINT_LEAST32_MAX (4294967295U)
# define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615))
/* Minimum of fast signed integral types having a minimum size. */
# define INT_FAST8_MIN (-128)
# if __WORDSIZE == 64
# define INT_FAST16_MIN (-9223372036854775807L-1)
# define INT_FAST32_MIN (-9223372036854775807L-1)
# else
# define INT_FAST16_MIN (-2147483647-1)
# define INT_FAST32_MIN (-2147483647-1)
# endif
# define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1)
/* Maximum of fast signed integral types having a minimum size. */
# define INT_FAST8_MAX (127)
# if __WORDSIZE == 64
# define INT_FAST16_MAX (9223372036854775807L)
# define INT_FAST32_MAX (9223372036854775807L)
# else
# define INT_FAST16_MAX (2147483647)
# define INT_FAST32_MAX (2147483647)
# endif
# define INT_FAST64_MAX (__INT64_C(9223372036854775807))
/* Maximum of fast unsigned integral types having a minimum size. */
# define UINT_FAST8_MAX (255)
# if __WORDSIZE == 64
# define UINT_FAST16_MAX (18446744073709551615UL)
# define UINT_FAST32_MAX (18446744073709551615UL)
# else
# define UINT_FAST16_MAX (4294967295U)
# define UINT_FAST32_MAX (4294967295U)
# endif
# define UINT_FAST64_MAX (__UINT64_C(18446744073709551615))
/* Values to test for integral types holding `void *' pointer. */
# if __WORDSIZE == 64
# define INTPTR_MIN (-9223372036854775807L-1)
# define INTPTR_MAX (9223372036854775807L)
# define UINTPTR_MAX (18446744073709551615UL)
# else
# define INTPTR_MIN (-2147483647-1)
# define INTPTR_MAX (2147483647)
# define UINTPTR_MAX (4294967295U)
# endif
/* Minimum for largest signed integral type. */
# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
/* Maximum for largest signed integral type. */
# define INTMAX_MAX (__INT64_C(9223372036854775807))
/* Maximum for largest unsigned integral type. */
# define UINTMAX_MAX (__UINT64_C(18446744073709551615))
/* Limits of other integer types. */
/* Limits of `ptrdiff_t' type. */
# if __WORDSIZE == 64
# define PTRDIFF_MIN (-9223372036854775807L-1)
# define PTRDIFF_MAX (9223372036854775807L)
# else
# define PTRDIFF_MIN (-2147483647-1)
# define PTRDIFF_MAX (2147483647)
# endif
/* Limits of `sig_atomic_t'. */
# define SIG_ATOMIC_MIN (-2147483647-1)
# define SIG_ATOMIC_MAX (2147483647)
/* Limit of `size_t' type. */
# if __WORDSIZE == 64
# define SIZE_MAX (18446744073709551615UL)
# else
# define SIZE_MAX (4294967295U)
# endif
/* Limits of `wchar_t'. */
# ifndef WCHAR_MIN
/* These constants might also be defined in <wchar.h>. */
# define WCHAR_MIN __WCHAR_MIN
# define WCHAR_MAX __WCHAR_MAX
# endif
/* Limits of `wint_t'. */
# define WINT_MIN (0u)
# define WINT_MAX (4294967295u)
#endif /* C++ && limit macros */
/* The ISO C99 standard specifies that in C++ implementations these
should only be defined if explicitly requested. */
#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
/* Signed. */
# define INT8_C(c) c
# define INT16_C(c) c
# define INT32_C(c) c
# if __WORDSIZE == 64
# define INT64_C(c) c ## L
# else
# define INT64_C(c) c ## LL
# endif
/* Unsigned. */
# define UINT8_C(c) c ## U
# define UINT16_C(c) c ## U
# define UINT32_C(c) c ## U
# if __WORDSIZE == 64
# define UINT64_C(c) c ## UL
# else
# define UINT64_C(c) c ## ULL
# endif
/* Maximal type. */
# if __WORDSIZE == 64
# define INTMAX_C(c) c ## L
# define UINTMAX_C(c) c ## UL
# else
# define INTMAX_C(c) c ## LL
# define UINTMAX_C(c) c ## ULL
# endif
#endif /* C++ && constant macros */
#endif /* stdint.h */

View File

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

View File

@ -1,69 +0,0 @@
#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,8 +24,9 @@ static int is48;
static DECLFW(Mapper33_write)
{
A&=0xF003;
//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

@ -1,79 +0,0 @@
#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,96 +22,62 @@
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)
{
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;
}
if((A&0x7300)==0x5000)
setprg32(0x8000,V);
//else
//if(A==0x5200)
// printf("$%04x:$%02x\n",A,V);
}
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)
{
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();
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);
}
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);
}
void Mapper163_Init(CartInfo *info)
{
info->Power=Power2;
GameHBIRQHook=M163HB;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
info->Power=Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -1,95 +0,0 @@
/* 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

@ -1,95 +0,0 @@
/* 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

@ -0,0 +1,80 @@
/* 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

@ -1,25 +0,0 @@
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,300 +87,316 @@ 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++)
int x;
for(x=0;x<8;x++)
{
switch(MMC5WRAMsize)
{
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;
}
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)
{
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)
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)
{
uint32 t;
t=V|(V<<8)|(V<<16)|(V<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0);
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;
}
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)
@ -394,59 +410,60 @@ static DECLFR(MMC5_ExRAMRd)
static DECLFR(MMC5_read)
{
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);
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);
}
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;
@ -454,41 +471,47 @@ void MMC5Synco(void)
void MMC5_hb(int scanline)
{
//printf("%d:%d, ",scanline,MMC5LineCounter);
if(scanline==240)
{
MMC5LineCounter=0;
MMC5IRQR=0x40;
return;
// printf("\n%d:%d\n",scanline,MMC5LineCounter);
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++;
}
if(MMC5LineCounter==240)
MMC5IRQR=0;
// printf("%d:%d\n",MMC5LineCounter,scanline);
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;
@ -496,88 +519,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;
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);
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 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];
@ -587,7 +610,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;
@ -602,18 +625,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++)
{
@ -625,7 +648,7 @@ static void Do5SQHQ(int P)
vc=wl;
dc=(dc+1)&7;
}
}
}
MMC5Sound.dcount[P]=dc;
MMC5Sound.vcount[P]=vc;
}
@ -633,7 +656,7 @@ static void Do5SQHQ(int P)
}
void MMC5RunSoundHQ(void)
{
{
Do5SQHQ(0);
Do5SQHQ(1);
Do5PCMHQ();
@ -663,7 +686,7 @@ void Mapper5_ESI(void)
if(FSettings.soundq>=1)
{
sfun=Do5SQHQ;
psfun=Do5PCMHQ;
psfun=Do5PCMHQ;
}
else
{
@ -688,7 +711,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);
@ -739,21 +762,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}
@ -778,7 +801,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,18 +191,21 @@ 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; }
// 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;
}
framets = 0;
nextd = d;
}
memcpy(js,joop,4);
}

View File

@ -173,9 +173,7 @@ 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);
@ -186,9 +184,7 @@ 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);
@ -200,9 +196,7 @@ 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);
}
@ -289,24 +283,18 @@ 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: 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);
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);
/* 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);
/* 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);
/* DOP */

View File

@ -153,7 +153,10 @@ static DECLFR(A2002)
FCEUPPU_LineUpdate();
ret = PPU_status;
ret|=PPUGenLatch&0x1F;
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg)
#endif
{
vtoggle=0;
PPU_status&=0x7F;
@ -202,7 +205,9 @@ static DECLFR(A2007)
ret=VRAMBuffer;
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg)
#endif
{
if(PPU_hook) PPU_hook(tmp);
PPUGenLatch=VRAMBuffer;
@ -215,7 +220,9 @@ static DECLFR(A2007)
VRAMBuffer=vnapage[(tmp>>10)&0x3][tmp&0x3FF];
}
}
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg)
#endif
{
if (INC32) RefreshAddr+=32;
else RefreshAddr++;
@ -374,6 +381,7 @@ static int tofix=0;
static void ResetRL(uint8 *target)
{
memset(target,0xFF,256);
if(InputScanlineHook)
InputScanlineHook(0,0,0,0);
Plinef=target;
@ -388,11 +396,14 @@ static uint8 sprlinebuf[256+8];
void FCEUPPU_LineUpdate(void)
{
if(Pline && !fceuindbg)
{
int l=GETLASTPIXEL;
RefreshLine(l);
}
#ifdef FCEUDEF_DEBUGGER
if(!fceuindbg)
#endif
if(Pline)
{
int l=GETLASTPIXEL;
RefreshLine(l);
}
}
static int tileview=0;
@ -462,14 +473,20 @@ 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
@ -497,6 +514,16 @@ 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;
@ -660,7 +687,11 @@ static void FASTAPASS(1) RefreshLine(int lastpixel)
tofix=0;
}
CheckSpriteHit(lasttile*8); //lasttile*8); //lastpixel);
//CheckSpriteHit(lasttile*8); //lasttile*8); //lastpixel);
CheckSpriteHit(lastpixel); /* This only works right because
of a hack earlier in this function.
*/
if(InputScanlineHook && (lastpixel-16)>=0)
{
InputScanlineHook(Plinef,spork?sprlinebuf:0,linestartts,lasttile*8-16);
@ -964,19 +995,25 @@ 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--)
{
register uint32 pixdata;
register uint8 J,atr;
int x=spr->x;
uint8 *C;
uint8 *VB;
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;
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)
{
@ -1073,7 +1110,7 @@ static void RefreshSprites(void)
}
}
SpriteBlurp=0;
spork=1;
spork=1;
}
static void CopySprites(uint8 *target)
@ -1085,6 +1122,7 @@ static void CopySprites(uint8 *target)
spork=0;
if(rendis & 1) return; /* User asked to not display sprites. */
loopskie:
{
uint32 t=*(uint32 *)(sprlinebuf+n);
@ -1094,25 +1132,25 @@ static void CopySprites(uint8 *target)
#ifdef LSB_FIRST
if(!(t&0x80))
{
if(!(t&0x40) || (P[n]&64)) // Normal sprite || behind bg sprite
if(!(t&0x40) || (P[n]&0x40)) // Normal sprite || behind bg sprite
P[n]=sprlinebuf[n];
}
if(!(t&0x8000))
{
if(!(t&0x4000) || (P[n+1]&64)) // Normal sprite || behind bg sprite
if(!(t&0x4000) || (P[n+1]&0x40)) // Normal sprite || behind bg sprite
P[n+1]=(sprlinebuf+1)[n];
}
if(!(t&0x800000))
{
if(!(t&0x400000) || (P[n+2]&64)) // Normal sprite || behind bg sprite
if(!(t&0x400000) || (P[n+2]&0x40)) // Normal sprite || behind bg sprite
P[n+2]=(sprlinebuf+2)[n];
}
if(!(t&0x80000000))
{
if(!(t&0x40000000) || (P[n+3]&64)) // Normal sprite || behind bg sprite
if(!(t&0x40000000) || (P[n+3]&0x40)) // Normal sprite || behind bg sprite
P[n+3]=(sprlinebuf+3)[n];
}
#else

View File

@ -21,6 +21,60 @@
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];
@ -36,6 +90,7 @@
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;
}
DECLFW(Write_IRQFM)
static DECLFW(Write_IRQFM)
{
V=(V&0xC0)>>6;
fcnt=0;
if(V&0x2)
if(V&0x2)
FrameSoundUpdate();
fcnt=1;
fhcnt=fhinc;
@ -944,7 +944,7 @@ 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;
int x;
SetNESSoundMap();
memset(PSG,0x00,sizeof(PSG));
FCEUSND_Reset();
SetNESSoundMap();
memset(PSG,0x00,sizeof(PSG));
FCEUSND_Reset();
memset(Wave,0,sizeof(Wave));
memset(WaveHi,0,sizeof(WaveHi));
memset(&EnvUnits,0,sizeof(EnvUnits));
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);
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,11 +79,6 @@ SFORMAT SFCPUC[]={
{ 0 }
};
void cleanSFMDATA()
{
memset(&SFMDATA[0], 0, sizeof(SFMDATA) * 64 );
}
static int SubWrite(FILE *st, SFORMAT *sf)
{
uint32 acc=0;
@ -451,9 +446,7 @@ 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);
}
@ -468,3 +461,7 @@ void FCEU_DrawSaveStates(uint8 *XBuf)
StateShow--;
}
void cleanSFMDATA()
{
memset(&SFMDATA[0], 0, sizeof(SFMDATA) * 64 );
}

View File

@ -41,7 +41,6 @@ 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,14 +371,12 @@ 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,7 +27,9 @@
X6502 X;
#ifdef FCEUDEF_DEBUGGER
void (*X6502_Run)(int32 cycles);
#endif
uint32 timestamp;
void FP_FASTAPASS(1) (*MapIRQHook)(int a);
@ -63,6 +65,7 @@ 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); }
@ -82,6 +85,7 @@ 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)
@ -129,18 +133,19 @@ static uint8 ZNTable[256];
if(cond) \
{ \
uint32 tmp; \
int8 disp; \
disp=RdMem(_PC); \
int32 disp; \
disp=(int8)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)
@ -393,6 +398,7 @@ void TriggerNMI2(void)
_IRQlow|=FCEU_IQNMI2;
}
#ifdef FCEUDEF_DEBUGGER
/* Called from debugger. */
void FCEUI_NMI(void)
{
@ -404,11 +410,6 @@ 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;
@ -421,8 +422,14 @@ 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;
}
void X6502_Init(void)
{
int x;
@ -432,7 +439,9 @@ 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)
@ -442,6 +451,7 @@ void X6502_Power(void)
X6502_Reset();
}
#ifdef FCEUDEF_DEBUGGER
static void X6502_RunDebug(int32 cycles)
{
#define RdRAM RdMemHook
@ -565,6 +575,9 @@ 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
@ -650,15 +663,13 @@ static void X6502_RunNormal(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++;
@ -675,6 +686,7 @@ static void X6502_RunNormal(int32 cycles)
#undef WrRAM
}
#ifdef FCEUDEF_DEBUGGER
void X6502_Debug(void (*CPUHook)(X6502 *),
uint8 (*ReadHook)(X6502 *, unsigned int),
void (*WriteHook)(X6502 *, unsigned int, uint8))
@ -689,3 +701,5 @@ void X6502_Debug(void (*CPUHook)(X6502 *),
else
X6502_Run=X6502_RunDebug;
}
#endif

View File

@ -22,13 +22,18 @@
#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,9 +14,13 @@ 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

View File

@ -84,7 +84,7 @@ CtrlrMap ctrlr_def[4] = {
{PAD_BUTTON_B, "B"},
{PAD_BUTTON_X, "X"},
{PAD_BUTTON_Y, "Y"},
{PAD_BUTTON_MENU, "MENU"},
{PAD_BUTTON_MENU, "START"},
{PAD_BUTTON_START, "START"},
{PAD_TRIGGER_L, "L TRIG"},
{PAD_TRIGGER_R, "R TRIG"},