It is currently Tue Dec 11, 2018 12:47 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Dec 08, 2018 8:32 pm 
Offline
User avatar

Joined: Sat May 04, 2013 6:44 am
Posts: 35
Is anyone familiar with the behavior of Impossible Mission 2 on real hardware?

I just wrote a NINA-001 implementation for my emulator, and while testing the only NINA-001 game, I noticed that the starting map was different in my emulator compared to Nintendulator and puNES, but I don't know which behavior is correct.

Stepping through the game in the debugger, I noticed that it reads from uninitialized PRG-RAM! I haven't been initializing PRG-RAM, since I figured that its power-on state would be unreliable and random.

Without initializing PRG-RAM, my emulator starts the game with the number 4 highlighted in the lower-left. (Is that the current level?) Nintendulator and puNES start the game with number 7 highlighted. There are videos of the game on other platforms, and some seem to start with 1 highlighted, and others with 7 highlighted.

If I initialize PRG-RAM ($6000-$7FFF) to 0, then I get 7 highlighted, like the other emulators. If I initialize to 0xFF, then I get number 1 highlighted, like this C64 longplay. On real hardware with the original cartridge, is the starting number random or fixed, and if it is fixed, what does it start with?


Top
 Profile  
 
PostPosted: Sat Dec 08, 2018 9:08 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7810
Location: Seattle
Real world SRAMs tend to power on with some particular value, but that value depends on the specific vendor, process, and location within the die. All bits will power up with some probability of 1 or 0; for many of the bits this is sufficiently tilted to be reliably 1 or 0.

It could even be the case—who knows?—that AVE used multiple different models of SRAM during manufacture with entirely different behaviors and that all behaviors are "correct".


Top
 Profile  
 
PostPosted: Sat Dec 08, 2018 9:45 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3720
Location: Mountain View, CA
This sounds almost identical to subjects discussed in the past, only that this is about PRG-RAM region and not RAM/ZP region -- but in both cases the behaviour is the same.

The "major" thread on this subject is here -- viewtopic.php?f=3&t=10845 -- but there have been others. Dig around on the forum/search and you'll find others.

There is no "infallible" way to solve this in an emulator. It's recommended you do what Mesen and FCEUX do: let the user choose (in Preferences) what to initialise the RAM values as: all zeros, all ones, or random values. I advocate all zeros, but that will break some games; if you default to the opposite (all ones or random), that breaks other games. You can't do anything about it, and it's not your fault.

Also, I'm going to update this wiki page to note that this game does said thing. That page will interest you, I'm sure.


Top
 Profile  
 
PostPosted: Sun Dec 09, 2018 1:22 pm 
Offline
User avatar

Joined: Sat May 04, 2013 6:44 am
Posts: 35
If the walkthrough on GameFAQs is to be believed, then we can deduce that Impossible Mission 2 relies on PRG-RAM being somewhat random on initialization:
Quote:
You begin the game on an elevator on a random tower. This game is completely random, and I will do my best to offer my solutions to each room as I get to them.


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 10:23 am 
Offline

Joined: Thu May 19, 2005 11:30 am
Posts: 709
I have removed Impossible Mission 2 and Apple Town Story from the Game bugs wiki page. It is clear that these games read from uninitialized RAM to obtain a seed for random number generation, and doing so is not a game bug. I have instead added them to the respective section of the Tricky-to-emulate games page.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Dwedit and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group