8

The postulated address range for CPU ROM (so-called "PRG-ROM") in cartridges is $8000..$FFFF, that is pre-decoded in NES/Famicom and the chipselect is fed to the cartridge.

However, it is quite common for some games to have extra "PRG-RAM" range of $6000..$7FFF. While the chipselect only decodes $8000..$FFFF range, we certainly know when the CPU accesses $0000..$7FFF range by NOT having chipselect. Since all CPU address pins except A15 are also provided to the cartridge, we are able to know exactly which location the CPU accesses.

What is the lowest available to the cartridge CPU address, i.e. how much down to zero the cartridge space may span, whether it would be PRG-ROM, PRG-RAM or cartridge registers?

The $6000 border seems to be just a conveniently-decoded one, is it possible to have for example PRG-RAM from $4100 or so (provided that $4000..$4020 range is occupied with sound and OAMDMA on-chip registers)?

0

2 Answers 2

6

What is the lowest available to the cartridge CPU address, i.e. how much down to zero the cartridge space may span, whether it would be PRG-ROM, PRG-RAM or cartridge registers?

Well, everything up to 4020 is filled, or better internal chip select decoding will fire for each and every address. For example the 2 KiB internal RAM are visible 4 times on $0000, $0800, $1000 and $1800. Similar the 8 PPU registers are mirrored a 1024 times.

The secret here is that RAM and PPU is selected via a 74139 TTL, while the APU is fully decoded within the CPU/APU chip. The 74139 only decodes 3 large areas ($0000-1FFF, $2000-$3FFF and $8000-$FFFF) to select RAM, PPU and cardridge. No provision is needed for the APU as this is already done on chip.

The $6000 border seems to be just a conveniently-decoded one, it is possible to have for example PRG-RAM from $4100 or so (provided that $4000..$4020 range is occupied with sound and OAMDMA on-chip registers)?

Yeah, that's the fun part, unlike all other internal hardware, the APU is decoded down to A5, thus realy only reacting to $4000..$401F. Therefore everything from $4020 up to $7FFFcan be used with the 'PRG-RAM' trick for a total of 32KiB-32B.

Well, with one exception: The Famicom Disk System. Its hardware registers are located after $4020. AFAIR less than $20 Registers are used, but the address decoding is only down to a whole pave, so all all addresses $4020-40FF are taken.

Bonus Question:

So why is there no cardridge using the Space between $4020 and $5FFF ?

Well, adding 8 KiB at $6000 is a simple RAM Chip (6264) and one 7400 TTL. Adding another 8 KiB (minus 32 B), would not only require another 6264, as there are no 16 KiB RAMS (or at least wheren't back then) and at least two TTL for decoding. Not to mention the space needed to crap that into a cardridge. Money better spend for more ROM to enhance the game.

6
  • 2
    There are also a few unused registers in the I/O register range, namely $4009, $400D, and $4018-$401F. These registers are open-bus, so a cartridge technically could put stuff there if it really wanted to. $4000-$4014 could also be used for read-only registers, since those APU registers are write-only. (Sources: wiki.nesdev.com/... and forums.nesdev.com/...).
    – NobodyNada
    Jan 15, 2018 at 21:35
  • 1
    @NobodyNada Right. Except, AFAIR, $4018..1F is used on some development hardware, thus might not work. And serious, if one can't get his stuff done in 16736 Bytes, then 10 (or so) more bytes won't help much. Would they?
    – Raffzahn
    Jan 15, 2018 at 21:39
  • Then, how is this strict APU decoding (down to $4000..$401F) repeatable at different clones? I mean PAL NES, then 90ies famiclones including Dendy, then recent clones that have lots of games on-board?
    – lvd
    Jan 15, 2018 at 22:02
  • @lvd ?? Erm, I somehow fail to understand your question. Could you elaborate what you want to know?
    – Raffzahn
    Jan 15, 2018 at 22:15
  • Well, could there be differences in APU decoding through all the existing (chinese) clones? Specifically, the ones that would prevent having PRG-RAM start at say $4100.
    – lvd
    Jan 15, 2018 at 23:27
3

The cartridge can map anything anywhere, however there's restrictions if it overlaps existing hardware in the console.

Write-only registers could be mapped in a way that overlaps RAM in $0000-$1fff range.

Read-only registers could be mapped overlapping $2000, $2001, $2003, $2005 and $2006 PPU registers (or any of their mirrors), as well as $4000-$4014 pAPU registers, as those are open-bus, meaning the PPU will leave the data bus alone when reading from those addresses.

Write-only registers could be mapped overlapping $2002 PPU register or any of its mirror.

Anything $4018-$ffff is free for the cartridge to use.

In practice, ROM or RAM chips are at least 8kb (8192/$2000 bytes) in size, so mapping anything other than registers below $6000 is complicated/wasteful and not worth it, which is why it's typically never done. But Nintendo MMC5 mapper maps it's internal 1k of Expansion RAM at $5c00-$5fff.

So the answer of your question is:

  • For write-only registers, address $0000 is the minimum.
  • For read-only registers, address $2000 is the minimum
  • For r/w registers, ROM and RAM, $4018 is the minimum
  • In practice for ROM and RAM the chip size granularity prevents using address low in range because it means complicated decoding and loss of some bytes from the chip, so unless it's integreated in an ASIC, $6000 can considered to be the practical minimum

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .