It is currently Sat Dec 15, 2018 11:06 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Mon Feb 11, 2013 6:29 pm 
Offline

Joined: Thu Aug 12, 2010 3:43 am
Posts: 1589
Bregalad wrote:
The initial RAM content will vary from NES to NES, but will be likely the same at power up on the same console.

Are you sure? The whole reason RAM is garbage on start up is because the values aren't stable, resulting in pretty much the equivalent to random. Otherwise RAM would always be filled with 00 or FF at startup, since all cells would be probably stable to the same value.

(there's an exception regarding leaving a value in RAM for really long periods of time can actually affect the value on power-on, but I doubt there's any such place in the NES' 2KB of RAM =P)


Top
 Profile  
 
PostPosted: Mon Feb 11, 2013 6:36 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20880
Location: NE Indiana, USA (NTSC)
eric_j_ in #nesdev tried power cycles, waiting a few seconds after each, and got CF84, 20A7, 3EAE, 4DA1, E72E, 4EE8, FE6A
He noticed that the third digit was far more likely to be even than odd, and I have no idea why that is.


Top
 Profile  
 
PostPosted: Mon Feb 11, 2013 6:55 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7019
Location: Canada
Bregalad wrote:
The initial RAM content will vary from NES to NES, but will be likely the same at power up on the same console.


I don't find this is true, exactly. The same console is subject to random static/capacitance/etc. Individual bits have a tendency to go one way or the other on startup, but there's plenty of uncontrollable environmental factors that can sway them one way or another.


Top
 Profile  
 
PostPosted: Mon Feb 11, 2013 8:48 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
Denine wrote:
blargg wrote:
* Initial RAM contents

When I start reading this topic, I had same idea. But it is not emulated, is it?

You're suggesting that we not program things that depend on things not emulated? Chicken-and-egg situation there. By relying on unemulated features, we give incentive to emulator authors to emulate these things.


Top
 Profile  
 
PostPosted: Tue Feb 12, 2013 12:06 am 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 2097
Location: WhereverIparkIt, USA
blargg wrote:
Denine wrote:
blargg wrote:
* Initial RAM contents

When I start reading this topic, I had same idea. But it is not emulated, is it?

You're suggesting that we not program things that depend on things not emulated? Chicken-and-egg situation there. By relying on unemulated features, we give incentive to emulator authors to emulate these things.


Agreed, I am mystified when this backwards logic is used...


So it looks like you already got your data, but more data is always better ;)

AC92, 0D5F, CC4B, D600, 66C1, 8C67, 3460, 2DCC, 56EA, 726C, E0BC, CB09, F292, B78F, C769, 779A, 04A4, 0C9E, B6F4, 4988, 1955, ACFC, 0318, 0C43...

Those were all from power on/power cycling. I didn't wait a few seconds like eric did....

A few from reset if you're curious: 5969, 5211, 2CE2, 7E96, F3A2, 0DDB, 6CCD, D841, 085E, 9621, C5EA, 1C17, 9308, F903, 0291, 060F, 40F8, B553, D89A, 08CA, 9CB3.

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
PostPosted: Tue Feb 12, 2013 8:09 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20880
Location: NE Indiana, USA (NTSC)
Thanks. So we appear to have something usable as a hardware RNG, at least at power-on. Now all I need are more puns on "Nintendo".


Top
 Profile  
 
PostPosted: Tue Feb 12, 2013 11:47 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7604
Location: Chexbres, VD, Switzerland
tepples wrote:
Now all I need are more puns on "Nintendo".

No, thanks.


Top
 Profile  
 
PostPosted: Tue Feb 12, 2013 2:36 pm 
Offline

Joined: Thu Aug 12, 2010 3:43 am
Posts: 1589
tepples wrote:
Thanks. So we appear to have something usable as a hardware RNG, at least at power-on. Now all I need are more puns on "Nintendo".

