CPU ram Initial value is 0x00?
Moderator: Moderators
CPU ram Initial value is 0x00?
fceux is 0x00 (NTSC)
nestopia is 0xFF (NTSC),or 0x00(DENDY)
Which is the right one?
nestopia is 0xFF (NTSC),or 0x00(DENDY)
Which is the right one?
Re: CPU ram Initial value is 0x00?
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.
I have no idea of the initial state of the Dendy or other famiclones though.
Re: CPU ram Initial value is 0x00?
It doesn't matter. All memory must be initialized by software.
Re: CPU ram Initial value is 0x00?
No, initialization is different, a game may be differentZepper wrote:It doesn't matter. All memory must be initialized by software.
Re: CPU ram Initial value is 0x00?
Argh, read what Bregalad wrote.zxbdragon wrote:No, initialization is different, a game may be differentZepper wrote:It doesn't matter. All memory must be initialized by software.
Re: CPU ram Initial value is 0x00?
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.
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.
Re: CPU ram Initial value is 0x00?
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.
Final Fantasy 1 uses uninitialized memory for the RNG.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: CPU ram Initial value is 0x00?
0-1 Will not happen in fceuxDwedit 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.
Re: CPU ram Initial value is 0x00?
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!
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: CPU ram Initial value is 0x00?
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.
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.
Re: CPU ram Initial value is 0x00?
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.)
(I use "unspecified" with the meaning that the C and C++ standards use.)
Re: CPU ram Initial value is 0x00?
If a game runs differently depending on the initial contents of RAM, it'll run differently on different NES consoles.zxbdragon wrote:No, initialization is different, a game may be differentZepper wrote:It doesn't matter. All memory must be initialized by software.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: CPU ram Initial value is 0x00?
In theory it may run differently on the same console at different times too.AWJ wrote:If a game runs differently depending on the initial contents of RAM, it'll run differently on different NES consoles.
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.