LOL by the way FCEUX initializes RAM to this 8-byte repeating pattern, apparently:
00 00 00 00 FF FF FF FF
There's a bunch of variations commented out with some remarks.
It looks like it's been modified a lot of times over the years, also probably is merging comments from different forks.
Code: Select all
// excerpt from fceux.cpp::PowerNES
//dont do this, it breaks some games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; and maybe mechanized attack
//memset(RAM,0xFF,0x800);
//this fixes the above, but breaks Huang Di, which expects $100 to be non-zero or else it believes it has debug cheats enabled, giving you moon jump and other great but likely unwanted things
//FCEU_MemoryRand(RAM,0x800);
//this should work better, based on observational evidence. fixes all of the above:
//for(int i=0;i<0x800;i++) if(i&1) RAM[i] = 0xAA; else RAM[i] = 0x55;
//but we're leaving this for now until we collect some more data
FCEU_MemoryRand(RAM, 0x800);
// fceux.cpp::FCEU_MemoryRand
void FCEU_MemoryRand(uint8 *ptr, uint32 size) {
int x = 0;
while (size) {
*ptr = (x & 4) ? 0xFF : 0x00; // Huang Di DEBUG MODE enabled by default
// Cybernoid NO MUSIC by default
// *ptr = (x & 4) ? 0x7F : 0x00; // Huang Di DEBUG MODE enabled by default
// Minna no Taabou no Nakayoshi Daisakusen DOESN'T BOOT
// Cybernoid NO MUSIC by default
// *ptr = (x & 1) ? 0x55 : 0xAA; // F-15 Sity War HISCORE is screwed...
// 1942 SCORE/HISCORE is screwed...
// *ptr = 0xFF; // Work for all cases
x++;
size--;
ptr++;
}
}
Anyhow, let this be evidence that at least some people aren't satisfied with all 0s or all 1s.
Also evidence of why options are important instead of trying to find some magic RAM startup state that somehow works for everything.
If that 8-byte pattern sounds stupid and arbitrary to anybody, I might point out that it's actually similar to the dominant patterns I get in my Famicom, so I don't think it's quite as stupid as it looks.
(FCEUX is such a bizarre and wonderful codebase. I'm always amazed how well it actually works despite its code being this giant katamari ball of garbage.)