Use C-comment style

This commit is contained in:
retro-wertz
2017-10-15 03:13:11 +08:00
parent ebca2248d0
commit 52c8155dee
33 changed files with 441 additions and 408 deletions

View File

@@ -2,7 +2,7 @@
#if defined(_WIN32) && !defined(_XBOX) && !defined(__LIBRETRO__) #if defined(_WIN32) && !defined(_XBOX) && !defined(__LIBRETRO__)
HANDLE SerialPort = NULL; // Handle of SerialPort itself. HANDLE SerialPort = NULL; /* Handle of SerialPort itself. */
BOOL SerialOpen(int port, int baud) { BOOL SerialOpen(int port, int baud) {
HANDLE Comport; HANDLE Comport;
@@ -15,24 +15,24 @@ BOOL SerialOpen(int port, int baud) {
else else
sprintf(str, "COM%d", port); sprintf(str, "COM%d", port);
// Open the serial port /* Open the serial port */
if ((Comport = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) if ((Comport = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
return FALSE; return FALSE;
// Configure Serial port (Setup Comm) /* Configure Serial port (Setup Comm) */
// Buffer sizes /* Buffer sizes */
if (!SetupComm(Comport, 128, 128)) if (!SetupComm(Comport, 128, 128))
return FALSE; return FALSE;
// Setup DCB using current values /* Setup DCB using current values */
if (!GetCommState(Comport, &myDCB)) if (!GetCommState(Comport, &myDCB))
return FALSE; return FALSE;
myDCB.fInX = FALSE; // Turn off xon/xoff handler myDCB.fInX = FALSE; /* Turn off xon/xoff handler */
myDCB.fOutX = FALSE; myDCB.fOutX = FALSE;
myDCB.fOutxDsrFlow = FALSE; myDCB.fOutxDsrFlow = FALSE;
myDCB.fOutxCtsFlow = FALSE; // no hardware flow control. myDCB.fOutxCtsFlow = FALSE; /* no hardware flow control. */
myDCB.BaudRate = baud; myDCB.BaudRate = baud;
myDCB.DCBlength = sizeof(DCB); myDCB.DCBlength = sizeof(DCB);
myDCB.fBinary = 1; myDCB.fBinary = 1;
@@ -52,12 +52,12 @@ BOOL SerialOpen(int port, int baud) {
if (!SetCommState(Comport, &myDCB)) if (!SetCommState(Comport, &myDCB))
return FALSE; return FALSE;
// Set timeouts /* Set timeouts */
CTout.ReadIntervalTimeout = 0xffffffff; CTout.ReadIntervalTimeout = 0xffffffff;
CTout.ReadTotalTimeoutMultiplier = 0; CTout.ReadTotalTimeoutMultiplier = 0;
CTout.ReadTotalTimeoutConstant = 0; CTout.ReadTotalTimeoutConstant = 0;
CTout.WriteTotalTimeoutMultiplier = 0; CTout.WriteTotalTimeoutMultiplier = 0;
CTout.WriteTotalTimeoutConstant = 5000; // don't hang if CTS is locked, for example CTout.WriteTotalTimeoutConstant = 5000; /* don't hang if CTS is locked, for example */
SetCommTimeouts(Comport, &CTout); SetCommTimeouts(Comport, &CTout);
EscapeCommFunction(Comport, SETDTR); EscapeCommFunction(Comport, SETDTR);

View File

@@ -32,14 +32,14 @@ static uint8 cpu410x[16], ppu201x[16], apu40xx[64];
/* IRQ Registers */ /* IRQ Registers */
static uint8 IRQCount, IRQa, IRQReload; static uint8 IRQCount, IRQa, IRQReload;
#define IRQLatch cpu410x[0x1] // accc cccc, a = 0, AD12 switching, a = 1, HSYNC switching #define IRQLatch cpu410x[0x1] /* accc cccc, a = 0, AD12 switching, a = 1, HSYNC switching */
/* MMC3 Registers */ /* MMC3 Registers */
static uint8 inv_hack = 0; /* some OneBus Systems have swapped PRG reg commans in MMC3 inplementation, static uint8 inv_hack = 0; /* some OneBus Systems have swapped PRG reg commans in MMC3 inplementation,
* trying to autodetect unusual behavior, due not to add a new mapper. * trying to autodetect unusual behavior, due not to add a new mapper.
*/ */
#define mmc3cmd cpu410x[0x5] // pcv- ----, p - program swap, c - video swap, v - internal VRAM enable #define mmc3cmd cpu410x[0x5] /* pcv- ----, p - program swap, c - video swap, v - internal VRAM enable */
#define mirror cpu410x[0x6] // ---- ---m, m = 0 - H, m = 1 - V #define mirror cpu410x[0x6] /* ---- ---m, m = 0 - H, m = 1 - V */
/* APU Registers */ /* APU Registers */
static uint8 pcm_enable = 0, pcm_irq = 0; static uint8 pcm_enable = 0, pcm_irq = 0;

View File

@@ -136,7 +136,7 @@ DECLFR(CartBR) {
} }
DECLFW(CartBW) { DECLFW(CartBW) {
//printf("Ok: %04x:%02x, %d\n",A,V,PRGIsRAM[A>>11]); /* printf("Ok: %04x:%02x, %d\n",A,V,PRGIsRAM[A>>11]); */
if (PRGIsRAM[A >> 11] && Page[A >> 11]) if (PRGIsRAM[A >> 11] && Page[A >> 11])
Page[A >> 11][A] = V; Page[A >> 11][A] = V;
} }
@@ -439,7 +439,7 @@ static readfunc GenieBackup[3];
static DECLFR(GenieFix1) { static DECLFR(GenieFix1) {
uint8 r = GenieBackup[0](A); uint8 r = GenieBackup[0](A);
if ((modcon >> 1) & 1) // No check if ((modcon >> 1) & 1) /* No check */
return genieval[0]; return genieval[0];
else if (r == geniech[0]) else if (r == geniech[0])
return genieval[0]; return genieval[0];
@@ -450,7 +450,7 @@ static DECLFR(GenieFix1) {
static DECLFR(GenieFix2) { static DECLFR(GenieFix2) {
uint8 r = GenieBackup[1](A); uint8 r = GenieBackup[1](A);
if ((modcon >> 2) & 1) // No check if ((modcon >> 2) & 1) /* No check */
return genieval[1]; return genieval[1];
else if (r == geniech[1]) else if (r == geniech[1])
return genieval[1]; return genieval[1];
@@ -461,7 +461,7 @@ static DECLFR(GenieFix2) {
static DECLFR(GenieFix3) { static DECLFR(GenieFix3) {
uint8 r = GenieBackup[2](A); uint8 r = GenieBackup[2](A);
if ((modcon >> 3) & 1) // No check if ((modcon >> 3) & 1) /* No check */
return genieval[2]; return genieval[2];
else if (r == geniech[2]) else if (r == geniech[2])
return genieval[2]; return genieval[2];
@@ -480,7 +480,7 @@ void FixGenieMap(void) {
VPageR = VPage; VPageR = VPage;
FlushGenieRW(); FlushGenieRW();
//printf("Rightyo\n"); /* printf("Rightyo\n"); */
for (x = 0; x < 3; x++) for (x = 0; x < 3; x++)
if ((modcon >> (4 + x)) & 1) { if ((modcon >> (4 + x)) & 1) {
readfunc tmp[3] = { GenieFix1, GenieFix2, GenieFix3 }; readfunc tmp[3] = { GenieFix1, GenieFix2, GenieFix3 };

View File

@@ -2,25 +2,27 @@
#define _FCEU_CART_H #define _FCEU_CART_H
typedef struct { typedef struct {
// Set by mapper/board code: /* Set by mapper/board code: */
void (*Power)(void); void (*Power)(void);
void (*Reset)(void); void (*Reset)(void);
void (*Close)(void); void (*Close)(void);
uint8 *SaveGame[4]; // Pointers to memory to save/load. uint8 *SaveGame[4]; /* Pointers to memory to save/load. */
uint32 SaveGameLen[4]; // How much memory to save/load. uint32 SaveGameLen[4]; /* How much memory to save/load. */
// Set by iNES/UNIF loading code. /* Set by iNES/UNIF loading code. */
int mirror; // As set in the header or chunk. int mirror; /* As set in the header or chunk.
// iNES/UNIF specific. Intended * iNES/UNIF specific. Intended
// to help support games like "Karnov" * to help support games like "Karnov"
// that are not really MMC3 but are * that are not really MMC3 but are
// set to mapper 4. * set to mapper 4.
int battery; // Presence of an actual battery. */
int battery; /* Presence of an actual battery. */
int vram_size; int vram_size;
uint8 MD5[16]; uint8 MD5[16];
uint32 CRC32; // Should be set by the iNES/UNIF loading uint32 CRC32; /* Should be set by the iNES/UNIF loading
// code, used by mapper/board code, maybe * code, used by mapper/board code, maybe
// other code in the future. * other code in the future.
*/
} CartInfo; } CartInfo;
extern uint8 *Page[32], *VPage[8], *MMC5SPRVPage[8], *MMC5BGVPage[8]; extern uint8 *Page[32], *VPage[8], *MMC5SPRVPage[8], *MMC5BGVPage[8];

View File

@@ -114,7 +114,7 @@ void RebuildSubCheats(void) {
if (c->type == 1 && c->status) { if (c->type == 1 && c->status) {
if (GetReadHandler(c->addr) == SubCheatsRead) { if (GetReadHandler(c->addr) == SubCheatsRead) {
/* Prevent a catastrophe by this check. */ /* Prevent a catastrophe by this check. */
//FCEU_DispMessage("oops"); /* FCEU_DispMessage("oops"); */
} else { } else {
SubCheats[numsubcheats].PrevRead = GetReadHandler(c->addr); SubCheats[numsubcheats].PrevRead = GetReadHandler(c->addr);
SubCheats[numsubcheats].addr = c->addr; SubCheats[numsubcheats].addr = c->addr;
@@ -224,27 +224,27 @@ int FCEUI_DelCheat(uint32 which) {
uint32 x = 0; uint32 x = 0;
for (prev = 0, cur = cheats;; ) { for (prev = 0, cur = cheats;; ) {
if (x == which) { // Remove this cheat. if (x == which) { /* Remove this cheat. */
if (prev) { // Update pointer to this cheat. if (prev) { /* Update pointer to this cheat. */
if (cur->next) // More cheats. if (cur->next) /* More cheats. */
prev->next = cur->next; prev->next = cur->next;
else { // No more. else { /* No more. */
prev->next = 0; prev->next = 0;
cheatsl = prev; // Set the previous cheat as the last cheat. cheatsl = prev; /* Set the previous cheat as the last cheat. */
} }
} else {// This is the first cheat. } else {/* This is the first cheat. */
if (cur->next) // More cheats if (cur->next) /* More cheats */
cheats = cur->next; cheats = cur->next;
else else
cheats = cheatsl = 0; // No (more) cheats. cheats = cheatsl = 0; /* No (more) cheats. */
} }
free(cur->name);// Now that all references to this cheat are removed, free(cur->name);/* Now that all references to this cheat are removed, */
free(cur); // free the memory. free(cur); /* free the memory. */
break; break;
} // *END REMOVE THIS CHEAT* } /* *END REMOVE THIS CHEAT* */
if (!cur->next) // No more cheats to go through(this shouldn't ever happen...) if (!cur->next) /* No more cheats to go through(this shouldn't ever happen...) */
return(0); return(0);
prev = cur; prev = cur;
cur = prev->next; cur = prev->next;
@@ -341,7 +341,7 @@ int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c) {
t = GGtobin(*str++); t = GGtobin(*str++);
A |= (t & 0x07) << 4; A |= (t & 0x07) << 4;
//if(t&0x08) return(0); /* 8-character code?! */ /* if(t&0x08) return(0); */ /* 8-character code?! */
t = GGtobin(*str++); t = GGtobin(*str++);
A |= (t & 0x07) << 12; A |= (t & 0x07) << 12;
@@ -579,41 +579,41 @@ void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2) {
} }
if (!type) {// Change to a specific value. if (!type) {/* Change to a specific value. */
for (x = 0; x < 0x10000; x++) for (x = 0; x < 0x10000; x++)
if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (!(CheatComp[x] & CHEATC_NOSHOW)) {
if (CheatComp[x] == v1 && CheatRPtrs[x >> 10][x] == v2) { if (CheatComp[x] == v1 && CheatRPtrs[x >> 10][x] == v2) {
} else } else
CheatComp[x] |= CHEATC_EXCLUDED; CheatComp[x] |= CHEATC_EXCLUDED;
} }
} else if (type == 1) { // Search for relative change(between values). } else if (type == 1) { /* Search for relative change(between values). */
for (x = 0; x < 0x10000; x++) for (x = 0; x < 0x10000; x++)
if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (!(CheatComp[x] & CHEATC_NOSHOW)) {
if (CheatComp[x] == v1 && CAbs(CheatComp[x] - CheatRPtrs[x >> 10][x]) == v2) { if (CheatComp[x] == v1 && CAbs(CheatComp[x] - CheatRPtrs[x >> 10][x]) == v2) {
} else } else
CheatComp[x] |= CHEATC_EXCLUDED; CheatComp[x] |= CHEATC_EXCLUDED;
} }
} else if (type == 2) { // Purely relative change. } else if (type == 2) { /* Purely relative change. */
for (x = 0x000; x < 0x10000; x++) for (x = 0x000; x < 0x10000; x++)
if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (!(CheatComp[x] & CHEATC_NOSHOW)) {
if (CAbs(CheatComp[x] - CheatRPtrs[x >> 10][x]) == v2) { if (CAbs(CheatComp[x] - CheatRPtrs[x >> 10][x]) == v2) {
} else } else
CheatComp[x] |= CHEATC_EXCLUDED; CheatComp[x] |= CHEATC_EXCLUDED;
} }
} else if (type == 3) { // Any change. } else if (type == 3) { /* Any change. */
for (x = 0; x < 0x10000; x++) for (x = 0; x < 0x10000; x++)
if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (!(CheatComp[x] & CHEATC_NOSHOW)) {
if (CheatComp[x] != CheatRPtrs[x >> 10][x]) { if (CheatComp[x] != CheatRPtrs[x >> 10][x]) {
} else } else
CheatComp[x] |= CHEATC_EXCLUDED; CheatComp[x] |= CHEATC_EXCLUDED;
} }
} else if (type == 4) { // Value decreased. } else if (type == 4) { /* Value decreased. */
for (x = 0; x < 0x10000; x++) for (x = 0; x < 0x10000; x++)
if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (!(CheatComp[x] & CHEATC_NOSHOW)) {
if (!(CheatRPtrs[x >> 10][x] < CheatComp[x])) if (!(CheatRPtrs[x >> 10][x] < CheatComp[x]))
CheatComp[x] |= CHEATC_EXCLUDED; CheatComp[x] |= CHEATC_EXCLUDED;
} }
} else if (type == 5) { // Value increased. } else if (type == 5) { /* Value increased. */
for (x = 0; x < 0x10000; x++) for (x = 0; x < 0x10000; x++)
if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (!(CheatComp[x] & CHEATC_NOSHOW)) {
if (!(CheatRPtrs[x >> 10][x] > CheatComp[x])) if (!(CheatRPtrs[x >> 10][x] > CheatComp[x]))

View File

@@ -70,17 +70,17 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl) {
static char *fstrings[12] = static char *fstrings[12] =
{ {
"#$%02X", // immediate "#$%02X", /* immediate */
"$%04X", // RELATIVE(jump) "$%04X", /* RELATIVE(jump) */
"$%02X", // Z "$%02X", /* Z */
"$%02X,X", // Z,x "$%02X,X", /* Z,x */
"$%02X,Y", // Z,y "$%02X,Y", /* Z,y */
"$%04X", //ABS "$%04X", /*ABS */
"$%04X,X", // ABS,x "$%04X,X", /* ABS,x */
"$%04X,Y", // ABS,y "$%04X,Y", /* ABS,y */
"($%04X)", // IND "($%04X)", /* IND */
"($%02X,X)", // INX "($%02X,X)", /* INX */
"($%02X),Y", // INY "($%02X),Y", /* INY */
"" ""
}; };
static int flengths[12] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 0 }; static int flengths[12] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 0 };

View File

@@ -254,7 +254,7 @@ void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi);
uint32 FCEUI_CRC32(uint32 crc, uint8 *buf, uint32 len); uint32 FCEUI_CRC32(uint32 crc, uint8 *buf, uint32 len);
//void FCEUI_ToggleTileView(void); /* void FCEUI_ToggleTileView(void); */
void FCEUI_SetLowPass(int q); void FCEUI_SetLowPass(int q);
void FCEUI_NSFSetVis(int mode); void FCEUI_NSFSetVis(int mode);

View File

@@ -31,8 +31,8 @@
#include "video.c" #include "video.c"
#include "vsuni.c" #include "vsuni.c"
//#include "x6502.c" /* #include "x6502.c" */
//#include "ines.c" /* #include "ines.c" */
//#include "unif.c" /* #include "unif.c" */
#endif #endif

View File

@@ -216,7 +216,7 @@ typedef uint64_t uintmax_t;
#ifndef WCHAR_MIN /* [ */ #ifndef WCHAR_MIN /* [ */
# define WCHAR_MIN 0 # define WCHAR_MIN 0
#endif /* WCHAR_MIN ] */ #endif /* WCHAR_MIN ] */
#ifndef WCHAR_MAX // [ #ifndef WCHAR_MAX /* [ */
# define WCHAR_MAX _UI16_MAX # define WCHAR_MAX _UI16_MAX
#endif /* WCHAR_MAX ] */ #endif /* WCHAR_MAX ] */

View File

@@ -87,8 +87,6 @@ unsigned sndquality = 0;
unsigned sndvolume = 150; unsigned sndvolume = 150;
unsigned swapDuty = 0; unsigned swapDuty = 0;
static volatile int nofocus = 0;
static int32_t *sound = 0; static int32_t *sound = 0;
static uint32_t JSReturn = 0; static uint32_t JSReturn = 0;
static uint32_t MouseData[3]; static uint32_t MouseData[3];

View File

@@ -42,10 +42,12 @@ typedef long long int64;
#elif MSVC #elif MSVC
typedef __int64 int64; typedef __int64 int64;
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
#define GINLINE // Can't declare a function INLINE #define GINLINE /* Can't declare a function INLINE
// and global in MSVC. Bummer. * and global in MSVC. Bummer.
#define PSS_STYLE 2 // Does MSVC compile for anything */
// other than Windows/DOS targets? #define PSS_STYLE 2 /* Does MSVC compile for anything
* other than Windows/DOS targets?
*/
#else #else
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef long long int64; typedef long long int64;

View File

@@ -284,7 +284,7 @@ endlseq:
} }
FCEU_ResetPalette(); FCEU_ResetPalette();
FCEU_ResetMessages(); // Save state, status messages, etc. FCEU_ResetMessages(); /* Save state, status messages, etc. */
return(GameInfo); return(GameInfo);
} }
@@ -327,7 +327,7 @@ FCEUGI *FCEUI_CopyFamiStart(void)
} }
FCEU_ResetPalette(); FCEU_ResetPalette();
FCEU_ResetMessages(); // Save state, status messages, etc. FCEU_ResetMessages(); /* Save state, status messages, etc. */
return(GameInfo); return(GameInfo);
} }
@@ -385,13 +385,15 @@ void FCEU_MemoryRand(uint8 *ptr, uint32 size)
{ {
int x = 0; int x = 0;
while (size) { while (size) {
// *ptr = (x & 4) ? 0xFF : 0x00; // Huang Di DEBUG MODE enabled by default #if 0
// Cybernoid NO MUSIC by default *ptr = (x & 4) ? 0xFF : 0x00; /* Huang Di DEBUG MODE enabled by default */
// *ptr = (x & 4) ? 0x7F : 0x00; // Huang Di DEBUG MODE enabled by default /* Cybernoid NO MUSIC by default */
// Minna no Taabou no Nakayoshi Daisakusen DOESN'T BOOT *ptr = (x & 4) ? 0x7F : 0x00; /* Huang Di DEBUG MODE enabled by default */
// Cybernoid NO MUSIC by default /* Minna no Taabou no Nakayoshi Daisakusen DOESN'T BOOT */
// *ptr = (x & 1) ? 0x55 : 0xAA; // F-15 Sity War HISCORE is screwed... /* Cybernoid NO MUSIC by default */
// 1942 SCORE/HISCORE is screwed... *ptr = (x & 1) ? 0x55 : 0xAA; /* F-15 Sity War HISCORE is screwed... */
/* 1942 SCORE/HISCORE is screwed... */
#endif
*ptr = 0xFF; *ptr = 0xFF;
x++; x++;
size--; size--;
@@ -551,7 +553,7 @@ void FCEUI_SetSnapName(int a)
int32 FCEUI_GetDesiredFPS(void) int32 FCEUI_GetDesiredFPS(void)
{ {
if (PAL || dendy) if (PAL || dendy)
return(838977920); // ~50.007 return(838977920); /* ~50.007 */
else else
return(1008307711); // ~60.1 return(1008307711); /* ~60.1 */
} }

View File

@@ -85,12 +85,13 @@ typedef struct {
int SoundVolume; int SoundVolume;
int GameGenie; int GameGenie;
// Current first and last rendered scanlines. /* Current first and last rendered scanlines. */
int FirstSLine; int FirstSLine;
int LastSLine; int LastSLine;
// Driver code(user)-specified first and last rendered scanlines. /* Driver code(user)-specified first and last rendered scanlines.
// Usr*SLine[0] is for NTSC, Usr*SLine[1] is for PAL. * Usr*SLine[0] is for NTSC, Usr*SLine[1] is for PAL.
*/
int UsrFirstSLine[2]; int UsrFirstSLine[2];
int UsrLastSLine[2]; int UsrLastSLine[2];
int SnapName; int SnapName;

View File

@@ -34,10 +34,11 @@
#include "cart.h" #include "cart.h"
#include "md5.h" #include "md5.h"
// TODO: Add code to put a delay in between the time a disk is inserted /* TODO: Add code to put a delay in between the time a disk is inserted
// and the when it can be successfully read/written to. This should * and the when it can be successfully read/written to. This should
// prevent writes to wrong places OR add code to prevent disk ejects * prevent writes to wrong places OR add code to prevent disk ejects
// when the virtual motor is on(mmm...virtual motor). * when the virtual motor is on(mmm...virtual motor).
*/
static DECLFR(FDSRead4030); static DECLFR(FDSRead4030);
static DECLFR(FDSRead4031); static DECLFR(FDSRead4031);
@@ -115,9 +116,9 @@ static void FDSInit(void) {
lastDiskPtrRead = lastDiskPtrWrite = writeskip = DiskPtr = DiskSeekIRQ = 0; lastDiskPtrRead = lastDiskPtrWrite = writeskip = DiskPtr = DiskSeekIRQ = 0;
setmirror(1); setmirror(1);
setprg8(0xE000, 0); // BIOS setprg8(0xE000, 0); /* BIOS */
setprg32r(1, 0x6000, 0); // 32KB RAM setprg32r(1, 0x6000, 0); /* 32KB RAM */
setchr8(0); // 8KB CHR RAM setchr8(0); /* 8KB CHR RAM */
MapIRQHook = FDSFix; MapIRQHook = FDSFix;
GameStateRestore = FDSStateRestore; GameStateRestore = FDSStateRestore;
@@ -230,7 +231,7 @@ static DECLFR(FDSRead4032) {
} }
static DECLFR(FDSRead4033) { static DECLFR(FDSRead4033) {
return 0x80; // battery return 0x80; /* battery */
} }
/* Begin FDS sound */ /* Begin FDS sound */
@@ -238,21 +239,21 @@ static DECLFR(FDSRead4033) {
#define FDSClock (1789772.7272727272727272 / 2) #define FDSClock (1789772.7272727272727272 / 2)
typedef struct { typedef struct {
int64 cycles; // Cycles per PCM sample int64 cycles; /* Cycles per PCM sample */
int64 count; // Cycle counter int64 count; /* Cycle counter */
int64 envcount; // Envelope cycle counter int64 envcount; /* Envelope cycle counter */
uint32 b19shiftreg60; uint32 b19shiftreg60;
uint32 b24adder66; uint32 b24adder66;
uint32 b24latch68; uint32 b24latch68;
uint32 b17latch76; uint32 b17latch76;
int32 clockcount; // Counter to divide frequency by 8. int32 clockcount; /* Counter to divide frequency by 8. */
uint8 b8shiftreg88; // Modulation register. uint8 b8shiftreg88; /* Modulation register. */
uint8 amplitude[2]; // Current amplitudes. uint8 amplitude[2]; /* Current amplitudes. */
uint8 speedo[2]; uint8 speedo[2];
uint8 mwcount; uint8 mwcount;
uint8 mwstart; uint8 mwstart;
uint8 mwave[0x20]; // Modulation waveform uint8 mwave[0x20]; /* Modulation waveform */
uint8 cwave[0x40]; // Game-defined waveform(carrier) uint8 cwave[0x40]; /* Game-defined waveform(carrier) */
uint8 SPSG[0xB]; uint8 SPSG[0xB];
} FDSSOUND; } FDSSOUND;
@@ -318,13 +319,14 @@ static DECLFW(FDSSWrite) {
SPSG[A] = V; SPSG[A] = V;
} }
// $4080 - Fundamental wave amplitude data register 92 /* $4080 - Fundamental wave amplitude data register 92
// $4082 - Fundamental wave frequency data register 58 * $4082 - Fundamental wave frequency data register 58
// $4083 - Same as $4082($4083 is the upper 4 bits). * $4083 - Same as $4082($4083 is the upper 4 bits).
*
// $4084 - Modulation amplitude data register 78 * $4084 - Modulation amplitude data register 78
// $4086 - Modulation frequency data register 72 * $4086 - Modulation frequency data register 72
// $4087 - Same as $4086($4087 is the upper 4 bits) * $4087 - Same as $4086($4087 is the upper 4 bits)
*/
static void DoEnv() { static void DoEnv() {
@@ -413,7 +415,7 @@ static INLINE int32 FDSDoSound(void) {
} }
if (fdso.count >= 32768) goto dogk; if (fdso.count >= 32768) goto dogk;
// Might need to emulate applying the amplitude to the waveform a bit better... /* Might need to emulate applying the amplitude to the waveform a bit better... */
{ {
int k = amplitude[0]; int k = amplitude[0];
if (k > 0x20) k = 0x20; if (k > 0x20) k = 0x20;
@@ -438,7 +440,7 @@ static void RenderSound(void) {
uint32 t = FDSDoSound(); uint32 t = FDSDoSound();
t += t >> 1; t += t >> 1;
t >>= 4; t >>= 4;
Wave[x >> 4] += t; //(t>>2)-(t>>3); //>>3; Wave[x >> 4] += t; /* (t>>2)-(t>>3); */ /* >>3; */
} }
} }
@@ -449,7 +451,7 @@ static void RenderSoundHQ(void) {
for (x = FBC; x < SOUNDTS; x++) { for (x = FBC; x < SOUNDTS; x++) {
uint32 t = FDSDoSound(); uint32 t = FDSDoSound();
t += t >> 1; t += t >> 1;
WaveHi[x] += t; //(t<<2)-(t<<1); WaveHi[x] += t; /* (t<<2)-(t<<1); */
} }
FBC = SOUNDTS; FBC = SOUNDTS;
} }

View File

@@ -13,9 +13,9 @@ typedef struct {
#ifdef __LIBRETRO__ #ifdef __LIBRETRO__
MEMWRAP *fp; MEMWRAP *fp;
#else #else
void *fp; // FILE* or ptr to ZIPWRAP void *fp; /* FILE* or ptr to ZIPWRAP */
#endif #endif
uint32 type; // 0=normal file, 1=gzip, 2=zip uint32 type; /* 0=normal file, 1=gzip, 2=zip */
} FCEUFILE; } FCEUFILE;
#ifdef __LIBRETRO__ #ifdef __LIBRETRO__

View File

@@ -22,7 +22,7 @@ void SexyFilter2(int32 *in, int32 count) {
p = ((double)2 - cos(x)) - sqrt(pow((double)2 - cos(x), 2) - 1); p = ((double)2 - cos(x)) - sqrt(pow((double)2 - cos(x), 2) - 1);
c = p * 0x100000; c = p * 0x100000;
//printf("%f\n",(double)c/0x100000); /* printf("%f\n",(double)c/0x100000); */
#endif #endif
static int64 acc = 0; static int64 acc = 0;
@@ -33,9 +33,11 @@ void SexyFilter2(int32 *in, int32 count) {
acc += dropcurrent; acc += dropcurrent;
*in = acc >> 16; *in = acc >> 16;
in++; in++;
//acc=((int64)0x100000-c)* *in + ((c*acc)>>20); #if 0
//*in=acc>>20; acc=((int64)0x100000-c)* *in + ((c*acc)>>20);
//in++; *in=acc>>20;
in++;
#endif
} }
} }
@@ -56,11 +58,11 @@ void SexyFilter(int32 *in, int32 *out, int32 count) {
int64 ino = (int64) * in * vmul; int64 ino = (int64) * in * vmul;
acc1 += ((ino - acc1) * mul1) >> 16; acc1 += ((ino - acc1) * mul1) >> 16;
acc2 += ((ino - acc1 - acc2) * mul2) >> 16; acc2 += ((ino - acc1 - acc2) * mul2) >> 16;
//printf("%d ",*in); /* printf("%d ",*in); */
*in = 0; *in = 0;
{ {
int32 t = (acc1 - ino + acc2) >> 16; int32 t = (acc1 - ino + acc2) >> 16;
//if(t>32767 || t<-32768) printf("Flow: %d\n",t); /* if(t>32767 || t<-32768) printf("Flow: %d\n",t); */
if (t > 32767) t = 32767; if (t > 32767) t = 32767;
if (t < -32768) t = -32768; if (t < -32768) t = -32768;
*out = t; *out = t;
@@ -76,7 +78,7 @@ void SexyFilter(int32 *in, int32 *out, int32 count) {
from the end of in to the beginning of in. from the end of in to the beginning of in.
*/ */
//static uint32 mva=1000; /* static uint32 mva=1000; */
/* This filtering code assumes that almost all input values stay below 32767. /* This filtering code assumes that almost all input values stay below 32767.
Do not adjust the volume in the wlookup tables and the expansion sound Do not adjust the volume in the wlookup tables and the expansion sound
@@ -89,10 +91,12 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover) {
int32 *outsave = out; int32 *outsave = out;
int32 count = 0; int32 count = 0;
// for(x=0;x<inlen;x++) #if 0
// { for(x=0;x<inlen;x++)
// if(in[x]>mva) { mva=in[x]; printf("%ld\n",in[x]);} {
// } if(in[x]>mva) { mva=in[x]; printf("%ld\n",in[x]);}
}
#endif
max = (inlen - 1) << 16; max = (inlen - 1) << 16;
if (FSettings.soundq == 2) if (FSettings.soundq == 2)

View File

@@ -60,7 +60,7 @@ void FCEUI_SetSaveDirectory(char *sav_dir)
SaveDirectory[2047] = 0; SaveDirectory[2047] = 0;
} }
static char *odirs[FCEUIOD__COUNT] = { 0, 0, 0, 0, 0, 0 }; // odirs, odors. ^_^ static char *odirs[FCEUIOD__COUNT] = { 0, 0, 0, 0, 0, 0 }; /* odirs, odors. ^_^ */
void FCEUI_SetDirOverride(int which, char *n) void FCEUI_SetDirOverride(int which, char *n)
{ {

View File

@@ -129,73 +129,73 @@ struct INPSEL {
static void SetInput(void) { static void SetInput(void) {
static struct INPSEL moo[] = static struct INPSEL moo[] =
{ {
{0x19b0a9f1, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // 6-in-1 (MGC-023)(Unl)[!] {0x19b0a9f1, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, /* 6-in-1 (MGC-023)(Unl)[!] */
{0x29de87af, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Aerobics Studio {0x29de87af, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Aerobics Studio */
{0xd89e5a67, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid (J) {0xd89e5a67, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, /* Arkanoid (J) */
{0x0f141525, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid 2(J) {0x0f141525, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, /* Arkanoid 2(J) */
{0x32fb0583, SI_UNSET, SI_ARKANOID, SIFC_NONE }, // Arkanoid(NES) {0x32fb0583, SI_UNSET, SI_ARKANOID, SIFC_NONE }, /* Arkanoid(NES) */
{0x60ad090a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Athletic World {0x60ad090a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, /* Athletic World */
{0x48ca0ee1, SI_GAMEPAD, SI_GAMEPAD, SIFC_BWORLD }, // Barcode World {0x48ca0ee1, SI_GAMEPAD, SI_GAMEPAD, SIFC_BWORLD }, /* Barcode World */
{0x4318a2f8, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Barker Bill's Trick Shooting {0x4318a2f8, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Barker Bill's Trick Shooting */
{0x6cca1c1f, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Dai Undoukai {0x6cca1c1f, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Dai Undoukai */
{0x24598791, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Duck Hunt {0x24598791, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Duck Hunt */
{0xd5d6eac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Edu (As) {0xd5d6eac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* Edu (As) */
{0xe9a7fe9e, SI_UNSET, SI_MOUSE, SIFC_NONE }, // Educational Computer 2000 {0xe9a7fe9e, SI_UNSET, SI_MOUSE, SIFC_NONE }, /* Educational Computer 2000 */
{0x8f7b1669, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // FP BASIC 3.3 by maxzhou88 {0x8f7b1669, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* FP BASIC 3.3 by maxzhou88 */
{0xf7606810, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 2.0A {0xf7606810, SI_UNSET, SI_UNSET, SIFC_FKB }, /* Family BASIC 2.0A */
{0x895037bc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 2.1a {0x895037bc, SI_UNSET, SI_UNSET, SIFC_FKB }, /* Family BASIC 2.1a */
{0xb2530afc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 3.0 {0xb2530afc, SI_UNSET, SI_UNSET, SIFC_FKB }, /* Family BASIC 3.0 */
{0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Family Trainer: Running Stadium {0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Family Trainer: Running Stadium */
{0xbba58be5, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Family Trainer: Manhattan Police {0xbba58be5, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Family Trainer: Manhattan Police */
{0x3e58a87e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Freedom Force {0x3e58a87e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Freedom Force */
{0xd9f45be9, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, // Gimme a Break ... {0xd9f45be9, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, /* Gimme a Break ... */
{0x1545bd13, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, // Gimme a Break ... 2 {0x1545bd13, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, /* Gimme a Break ... 2 */
{0x4e959173, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Gotcha! - The Sport! {0x4e959173, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Gotcha! - The Sport! */
{0xbeb8ab01, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Gumshoe {0xbeb8ab01, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Gumshoe */
{0xff24d794, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Hogan's Alley {0xff24d794, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Hogan's Alley */
{0x21f85681, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Olympic (Gentei Ban) {0x21f85681, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, /* Hyper Olympic (Gentei Ban) */
{0x980be936, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Olympic {0x980be936, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, /* Hyper Olympic */
{0x915a53a7, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Sports {0x915a53a7, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, /* Hyper Sports */
{0x9fae4d46, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, // Ide Yousuke Meijin no Jissen Mahjong {0x9fae4d46, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, /* Ide Yousuke Meijin no Jissen Mahjong */
{0x7b44fb2a, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, // Ide Yousuke Meijin no Jissen Mahjong 2 {0x7b44fb2a, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, /* Ide Yousuke Meijin no Jissen Mahjong 2 */
{0x2f128512, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Jogging Race {0x2f128512, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, /* Jogging Race */
{0xbb33196f, SI_UNSET, SI_UNSET, SIFC_FKB }, // Keyboard Transformer {0xbb33196f, SI_UNSET, SI_UNSET, SIFC_FKB }, /* Keyboard Transformer */
{0x8587ee00, SI_UNSET, SI_UNSET, SIFC_FKB }, // Keyboard Transformer {0x8587ee00, SI_UNSET, SI_UNSET, SIFC_FKB }, /* Keyboard Transformer */
{0x543ab532, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // LIKO Color Lines {0x543ab532, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* LIKO Color Lines */
{0x368c19a8, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // LIKO Study Cartridge {0x368c19a8, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* LIKO Study Cartridge */
{0x5ee6008e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Mechanized Attack {0x5ee6008e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Mechanized Attack */
{0x370ceb65, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Meiro Dai Sakusen {0x370ceb65, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Meiro Dai Sakusen */
{0x3a1694f9, SI_GAMEPAD, SI_GAMEPAD, SIFC_4PLAYER }, // Nekketsu Kakutou Densetsu {0x3a1694f9, SI_GAMEPAD, SI_GAMEPAD, SIFC_4PLAYER }, /* Nekketsu Kakutou Densetsu */
{0x9d048ea4, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, // Oeka Kids {0x9d048ea4, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, /* Oeka Kids */
{0x2a6559a1, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Operation Wolf (J) {0x2a6559a1, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Operation Wolf (J) */
{0xedc3662b, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Operation Wolf {0xedc3662b, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Operation Wolf */
{0x912989dc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Playbox BASIC {0x912989dc, SI_UNSET, SI_UNSET, SIFC_FKB }, /* Playbox BASIC */
{0x9044550e, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Rairai Kyonshizu {0x9044550e, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, /* Rairai Kyonshizu */
{0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Running Stadium {0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Running Stadium */
{0x851eb9be, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // Shooting Range {0x851eb9be, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, /* Shooting Range */
{0x6435c095, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Short Order/Eggsplode {0x6435c095, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, /* Short Order/Eggsplode */
{0xc043a8df, SI_UNSET, SI_MOUSE, SIFC_NONE }, // Shu Qi Yu - Shu Xue Xiao Zhuan Yuan (Ch) {0xc043a8df, SI_UNSET, SI_MOUSE, SIFC_NONE }, /* Shu Qi Yu - Shu Xue Xiao Zhuan Yuan (Ch) */
{0x2cf5db05, SI_UNSET, SI_MOUSE, SIFC_NONE }, // Shu Qi Yu - Zhi Li Xiao Zhuan Yuan (Ch) {0x2cf5db05, SI_UNSET, SI_MOUSE, SIFC_NONE }, /* Shu Qi Yu - Zhi Li Xiao Zhuan Yuan (Ch) */
{0xad9c63e2, SI_GAMEPAD, SI_UNSET, SIFC_SHADOW }, // Space Shadow {0xad9c63e2, SI_GAMEPAD, SI_UNSET, SIFC_SHADOW }, /* Space Shadow */
{0x61d86167, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Street Cop {0x61d86167, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, /* Street Cop */
{0xabb2f974, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Study and Game 32-in-1 {0xabb2f974, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* Study and Game 32-in-1 */
{0x41ef9ac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor {0x41ef9ac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* Subor */
{0x8b265862, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor {0x8b265862, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* Subor */
{0x82f1fb96, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor 1.0 Russian {0x82f1fb96, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* Subor 1.0 Russian */
{0x9f8f200a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Super Mogura Tataki!! - Pokkun Moguraa {0x9f8f200a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, /* Super Mogura Tataki!! - Pokkun Moguraa */
{0xd74b2719, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Super Team Games {0xd74b2719, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, /* Super Team Games */
{0x74bea652, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // Supergun 3-in-1 {0x74bea652, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, /* Supergun 3-in-1 */
{0x5e073a1b, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Supor English (Chinese) {0x5e073a1b, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* Supor English (Chinese) */
{0x589b6b0d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // SuporV20 {0x589b6b0d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* SuporV20 */
{0x41401c6d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // SuporV40 {0x41401c6d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, /* SuporV40 */
{0x23d17f5e, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // The Lone Ranger {0x23d17f5e, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, /* The Lone Ranger */
{0xc3c0811d, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, // The two "Oeka Kids" games {0xc3c0811d, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, /* The two "Oeka Kids" games */
{0xde8fd935, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // To the Earth {0xde8fd935, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* To the Earth */
{0x47232739, SI_GAMEPAD, SI_GAMEPAD, SIFC_TOPRIDER }, // Top Rider {0x47232739, SI_GAMEPAD, SI_GAMEPAD, SIFC_TOPRIDER }, /* Top Rider */
{0x8a12a7d9, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Totsugeki Fuuun Takeshi Jou {0x8a12a7d9, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, /* Totsugeki Fuuun Takeshi Jou */
{0xb8b9aca3, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Wild Gunman {0xb8b9aca3, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Wild Gunman */
{0x5112dc21, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Wild Gunman {0x5112dc21, SI_UNSET, SI_ZAPPER, SIFC_NONE }, /* Wild Gunman */
{0xaf4010ea, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // World Class Track Meet {0xaf4010ea, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, /* World Class Track Meet */
{0x00000000, SI_UNSET, SI_UNSET, SIFC_UNSET } {0x00000000, SI_UNSET, SI_UNSET, SIFC_UNSET }
}; };
int x = 0; int x = 0;
@@ -397,7 +397,7 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"MMC5", 5, Mapper5_Init}, {(uint8_t*)"MMC5", 5, Mapper5_Init},
{(uint8_t*)"FFE Rev. A", 6, Mapper6_Init}, {(uint8_t*)"FFE Rev. A", 6, Mapper6_Init},
{(uint8_t*)"ANROM", 7, ANROM_Init}, {(uint8_t*)"ANROM", 7, ANROM_Init},
{(uint8_t*)"", 8, Mapper8_Init}, // Nogaems, it's worthless {(uint8_t*)"", 8, Mapper8_Init}, /* Nogaems, it's worthless */
{(uint8_t*)"MMC2", 9, Mapper9_Init}, {(uint8_t*)"MMC2", 9, Mapper9_Init},
{(uint8_t*)"MMC4", 10, Mapper10_Init}, {(uint8_t*)"MMC4", 10, Mapper10_Init},
{(uint8_t*)"Color Dreams", 11, Mapper11_Init}, {(uint8_t*)"Color Dreams", 11, Mapper11_Init},
@@ -407,28 +407,28 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"100-in-1", 15, Mapper15_Init}, {(uint8_t*)"100-in-1", 15, Mapper15_Init},
{(uint8_t*)"BANDAI 24C02", 16, Mapper16_Init}, {(uint8_t*)"BANDAI 24C02", 16, Mapper16_Init},
{(uint8_t*)"FFE Rev. B", 17, Mapper17_Init}, {(uint8_t*)"FFE Rev. B", 17, Mapper17_Init},
{(uint8_t*)"JALECO SS880006", 18, Mapper18_Init}, // JF-NNX (EB89018-30007) boards {(uint8_t*)"JALECO SS880006", 18, Mapper18_Init}, /* JF-NNX (EB89018-30007) boards */
{(uint8_t*)"Namcot 106", 19, Mapper19_Init}, {(uint8_t*)"Namcot 106", 19, Mapper19_Init},
// {(uint8_t*)"", 20, Mapper20_Init}, /* {(uint8_t*)"", 20, Mapper20_Init}, */
{(uint8_t*)"Konami VRC2/VRC4 A", 21, Mapper21_Init}, {(uint8_t*)"Konami VRC2/VRC4 A", 21, Mapper21_Init},
{(uint8_t*)"Konami VRC2/VRC4 B", 22, Mapper22_Init}, {(uint8_t*)"Konami VRC2/VRC4 B", 22, Mapper22_Init},
{(uint8_t*)"Konami VRC2/VRC4 C", 23, Mapper23_Init}, {(uint8_t*)"Konami VRC2/VRC4 C", 23, Mapper23_Init},
{(uint8_t*)"Konami VRC6 Rev. A", 24, Mapper24_Init}, {(uint8_t*)"Konami VRC6 Rev. A", 24, Mapper24_Init},
{(uint8_t*)"Konami VRC2/VRC4 D", 25, Mapper25_Init}, {(uint8_t*)"Konami VRC2/VRC4 D", 25, Mapper25_Init},
{(uint8_t*)"Konami VRC6 Rev. B", 26, Mapper26_Init}, {(uint8_t*)"Konami VRC6 Rev. B", 26, Mapper26_Init},
{(uint8_t*)"CC-21 MI HUN CHE", 27, UNLCC21_Init}, // Former dupe for VRC2/VRC4 mapper, redefined with crc to mihunche boards {(uint8_t*)"CC-21 MI HUN CHE", 27, UNLCC21_Init}, /* Former dupe for VRC2/VRC4 mapper, redefined with crc to mihunche boards */
// {(uint8_t*)"", 28, Mapper28_Init}, // Custom Multidiscrete mapper for PDs /* {(uint8_t*)"", 28, Mapper28_Init}, */ /* Custom Multidiscrete mapper for PDs */
// {(uint8_t*)"", 29, Mapper29_Init}, /* {(uint8_t*)"", 29, Mapper29_Init}, */
{(uint8_t*)"UNROM 512", 30, UNROM512_Init}, {(uint8_t*)"UNROM 512", 30, UNROM512_Init},
// {(uint8_t*)"", 31, Mapper31_Init}, /* {(uint8_t*)"", 31, Mapper31_Init}, */
{(uint8_t*)"IREM G-101", 32, Mapper32_Init}, {(uint8_t*)"IREM G-101", 32, Mapper32_Init},
{(uint8_t*)"TC0190FMC/TC0350FMR", 33, Mapper33_Init}, {(uint8_t*)"TC0190FMC/TC0350FMR", 33, Mapper33_Init},
{(uint8_t*)"IREM I-IM/BNROM", 34, Mapper34_Init}, {(uint8_t*)"IREM I-IM/BNROM", 34, Mapper34_Init},
{(uint8_t*)"Wario Land 2", 35, UNLSC127_Init}, {(uint8_t*)"Wario Land 2", 35, UNLSC127_Init},
{(uint8_t*)"TXC Policeman", 36, Mapper36_Init}, {(uint8_t*)"TXC Policeman", 36, Mapper36_Init},
{(uint8_t*)"PAL-ZZ SMB/TETRIS/NWC",37, Mapper37_Init}, {(uint8_t*)"PAL-ZZ SMB/TETRIS/NWC",37, Mapper37_Init},
{(uint8_t*)"Bit Corp.", 38, Mapper38_Init}, // Crime Busters {(uint8_t*)"Bit Corp.", 38, Mapper38_Init}, /* Crime Busters */
// {(uint8_t*)"", 39, Mapper39_Init}, /* {(uint8_t*)"", 39, Mapper39_Init}, */
{(uint8_t*)"SMB2j FDS", 40, Mapper40_Init}, {(uint8_t*)"SMB2j FDS", 40, Mapper40_Init},
{(uint8_t*)"CALTRON 6-in-1", 41, Mapper41_Init}, {(uint8_t*)"CALTRON 6-in-1", 41, Mapper41_Init},
{(uint8_t*)"BIO MIRACLE FDS", 42, Mapper42_Init}, {(uint8_t*)"BIO MIRACLE FDS", 42, Mapper42_Init},
@@ -440,19 +440,19 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"TAITO TCxxx", 48, Mapper48_Init}, {(uint8_t*)"TAITO TCxxx", 48, Mapper48_Init},
{(uint8_t*)"MMC3 BMC PIRATE C", 49, Mapper49_Init}, {(uint8_t*)"MMC3 BMC PIRATE C", 49, Mapper49_Init},
{(uint8_t*)"SMB2j FDS Rev. A", 50, Mapper50_Init}, {(uint8_t*)"SMB2j FDS Rev. A", 50, Mapper50_Init},
{(uint8_t*)"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version {(uint8_t*)"11-in-1 BALL SERIES", 51, Mapper51_Init}, /* 1993 year version */
{(uint8_t*)"MMC3 BMC PIRATE D", 52, Mapper52_Init}, {(uint8_t*)"MMC3 BMC PIRATE D", 52, Mapper52_Init},
{(uint8_t*)"SUPERVISION 16-in-1", 53, Supervision16_Init}, {(uint8_t*)"SUPERVISION 16-in-1", 53, Supervision16_Init},
// {(uint8_t*)"", 54, Mapper54_Init}, /* {(uint8_t*)"", 54, Mapper54_Init}, */
// {(uint8_t*)"", 55, Mapper55_Init}, /* {(uint8_t*)"", 55, Mapper55_Init}, */
// {(uint8_t*)"", 56, Mapper56_Init}, /* {(uint8_t*)"", 56, Mapper56_Init}, */
{(uint8_t*)"SIMBPLE BMC PIRATE A", 57, Mapper57_Init}, {(uint8_t*)"SIMBPLE BMC PIRATE A", 57, Mapper57_Init},
{(uint8_t*)"SIMBPLE BMC PIRATE B", 58, BMCGK192_Init}, {(uint8_t*)"SIMBPLE BMC PIRATE B", 58, BMCGK192_Init},
{(uint8_t*)"", 59, Mapper59_Init}, // Check this out {(uint8_t*)"", 59, Mapper59_Init}, /* Check this out */
{(uint8_t*)"SIMBPLE BMC PIRATE C", 60, BMCD1038_Init}, {(uint8_t*)"SIMBPLE BMC PIRATE C", 60, BMCD1038_Init},
{(uint8_t*)"20-in-1 KAISER Rev. A",61, Mapper61_Init}, {(uint8_t*)"20-in-1 KAISER Rev. A",61, Mapper61_Init},
{(uint8_t*)"700-in-1", 62, Mapper62_Init}, {(uint8_t*)"700-in-1", 62, Mapper62_Init},
// {(uint8_t*)"", 63, Mapper63_Init}, /* {(uint8_t*)"", 63, Mapper63_Init}, */
{(uint8_t*)"TENGEN RAMBO1", 64, Mapper64_Init}, {(uint8_t*)"TENGEN RAMBO1", 64, Mapper64_Init},
{(uint8_t*)"IREM-H3001", 65, Mapper65_Init}, {(uint8_t*)"IREM-H3001", 65, Mapper65_Init},
{(uint8_t*)"MHROM", 66, MHROM_Init}, {(uint8_t*)"MHROM", 66, MHROM_Init},
@@ -470,37 +470,37 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"Irem 74HC161/32", 78, Mapper78_Init}, {(uint8_t*)"Irem 74HC161/32", 78, Mapper78_Init},
{(uint8_t*)"AVE/C&E/TXC BOARD", 79, Mapper79_Init}, {(uint8_t*)"AVE/C&E/TXC BOARD", 79, Mapper79_Init},
{(uint8_t*)"TAITO X1-005 Rev. A", 80, Mapper80_Init}, {(uint8_t*)"TAITO X1-005 Rev. A", 80, Mapper80_Init},
// {(uint8_t*)"", 81, Mapper81_Init}, /* {(uint8_t*)"", 81, Mapper81_Init}, */
{(uint8_t*)"TAITO X1-017", 82, Mapper82_Init}, {(uint8_t*)"TAITO X1-017", 82, Mapper82_Init},
{(uint8_t*)"YOKO VRC Rev. B", 83, Mapper83_Init}, {(uint8_t*)"YOKO VRC Rev. B", 83, Mapper83_Init},
// {(uint8_t*)"", 84, Mapper84_Init}, /* {(uint8_t*)"", 84, Mapper84_Init}, */
{(uint8_t*)"KONAMI VRC7", 85, Mapper85_Init}, {(uint8_t*)"KONAMI VRC7", 85, Mapper85_Init},
{(uint8_t*)"JALECO JF-13", 86, Mapper86_Init}, {(uint8_t*)"JALECO JF-13", 86, Mapper86_Init},
{(uint8_t*)"74*139/74 DISCRETE", 87, Mapper87_Init}, {(uint8_t*)"74*139/74 DISCRETE", 87, Mapper87_Init},
{(uint8_t*)"NAMCO 3433", 88, Mapper88_Init}, {(uint8_t*)"NAMCO 3433", 88, Mapper88_Init},
{(uint8_t*)"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper {(uint8_t*)"SUNSOFT-3", 89, Mapper89_Init}, /* SUNSOFT-2 mapper */
{(uint8_t*)"HUMMER/JY BOARD", 90, Mapper90_Init}, {(uint8_t*)"HUMMER/JY BOARD", 90, Mapper90_Init},
{(uint8_t*)"EARLY HUMMER/JY BOARD",91, Mapper91_Init}, {(uint8_t*)"EARLY HUMMER/JY BOARD",91, Mapper91_Init},
{(uint8_t*)"JALECO JF-19", 92, Mapper92_Init}, {(uint8_t*)"JALECO JF-19", 92, Mapper92_Init},
{(uint8_t*)"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init},// SUNSOFT-2 mapper with VRAM, different wiring {(uint8_t*)"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init},/* SUNSOFT-2 mapper with VRAM, different wiring */
{(uint8_t*)"HVC-UN1ROM", 94, Mapper94_Init}, {(uint8_t*)"HVC-UN1ROM", 94, Mapper94_Init},
{(uint8_t*)"NAMCOT 108 Rev. B", 95, Mapper95_Init}, {(uint8_t*)"NAMCOT 108 Rev. B", 95, Mapper95_Init},
{(uint8_t*)"BANDAI OEKAKIDS", 96, Mapper96_Init}, {(uint8_t*)"BANDAI OEKAKIDS", 96, Mapper96_Init},
{(uint8_t*)"IREM TAM-S1", 97, Mapper97_Init}, {(uint8_t*)"IREM TAM-S1", 97, Mapper97_Init},
// {(uint8_t*)"", 98, Mapper98_Init}, /* {(uint8_t*)"", 98, Mapper98_Init}, */
{(uint8_t*)"VS Uni/Dual- system", 99, Mapper99_Init}, {(uint8_t*)"VS Uni/Dual- system", 99, Mapper99_Init},
// {(uint8_t*)"", 100, Mapper100_Init}, /* {(uint8_t*)"", 100, Mapper100_Init}, */
{(uint8_t*)"", 101, Mapper101_Init}, {(uint8_t*)"", 101, Mapper101_Init},
// {(uint8_t*)"", 102, Mapper102_Init}, /* {(uint8_t*)"", 102, Mapper102_Init}, */
{(uint8_t*)"FDS DOKIDOKI FULL", 103, Mapper103_Init}, {(uint8_t*)"FDS DOKIDOKI FULL", 103, Mapper103_Init},
{(uint8_t*)"CAMERICA GOLDENFIVE", 104, Mapper104_Init}, {(uint8_t*)"CAMERICA GOLDENFIVE", 104, Mapper104_Init},
{(uint8_t*)"NES-EVENT NWC1990", 105, Mapper105_Init}, {(uint8_t*)"NES-EVENT NWC1990", 105, Mapper105_Init},
{(uint8_t*)"SMB3 PIRATE A", 106, Mapper106_Init}, {(uint8_t*)"SMB3 PIRATE A", 106, Mapper106_Init},
{(uint8_t*)"MAGIC CORP A", 107, Mapper107_Init}, {(uint8_t*)"MAGIC CORP A", 107, Mapper107_Init},
{(uint8_t*)"FDS UNROM BOARD", 108, Mapper108_Init}, {(uint8_t*)"FDS UNROM BOARD", 108, Mapper108_Init},
// {(uint8_t*)"", 109, Mapper109_Init}, /* {(uint8_t*)"", 109, Mapper109_Init}, */
// {(uint8_t*)"", 110, Mapper110_Init}, /* {(uint8_t*)"", 110, Mapper110_Init}, */
// {(uint8_t*)"", 111, Mapper111_Init}, /* {(uint8_t*)"", 111, Mapper111_Init}, */
{(uint8_t*)"ASDER/NTDEC BOARD", 112, Mapper112_Init}, {(uint8_t*)"ASDER/NTDEC BOARD", 112, Mapper112_Init},
{(uint8_t*)"HACKER/SACHEN BOARD", 113, Mapper113_Init}, {(uint8_t*)"HACKER/SACHEN BOARD", 113, Mapper113_Init},
{(uint8_t*)"MMC3 SG PROT. A", 114, Mapper114_Init}, {(uint8_t*)"MMC3 SG PROT. A", 114, Mapper114_Init},
@@ -511,20 +511,20 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"NES-TQROM", 119, Mapper119_Init}, {(uint8_t*)"NES-TQROM", 119, Mapper119_Init},
{(uint8_t*)"FDS TOBIDASE", 120, Mapper120_Init}, {(uint8_t*)"FDS TOBIDASE", 120, Mapper120_Init},
{(uint8_t*)"MMC3 PIRATE PROT. A", 121, Mapper121_Init}, {(uint8_t*)"MMC3 PIRATE PROT. A", 121, Mapper121_Init},
// {(uint8_t*)"", 122, Mapper122_Init}, /* {(uint8_t*)"", 122, Mapper122_Init}, */
{(uint8_t*)"MMC3 PIRATE H2288", 123, UNLH2288_Init}, {(uint8_t*)"MMC3 PIRATE H2288", 123, UNLH2288_Init},
// {(uint8_t*)"", 124, Mapper124_Init}, /* {(uint8_t*)"", 124, Mapper124_Init}, */
{(uint8_t*)"FDS LH32", 125, LH32_Init}, {(uint8_t*)"FDS LH32", 125, LH32_Init},
// {(uint8_t*)"", 126, Mapper126_Init}, /* {(uint8_t*)"", 126, Mapper126_Init}, */
// {(uint8_t*)"", 127, Mapper127_Init}, /* {(uint8_t*)"", 127, Mapper127_Init}, */
// {(uint8_t*)"", 128, Mapper128_Init}, /* {(uint8_t*)"", 128, Mapper128_Init}, */
// {(uint8_t*)"", 129, Mapper129_Init}, /* {(uint8_t*)"", 129, Mapper129_Init}, */
// {(uint8_t*)"", 130, Mapper130_Init}, /* {(uint8_t*)"", 130, Mapper130_Init}, */
// {(uint8_t*)"", 131, Mapper131_Init}, /* {(uint8_t*)"", 131, Mapper131_Init}, */
{(uint8_t*)"TXC/MGENIUS 22111", 132, UNL22211_Init}, {(uint8_t*)"TXC/MGENIUS 22111", 132, UNL22211_Init},
{(uint8_t*)"SA72008", 133, SA72008_Init}, {(uint8_t*)"SA72008", 133, SA72008_Init},
{(uint8_t*)"MMC3 BMC PIRATE", 134, Mapper134_Init}, {(uint8_t*)"MMC3 BMC PIRATE", 134, Mapper134_Init},
// {(uint8_t*)"", 135, Mapper135_Init}, /* {(uint8_t*)"", 135, Mapper135_Init}, */
{(uint8_t*)"TCU02", 136, TCU02_Init}, {(uint8_t*)"TCU02", 136, TCU02_Init},
{(uint8_t*)"S8259D", 137, S8259D_Init}, {(uint8_t*)"S8259D", 137, S8259D_Init},
{(uint8_t*)"S8259B", 138, S8259B_Init}, {(uint8_t*)"S8259B", 138, S8259B_Init},
@@ -542,15 +542,15 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"S74LS374N", 150, S74LS374N_Init}, {(uint8_t*)"S74LS374N", 150, S74LS374N_Init},
{(uint8_t*)"", 151, Mapper151_Init}, {(uint8_t*)"", 151, Mapper151_Init},
{(uint8_t*)"", 152, Mapper152_Init}, {(uint8_t*)"", 152, Mapper152_Init},
{(uint8_t*)"BANDAI SRAM", 153, Mapper153_Init}, // Bandai board 16 with SRAM instead of EEPROM {(uint8_t*)"BANDAI SRAM", 153, Mapper153_Init}, /* Bandai board 16 with SRAM instead of EEPROM */
{(uint8_t*)"", 154, Mapper154_Init}, {(uint8_t*)"", 154, Mapper154_Init},
{(uint8_t*)"", 155, Mapper155_Init}, {(uint8_t*)"", 155, Mapper155_Init},
{(uint8_t*)"", 156, Mapper156_Init}, {(uint8_t*)"", 156, Mapper156_Init},
{(uint8_t*)"BANDAI BARCODE", 157, Mapper157_Init}, {(uint8_t*)"BANDAI BARCODE", 157, Mapper157_Init},
{(uint8_t*)"TENGEN 800037", 158, Mapper158_Init}, {(uint8_t*)"TENGEN 800037", 158, Mapper158_Init},
{(uint8_t*)"BANDAI 24C01", 159, Mapper159_Init}, // Different type of EEPROM on the bandai board {(uint8_t*)"BANDAI 24C01", 159, Mapper159_Init}, /* Different type of EEPROM on the bandai board */
{(uint8_t*)"SA009", 160, SA009_Init}, {(uint8_t*)"SA009", 160, SA009_Init},
// {(uint8_t*)"", 161, Mapper161_Init}, /* {(uint8_t*)"", 161, Mapper161_Init}, */
{(uint8_t*)"", 162, UNLFS304_Init}, {(uint8_t*)"", 162, UNLFS304_Init},
{(uint8_t*)"", 163, Mapper163_Init}, {(uint8_t*)"", 163, Mapper163_Init},
{(uint8_t*)"", 164, Mapper164_Init}, {(uint8_t*)"", 164, Mapper164_Init},
@@ -558,20 +558,20 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"SUBOR Rev. A", 166, Mapper166_Init}, {(uint8_t*)"SUBOR Rev. A", 166, Mapper166_Init},
{(uint8_t*)"SUBOR Rev. B", 167, Mapper167_Init}, {(uint8_t*)"SUBOR Rev. B", 167, Mapper167_Init},
{(uint8_t*)"", 168, Mapper168_Init}, {(uint8_t*)"", 168, Mapper168_Init},
// {(uint8_t*)"", 169, Mapper169_Init}, /* {(uint8_t*)"", 169, Mapper169_Init}, */
{(uint8_t*)"", 170, Mapper170_Init}, {(uint8_t*)"", 170, Mapper170_Init},
{(uint8_t*)"", 171, Mapper171_Init}, {(uint8_t*)"", 171, Mapper171_Init},
{(uint8_t*)"", 172, Mapper172_Init}, {(uint8_t*)"", 172, Mapper172_Init},
{(uint8_t*)"", 173, Mapper173_Init}, {(uint8_t*)"", 173, Mapper173_Init},
// {(uint8_t*)"", 174, Mapper174_Init}, /* {(uint8_t*)"", 174, Mapper174_Init}, */
{(uint8_t*)"", 175, Mapper175_Init}, {(uint8_t*)"", 175, Mapper175_Init},
{(uint8_t*)"BMCFK23C", 176, BMCFK23C_Init}, // zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance ????. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it. {(uint8_t*)"BMCFK23C", 176, BMCFK23C_Init}, /* zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance ????. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it. */
{(uint8_t*)"", 177, Mapper177_Init}, {(uint8_t*)"", 177, Mapper177_Init},
{(uint8_t*)"", 178, Mapper178_Init}, {(uint8_t*)"", 178, Mapper178_Init},
// {(uint8_t*)"", 179, Mapper179_Init}, /* {(uint8_t*)"", 179, Mapper179_Init}, */
{(uint8_t*)"", 180, Mapper180_Init}, {(uint8_t*)"", 180, Mapper180_Init},
{(uint8_t*)"", 181, Mapper181_Init}, {(uint8_t*)"", 181, Mapper181_Init},
// {(uint8_t*)"", 182, Mapper182_Init}, // Deprecated, dupe /* {(uint8_t*)"", 182, Mapper182_Init}, */ /* Deprecated, dupe */
{(uint8_t*)"", 183, Mapper183_Init}, {(uint8_t*)"", 183, Mapper183_Init},
{(uint8_t*)"", 184, Mapper184_Init}, {(uint8_t*)"", 184, Mapper184_Init},
{(uint8_t*)"", 185, Mapper185_Init}, {(uint8_t*)"", 185, Mapper185_Init},
@@ -582,7 +582,7 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"", 190, Mapper190_Init}, {(uint8_t*)"", 190, Mapper190_Init},
{(uint8_t*)"", 191, Mapper191_Init}, {(uint8_t*)"", 191, Mapper191_Init},
{(uint8_t*)"TW MMC3+VRAM Rev. B", 192, Mapper192_Init}, {(uint8_t*)"TW MMC3+VRAM Rev. B", 192, Mapper192_Init},
{(uint8_t*)"NTDEC TC-112", 193, Mapper193_Init}, // War in the Gulf {(uint8_t*)"NTDEC TC-112", 193, Mapper193_Init}, /* War in the Gulf */
{(uint8_t*)"TW MMC3+VRAM Rev. C", 194, Mapper194_Init}, {(uint8_t*)"TW MMC3+VRAM Rev. C", 194, Mapper194_Init},
{(uint8_t*)"TW MMC3+VRAM Rev. D", 195, Mapper195_Init}, {(uint8_t*)"TW MMC3+VRAM Rev. D", 195, Mapper195_Init},
{(uint8_t*)"", 196, Mapper196_Init}, {(uint8_t*)"", 196, Mapper196_Init},
@@ -595,7 +595,7 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"", 203, Mapper203_Init}, {(uint8_t*)"", 203, Mapper203_Init},
{(uint8_t*)"", 204, Mapper204_Init}, {(uint8_t*)"", 204, Mapper204_Init},
{(uint8_t*)"", 205, Mapper205_Init}, {(uint8_t*)"", 205, Mapper205_Init},
{(uint8_t*)"NAMCOT 108 Rev. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3 {(uint8_t*)"NAMCOT 108 Rev. C", 206, Mapper206_Init}, /* Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3 */
{(uint8_t*)"TAITO X1-005 Rev. B", 207, Mapper207_Init}, {(uint8_t*)"TAITO X1-005 Rev. B", 207, Mapper207_Init},
{(uint8_t*)"", 208, Mapper208_Init}, {(uint8_t*)"", 208, Mapper208_Init},
{(uint8_t*)"HUMMER/JY BOARD", 209, Mapper209_Init}, {(uint8_t*)"HUMMER/JY BOARD", 209, Mapper209_Init},
@@ -606,14 +606,14 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"", 214, Mapper214_Init}, {(uint8_t*)"", 214, Mapper214_Init},
{(uint8_t*)"", 215, UNL8237_Init}, {(uint8_t*)"", 215, UNL8237_Init},
{(uint8_t*)"", 216, Mapper216_Init}, {(uint8_t*)"", 216, Mapper216_Init},
{(uint8_t*)"", 217, Mapper217_Init}, // Redefined to a new Discrete BMC mapper {(uint8_t*)"", 217, Mapper217_Init}, /* Redefined to a new Discrete BMC mapper */
// {(uint8_t*)"", 218, Mapper218_Init}, /* {(uint8_t*)"", 218, Mapper218_Init}, */
{(uint8_t*)"UNLA9746", 219, UNLA9746_Init}, {(uint8_t*)"UNLA9746", 219, UNLA9746_Init},
{(uint8_t*)"Debug Mapper", 220, UNLKS7057_Init}, {(uint8_t*)"Debug Mapper", 220, UNLKS7057_Init},
{(uint8_t*)"UNLN625092", 221, UNLN625092_Init}, {(uint8_t*)"UNLN625092", 221, UNLN625092_Init},
{(uint8_t*)"", 222, Mapper222_Init}, {(uint8_t*)"", 222, Mapper222_Init},
// {(uint8_t*)"", 223, Mapper223_Init}, /* {(uint8_t*)"", 223, Mapper223_Init}, */
// {(uint8_t*)"", 224, Mapper224_Init}, /* {(uint8_t*)"", 224, Mapper224_Init}, */
{(uint8_t*)"", 225, Mapper225_Init}, {(uint8_t*)"", 225, Mapper225_Init},
{(uint8_t*)"BMC 22+20-in-1", 226, Mapper226_Init}, {(uint8_t*)"BMC 22+20-in-1", 226, Mapper226_Init},
{(uint8_t*)"", 227, Mapper227_Init}, {(uint8_t*)"", 227, Mapper227_Init},
@@ -625,10 +625,10 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"BMC 22+20-in-1 RST", 233, Mapper233_Init}, {(uint8_t*)"BMC 22+20-in-1 RST", 233, Mapper233_Init},
{(uint8_t*)"BMC MAXI", 234, Mapper234_Init}, {(uint8_t*)"BMC MAXI", 234, Mapper234_Init},
{(uint8_t*)"", 235, Mapper235_Init}, {(uint8_t*)"", 235, Mapper235_Init},
// {(uint8_t*)"", 236, Mapper236_Init}, /* {(uint8_t*)"", 236, Mapper236_Init}, */
// {(uint8_t*)"", 237, Mapper237_Init}, /* {(uint8_t*)"", 237, Mapper237_Init}, */
{(uint8_t*)"UNL6035052", 238, UNL6035052_Init}, {(uint8_t*)"UNL6035052", 238, UNL6035052_Init},
// {(uint8_t*)"", 239, Mapper239_Init}, /* {(uint8_t*)"", 239, Mapper239_Init}, */
{(uint8_t*)"", 240, Mapper240_Init}, {(uint8_t*)"", 240, Mapper240_Init},
{(uint8_t*)"", 241, Mapper241_Init}, {(uint8_t*)"", 241, Mapper241_Init},
{(uint8_t*)"", 242, Mapper242_Init}, {(uint8_t*)"", 242, Mapper242_Init},
@@ -636,15 +636,15 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"DECATHLON", 244, Mapper244_Init}, {(uint8_t*)"DECATHLON", 244, Mapper244_Init},
{(uint8_t*)"", 245, Mapper245_Init}, {(uint8_t*)"", 245, Mapper245_Init},
{(uint8_t*)"FONG SHEN BANG", 246, Mapper246_Init}, {(uint8_t*)"FONG SHEN BANG", 246, Mapper246_Init},
// {(uint8_t*)"", 247, Mapper247_Init}, /* {(uint8_t*)"", 247, Mapper247_Init}, */
// {(uint8_t*)"", 248, Mapper248_Init}, /* {(uint8_t*)"", 248, Mapper248_Init}, */
{(uint8_t*)"", 249, Mapper249_Init}, {(uint8_t*)"", 249, Mapper249_Init},
{(uint8_t*)"", 250, Mapper250_Init}, {(uint8_t*)"", 250, Mapper250_Init},
// {(uint8_t*)"", 251, Mapper251_Init}, // No good dumps for this mapper, use UNIF version /* {(uint8_t*)"", 251, Mapper251_Init}, */ /* No good dumps for this mapper, use UNIF version */
{(uint8_t*)"SAN GUO ZHI PIRATE", 252, Mapper252_Init}, {(uint8_t*)"SAN GUO ZHI PIRATE", 252, Mapper252_Init},
{(uint8_t*)"DRAGON BALL PIRATE", 253, Mapper253_Init}, {(uint8_t*)"DRAGON BALL PIRATE", 253, Mapper253_Init},
{(uint8_t*)"", 254, Mapper254_Init}, {(uint8_t*)"", 254, Mapper254_Init},
// {(uint8_t*)"", 255, Mapper255_Init}, // No good dumps for this mapper /* {(uint8_t*)"", 255, Mapper255_Init}, */ /* No good dumps for this mapper */
{(uint8_t*)"", 0, NULL} {(uint8_t*)"", 0, NULL}
}; };
@@ -774,7 +774,7 @@ int iNESLoad(const char *name, FCEUFILE *fp) {
FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring); FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring);
} }
/* Must remain here because above functions might change value of /* Must remain here because above functions might change value of
VROM_size and free(VROM). * VROM_size and free(VROM).
*/ */
if (VROM_size) if (VROM_size)
SetupCartCHRMapping(0, VROM, VROM_size * 0x2000, 0); SetupCartCHRMapping(0, VROM, VROM_size * 0x2000, 0);
@@ -825,9 +825,9 @@ static int iNES_Init(int num) {
while (tmp->init) { while (tmp->init) {
if (num == tmp->number) { if (num == tmp->number) {
UNIFchrrama = 0; // need here for compatibility with UNIF mapper code UNIFchrrama = 0; /* need here for compatibility with UNIF mapper code */
if (!VROM_size) { if (!VROM_size) {
switch (num) { // FIXME, mapper or game data base with the board parameters and ROM/RAM sizes switch (num) { /* FIXME, mapper or game data base with the board parameters and ROM/RAM sizes */
case 13: CHRRAMSize = 16 * 1024; break; case 13: CHRRAMSize = 16 * 1024; break;
case 6: case 6:
case 30: case 30:

View File

@@ -57,7 +57,7 @@ void Mapper23_Init(CartInfo *);
void Mapper24_Init(CartInfo *); void Mapper24_Init(CartInfo *);
void Mapper25_Init(CartInfo *); void Mapper25_Init(CartInfo *);
void Mapper26_Init(CartInfo *); void Mapper26_Init(CartInfo *);
void UNROM512_Init(CartInfo *); // Mapper #30 void UNROM512_Init(CartInfo *); /* Mapper #30 */
void Mapper32_Init(CartInfo *); void Mapper32_Init(CartInfo *);
void Mapper33_Init(CartInfo *); void Mapper33_Init(CartInfo *);
void Mapper34_Init(CartInfo *); void Mapper34_Init(CartInfo *);

View File

@@ -104,17 +104,17 @@ void NSFGI(int h) {
free(ExWRAM); ExWRAM = 0; free(ExWRAM); ExWRAM = 0;
} }
if (NSFHeader.SoundChip & 1) { if (NSFHeader.SoundChip & 1) {
// NSFVRC6_Init(); /* NSFVRC6_Init(); */
} else if (NSFHeader.SoundChip & 2) { } else if (NSFHeader.SoundChip & 2) {
// NSFVRC7_Init(); /* NSFVRC7_Init(); */
} else if (NSFHeader.SoundChip & 4) { } else if (NSFHeader.SoundChip & 4) {
// FDSSoundReset(); /* FDSSoundReset(); */
} else if (NSFHeader.SoundChip & 8) { } else if (NSFHeader.SoundChip & 8) {
NSFMMC5_Close(); NSFMMC5_Close();
} else if (NSFHeader.SoundChip & 0x10) { } else if (NSFHeader.SoundChip & 0x10) {
// NSFN106_Init(); /* NSFN106_Init(); */
} else if (NSFHeader.SoundChip & 0x20) { } else if (NSFHeader.SoundChip & 0x20) {
// NSFAY_Init(); /* NSFAY_Init(); */
} }
break; break;
case GI_RESETM2: case GI_RESETM2:
@@ -122,7 +122,7 @@ void NSFGI(int h) {
} }
} }
// First 32KB is reserved for sound chip emulation in the iNES mapper code. /* First 32KB is reserved for sound chip emulation in the iNES mapper code. */
static INLINE void BANKSET(uint32 A, uint32 bank) { static INLINE void BANKSET(uint32 A, uint32 bank) {
bank &= NSFMaxBank; bank &= NSFMaxBank;

View File

@@ -22,7 +22,7 @@
#define _FCEU_NSF_H #define _FCEU_NSF_H
typedef struct { typedef struct {
char ID[5]; // NESM^Z char ID[5]; /* NESM^Z */
uint8 Version; uint8 Version;
uint8 TotalSongs; uint8 TotalSongs;
uint8 StartingSong; uint8 StartingSong;
@@ -35,9 +35,9 @@ typedef struct {
uint8 SongName[32]; uint8 SongName[32];
uint8 Artist[32]; uint8 Artist[32];
uint8 Copyright[32]; uint8 Copyright[32];
uint8 NTSCspeed[2]; // Unused uint8 NTSCspeed[2]; /* Unused */
uint8 BankSwitch[8]; uint8 BankSwitch[8];
uint8 PALspeed[2]; // Unused uint8 PALspeed[2]; /* Unused */
uint8 VideoSystem; uint8 VideoSystem;
uint8 SoundChip; uint8 SoundChip;
uint8 Expansion[4]; uint8 Expansion[4];

View File

@@ -322,8 +322,8 @@ case 0x50: JR(!(_P&V_FLAG)); break;
/* BVS */ /* BVS */
case 0x70: JR(_P&V_FLAG); break; case 0x70: JR(_P&V_FLAG); break;
//default: printf("Bad %02x at $%04x\n",b1,X.PC);break; /* default: printf("Bad %02x at $%04x\n",b1,X.PC);break; */
//ifdef moo /* ifdef moo */
/* Here comes the undocumented instructions block. Note that this implementation /* Here comes the undocumented instructions block. Note that this implementation
may be "wrong". If so, please tell me. may be "wrong". If so, please tell me.
*/ */
@@ -485,6 +485,5 @@ case 0xFC: LD_ABX(;);
/* XAA - BIG QUESTION MARK HERE */ /* XAA - BIG QUESTION MARK HERE */
case 0x8B: _A|=0xEE; _A&=_X; LD_IM(AND); case 0x8B: _A|=0xEE; _A&=_X; LD_IM(AND);
//endif /* endif */
//
#endif #endif

View File

@@ -39,9 +39,9 @@ static int ntsctint = 46 + 10;
static int ntschue = 72; static int ntschue = 72;
/* These are dynamically filled/generated palettes: */ /* These are dynamically filled/generated palettes: */
pal palettei[64]; // Custom palette for an individual game. pal palettei[64]; /* Custom palette for an individual game. */
pal palettec[64]; // Custom "global" palette. pal palettec[64]; /* Custom "global" palette. */
pal paletten[64]; // Mathematically generated palette. pal paletten[64]; /* Mathematically generated palette. */
static void CalculatePalette(void); static void CalculatePalette(void);
static void ChoosePalette(void); static void ChoosePalette(void);

View File

@@ -63,8 +63,10 @@ static uint8 rp2c05004_colortable[] =
main() { main() {
int x; int x;
for (x = 0; x < 64; x++) { for (x = 0; x < 64; x++) {
// if(x <= 0x20) #if 0
// if(rp2c04002_colortable[x] == 0xFF) rp2c04002_colortable[x]= 0x30; if(x <= 0x20)
if(rp2c04002_colortable[x] == 0xFF) rp2c04002_colortable[x]= 0x30;
#endif
printf("{0x%02x, 0x%02x, 0x%02x},\n", palette[rp2c04001_colortable[x] & 0x3F].r, printf("{0x%02x, 0x%02x, 0x%02x},\n", palette[rp2c04001_colortable[x] & 0x3F].r,
palette[rp2c04001_colortable[x] & 0x3F].g, palette[rp2c04001_colortable[x] & 0x3F].g,
palette[rp2c04001_colortable[x] & 0x3F].b); palette[rp2c04001_colortable[x] & 0x3F].b);

109
src/ppu.c
View File

@@ -40,15 +40,15 @@
#include "video.h" #include "video.h"
#include "input.h" #include "input.h"
#define VBlankON (PPU[0] & 0x80) //Generate VBlank NMI #define VBlankON (PPU[0] & 0x80) /* Generate VBlank NMI */
#define Sprite16 (PPU[0] & 0x20) //Sprites 8x16/8x8 #define Sprite16 (PPU[0] & 0x20) /* Sprites 8x16/8x8 */
#define BGAdrHI (PPU[0] & 0x10) //BG pattern adr $0000/$1000 #define BGAdrHI (PPU[0] & 0x10) /* BG pattern adr $0000/$1000 */
#define SpAdrHI (PPU[0] & 0x08) //Sprite pattern adr $0000/$1000 #define SpAdrHI (PPU[0] & 0x08) /* Sprite pattern adr $0000/$1000 */
#define INC32 (PPU[0] & 0x04) //auto increment 1/32 #define INC32 (PPU[0] & 0x04) /* auto increment 1/32 */
#define SpriteON (PPU[1] & 0x10) //Show Sprite #define SpriteON (PPU[1] & 0x10) /* Show Sprite */
#define ScreenON (PPU[1] & 0x08) //Show screen #define ScreenON (PPU[1] & 0x08) /* Show screen */
#define GRAYSCALE (PPU[1] & 0x01) //Grayscale (AND palette entries with 0x30) #define GRAYSCALE (PPU[1] & 0x01) /* Grayscale (AND palette entries with 0x30) */
#define PPU_status (PPU[2]) #define PPU_status (PPU[2])
@@ -109,7 +109,7 @@ uint8 *vnapage[4];
uint8 PPUNTARAM = 0; uint8 PPUNTARAM = 0;
uint8 PPUCHRRAM = 0; uint8 PPUCHRRAM = 0;
//Color deemphasis emulation. Joy... /* Color deemphasis emulation. Joy... */
static uint8 deemp = 0; static uint8 deemp = 0;
static int deempcnt[8]; static int deempcnt[8];
@@ -123,15 +123,16 @@ uint32 TempAddr = 0, RefreshAddr = 0;
static int maxsprites = 8; static int maxsprites = 8;
//scanline is equal to the current visible scanline we're on. /* scanline is equal to the current visible scanline we're on. */
int scanline; int scanline;
static uint32 scanlines_per_frame; static uint32 scanlines_per_frame;
uint8 PPU[4]; uint8 PPU[4];
uint8 PPUSPL; uint8 PPUSPL;
uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], SPRBUF[0x100]; uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], SPRBUF[0x100];
uint8 UPALRAM[0x03];//for 0x4/0x8/0xC addresses in palette, the ones in uint8 UPALRAM[0x03];/* for 0x4/0x8/0xC addresses in palette, the ones in
//0x20 are 0 to not break fceu rendering. * 0x20 are 0 to not break fceu rendering.
*/
#define MMC5SPRVRAMADR(V) &MMC5SPRVPage[(V) >> 10][(V)] #define MMC5SPRVRAMADR(V) &MMC5SPRVPage[(V) >> 10][(V)]
#define VRAMADR(V) &VPage[(V) >> 10][(V)] #define VRAMADR(V) &VPage[(V) >> 10][(V)]
@@ -176,7 +177,7 @@ static DECLFR(A2007) {
FCEUPPU_LineUpdate(); FCEUPPU_LineUpdate();
if (tmp >= 0x3F00) { // Palette RAM tied directly to the output data, without VRAM buffer if (tmp >= 0x3F00) { /* Palette RAM tied directly to the output data, without VRAM buffer */
if (!(tmp & 3)) { if (!(tmp & 3)) {
if (!(tmp & 0xC)) if (!(tmp & 0xC))
ret = PALRAM[0x00]; ret = PALRAM[0x00];
@@ -431,11 +432,12 @@ static void CheckSpriteHit(int p) {
} }
} }
//spork the world. Any sprites on this line? Then this will be set to 1. /* spork the world. Any sprites on this line? Then this will be set to 1.
//Needed for zapper emulation and *gasp* sprite emulation. * Needed for zapper emulation and *gasp* sprite emulation.
*/
static int spork = 0; static int spork = 0;
// lasttile is really "second to last tile." /* lasttile is really "second to last tile." */
static void FASTAPASS(1) RefreshLine(int lastpixel) { static void FASTAPASS(1) RefreshLine(int lastpixel) {
static uint32 pshift[2]; static uint32 pshift[2];
static uint32 atlatch; static uint32 atlatch;
@@ -448,11 +450,12 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) {
register uint8 *P = Pline; register uint8 *P = Pline;
int lasttile = lastpixel >> 3; int lasttile = lastpixel >> 3;
int numtiles; int numtiles;
static int norecurse = 0; // Yeah, recursion would be bad. static int norecurse = 0; /* Yeah, recursion would be bad.
// PPU_hook() functions can call * PPU_hook() functions can call
// mirroring/chr bank switching functions, * mirroring/chr bank switching functions,
// which call FCEUPPU_LineUpdate, which call this * which call FCEUPPU_LineUpdate, which call this
// function. * function.
*/
if (norecurse) return; if (norecurse) return;
if (sphitx != 0x100 && !(PPU_status & 0x40)) { if (sphitx != 0x100 && !(PPU_status & 0x40)) {
@@ -496,14 +499,15 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) {
return; return;
} }
//Priority bits, needed for sprite emulation. /* Priority bits, needed for sprite emulation. */
Pal[0] |= 64; Pal[0] |= 64;
Pal[4] |= 64; Pal[4] |= 64;
Pal[8] |= 64; Pal[8] |= 64;
Pal[0xC] |= 64; Pal[0xC] |= 64;
//This high-level graphics MMC5 emulation code was written for MMC5 carts in "CL" mode. /* This high-level graphics MMC5 emulation code was written for MMC5 carts in "CL" mode.
//It's probably not totally correct for carts in "SL" mode. * It's probably not totally correct for carts in "SL" mode.
*/
#define PPUT_MMC5 #define PPUT_MMC5
if (MMC5Hack && geniestage != 1) { if (MMC5Hack && geniestage != 1) {
@@ -577,7 +581,7 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) {
#undef vofs #undef vofs
#undef RefreshAddr #undef RefreshAddr
//Reverse changes made before. /* Reverse changes made before. */
Pal[0] &= 63; Pal[0] &= 63;
Pal[4] &= 63; Pal[4] &= 63;
Pal[8] &= 63; Pal[8] &= 63;
@@ -612,7 +616,7 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) {
tofix = 0; tofix = 0;
} }
//This only works right because of a hack earlier in this function. /* This only works right because of a hack earlier in this function. */
CheckSpriteHit(lastpixel); CheckSpriteHit(lastpixel);
if (InputScanlineHook && (lastpixel - 16) >= 0) { if (InputScanlineHook && (lastpixel - 16) >= 0) {
@@ -649,7 +653,7 @@ static void Fixit1(void) {
} }
} }
void MMC5_hb(int); //Ugh ugh ugh. void MMC5_hb(int); /* Ugh ugh ugh. */
static void DoLine(void) static void DoLine(void)
{ {
int x; int x;
@@ -669,7 +673,7 @@ static void DoLine(void)
X6502_Run(256); X6502_Run(256);
EndRL(); EndRL();
if (rendis & 2) {// User asked to not display background data. if (rendis & 2) {/* User asked to not display background data. */
uint32 tem; uint32 tem;
tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24); tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24);
tem |= 0x40404040; tem |= 0x40404040;
@@ -679,7 +683,7 @@ static void DoLine(void)
if (SpriteON) if (SpriteON)
CopySprites(target); CopySprites(target);
if (ScreenON || SpriteON) { // Yes, very el-cheapo. if (ScreenON || SpriteON) { /* Yes, very el-cheapo. */
if (PPU[1] & 0x01) { if (PPU[1] & 0x01) {
for (x = 63; x >= 0; x--) for (x = 63; x >= 0; x--)
*(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) & 0x30303030; *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) & 0x30303030;
@@ -709,7 +713,7 @@ static void DoLine(void)
} else { } else {
X6502_Run(85 - 6 - 16); X6502_Run(85 - 6 - 16);
// A semi-hack for Star Trek: 25th Anniversary /* A semi-hack for Star Trek: 25th Anniversary */
if (GameHBIRQHook && (ScreenON || SpriteON) && ((PPU[0] & 0x38) != 0x18)) if (GameHBIRQHook && (ScreenON || SpriteON) && ((PPU[0] & 0x38) != 0x18))
GameHBIRQHook(); GameHBIRQHook();
} }
@@ -861,7 +865,7 @@ static void FetchSpriteData(void) {
} }
} }
//Handle case when >8 sprites per scanline option is enabled. /* Handle case when >8 sprites per scanline option is enabled. */
if (ns > 8) PPU_status |= 0x20; if (ns > 8) PPU_status |= 0x20;
else if (PPU_hook) { else if (PPU_hook) {
for (n = 0; n < (8 - ns); n++) { for (n = 0; n < (8 - ns); n++) {
@@ -996,7 +1000,7 @@ static void CopySprites(uint8 *target) {
if (!spork) return; if (!spork) return;
spork = 0; spork = 0;
if (rendis & 1) return; //User asked to not display sprites. if (rendis & 1) return; /* User asked to not display sprites. */
do do
{ {
@@ -1005,43 +1009,43 @@ static void CopySprites(uint8 *target) {
if (t != 0x80808080) { if (t != 0x80808080) {
#ifdef MSB_FIRST #ifdef MSB_FIRST
if (!(t & 0x80000000)) { if (!(t & 0x80000000)) {
if (!(t & 0x40000000) || (P[n] & 64)) // Normal sprite || behind bg sprite if (!(t & 0x40000000) || (P[n] & 64)) /* Normal sprite || behind bg sprite */
P[n] = sprlinebuf[n]; P[n] = sprlinebuf[n];
} }
if (!(t & 0x800000)) { if (!(t & 0x800000)) {
if (!(t & 0x400000) || (P[n + 1] & 64)) // Normal sprite || behind bg sprite if (!(t & 0x400000) || (P[n + 1] & 64)) /* Normal sprite || behind bg sprite */
P[n + 1] = (sprlinebuf + 1)[n]; P[n + 1] = (sprlinebuf + 1)[n];
} }
if (!(t & 0x8000)) { if (!(t & 0x8000)) {
if (!(t & 0x4000) || (P[n + 2] & 64)) // Normal sprite || behind bg sprite if (!(t & 0x4000) || (P[n + 2] & 64)) /* Normal sprite || behind bg sprite */
P[n + 2] = (sprlinebuf + 2)[n]; P[n + 2] = (sprlinebuf + 2)[n];
} }
if (!(t & 0x80)) { if (!(t & 0x80)) {
if (!(t & 0x40) || (P[n + 3] & 64)) // Normal sprite || behind bg sprite if (!(t & 0x40) || (P[n + 3] & 64)) /* Normal sprite || behind bg sprite */
P[n + 3] = (sprlinebuf + 3)[n]; P[n + 3] = (sprlinebuf + 3)[n];
} }
#else #else
if (!(t & 0x80)) { if (!(t & 0x80)) {
if (!(t & 0x40) || (P[n] & 0x40)) // Normal sprite || behind bg sprite if (!(t & 0x40) || (P[n] & 0x40)) /* Normal sprite || behind bg sprite */
P[n] = sprlinebuf[n]; P[n] = sprlinebuf[n];
} }
if (!(t & 0x8000)) { if (!(t & 0x8000)) {
if (!(t & 0x4000) || (P[n + 1] & 0x40)) // Normal sprite || behind bg sprite if (!(t & 0x4000) || (P[n + 1] & 0x40)) /* Normal sprite || behind bg sprite */
P[n + 1] = (sprlinebuf + 1)[n]; P[n + 1] = (sprlinebuf + 1)[n];
} }
if (!(t & 0x800000)) { if (!(t & 0x800000)) {
if (!(t & 0x400000) || (P[n + 2] & 0x40)) // Normal sprite || behind bg sprite if (!(t & 0x400000) || (P[n + 2] & 0x40)) /* Normal sprite || behind bg sprite */
P[n + 2] = (sprlinebuf + 2)[n]; P[n + 2] = (sprlinebuf + 2)[n];
} }
if (!(t & 0x80000000)) { if (!(t & 0x80000000)) {
if (!(t & 0x40000000) || (P[n + 3] & 0x40)) // Normal sprite || behind bg sprite if (!(t & 0x40000000) || (P[n + 3] & 0x40)) /* Normal sprite || behind bg sprite */
P[n + 3] = (sprlinebuf + 3)[n]; P[n + 3] = (sprlinebuf + 3)[n];
} }
#endif #endif
@@ -1094,7 +1098,7 @@ void FCEUPPU_Power(void) {
BWrite[x + 2] = B2002; BWrite[x + 2] = B2002;
ARead[x + 3] = A200x; ARead[x + 3] = A200x;
BWrite[x + 3] = B2003; BWrite[x + 3] = B2003;
ARead[x + 4] = A200x; //A2004; ARead[x + 4] = A200x; /* A2004; */
BWrite[x + 4] = B2004; BWrite[x + 4] = B2004;
ARead[x + 5] = A200x; ARead[x + 5] = A200x;
BWrite[x + 5] = B2005; BWrite[x + 5] = B2005;
@@ -1113,7 +1117,7 @@ void FCEUPPU_Power(void) {
BWrite[x + 2] = B2002; BWrite[x + 2] = B2002;
ARead[x + 3] = A200x; ARead[x + 3] = A200x;
BWrite[x + 3] = B2003; BWrite[x + 3] = B2003;
ARead[x + 4] = A200x; //A2004; ARead[x + 4] = A200x; /* A2004; */
BWrite[x + 4] = B2004; BWrite[x + 4] = B2004;
ARead[x + 5] = A200x; ARead[x + 5] = A200x;
BWrite[x + 5] = B2005; BWrite[x + 5] = B2005;
@@ -1128,7 +1132,7 @@ void FCEUPPU_Power(void) {
int FCEUPPU_Loop(int skip) { int FCEUPPU_Loop(int skip) {
//Needed for Knight Rider, possibly others. /* Needed for Knight Rider, possibly others. */
if (ppudead) { if (ppudead) {
memset(XBuf, 0x80, 256 * 240); memset(XBuf, 0x80, 256 * 240);
X6502_Run(scanlines_per_frame * (256 + 85)); X6502_Run(scanlines_per_frame * (256 + 85));
@@ -1137,12 +1141,13 @@ int FCEUPPU_Loop(int skip) {
X6502_Run(256 + 85); X6502_Run(256 + 85);
PPU_status |= 0x80; PPU_status |= 0x80;
//Not sure if this is correct. According to Matt Conte and my own tests, it is. /* Not sure if this is correct. According to Matt Conte and my own tests, it is.
//Timing is probably off, though. * Timing is probably off, though.
//NOTE: Not having this here breaks a Super Donkey Kong game. * NOTE: Not having this here breaks a Super Donkey Kong game.
*/
PPU[3] = PPUSPL = 0; PPU[3] = PPUSPL = 0;
//I need to figure out the true nature and length of this delay. /* I need to figure out the true nature and length of this delay. */
X6502_Run(12); X6502_Run(12);
if (GameInfo->type == GIT_NSF) if (GameInfo->type == GIT_NSF)
DoNSFFrame(); DoNSFFrame();
@@ -1180,7 +1185,7 @@ int FCEUPPU_Loop(int skip) {
if (PPU_hook) PPU_hook(RefreshAddr & 0x3fff); if (PPU_hook) PPU_hook(RefreshAddr & 0x3fff);
} }
//Clean this stuff up later. /* Clean this stuff up later. */
spork = numsprites = 0; spork = numsprites = 0;
ResetRL(XBuf); ResetRL(XBuf);
@@ -1196,7 +1201,7 @@ int FCEUPPU_Loop(int skip) {
y = SPRAM[0]; y = SPRAM[0];
y++; y++;
PPU_status |= 0x20; // Fixes "Bee 52". Does it break anything? PPU_status |= 0x20; /* Fixes "Bee 52". Does it break anything? */
if (GameHBIRQHook) { if (GameHBIRQHook) {
X6502_Run(256); X6502_Run(256);
for (scanline = 0; scanline < 240; scanline++) { for (scanline = 0; scanline < 240; scanline++) {
@@ -1207,7 +1212,7 @@ int FCEUPPU_Loop(int skip) {
} }
} else if (y < 240) { } else if (y < 240) {
X6502_Run((256 + 85) * y); X6502_Run((256 + 85) * y);
if (SpriteON) PPU_status |= 0x40; // Quick and very dirty hack. if (SpriteON) PPU_status |= 0x40; /* Quick and very dirty hack. */
X6502_Run((256 + 85) * (240 - y)); X6502_Run((256 + 85) * (240 - y));
} else } else
X6502_Run((256 + 85) * 240); X6502_Run((256 + 85) * 240);
@@ -1218,13 +1223,13 @@ int FCEUPPU_Loop(int skip) {
deemp = PPU[1] >> 5; deemp = PPU[1] >> 5;
// manual samples can't play correctly with overclocking /* manual samples can't play correctly with overclocking */
if (DMC_7bit && skip_7bit_overclocking) if (DMC_7bit && skip_7bit_overclocking)
totalscanlines = normal_scanlines; totalscanlines = normal_scanlines;
else else
totalscanlines = normal_scanlines + (overclock_state ? extrascanlines : 0); totalscanlines = normal_scanlines + (overclock_state ? extrascanlines : 0);
for (scanline = 0; scanline < totalscanlines; ) { //scanline is incremented in DoLine. Evil. :/ for (scanline = 0; scanline < totalscanlines; ) { /* scanline is incremented in DoLine. Evil. :/ */
deempcnt[deemp]++; deempcnt[deemp]++;
if ((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1); if ((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1);
DoLine(); DoLine();

View File

@@ -42,7 +42,7 @@ if (X1 >= 2) {
#else #else
zz = RefreshAddr & 0x1F; zz = RefreshAddr & 0x1F;
C = vnapage[(RefreshAddr >> 10) & 3]; C = vnapage[(RefreshAddr >> 10) & 3];
vadr = (C[RefreshAddr & 0x3ff] << 4) + vofs; // Fetch name table byte. vadr = (C[RefreshAddr & 0x3ff] << 4) + vofs; /* Fetch name table byte. */
#endif #endif
#ifdef PPUT_HOOK #ifdef PPUT_HOOK
@@ -56,7 +56,7 @@ if (X1 >= 2) {
#ifdef PPUT_MMC5CHR1 #ifdef PPUT_MMC5CHR1
cc = (MMC5HackExNTARAMPtr[RefreshAddr & 0x3ff] & 0xC0) >> 6; cc = (MMC5HackExNTARAMPtr[RefreshAddr & 0x3ff] & 0xC0) >> 6;
#else #else
cc = C[0x3c0 + (zz >> 2) + ((RefreshAddr & 0x380) >> 4)]; // Fetch attribute table byte. cc = C[0x3c0 + (zz >> 2) + ((RefreshAddr & 0x380) >> 4)]; /* Fetch attribute table byte. */
cc = ((cc >> ((zz & 2) + ((RefreshAddr & 0x40) >> 4))) & 3); cc = ((cc >> ((zz & 2) + ((RefreshAddr & 0x40) >> 4))) & 3);
#endif #endif
#endif #endif

View File

@@ -61,7 +61,7 @@ typedef struct {
int reloaddec; int reloaddec;
} ENVUNIT; } ENVUNIT;
unsigned DMC_7bit = 0; // used to skip overclocking unsigned DMC_7bit = 0; /* used to skip overclocking */
static ENVUNIT EnvUnits[3]; static ENVUNIT EnvUnits[3];
static const int RectDuties[4] = { 1, 2, 4, 6 }; static const int RectDuties[4] = { 1, 2, 4, 6 };
@@ -119,10 +119,11 @@ static const uint32 PALDMCTable[0x10] =
0x0B0, 0x094, 0x084, 0x076, 0x062, 0x04E, 0x042, 0x032 0x0B0, 0x094, 0x084, 0x076, 0x062, 0x04E, 0x042, 0x032
}; };
// $4010 - Frequency /* $4010 - Frequency
// $4011 - Actual data outputted * $4011 - Actual data outputted
// $4012 - Address register: $c000 + V*64 * $4012 - Address register: $c000 + V*64
// $4013 - Size register: Size in bytes = (V+1)*64 * $4013 - Size register: Size in bytes = (V+1)*64
*/
/*static*/ int32 DMCacc = 1; /*static*/ int32 DMCacc = 1;
static int32 DMCPeriod = 0; static int32 DMCPeriod = 0;
@@ -188,11 +189,11 @@ static void SQReload(int x, uint8 V) {
RectDutyCount[x] = 7; RectDutyCount[x] = 7;
EnvUnits[x].reloaddec = 1; EnvUnits[x].reloaddec = 1;
//reloadfreq[x]=1; /* reloadfreq[x]=1; */
} }
static DECLFW(Write_PSG) { static DECLFW(Write_PSG) {
// FCEU_printf("APU1 %04x:%04x\n",A,V); /* FCEU_printf("APU1 %04x:%04x\n",A,V); */
A &= 0x1F; A &= 0x1F;
switch (A) { switch (A) {
case 0x0: case 0x0:
@@ -270,7 +271,7 @@ static DECLFW(Write_PSG) {
} }
static DECLFW(Write_DMCRegs) { static DECLFW(Write_DMCRegs) {
// FCEU_printf("APU1 %04x:%04x\n",A,V); /* FCEU_printf("APU1 %04x:%04x\n",A,V); */
A &= 0xF; A &= 0xF;
switch (A) { switch (A) {
@@ -305,7 +306,7 @@ static DECLFW(Write_DMCRegs) {
static DECLFW(StatusWrite) { static DECLFW(StatusWrite) {
int x; int x;
// FCEU_printf("APU1 %04x:%04x\n",A,V); /* FCEU_printf("APU1 %04x:%04x\n",A,V); */
DoSQ1(); DoSQ1();
DoSQ2(); DoSQ2();
@@ -375,7 +376,7 @@ static void FASTAPASS(1) FrameSoundStuff(int V) {
if (SweepCount[P] > 0) SweepCount[P]--; if (SweepCount[P] > 0) SweepCount[P]--;
if (SweepCount[P] <= 0) { if (SweepCount[P] <= 0) {
SweepCount[P] = ((PSG[(P << 2) + 0x1] >> 4) & 7) + 1; //+1; SweepCount[P] = ((PSG[(P << 2) + 0x1] >> 4) & 7) + 1; /* +1; */
if (PSG[(P << 2) + 0x1] & 0x8) { 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*/) { if (curfreq[P] && (PSG[(P << 2) + 0x1] & 7) /* && sweepon[P]&0x80*/) {
@@ -394,15 +395,17 @@ static void FASTAPASS(1) FrameSoundStuff(int V) {
} }
} }
} else {/* Sweeping is disabled: */ } else {/* Sweeping is disabled: */
//curfreq[P]&=0xFF00; #if 0
//curfreq[P]|=PSG[(P<<2)|0x2]; //|((PSG[(P<<2)|3]&7)<<8); curfreq[P]&=0xFF00;
curfreq[P]|=PSG[(P<<2)|0x2]; /* |((PSG[(P<<2)|3]&7)<<8); */
#endif
} }
} }
} }
/* Now do envelope decay + linear counter. */ /* Now do envelope decay + linear counter. */
if (TriMode)// In load mode? if (TriMode)/* In load mode? */
TriCount = PSG[0x8] & 0x7F; TriCount = PSG[0x8] & 0x7F;
else if (TriCount) else if (TriCount)
TriCount--; TriCount--;
@@ -430,8 +433,9 @@ static void FASTAPASS(1) FrameSoundStuff(int V) {
} }
void FrameSoundUpdate(void) { void FrameSoundUpdate(void) {
// Linear counter: Bit 0-6 of $4008 /* Linear counter: Bit 0-6 of $4008
// Length counter: Bit 4-7 of $4003, $4007, $400b, $400f * Length counter: Bit 4-7 of $4003, $4007, $400b, $400f
*/
if (!fcnt && !(IRQFrameMode & 0x3)) { if (!fcnt && !(IRQFrameMode & 0x3)) {
SIRQStat |= 0x40; SIRQStat |= 0x40;
@@ -542,7 +546,7 @@ static INLINE void RDoSQ(int x) {
amp = EnvUnits[x].Speed; amp = EnvUnits[x].Speed;
else else
amp = EnvUnits[x].decvolume; amp = EnvUnits[x].decvolume;
// printf("%d\n",amp); /* printf("%d\n",amp); */
amp <<= 24; amp <<= 24;
rthresh = RectDuties[(PSG[(x << 2)] & 0xC0) >> 6]; rthresh = RectDuties[(PSG[(x << 2)] & 0xC0) >> 6];
@@ -635,15 +639,16 @@ static void RDoSQLQ(void) {
Wave[V >> 4] += totalout; Wave[V >> 4] += totalout;
} else } else
for (V = start; V < end; V++) { for (V = start; V < end; V++) {
//int tmpamp=0; /* int tmpamp=0;
//if(RectDutyCount[0]<rthresh[0]) if(RectDutyCount[0]<rthresh[0])
// tmpamp=amp[0]; tmpamp=amp[0];
//if(RectDutyCount[1]<rthresh[1]) if(RectDutyCount[1]<rthresh[1])
// tmpamp+=amp[1]; tmpamp+=amp[1];
//tmpamp=wlookup1[tmpamp]; tmpamp=wlookup1[tmpamp];
//tmpamp = wlookup1[ ttable[0][RectDutyCount[0]] + ttable[1][RectDutyCount[1]] ]; tmpamp = wlookup1[ ttable[0][RectDutyCount[0]] + ttable[1][RectDutyCount[1]] ];
*/
Wave[V >> 4] += totalout; //tmpamp; Wave[V >> 4] += totalout; /* tmpamp; */
sqacc[0] -= inie[0]; sqacc[0] -= inie[0];
sqacc[1] -= inie[1]; sqacc[1] -= inie[1];
@@ -672,7 +677,7 @@ static void RDoTriangle(void) {
tcout = (tristep & 0xF); tcout = (tristep & 0xF);
if (!(tristep & 0x10)) tcout ^= 0xF; if (!(tristep & 0x10)) tcout ^= 0xF;
tcout = (tcout * 3) << 16; //(tcout<<1); tcout = (tcout * 3) << 16; /* (tcout<<1); */
if (!lengthcount[2] || !TriCount) { /* Counter is halted, but we still need to output. */ if (!lengthcount[2] || !TriCount) { /* Counter is halted, but we still need to output. */
int32 *start = &WaveHi[ChannelBC[2]]; int32 *start = &WaveHi[ChannelBC[2]];
@@ -681,8 +686,10 @@ static void RDoTriangle(void) {
*start += tcout; *start += tcout;
start++; start++;
} }
//for(V=ChannelBC[2];V<SOUNDTS;V++) #if 0
// WaveHi[V]+=tcout; for(V = ChannelBC[2]; V < SOUNDTS; V++)
WaveHi[V] += tcout;
#endif
} else } else
for (V = ChannelBC[2]; V < SOUNDTS; V++) { for (V = ChannelBC[2]; V < SOUNDTS; V++) {
WaveHi[V] += tcout; WaveHi[V] += tcout;
@@ -756,7 +763,7 @@ static void RDoTriangleNoisePCMLQ(void) {
if (triacc <= 0) { if (triacc <= 0) {
rea: rea:
triacc += freq[0]; //t; triacc += freq[0]; /* t; */
tristep = (tristep + 1) & 0x1F; tristep = (tristep + 1) & 0x1F;
if (triacc <= 0) goto rea; if (triacc <= 0) goto rea;
tcout = (tristep & 0xF); tcout = (tristep & 0xF);
@@ -767,8 +774,9 @@ static void RDoTriangleNoisePCMLQ(void) {
if (noiseacc <= 0) { if (noiseacc <= 0) {
rea2: rea2:
//used to added <<(16+2) when the noise table /* used to added <<(16+2) when the noise table
//values were half. * values were half.
*/
if (PAL) if (PAL)
noiseacc += PALNoiseFreqTable[PSG[0xE] & 0xF] << (16 + 1); noiseacc += PALNoiseFreqTable[PSG[0xE] & 0xF] << (16 + 1);
else else
@@ -788,7 +796,7 @@ static void RDoTriangleNoisePCMLQ(void) {
if (triacc <= 0) { if (triacc <= 0) {
area: area:
triacc += freq[0]; //t; triacc += freq[0]; /* t; */
tristep = (tristep + 1) & 0x1F; tristep = (tristep + 1) & 0x1F;
if (triacc <= 0) goto area; if (triacc <= 0) goto area;
tcout = (tristep & 0xF); tcout = (tristep & 0xF);
@@ -803,8 +811,9 @@ static void RDoTriangleNoisePCMLQ(void) {
noiseacc -= inie[1]; noiseacc -= inie[1];
if (noiseacc <= 0) { if (noiseacc <= 0) {
area2: area2:
//used to be added <<(16+2) when the noise table /* used to be added <<(16+2) when the noise table
//values were half. * values were half.
*/
if (PAL) if (PAL)
noiseacc += PALNoiseFreqTable[PSG[0xE] & 0xF] << (16 + 1); noiseacc += PALNoiseFreqTable[PSG[0xE] & 0xF] << (16 + 1);
else else
@@ -844,7 +853,7 @@ static void RDoNoise(void) {
outo = amptab[0] = 0; outo = amptab[0] = 0;
} }
if (PSG[0xE] & 0x80)// "short" noise if (PSG[0xE] & 0x80)/* "short" noise */
for (V = ChannelBC[3]; V < SOUNDTS; V++) { for (V = ChannelBC[3]; V < SOUNDTS; V++) {
WaveHi[V] += outo; WaveHi[V] += outo;
wlcount[3]--; wlcount[3]--;
@@ -944,8 +953,10 @@ int FlushEmulateSound(void) {
SexyFilter(Wave, WaveFinal, end >> 4); SexyFilter(Wave, WaveFinal, end >> 4);
//if(FSettings.lowpass) #if o
// SexyFilter2(WaveFinal,end>>4); if (FSettings.lowpass)
SexyFilter2(WaveFinal, end >> 4);
#endif
if (end & 0xF) if (end & 0xF)
Wave[0] = Wave[(end >> 4)]; Wave[0] = Wave[(end >> 4)];
Wave[end >> 4] = 0; Wave[end >> 4] = 0;
@@ -982,19 +993,18 @@ void FCEUSND_Reset(void) {
IRQFrameMode = 0x0; IRQFrameMode = 0x0;
fhcnt = fhinc; fhcnt = fhinc;
fcnt = 0; fcnt = 0;
nreg = 1; nreg = 1;
for (x = 0; x < 2; x++) { for (x = 0; x < 2; x++) {
wlcount[x] = 2048; wlcount[x] = 2048;
if (nesincsize) // lq mode if (nesincsize) /* lq mode */
sqacc[x] = ((uint32)2048 << 17) / nesincsize; sqacc[x] = ((uint32)2048 << 17) / nesincsize;
else else
sqacc[x] = 1; sqacc[x] = 1;
sweepon[x] = 0; sweepon[x] = 0;
curfreq[x] = 0; curfreq[x] = 0;
} }
wlcount[2] = 1; //2048; wlcount[2] = 1; /* 2048; */
wlcount[3] = 2048; wlcount[3] = 2048;
DMCHaveDMA = DMCHaveSample = 0; DMCHaveDMA = DMCHaveSample = 0;
SIRQStat = 0x00; SIRQStat = 0x00;
@@ -1036,7 +1046,7 @@ void FCEUSND_Power(void) {
void SetSoundVariables(void) { void SetSoundVariables(void) {
int x; int x;
fhinc = PAL ? 16626 : 14915; // *2 CPU clock rate fhinc = PAL ? 16626 : 14915; /* *2 CPU clock rate */
fhinc *= 24; fhinc *= 24;
if (FSettings.SndRate) { if (FSettings.SndRate) {
@@ -1078,7 +1088,7 @@ void SetSoundVariables(void) {
memset(sqacc, 0, sizeof(sqacc)); memset(sqacc, 0, sizeof(sqacc));
memset(ChannelBC, 0, sizeof(ChannelBC)); memset(ChannelBC, 0, sizeof(ChannelBC));
LoadDMCPeriod(DMCFormat & 0xF); // For changing from PAL to NTSC LoadDMCPeriod(DMCFormat & 0xF); /* For changing from PAL to NTSC */
soundtsinc = (uint32)((uint64)(PAL ? (long double)PAL_CPU * 65536 : (long double)NTSC_CPU * 65536) / (FSettings.SndRate * 16)); soundtsinc = (uint32)((uint64)(PAL ? (long double)PAL_CPU * 65536 : (long double)NTSC_CPU * 65536) / (FSettings.SndRate * 16));
} }

View File

@@ -42,12 +42,12 @@
static void (*SPreSave)(void); static void (*SPreSave)(void);
static void (*SPostSave)(void); static void (*SPostSave)(void);
static int SaveStateStatus[10]; /* static int SaveStateStatus[10]; */
static SFORMAT SFMDATA[64]; static SFORMAT SFMDATA[64];
static int SFEXINDEX; static int SFEXINDEX;
#define RLSB FCEUSTATE_RLSB //0x80000000 #define RLSB FCEUSTATE_RLSB /* 0x80000000 */
extern SFORMAT FCEUPPU_STATEINFO[]; extern SFORMAT FCEUPPU_STATEINFO[];
extern SFORMAT FCEUSND_STATEINFO[]; extern SFORMAT FCEUSND_STATEINFO[];
@@ -214,7 +214,7 @@ static int ReadStateChunks(memstream_t *st, int32 totalsize)
if (!ReadStateChunk(st, SFCPUC, size)) if (!ReadStateChunk(st, SFCPUC, size))
ret = 0; ret = 0;
else else
X.mooPI = X.P; // Quick and dirty hack. X.mooPI = X.P; /* Quick and dirty hack. */
break; break;
case 3: case 3:
if (!ReadStateChunk(st, FCEUPPU_STATEINFO, size)) if (!ReadStateChunk(st, FCEUPPU_STATEINFO, size))
@@ -331,7 +331,7 @@ void AddExState(void *v, uint32 s, int type, char *desc)
SFMDATA[SFEXINDEX].s = s; SFMDATA[SFEXINDEX].s = s;
if (type) SFMDATA[SFEXINDEX].s |= RLSB; if (type) SFMDATA[SFEXINDEX].s |= RLSB;
if (SFEXINDEX < 63) SFEXINDEX++; if (SFEXINDEX < 63) SFEXINDEX++;
SFMDATA[SFEXINDEX].v = 0; // End marker. SFMDATA[SFEXINDEX].v = 0; /* End marker. */
} }
void FCEU_DrawSaveStates(uint8 *XBuf) void FCEU_DrawSaveStates(uint8 *XBuf)

View File

@@ -151,7 +151,7 @@ static int NAME(FCEUFILE *fp) {
int index; int index;
int t; int t;
//FCEU_printf(" Name: "); /* FCEU_printf(" Name: "); */
index = 0; index = 0;
while ((t = FCEU_fgetc(fp)) > 0) while ((t = FCEU_fgetc(fp)) > 0)
@@ -346,7 +346,7 @@ static BMAPPING bmap[] = {
{ "CNROM", CNROM_Init, 0 }, { "CNROM", CNROM_Init, 0 },
{ "CPROM", CPROM_Init, BMCFLAG_16KCHRR }, { "CPROM", CPROM_Init, BMCFLAG_16KCHRR },
{ "D1038", BMCD1038_Init, 0 }, { "D1038", BMCD1038_Init, 0 },
{ "DANCE", UNLOneBus_Init, 0 }, // redundant { "DANCE", UNLOneBus_Init, 0 }, /* redundant */
{ "DANCE2000", UNLD2000_Init, 0 }, { "DANCE2000", UNLD2000_Init, 0 },
{ "DREAMTECH01", DreamTech01_Init, 0 }, { "DREAMTECH01", DreamTech01_Init, 0 },
{ "EDU2000", UNLEDU2000_Init, 0 }, { "EDU2000", UNLEDU2000_Init, 0 },
@@ -418,9 +418,9 @@ static BMAPPING bmap[] = {
{ "SNROM", SNROM_Init, 0 }, { "SNROM", SNROM_Init, 0 },
{ "SOROM", SOROM_Init, 0 }, { "SOROM", SOROM_Init, 0 },
{ "SSS-NROM-256", SSSNROM_Init, 0 }, { "SSS-NROM-256", SSSNROM_Init, 0 },
{ "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 }, // fix me, real pcb name, real pcb type { "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 }, /* fix me, real pcb name, real pcb type */
{ "Sachen-74LS374N", S74LS374N_Init, 0 }, { "Sachen-74LS374N", S74LS374N_Init, 0 },
{ "Sachen-74LS374NA", S74LS374NA_Init, 0 }, //seems to be custom mapper { "Sachen-74LS374NA", S74LS374NA_Init, 0 }, /* seems to be custom mapper */
{ "Sachen-8259A", S8259A_Init, 0 }, { "Sachen-8259A", S8259A_Init, 0 },
{ "Sachen-8259B", S8259B_Init, 0 }, { "Sachen-8259B", S8259B_Init, 0 },
{ "Sachen-8259C", S8259C_Init, 0 }, { "Sachen-8259C", S8259C_Init, 0 },

View File

@@ -89,7 +89,7 @@ void SLROM_Init(CartInfo *info);
void SNROM_Init(CartInfo *info); void SNROM_Init(CartInfo *info);
void SOROM_Init(CartInfo *info); void SOROM_Init(CartInfo *info);
void SSSNROM_Init(CartInfo *info); void SSSNROM_Init(CartInfo *info);
void SUNSOFT_UNROM_Init(CartInfo *info); // "Shanghi" original version mapper void SUNSOFT_UNROM_Init(CartInfo *info); /* "Shanghi" original version mapper */
void Super24_Init(CartInfo *info); void Super24_Init(CartInfo *info);
void Supervision16_Init(CartInfo *info); void Supervision16_Init(CartInfo *info);
void TBROM_Init(CartInfo *info); void TBROM_Init(CartInfo *info);
@@ -163,7 +163,8 @@ void MapperCopyFamiMMC3_Init(CartInfo *info);
void MapperCopyFami_Init(CartInfo *info); void MapperCopyFami_Init(CartInfo *info);
#endif #endif
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM extern uint8 *UNIFchrrama; /* Meh. So I can stop CHR RAM
// bank switcherooing with certain boards... * bank switcherooing with certain boards...
*/
#endif #endif

View File

@@ -116,7 +116,7 @@ static DECLFR(A2002_Topgun) {
return((OldReadPPU(A) & ~0x3F) | 0x1B); return((OldReadPPU(A) & ~0x3F) | 0x1B);
} }
static DECLFR(A2002_MBJ) { // Mighty Bomb Jack static DECLFR(A2002_MBJ) { /* Mighty Bomb Jack */
return((OldReadPPU(A) & ~0x3F) | 0x3D); return((OldReadPPU(A) & ~0x3F) | 0x3D);
} }

View File

@@ -66,7 +66,7 @@ static INLINE void WrMemNorm(uint32 A, uint8 V) {
} }
#ifdef FCEUDEF_DEBUGGER #ifdef FCEUDEF_DEBUGGER
X6502 XSave; // This is getting ugly. X6502 XSave; /* This is getting ugly. */
static INLINE uint8 RdMemHook(uint32 A) { static INLINE uint8 RdMemHook(uint32 A) {
if (X.ReadHook) if (X.ReadHook)
@@ -110,7 +110,7 @@ void FASTAPASS(2) X6502_DMW(uint32 A, uint8 V) {
#define POP() RdRAM(0x100 + (++_S)) #define POP() RdRAM(0x100 + (++_S))
static uint8 ZNTable[256]; static uint8 ZNTable[256];
// Some of these operations will only make sense if you know what the flag constants are. /* Some of these operations will only make sense if you know what the flag constants are. */
#define X_ZN(zort) _P &= ~(Z_FLAG | N_FLAG); _P |= ZNTable[zort] #define X_ZN(zort) _P &= ~(Z_FLAG | N_FLAG); _P |= ZNTable[zort]
#define X_ZNT(zort) _P |= ZNTable[zort] #define X_ZNT(zort) _P |= ZNTable[zort]
@@ -134,7 +134,7 @@ static uint8 ZNTable[256];
#define LDX _X = x; X_ZN(_X) #define LDX _X = x; X_ZN(_X)
#define LDY _Y = x; X_ZN(_Y) #define LDY _Y = x; X_ZN(_Y)
// All of the freaky arithmetic operations. /* All of the freaky arithmetic operations. */
#define AND _A &= x; X_ZN(_A) #define AND _A &= x; X_ZN(_A)
#define BIT _P &= ~(Z_FLAG | V_FLAG | N_FLAG); _P |= ZNTable[x & _A] & Z_FLAG; _P |= x & (V_FLAG | N_FLAG) #define BIT _P &= ~(Z_FLAG | V_FLAG | N_FLAG); _P |= ZNTable[x & _A] & Z_FLAG; _P |= x & (V_FLAG | N_FLAG)
#define EOR _A ^= x; X_ZN(_A) #define EOR _A ^= x; X_ZN(_A)
@@ -165,7 +165,7 @@ static uint8 ZNTable[256];
_P |= ((t >> 8) & C_FLAG) ^ C_FLAG; \ _P |= ((t >> 8) & C_FLAG) ^ C_FLAG; \
} }
// Special undocumented operation. Very similar to CMP. /* Special undocumented operation. Very similar to CMP. */
#define AXS { \ #define AXS { \
uint32 t = (_A & _X) - x; \ uint32 t = (_A & _X) - x; \
X_ZN(t & 0xFF); \ X_ZN(t & 0xFF); \
@@ -178,14 +178,14 @@ static uint8 ZNTable[256];
#define CPX CMPL(_X, x) #define CPX CMPL(_X, x)
#define CPY CMPL(_Y, x) #define CPY CMPL(_Y, x)
// The following operations modify the byte being worked on. /* The following operations modify the byte being worked on. */
#define DEC x--; X_ZN(x) #define DEC x--; X_ZN(x)
#define INC x++; X_ZN(x) #define INC x++; X_ZN(x)
#define ASL _P &= ~C_FLAG; _P |= x >> 7; x <<= 1; X_ZN(x) #define ASL _P &= ~C_FLAG; _P |= x >> 7; x <<= 1; X_ZN(x)
#define LSR _P &= ~(C_FLAG | N_FLAG | Z_FLAG); _P |= x & 1; x >>= 1; X_ZNT(x) #define LSR _P &= ~(C_FLAG | N_FLAG | Z_FLAG); _P |= x & 1; x >>= 1; X_ZNT(x)
// For undocumented instructions, maybe for other things later... /* For undocumented instructions, maybe for other things later... */
#define LSRA _P &= ~(C_FLAG | N_FLAG | Z_FLAG); _P |= _A & 1; _A >>= 1; X_ZNT(_A) #define LSRA _P &= ~(C_FLAG | N_FLAG | Z_FLAG); _P |= _A & 1; _A >>= 1; X_ZNT(_A)
#define ROL { \ #define ROL { \
@@ -206,10 +206,11 @@ static uint8 ZNTable[256];
X_ZNT(x); \ X_ZNT(x); \
} }
// Icky icky thing for some undocumented instructions. Can easily be /* Icky icky thing for some undocumented instructions. Can easily be
// broken if names of local variables are changed. * broken if names of local variables are changed.
*/
// Absolute /* Absolute */
#define GetAB(target) { \ #define GetAB(target) { \
target = RdMem(_PC); \ target = RdMem(_PC); \
_PC++; \ _PC++; \
@@ -217,7 +218,7 @@ static uint8 ZNTable[256];
_PC++; \ _PC++; \
} }
// Absolute Indexed(for reads) /* Absolute Indexed(for reads) */
#define GetABIRD(target, i) { \ #define GetABIRD(target, i) { \
uint32 tmp; \ uint32 tmp; \
GetAB(tmp); \ GetAB(tmp); \
@@ -230,7 +231,7 @@ static uint8 ZNTable[256];
} \ } \
} }
// Absolute Indexed(for writes and rmws) /* Absolute Indexed(for writes and rmws) */
#define GetABIWR(target, i) { \ #define GetABIWR(target, i) { \
uint32 rt; \ uint32 rt; \
GetAB(rt); \ GetAB(rt); \
@@ -240,19 +241,19 @@ static uint8 ZNTable[256];
RdMem((target & 0x00FF) | (rt & 0xFF00)); \ RdMem((target & 0x00FF) | (rt & 0xFF00)); \
} }
// Zero Page /* Zero Page */
#define GetZP(target) { \ #define GetZP(target) { \
target = RdMem(_PC); \ target = RdMem(_PC); \
_PC++; \ _PC++; \
} }
// Zero Page Indexed /* Zero Page Indexed */
#define GetZPI(target, i) { \ #define GetZPI(target, i) { \
target = i + RdMem(_PC); \ target = i + RdMem(_PC); \
_PC++; \ _PC++; \
} }
// Indexed Indirect /* Indexed Indirect */
#define GetIX(target) { \ #define GetIX(target) { \
uint8 tmp; \ uint8 tmp; \
tmp = RdMem(_PC); \ tmp = RdMem(_PC); \
@@ -263,7 +264,7 @@ static uint8 ZNTable[256];
target |= RdRAM(tmp) << 8; \ target |= RdRAM(tmp) << 8; \
} }
// Indirect Indexed(for reads) /* Indirect Indexed(for reads) */
#define GetIYRD(target) { \ #define GetIYRD(target) { \
uint32 rt; \ uint32 rt; \
uint8 tmp; \ uint8 tmp; \
@@ -281,7 +282,7 @@ static uint8 ZNTable[256];
} \ } \
} }
// Indirect Indexed(for writes and rmws) /* Indirect Indexed(for writes and rmws) */
#define GetIYWR(target) { \ #define GetIYWR(target) { \
uint32 rt; \ uint32 rt; \
uint8 tmp; \ uint8 tmp; \
@@ -369,7 +370,7 @@ void TriggerNMI2(void) {
} }
#ifdef FCEUDEF_DEBUGGER #ifdef FCEUDEF_DEBUGGER
// Called from debugger. /* Called from debugger. */
void FCEUI_NMI(void) { void FCEUI_NMI(void) {
_IRQlow |= FCEU_IQNMI; _IRQlow |= FCEU_IQNMI;
} }
@@ -427,9 +428,9 @@ static void X6502_RunDebug(int32 cycles) {
#define WrMem WrMemHook #define WrMem WrMemHook
if (PAL) if (PAL)
cycles *= 15; // 15*4=60 cycles *= 15; /* 15*4=60 */
else else
cycles *= 16; // 16*4=64 cycles *= 16; /* 16*4=64 */
_count += cycles; _count += cycles;
@@ -473,13 +474,15 @@ static void X6502_RunDebug(int32 cycles) {
if (_count <= 0) { if (_count <= 0) {
_PI = _P; _PI = _P;
return; return;
} // Should increase accuracy without a } /* Should increase accuracy without a
// major speed hit. * major speed hit.
*/
} }
if (X.CPUHook) X.CPUHook(&X); if (X.CPUHook) X.CPUHook(&X);
// Ok, now the real fun starts. /* Ok, now the real fun starts.
// Do the pre-exec voodoo. * Do the pre-exec voodoo.
*/
if (X.ReadHook || X.WriteHook) { if (X.ReadHook || X.WriteHook) {
uint32 tsave = timestamp; uint32 tsave = timestamp;
XSave = X; XSave = X;
@@ -494,8 +497,9 @@ static void X6502_RunDebug(int32 cycles) {
timestamp = tsave; timestamp = tsave;
// In case an NMI/IRQ/RESET was triggered by the debugger. /* In case an NMI/IRQ/RESET was triggered by the debugger.
// Should we also copy over the other hook variables? * Should we also copy over the other hook variables?
*/
XSave.IRQlow = X.IRQlow; XSave.IRQlow = X.IRQlow;
XSave.ReadHook = X.ReadHook; XSave.ReadHook = X.ReadHook;
XSave.WriteHook = X.WriteHook; XSave.WriteHook = X.WriteHook;
@@ -537,7 +541,7 @@ void X6502_Run(int32 cycles)
#define WrMem WrMemNorm #define WrMem WrMemNorm
#if (defined(C80x86) && defined(__GNUC__)) #if (defined(C80x86) && defined(__GNUC__))
// Gives a nice little speed boost. /* Gives a nice little speed boost. */
register uint16 pbackus asm ("edi"); register uint16 pbackus asm ("edi");
#else #else
uint16 pbackus; uint16 pbackus;
@@ -549,9 +553,9 @@ void X6502_Run(int32 cycles)
#define _PC pbackus #define _PC pbackus
if (PAL) if (PAL)
cycles *= 15; // 15*4=60 cycles *= 15; /* 15*4=60 */
else else
cycles *= 16; // 16*4=64 cycles *= 16; /* 16*4=64 */
_count += cycles; _count += cycles;
@@ -596,8 +600,9 @@ void X6502_Run(int32 cycles)
_PI = _P; _PI = _P;
X.PC = pbackus; X.PC = pbackus;
return; return;
} // Should increase accuracy without a } /* Should increase accuracy without a
// major speed hit. * major speed hit.
*/
} }
_PI = _P; _PI = _P;

View File

@@ -55,7 +55,7 @@ extern void FP_FASTAPASS(1) (*MapIRQHook)(int a);
#define FCEU_IQEXT2 0x002 #define FCEU_IQEXT2 0x002
/* ... */ /* ... */
#define FCEU_IQRESET 0x020 #define FCEU_IQRESET 0x020
#define FCEU_IQNMI2 0x040 // Delayed NMI, gets converted to *_IQNMI #define FCEU_IQNMI2 0x040 /* Delayed NMI, gets converted to *_IQNMI */
#define FCEU_IQNMI 0x080 #define FCEU_IQNMI 0x080
#define FCEU_IQDPCM 0x100 #define FCEU_IQDPCM 0x100
#define FCEU_IQFCOUNT 0x200 #define FCEU_IQFCOUNT 0x200