What I do on the Mega Drive is take several samples from RAM scattered around (won't waste time reading all RAM!) and add them, gives a good enough value for a seed. Then add it to whatever value is in the seed variable (which is already random anyway). I imagine this should work for the NES too.

On reset the values of RAM aren't random anymore, although you still are unlikely to know what was going on when the system was reset so for all effects and purposes it's the same - and since we add to whatever value was in the seed before, it will still have the random factor from the initial boot up.

The Mega Drive has the added randomness factor that the HV counter (the position of the TV beam) can start at a completely different place each time, so I add that into the mix too. Does the NES have something similar?

(and yes, I'm aware that adding many random sources isn't always a good idea - if the sources are completely different and the output results can't have repeats (e.g. an addition will always yield an unique result for each possible value) this shouldn't be an issue)


Top
 Profile  
 
PostPosted: Tue Feb 12, 2013 2:41 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7604
Location: Chexbres, VD, Switzerland
I'll say it again - the content of RAM is NOT random : http://wiki.nesdev.com/w/index.php/CPU_power_up_state

Nesdev Wiki wrote:
All internal memory ($0000-$07FF) was consistently set to $ff except for a few bytes, which probably vary from console to console:
$0008=$F7
$0009=$EF
$000a=$DF
$000f=$BF


Top
 Profile  
 
PostPosted: Tue Feb 12, 2013 2:49 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20880
Location: NE Indiana, USA (NTSC)
Against how many consoles was that wiki page tested? Besides, this technique relies on "analog effects" of bus conflicts in the PPU.


Top
 Profile  
 
PostPosted: Wed Feb 13, 2013 5:05 am 
Offline

Joined: Thu Aug 12, 2010 3:43 am
Posts: 1589
tepples wrote:
Against how many consoles was that wiki page tested?

Still would mean it isn't safe. Though also you'd need to ask for the flashcart that was used to test - unless it was something that only showed the program itself and nothing else (i.e. as if it was a normal cartridge with pure ROM, no firmware at all), any initialization-time testing goes out of the window =/

Also Nintendo was trying to make hardware as cheap as possible, if they had used some RAM that was that much stable, wouldn't everybody be using RAM that is cleared on power up these days? =X

PS: I notice a really curious pattern in the values that are the exception to the rule:
$08 ... 11110111
$09 ... 11101111
$0A ... 11011111
$0F ... 10111111

What's with that 0? o_O;


Top
 Profile  
 
PostPosted: Wed Feb 13, 2013 5:10 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7604
Location: Chexbres, VD, Switzerland
I think a very close approach to the transistors that makes the SRAM cell only could explain the power up state, and why there is this strange pattern.
Since a SRAM cell is basically a positive feedback loop, only the dimensions of the transistors and parasitic resistors will actually determine if the loop goes one way or the other (I guess).


Top
 Profile  
 
PostPosted: Wed Feb 13, 2013 8:28 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11012
Location: Rio de Janeiro - Brazil
Sik wrote:
if they had used some RAM that was that much stable, wouldn't everybody be using RAM that is cleared on power up these days?

I guess that even though RAM isn't 100% stable, bits have a tendency to go one way or the other, which results in poor randomness.


Top
 Profile  
 
PostPosted: Wed Feb 13, 2013 12:42 pm 
Offline
User avatar

Joined: Wed Feb 13, 2008 9:10 am
Posts: 667
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Most bits in SRAM are at 1 on power up

_________________
http://www.tmeeco.eu


Top
 Profile  
 
PostPosted: Wed Feb 13, 2013 1:02 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7832
Location: Seattle
Sik wrote:
if they had used some RAM that was that much stable, wouldn't everybody be using RAM that is cleared on power up these days? =X

"Guarantee of cleared on power-up" is not the strict opposite of "Powers up with a different value each time"

My take? The only variables you can control in an already-assembled NES that would affect how the RAM would be filled at power up are 1-how Vcc rises when you turn it on, and 2- what temperature the RAM is. Given the way the power switch is wired, 1 is fully predictable. (charge a 100uF capacitor through a 7805 from a 2200uF capacitor)

That said, some really old computers did require that the DRAM boot up with a specific contents.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Banshaku, Google Adsense [Bot], gukingofheart, koitsu and 3 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