This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

NES RAM

NES RAM
by on (#80491)
There is something I don't get about RAM in the NES... Why is the addresses from 0x0000 to 0x07FF mirrored three times ?

by on (#80492)
Usually it comes down to what is easier from hardware point of view. Mirroring happens naturally when addresses are not completely decoded (using less hardware resources).

by on (#80494)
Here's my attempt at explaining this: post link

by on (#80502)
There's only 2kb of internal ram, which is $800 bytes. This is because, at the time, 2kb was cheaper than 4kb or 8kb, and for a new game console, that's important.

The range 0000-1FFF spans 8kb, and is mapped to internal ram, but the NES only has a 2kb ram chip in it. To specify a number between 0000-1FFF, you need 13 bits. However, the 2kb ram chip only takes in 11 bit adresses. So to keep things simple, the NES only connects 11 of its address bits to the ram chip.

This means that the bits higher than the 11th bit are ignored by the ram, so the byte at address $0000 also appears at $0800, $1000, and $1800, since the only difference between those addresses is the state of the 12th and 13th bits, which the ram chip doesn't look at.

by on (#80503)
You could replace the internal RAM with a 8K SRAM if you wanted to and had homebrew that would utilize it. It might break a game if it relies on RAM being mirrored. But you could install switches to fix this. But since it's easier to just put RAM in the cartridge that makes more sense.

by on (#80505)
MottZilla wrote:
You could replace the internal RAM with a 8K SRAM if you wanted to and had homebrew that would utilize it. It might break a game if it relies on RAM being mirrored. But you could install switches to fix this. But since it's easier to just put RAM in the cartridge that makes more sense.

The gameboy actually had a full 8kb of internal ram. As a result, it was easier to make complex games with large maps and lots of dynamic objects. One potential drawback is that programmers no longer needed to be clever and efficient with their ram utilization. A benefit obviously would be that the cartridges would be cheaper, since they would rarely need to contain extra ram, unless you want battery-backed sram.

However, the gameboy came out 4 years after the NES, so Nintendo could put more ram in the units and still have them be affordable, thanks to Moore's law.

by on (#80514)
I guess the Famicombox (sorta like the Playchoice-10, but intended for hotel rooms or whatever) actually has 8kB of RAM. I wonder why though. It's kind of a screwed up design anyways (carts can't use IRQ, for one thing).

by on (#80515)
Drag wrote:
One potential drawback is that programmers no longer needed to be clever and efficient with their ram utilization.


That doesn't really matter though...in fact if you think about it it'd be a shame to NOT use that extra ram. I don't see how being less efficient is bad if it truly doesn't matter and makes your life easier (allowing you to concentrate on other aspects of the programming)