It is currently Thu Oct 19, 2017 3:55 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Fri Sep 04, 2015 5:07 am 
Offline

Joined: Mon Dec 12, 2011 8:15 pm
Posts: 304
fceux is 0x00 (NTSC)
nestopia is 0xFF (NTSC),or 0x00(DENDY)

Which is the right one?


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 5:09 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7230
Location: Chexbres, VD, Switzerland
The memory is filled randomly with values which varies from system to system, usually it's $ff but with some bits randomly clear. This is not just CPU RAM, but also VRAM, as both are materialized 6116 chips on the NES' motherboard.

I have no idea of the initial state of the Dendy or other famiclones though.


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 5:17 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
It doesn't matter. All memory must be initialized by software.


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 5:19 am 
Offline

Joined: Mon Dec 12, 2011 8:15 pm
Posts: 304
Zepper wrote:
It doesn't matter. All memory must be initialized by software.

No, initialization is different, a game may be different


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 5:23 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
zxbdragon wrote:
Zepper wrote:
It doesn't matter. All memory must be initialized by software.

No, initialization is different, a game may be different


Argh, read what Bregalad wrote.


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 5:35 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10057
Location: Rio de Janeiro - Brazil
AFAIK the initial contents of RAM can change depending on how the chip is manufactured, the temperature, and a whole lot of other unpredictable analog variables. There are no "official" values an emulator can use, which is why different emulators use different values.

Games aren't supposed to rely on uninitialized memory, unless they're using it as a source of randomness (the randomness is quite poor though, since many addresses tend to be either $00 or $ff, with few flipped bits, and the same memory location tends to assume the same value every time). If they do rely on it, and can possibly misbehave with any values, then that's a bug.


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 5:57 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3943
Bootleg versions of games ripped from multicarts often rely on uninitialized memory, since the menu program would initialize them. Hence World 0-1 in bad versions of Super Mario Bros.
Final Fantasy 1 uses uninitialized memory for the RNG.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 6:17 am 
Offline

Joined: Mon Dec 12, 2011 8:15 pm
Posts: 304
Dwedit wrote:
Bootleg versions of games ripped from multicarts often rely on uninitialized memory, since the menu program would initialize them. Hence World 0-1 in bad versions of Super Mario Bros.
Final Fantasy 1 uses uninitialized memory for the RNG.


0-1 Will not happen in fceux


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 6:22 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3943
FCEUX uses a 0000 FFFF 0000 FFFF pattern that happens to put the world byte as 0, so it starts on 1-1. Real hardware would probably have FF there, so it would start at 0-1.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 8:54 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5718
Location: Canada
There's some valid reasons not to entirely initialize memory.

The most common is to retain some state after reset, like how Mario Bros. will remember which world you got to for the "continue" cheat code even after you reset. It checks for a very specific "key" value somewhere in RAM on startup, and if it's there it presumes that you've already been playing and it should leave it how it is. (The key value should be at least few bytes, with a healthy mix of 0 and 1 bits, something unlikely to happen by accident.) This is how the SMB / Tennis "swap trick" works: https://www.youtube.com/watch?v=eEEnEoKSgQs

Games that have a battery backed save will have to deal with uninitialized SRAM at first boot, and after any battery failure. Obviously it shouldn't be initialized if the player already has something saved there. Similar techniques apply in this case.

Of course, there's a bunch of games that just straight up forget to initialize memory, and rely on "lucky" startup values to run correctly.


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 11:49 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19099
Location: NE Indiana, USA (NTSC)
The initial values in CPU RAM ($0000-$1FFF) and VRAM are unspecified. The same is true of PRG RAM (usually at $6000-$7FFF) and CHR RAM on the cartridge unless they're battery-backed.

(I use "unspecified" with the meaning that the C and C++ standards use.)


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 3:05 pm 
Offline

Joined: Mon Nov 10, 2008 3:09 pm
Posts: 429
zxbdragon wrote:
Zepper wrote:
It doesn't matter. All memory must be initialized by software.

No, initialization is different, a game may be different


If a game runs differently depending on the initial contents of RAM, it'll run differently on different NES consoles.


Top
 Profile  
 
PostPosted: Fri Sep 04, 2015 6:53 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5718
Location: Canada
AWJ wrote:
If a game runs differently depending on the initial contents of RAM, it'll run differently on different NES consoles.

In theory it may run differently on the same console at different times too.

In practice, RAM usually initializes mostly to 1s, with a few 0 bits here and there. Most of the time, uninitialized RAM bugs are only dependent on the state of a few bytes, and most of the time they will be $FF.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users 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