Backgrounds

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Backgrounds
by on (#96183)
I'm getting really confused as to how backgrounds work and how they're related to name tables and attribute tables and where they're loaded and how to make them! I have some vague ideas, but nothing I can implement in code because I don't really know how it all fits together.

Are there a pertinent set of documents I should read? Direction is appreciated.

EDIT: I'd also like to know what kind of tools I can use for creating backgrounds, but the information about how things are arranged is more important because I could conceivably just write my own implementation.

by on (#96184)
The "pattern table" (aka "CHR") is a series of 8x8 pixel graphics. Each pixel can be one of 4 colors, where color 0 is "transparent". Each 8x8 graphic can be thought of as a "tile".

The "name table" is a 32x30 array of tiles which make up the screen.

For example... if you want to have a screen that is blank, except for a message that says "Press Start", your nametable might look something like this:

Code:
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000Press0Start0000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000


Where '0' coresponds to a "blank" tile in your pattern table, and each letter in the "Press start" text coresponds to a tile that has that letter.


There are 4 BG palettes to choose from, and the attribute table assigns a palette to each tile on the nametable. It's a little involved how the attribute table works... its layout is funky. It's outlined on the wiki (and in pretty much every document that talks about basic PPU functionality).


EDIT:

As for tools, sorry but I am not familiar with any as I don't actually do nesdev -- I do emudev.