PPU memory mirroring

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Elessar
Posts: 11
Joined: Tue Jun 14, 2011 6:42 pm

PPU memory mirroring

Post by Elessar » Tue Jun 14, 2011 6:58 pm

Hi,

I am writing a NES emulator for fun, and I have already have the CPU executing all the instructions correctly according to nestest.nes. Now I am starting to write the PPU, but I find the memory map somewhat confusing.

According to NinTech and other documents, the memory map for the PPU is more or less like this:

Code: Select all

+---------------+---------------+---------------+-----------------------+
|    Address    |   End         |    Size       | Description           |
+---------------+---------------+---------------+-----------------------+
|    $0000      |    $0FFF      |    $1000      | Tile Set #0           |
|    $1000      |    $1FFF      |    $1000      | Tile Set #1           |
+---------------+---------------+---------------+-----------------------+
|    $2000      |    $23FF      |    $0400      | Name Table #0         |  \
|    $2400      |    $27FF      |    $0400      | Name Table #1         |   \
|    $2800      |    $2BFF      |    $0400      | Name Table #2         |    } Size = $1000
|    $2C00      |    $2FFF      |    $0400      | Name Table #3         |   /
+---------------+---------------+---------------+-----------------------+  /
|    $3000      |    $3EFF      |    $3EFF      | Name Table Mirror *1  |  } Size = $0F00
|    $3F00      |    $3FFF      |    $0020      | Palette *2            |
|    $4000      |    $FFFF      |    $C000      | Mirrors of Above *3   |
+---------------+---------------+---------------+-----------------------+
So how does the mirroring work out if $3000-$3EFF is $0100 bytes too short to mirror all of $2000-$2FFF? (Am I missing something obvious?)
"In the high tongue I am Elessar, the Elfstone."

NickMass
Posts: 15
Joined: Tue Mar 30, 2010 7:59 pm

Post by NickMass » Tue Jun 14, 2011 7:24 pm

I believe $3000-$3EFF is simply a mirror of $2000-$2EFF.

User avatar
cpow
NESICIDE developer
Posts: 1099
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Post by cpow » Wed Jun 15, 2011 5:11 am

NickMass wrote:I believe $3000-$3EFF is simply a mirror of $2000-$2EFF.
$3000-$3FFF is a mirror of $2000-$2FFF. The PPU actually does a video ram read above $3F00 into the read buffer, but replaces the data sent back to the CPU with its internal palette data.

Reference: blargg's ppu test, specifically vram_access.nes.

Post Reply