Jump to content

NES RAM and MMC3 layout and registers


bruddog

Recommended Posts

Some general infro from CXROM regarding NES ram layout and registers

 

 

I think you are confusing the cpu addressing space with the actual rom addresses. so here is a better explanation:

 

PC = Program Counter

PPU = Picture Processing Unit

APU = Audio Processing Unit

 

the NES has a 16-bit PC which holds the address of the next instruction to be executed. with a 16-bit PC you can only address $0000-$FFFF. here is a break-down of what is what in CPU address space.

 

$0000-$07FF: RAM

$0800-$1FFF: Mirror of RAM

$2000-$2007: PPU registers

$2008-$3FFF: Mirror of PPU registers

$4000-$4017: APU registers/sprite DMA register/controller port registers

$4018-$5FFF: for TSB, there is nothing here

$6000-$7FFF: SRAM

$8000-$9FFF: prg bank 1

$A000-$BFFF: prg bank 2

$C000-$DFFF: prg bank 3

$E000-$FFFF: prg bank 4

so the NES can only "see" $8000 bytes of data that is on the cartridge at a time (mapped to $8000-$FFFF). to get around this, they created special chips called "mappers" to swap in different banks of data into the address space the the NES can see. TSB uses the MMC3 mapper.

 

in my post i usually write NES addresses with a '$' (e.g. $C000) and actual file addresses with "0x" (e.g. 0x08457). now the addresses you see in a hex editor mean nothing to the NES because that data can only be mapped to $8000-$FFFF.

 

$4012 is an NES address. it is part of memory mapped I/O. this means that instead of having special instructions for I/O between the main cpu and the ppu/apu, the programmer just writes the data to an address. the co-processors watch for writes to those addresses and act accordingly.

 

now to add another layer of confusion, the MMC3 has it's own set of memory mapped registers. these registers swap PRG (code/data) and CHR (graphic) banks, changing mirroring modes (has to do with scrolling), enable/disable sram, and set IRQs (interrupt requests). these are mapped to $8000, $8001, $A000, $A001, $C000, $C001, $E000, $E001. so not only can code or data be located at these addresses, but writing to them will have some effect on the MMC3. it will not overwrite what's there since $8000-$FFFF is technically read-only.

 

i hope this clears up the confusion. the nesDev wiki will have a better explanation and more info if you are interested."
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...