NES Memory Map

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NES Memory Map
by on (#16706)
Is this the correct memory map for the NES?

$0000-07FF Zero Page, Stack, RAM (Mirrored $0800-1FFF)
$2000-2007 PPU Registers (Mirrored $2008-3FFF)
$4000-401F Sound, Input Registers
$4020-5FFF Expansion ROM
$6000-7FFF Save RAM
$8000-FFFF ROM

1. Do the unused Sound, Inpute registers act like normal RAM?

2. What happens when you read/write to the expansion ROM/save RAM when the cart does not provide any?

by on (#16708)
Maybe this is what you're looking for memory map-wise.

by on (#16711)
Erm, no. That appears not only to be massively incomplete, but also rather inaccurate. Anyone else?

by on (#16712)
WedNESday wrote:
Erm, no. That appears not only to be massively incomplete, but also rather inaccurate. Anyone else?


Then that needs updated, as it seems it's been on there since that page started. Perhaps you want this then:

http://en.wikibooks.org/wiki/NES_Progra ... Memory_Map

Hopefully that's more accurate.

EDIT: Then again, some of that looks like it's labeled incorrectly too.

by on (#16713)
Thanks, but neither answer my questions.

by on (#16715)
It would be more precise to say 4020-7FFF is unmapped or undecoded, cartridges can decode whatever they like in that area freely.

I'm sure there has been discussion here regarding R/W open bus, I just can't find it now with search down. That's what to look for regarding accessing unmapped memory.

by on (#16737)
Most mappers do I/O on 4020-5FFF area, as Famicom DiskSystem for example, or even MMC5. I would call it as "Mapper Low I/O" and 8000-FFFF as "Mapper High I/O".

by on (#16738)
You too can edit the article with your findings.

by on (#16739)
Many early Famicom mappers map their single register to $6000-7FFF so you can't dismiss the area as being WRAM only.

by on (#16741)
Is $4018-$401F handled by the CPU's built-in I/O, or is it passed on to the cart?

by on (#16742)
tepples wrote:
Is $4018-$401F handled by the CPU's built-in I/O, or is it passed on to the cart?


Passed to the cartridge. The CPU only internally handles $4000-$4017 (and in those cases, it still echoes the bus signals to the cartridge, which can do whatever it wants with them).

by on (#16743)
Every address is passed onto the cart. Since 4000-4017 is fully decoded, 4018-7FFF is free.

by on (#16744)
Thanks for your replies, but this still does not clear anything up. I assume that writes are ignored to these areas when there is no support for them, but what about reads? What is read back from $4018-7FFF when not in use? I have read on the boards before that you get what was last on the databus (which is basically the high byte of the address), but the search feature is down and I can't find it.

by on (#16746)
WedNESday wrote:
What is read back from $4018-7FFF when not in use? I have read on the boards before that you get what was last on the databus (which is basically the high byte of the address), but the search feature is down and I can't find it.

That's correct. However, indexed reads that cross a page boundary return the high byte of the base address, not the effective address, because the effective address is never put on the data bus. For instance, the following code garbage-reads from $4C40 and then reads from $4D40 but will load the value #$4C on most mappers:
Code:
  ldx #$C0
  lda $4C80,x

by on (#16755)
As Q said, it's passed to the cartridge, so you can't assume anything. What's logical is to write a test program into your NES development "kit" to fire off 4018-5FFF writes and see what happens "for your pleasure". By taking a SMB board, it might reproduce the effect you wanna check in. About 6000-7FFF area, yes, it's still used as mapper I/O registers, don't count trained ones.

by on (#16946)
What happens when the registers that are supposed to be 'write only' are read from (and vice versa)? I would assume that the opcode (say A5h) would inc the PC and CC normally but leave the A untouched. I would also assume that opcode 85 would leave the read only memory location unchanged.

by on (#16947)
WedNESday wrote:
What happens when the registers that are supposed to be 'write only' are read from (and vice versa)?


Open bus.

The read gets the last value on the bus.
The write goes nowhere

by on (#17276)
Fx3 wrote:
What's logical is to write a test program into your NES development "kit" to fire off 4018-5FFF writes and see what happens "for your pleasure".


Didn't realize I even had one.

Here is what I conclude to happen. Reading from memory locations $2000, $2001, $2003, $2005, $2006 and $4018-7FFF, when there is no Expansion ROM or SRAM will always return the last value on the databus. Writes to invalid locations have no effect.