Offline
Tokyo, Japan

I am starting to dabble a little with some of Nocarriers awesome NES tools but I am struggling a bit with some of the terminology and basic concepts. If someone who knows their stuff (shiru, no carrier, batsly, animal style) could do an almost eli5 like explanation (or link to one) of things like what's a tile set / name table / chr and maybe clarify the limitations with the palette I would be super greatful.

I have had a look around in the nesdev wiki which has loads of super useful info but it seems aimed at people who already passed NES graphics 101.

Thanks!

Edit - I have read this http://nesdev.parodius.com/nesgfx.txt which covers some of the concepts but it skates over them pretty fast...

Last edited by Lazerbeat (Jun 5, 2012 7:26 am)

Offline
Russia, Moscow

Patterns, tiles, characters  - small pieces of graphics that are 8x8 pixels. NES can handle two sets of 256 characters. They are used for backgrounds and sprites. Only one set can be assigned to background or sprites, i.e. you can't use characters from different sets on a single screen (without tricks), but you can use one set for background and other for sprites.

Sprites - small movable objects that are overlayed on the background and can move independently. Graphically one sprite represented with one character 8x8 pixels, taken from one of the character sets. Up to 64 sprites could be displayed on a screen, but only 8 on a scanline (one horizontal line of pixels).

Background - an array of 32x28 cells. Sort of a text screen, one byte per cell - a number of a character in bank. It could be scrolled by two axises, but the cells always keep their relation to each other.

Nametable - part of video RAM that forms the background, 32x28 bytes. There are two nametables (technically four, but console only has enough video RAM for two), to organize a bit larger scroll area, also useful for some tricks.


Tricky part of NES graphics is the color.

There is general palette of 56 colors, defined by the hardware design, and a programmable palette of 32 entries. Each entry could have an assigned color. The entires are divided into two halves - 16 entires for background graphics, 16 for sprites. These further divided by four parts by 4 colors each, these are called palettes too. One sprite can have one of the four sprite palettes assigned. For background it is more complex, palettes assigned to blocks of 2x2 cells rather than individual cells.

Despite there are 32 palette entries, only 25 colors could be displayed at once (without tricks). That's because first color of all four background palettes is always the same, the background color - so 1+3+3+3+3=13 colors for background. First color of a sprite palette considered 'transparent', i.e. you can see background through it - so 3+3+3+3=12 colors for sprites. 13+12=25 colors on the screen at once.

There are many little details as well, ask if you want to know something specific.


You can try and see all these NES graphics components and their relation in action using my NES Screen Tool - a specialized nametable editor that also allow to create graphics.

Offline
Tokyo, Japan

Thanks man! I have a couple of follow up questions. What is the diffference between patterns, tiles and characters and what is a chr file?

Offline
Russia, Moscow

Patterns, tiles, characters - just few different terms for the same thing. In the NES context they are called characters (hence CHR-ROM), and patterns (in NesDev wiki). 'Tile' could mean more than simply a graphics, though - this word is also used to refer to a cell of the nametable.

CHR file is the content of CHR-ROM, contains graphics (characters).

Unusual thing in the NES architecture is that it completely separates program memory from graphics memory. Cartridge has two separate ROMs and two busses for them - one for code and various data (PRG-ROM), and other for graphics (CHR-ROM). CPU can only access the PRG-ROM, while PPU (graphics controller) can only access CHR-ROM. When CPU access to any video memory is needed, it is done indirectly, by asking PPU to do that.

Last edited by Shiru (Jun 5, 2012 8:47 am)

Offline
Tokyo, Japan

Thanks very much, this has been super helpful!

Offline
GNV / FL / USA

Also, this needs to be released some time, but check out this online Flash NES graphics editor: http://fsp.fm/wrk/playpower/

This was something started by Batsly Adams and myself in Processing, then ported to Flash by chootka. It might help you figure out the difference between palette, CHR, nametables, etc.

Offline
Tokyo, Japan

Is the example code you used for you youtube power play tutorials available anywhere? Those videos were super helpful and I wanted to mess with the code a bit!

Offline
GNV / FL / USA

Yeah, should be on the Playpower site for sure. Not home now, but can check later if you can't find them!