Error in F-1 Race (1984)

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Error in F-1 Race (1984)

Post by zeroone »

Here's another one:

Minna no Taabou no Nakayoshi Daisakusen

requires [$0011] = $FF or it won't start up.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Error in F-1 Race (1984)

Post by koitsu »

I've begun adding these games to the wiki, with references. I urge others to edit the details here, and add relevant entries. The more accuracy, the better. http://wiki.nesdev.com/w/index.php/Game ... RAM_values
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Error in F-1 Race (1984)

Post by thefox »

The Terminator 2 problem from viewtopic.php?p=180752#p180752 kind of fits the picture. The problem there was that they were calculating a checksum as a simple sum of the related bytes, making it think that a stored checksum of the data was correct when RAM was initialized to all zeros.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Error in F-1 Race (1984)

Post by koitsu »

thefox wrote:The Terminator 2 problem from viewtopic.php?p=180752#p180752 kind of fits the picture. The problem there was that they were calculating a checksum as a simple sum of the related bytes, making it think that a stored checksum of the data was correct when RAM was initialized to all zeros.
Read the post: I'd say that *definitely* qualifies. If you could add that one to the wiki, that'd be awesome. :)
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Error in F-1 Race (1984)

Post by zeroone »

Here's another mystery ROM:

Thunderbolt 2.7z <Thunderbolt 2 (Ch) [!].nes>

It works in some emulators and not others. All the other mapper 115 ROMS that I can find appear to work in most emulators. I suspect initial main memory, VRAM or mapper register values may have something to do with the discrepancy. But, I haven't been able to nail it down.
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Error in F-1 Race (1984)

Post by zeroone »

Multi-Game Pirate Carts.7z <45-in-1 (JY-120A) (Unl) [!].unf> is another ROM that appears sensitive to initial conditions. But, I can't figure out how FCEUX or Nestopia is able to run it.
User avatar
TakuikaNinja
Posts: 87
Joined: Mon Jan 09, 2023 6:42 pm
Location: New Zealand
Contact:

Re: Error in F-1 Race (1984)

Post by TakuikaNinja »

zeroone wrote: Thu Dec 29, 2016 10:06 am Here's another one:

Minna no Taabou no Nakayoshi Daisakusen

requires [$0011] = $FF or it won't start up.
Sorry to dig up a thread after 6~7 years, but here is an explanation for this odd reliance on initial RAM values.
This game enables NMIs in the reset handler while waiting for the PPU, causing the NMI handler to kick in before RAM is initialised. The NMI handler expects $10 & $11 to contain values > 0 (possibly some kind of NMI ready flag?) and will hang the game if the emulator initialises it with $00. The fix is to disable NMIs before the PPU wait delay loops and re-enable them afterwards (the game already does the latter). I have submitted a patch to RHDN.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Error in F-1 Race (1984)

Post by NewRisingSun »

That is nice, though a bit superfluous, as an official PRG1 revision of the game has since been found and included in No-Intro that no longer has this requirement.

(Edit: spelling error corrected)
Last edited by NewRisingSun on Tue Jan 10, 2023 2:11 pm, edited 1 time in total.
User avatar
TakuikaNinja
Posts: 87
Joined: Mon Jan 09, 2023 6:42 pm
Location: New Zealand
Contact:

Re: Error in F-1 Race (1984)

Post by TakuikaNinja »

Ah, I see. I never thought to check for revisions since the NESdev wiki page on game bugs didn't mention any for this game. Whoops.
Edit: I just checked the rev1 version. The reset fix is pretty much identical to what I did but there seems to be other major changes. I'll keep the patch up for compatibility with rev0 (some translations require this version), plus the documentation regarding the issue.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Error in F-1 Race (1984)

Post by NewRisingSun »

TakuikaNinja wrote: Tue Jan 10, 2023 2:07 pm I never thought to check for revisions since the NESdev wiki page on game bugs didn't mention any for this game.
I have corrected that omission on the wiki.
RetroProf
Posts: 8
Joined: Thu May 11, 2023 2:27 am

Re: Error in F-1 Race (1984)

Post by RetroProf »

