PPU Addresses Diagram from Nesdev Wiki

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Aliasmk
Posts: 21
Joined: Wed Aug 26, 2015 8:24 am
Location: Ontario, Canada
Contact:

PPU Addresses Diagram from Nesdev Wiki

Post by Aliasmk » Sat Oct 17, 2015 3:06 pm

In my attempts to try to understand how pattern and nametables work I've opened up a few games in FCEUXD to view the ppu memory and pattern tables. One question that i had was that if the nametable memory for a certain X,Y of the background is 0xFF (256th tile from the pattern table), how does the PPU know whether to read from the left or right pattern table? I noticed also that it looked like for DK the sprites took the left pattern table and the background the right.

The answer, I think, to my original question comes in the form of this diagram, where I see there is a flag for "Half of the sprite table" which i assume sets which half is used only for sprites and which is used for backgrounds. I'm having trouble understanding the context of this diagram though. It looks like a piece of two byte memory, but then where is that memory being read from?

This is the diagram from the nesdev wiki, this is all the section says.

Code: Select all

PPU addresses within the pattern tables can be decoded as follows:
DCBA98 76543210
---------------
0HRRRR CCCCPTTT
|||||| |||||+++- T: Fine Y offset, the row number within a tile
|||||| ||||+---- P: Bit plane (0: "lower"; 1: "upper")
|||||| ++++----- C: Tile column
||++++---------- R: Tile row
|+-------------- H: Half of sprite table (0: "left"; 1: "right")
+--------------- 0: Pattern table is at $0000-$1FFF
Aliasmk- GitHub :: Twitter :: Website
Current ALIAneS Emulator Progress: CPU complete, PPU indev - we have graphics and sprites!

lidnariq
Posts: 9659
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: PPU Addresses Diagram from Nesdev Wiki

Post by lidnariq » Sat Oct 17, 2015 3:18 pm

The "left" vs "right"-ness is determined by the bits in the PPUCTRL register.

(Backgrounds are always read from the half according to the $10s bit in this register. Sprites can come from left, right, or controlled by the individual sprite according to the $20s and $08s bits in the register)

User avatar
Aliasmk
Posts: 21
Joined: Wed Aug 26, 2015 8:24 am
Location: Ontario, Canada
Contact:

Re: PPU Addresses Diagram from Nesdev Wiki

Post by Aliasmk » Sat Oct 17, 2015 3:55 pm

lidnariq wrote:The "left" vs "right"-ness is determined by the bits in the PPUCTRL register.

(Backgrounds are always read from the half according to the $10s bit in this register. Sprites can come from left, right, or controlled by the individual sprite according to the $20s and $08s bits in the register)
Thanks for clearing that up. Any info on that what that diagram is trying to say?

Edit: i think i just figured it out. It refers to each 16 bit address in the VRAM: from a given address, you can derive that info based on the address alone.

I recommend an edit to the wiki that includes an example.
Aliasmk- GitHub :: Twitter :: Website
Current ALIAneS Emulator Progress: CPU complete, PPU indev - we have graphics and sprites!

Post Reply