NES memory layout and initialization?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
mreiland
Posts: 29
Joined: Wed Dec 17, 2014 3:28 am

NES memory layout and initialization?

Post by mreiland » Sat Mar 21, 2015 6:58 pm

Any good resources?

I'm ready to start implementing a crappy little 6502 emulator (in preparation for an NES), but I'm unsure how memory gets initialized on poweron and load of a script. Where is the stack at in memory, that sort of thing. I'm seeing some reference to it, but I'd like to see a page/article/tutorial dedicated to it specifically if possible.

User avatar
tokumaru
Posts: 11991
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NES memory layout and initialization?

Post by tokumaru » Sat Mar 21, 2015 7:35 pm

Well, there's not much more than this that you need to know. RAM is not initialized at all. The stack is always at $0100-$01FF, but which part of that block is the top of the stack will depend on the value of the stack pointer, which can be initialized to anything by the program.

Also, keep in mind that programs aren't "loaded". In ROM-based systems like the NES, the program is already there when the system is powered on. If bankswitching is used, there can be different parts of a larger ROM visible at different times, but this too isn't "loading", it's more like sliding the ROM behind a window so the CPU can see different parts of it.

User avatar
koitsu
Posts: 4218
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: NES memory layout and initialization?

Post by koitsu » Sat Mar 21, 2015 7:58 pm


mreiland
Posts: 29
Joined: Wed Dec 17, 2014 3:28 am

Re: NES memory layout and initialization?

Post by mreiland » Sun Mar 22, 2015 2:10 am

This is just something I'm doing for fun in my free time, it's not meant to be an actual new NES emulator. I wanted to sink my teeth into something a bit more technical for fun, and this seemed like a good start.

Thanks for the info guys, this will get me started. I should have found that on my own, but for some reason I missed it. I was tired last night, so that may be why.

Post Reply