rainwarrior wrote: Wed Aug 24, 2016 1:43 pm 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. :P 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.)
Bumping an old topic, but this has info which I need.

I am trying to play Huang Di on a Powerpak flash cart, but it defaults to debug mode. However, i can use Game Genie codes.

What does $100 mean in terms of HEX addresses? If I understand correctly, all I need to do is create a Genie code that writes the value 01 to the address line which corresponds to $100 right? is it 0000:FF? Because that would create a Game genie code of: PAEAAENY

But I don't fully understand what $100 means in terms of the hex address. Once I know the HEX address I can just use a program to generate the needed Game Genie code.

Many thanks in advance.
Joe
Posts: 649
Joined: Mon Apr 01, 2013 11:17 pm

Re: Error in F-1 Race (1984)

Post by Joe »

User avatar
aquasnake
Posts: 515
Joined: Fri Sep 13, 2019 11:22 pm

Re: Error in F-1 Race (1984)

Post by aquasnake »

Joe wrote: Thu May 11, 2023 10:14 am You can't use Game Genie codes to write to $100, but someone replied to your other thread with some Game Genie codes that should fix it.
Game genie cannot lock values below $8000. This is the limitation of its design. As for the emulator, it should be able to modify it to support less than $8000. In actual hardware, due to the fact that address line A15 is a delayed signal, when gating an address below $8000, $8000-$FFFF is momentarily gated in the first 66ns. And game genie expects to lock the data lines as the original comparison value during this time, so it does not support modifications below $8000 on physical hardware

Emulators do not emulate delay of a15 (they cannot emulate delay of only a few dozens of nano second).

However, if an external crystal is introduced to restore A15 through precise counting, then hardware GAME GENIE can also support below $8000
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Error in F-1 Race (1984)

Post by lidnariq »

... no?

First off, Game Genie and anything like it can only replace values from the cartridge: it cannot intercept and replace communication between the CPU, RAM, and PPU.

Second off, the Game Genie doesn't allocate a bit in its format to handle addresses below $8000 - it encodes 15 bits of address, 8 bits of data, 8 bits of match, and 1 bit of "should I care about the match value". The hardware registers don't support more either.

Third off, the Game Genie uses the ability to suppress forwarding M2 to the cartridge in enable its own bootstrap ROM. So M2 has to be passed to the cartridge as normal, which means that patches to CPU addresses $E000-$FFFF will look to the cartridge like access to $6000-$7FFF.
User avatar
aquasnake
Posts: 515
Joined: Fri Sep 13, 2019 11:22 pm

Re: Error in F-1 Race (1984)

Post by aquasnake »

lidnariq wrote: Thu May 25, 2023 8:45 pm ... no?

First off, Game Genie and anything like it can only replace values from the cartridge: it cannot intercept and replace communication between the CPU, RAM, and PPU.

Second off, the Game Genie doesn't allocate a bit in its format to handle addresses below $8000 - it encodes 15 bits of address, 8 bits of data, 8 bits of match, and 1 bit of "should I care about the match value". The hardware registers don't support more either.

Third off, the Game Genie uses the ability to suppress forwarding M2 to the cartridge in enable its own bootstrap ROM. So M2 has to be passed to the cartridge as normal, which means that patches to CPU addresses $E000-$FFFF will look to the cartridge like access to $6000-$7FFF.

nope

The 6-bit(16-base digit) code only implements replacement, which does not require time-division interception of the data line and is hijacked throughout the entire time period.

And the 8-bit code needs to be compared first and then intercepted, which requires gating first, and then hijacking during the rest positive pulse of m2
The above is the case of multiplexing data lines

When using independent data line method, input data line to the FPGA, and then output data line from the FPGA to the CPU, the 8-bit code can be hijacked throughout the entire process

The independent data line method needs spatial redundancy design(which takes 8 IOs more), while multiplexing data line design requires time-division judgment


2,3:Assuming I want to extend the original game genie implement (something similar to save state), then I will definitely need romsel pin and allocate the bios code space in $4020- $4FFF

This only requires software modifications, but it is not something unrealizable
Post Reply