Masterjun
He/Him
Site Developer, Skilled player (1970)
Joined: 10/12/2010
Posts: 1179
Location: Germany
So the subject itself has been brought up by this thread.
adelikat wrote:
For those unaware of the situation, hardware RAM is in an undetermined state on power-on (meaning it is unknown as to whether it is 0 or 1). Most any game is programmed to not assume, and set the desired value before using it. However, some games fail to do this due to bad programming or a small oversight in a particular situation.
My goal with this thread is to find games that use these uninitialized RAM values due to bad programming or because they expected a soft reset (some games put their game name in RAM and then do different things when they find that name in RAM on start-up). As an example I used Super Mario All-Stars where SMB3 reads one of the uninitialized values and if that is 0x80 (so you basically have a 1/256 chance on a real SNES) allows you to change the powerup status when pressing select: Link to video
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Patashu
He/Him
Joined: 10/2/2005
Posts: 4014
As an example I used Super Mario All-Stars where SMB3 reads one of the uninitialized values and if that is 0x80 (so you basically have a 1/256 chance on a real SNES) allows you to change the powerup status when pressing select:
Wow, why does that work? And if it's really a 1/256 chance, couldn't someone dedicated enough on console get this to happen?
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Tub
Joined: 6/25/2005
Posts: 1377
The easiest way to list the games would be to modify the emulator to keep track of initialization, similar to valgrind. For older consoles (NES/SNES), the overhead should be manageable.
Patashu wrote:
And if it's really a 1/256 chance, couldn't someone dedicated enough on console get this to happen?
The 1/256 chance is only true if we assume that every bit has a 50/50 chance to be 1 or 0 before initialization. Due to slight differences in hardware, that's rarely the case. If you want to do it from power-on, your best bet is to buy 256 NESs and hope that one of them favours the 0x80 value you need. It'd be easier to play a different cart, play it a while in the hopes that it sets the correct value, switch to SMB and do a soft reset. Pick a game that uses the same memory address for a known and manipulateable purpose and you're good to go.
m00
Editor, Player (68)
Joined: 1/18/2008
Posts: 663
Tub wrote:
The 1/256 chance is only true if we assume that every bit has a 50/50 chance to be 1 or 0 before initialization. Due to slight differences in hardware, that's rarely the case. If you want to do it from power-on, your best bet is to buy 256 NESs and hope that one of them favours the 0x80 value you need.
Not even. Default values at power-up are not guaranteed but will likely favor a "blank" value (usually 0x00 in SRAMs) - so this is likely unattainable in practice. Also this is probably a debug code that could be poked by the debugger that was left in. EDIT: I was thinking of NES for some reason even though SNES is in the title. SNES uses a PSRAM so it is more accurate to say that yes, the power-on states will differ by console, and consoles will independently have different patterns, favorite set/reset bits, and so on.
true on twitch - lsnes windows builds 20230425 - the date this site is buried
HHS
Active player (282)
Joined: 10/8/2006
Posts: 356
Secret of Mana will fail to zero a bunch of variables if you do a soft reset during the title screen.
marzojr
He/Him
Experienced player (748)
Joined: 9/29/2008
Posts: 964
Location: 🇫🇷 France
True wrote:
Not even. Default values at power-up are not guaranteed but will likely favor a "blank" value (usually 0x00 in SRAMs) - so this is likely unattainable in practice. Also this is probably a debug code that could be poked by the debugger that was left in.
Not quite: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.164.6432 Note that SRAM is random, but not entirely random -- some bits favor zero some favor one, some are neutral and therefore random. Given a specific chip, a given initial power on state might not be realizable, even if it is on another, because of the skewed bits.
Marzo Junior
Skilled player (1706)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Well, after reading this submission text:
A slightly different route. Also because of uninitialised RAM, we got an extra fight in the cave
So Final Fantasy VI (III (U)) can be added to the list.
GoombaHeart
He/Him
Joined: 7/11/2015
Posts: 131
Location: Winters
What about N64 games? Maybe it'd be worth asking Tyler Kehne about this.
Shit tier TASer.
Player (33)
Joined: 2/16/2012
Posts: 282
Hagane is affected by uninitialized memory in a variety of ways. The main thing it changes is the RNG seed (it is 0 in most cases, but is not initialized), however I have had several instances of very odd behavior with no other changes to the system (ie, just from a soft reset or quick hard reset). For example, gameplay playing at roughly 1/8 speed, collision detection being just plain wrong, and other things. I have a video somewhere if necessary.
Editor, Player (68)
Joined: 1/18/2008
Posts: 663
marzojr wrote:
True wrote:
Not even. Default values at power-up are not guaranteed but will likely favor a "blank" value (usually 0x00 in SRAMs) - so this is likely unattainable in practice. Also this is probably a debug code that could be poked by the debugger that was left in.
Not quite: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.164.6432 Note that SRAM is random, but not entirely random -- some bits favor zero some favor one, some are neutral and therefore random. Given a specific chip, a given initial power on state might not be realizable, even if it is on another, because of the skewed bits.
Well, we were talking SRAM. I mentioned "likely favor" and not "always favor." But I was wrong above for another reason and edited my post; the SNES uses PSRAM. so it is a different beast. Still, yes, for particular SRAMs specific bits may be favored to be 1 but SRAMs used in NES (and in fact many SRAM) have a very high percentage of bits being statistically always 0 at power-on. The probability of any specific bit being high quite low even console-to-console. What I mentioned regarding SRAM and what you mention regarding SRAM are not mutually exclusive.
true on twitch - lsnes windows builds 20230425 - the date this site is buried
Skilled player (1706)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Active player (251)
Joined: 12/13/2016
Posts: 352
Just saw this thread, and suppose for documentation purposes we should add Tales of Phantasia to this list. It uses the uninitialized values at 0x83-0x84 to seed its RNG, and also appears to save the uninitialized value at 0x3c9 and use it for something (haven't checked what, it is at least not the primary RNG, but movies do desync if you hex that value at the beginning).
Active player (251)
Joined: 12/13/2016
Posts: 352
As one might have guessed, the same phenomenon of uninitialized RAM being used to generate RNG occurs with Star Ocean (SNES); the addresses in question this time are 0xB8-0xB9
Post subject: Re: SNES games that are bad at initializing RAM
Skilled player (1706)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Masterjun wrote:
As an example I used Super Mario All-Stars where SMB3 reads one of the uninitialized values and if that is 0x80 (so you basically have a 1/256 chance on a real SNES) allows you to change the powerup status when pressing select: https://www.youtube.com/watch?v=eSdFdJGr5xA
Late, but is it possible to obtain that value of 0x80 anywhere in the All-Stars game itself, without relying on a different game?
Jigwally
He/Him
Active player (417)
Joined: 3/11/2012
Posts: 119
Couldn't you test this by writing an Lua script that alerts you to any memory addresses that are read prior to being written to?