Need clear answers on everything 'display'.

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
captainrhythm
Posts: 5
Joined: Thu Oct 23, 2008 11:00 pm

Need clear answers on everything 'display'.

Post by captainrhythm »

I'm in the middle of developing NES mock up graphics for a musical
project I'm nearly finished with. I'm trying to make the mock ups to
be as accurate as possible (they're for the 'game's' manual and box).

I've been reading all kinds of information to track down normalized
standard specifications. I've learned a lot, but there's a lot of conflicting
information as well; I suppose it's because of mappers, and home
brew's interest in pushing limitations.


What I need to know boils down to practical stuff.


Do you have to choose between 8*8 and 16*8, and only exclusively
use one or the other for all items on screen?

I've read both that you can only have 16 colors on screen at a time,
and 25; 13 for the background and 12 for the sprites.

64 sprites on screen at a time. This is confusing. 64 background tiles
and sprites (player objects, enemies) combined?

4 colors per palette, 1 palette per sprite?

256*240, but some games only used 256*224. What is the split like?
How many games ignored those 16 lines? If it's like only 1/3 I'll add them, etc.


Side topic: Anyone else dislike the term "chip tune"? I hate it.
Every time i hear it, it automatically gets associated with bland and
cheesy. There are some very talented composers out there in the
chip tune community, but more often then not I find that the music
is only listenable because of the "chip" in them, not the music.
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Welcome,

One of the PPU register bits determines whether or not you're using 8x8 or 8x16 sprites, so yes, it is either the whole screen 8x8 or the whole screen 8x16 sprites.

Only 16 colors at once? There are 32 palette entries, but the first color of every 4 entries is the same. The first 16 colors are used by the BG, so color #0 as it's commonly referred to as will be displayed. The next 16 colors are used by sprites, so color #0 for them is not displayed (it's invisible). But all together, yes, 12 for sprites as color #0 is not displayed for them, 13 for BG because color #0 is displayed for it.

There are 960 different tile entries for the BG. You have 256 different tiles to choose from to place on the BG. You do have 256 different tiles to choose from for sprites, but only 64 sprites can be displayed on screen at one time.

Actually, 3 colors per sprite palette, one palette per sprite. Remember, the first color of a sprite palette is invisible. Remember though that you can layer sprites to produce more colors. Though this might interfere with the sprite per scanline limit.

As for the display, on lots of NTSC TVs, the top and bottom 256x8 pixel rows aren't displayed. I'm pretty sure most games acknowledge those rows still as if they were to be displayed. Though there are games like Final Fantasy which use vertical mirroring that show glitches in those two rows, so it's best to play that with the rows undisplayed.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Need clear answers on everything 'display'.

Post by tokumaru »

I'll try to use short answers, to avoid confusing you even more.
captainrhythm wrote:Do you have to choose between 8*8 and 16*8, and only exclusively
use one or the other for all items on screen?
This setting only affects the 64 sprites, and yes, tipically you use the same setting for the hole screen. If your program splits the screen (like the status bar in a game), you could change this setting at the time of the split.
I've read both that you can only have 16 colors on screen at a time,
and 25; 13 for the background and 12 for the sprites.
There are 4 palettes for the background, and 4 for the sprites. Each palette is 4 colors, but the first color is always transparent, so you might think of them as having only 3 actual colors. There is also a background color, visible whenever the background uses the transparent color.

Background: 3 colors * 4 palettes + background color = 13 colors
Sprites: 3 colors * 4 palettes = 12 colors

There you have it, 25 colors.
64 sprites on screen at a time. This is confusing. 64 background tiles
and sprites (player objects, enemies) combined?
The background has nothing to do with this. The NES always uses 8x8 pixel tiles to draw everything. At any given time, there are 256 of them for the background and 256 for sprites.

The NES supports 64 "floating entities" (sprites), that can either be 8x8 (using 1 tile out of the 256) or 8x16 (using 2 tiles out of the 256).
4 colors per palette, 1 palette per sprite?
Yeah, but one of the colors is always transparent, so it's actually 3 colors. Keep in mind that the sprites are the things that float independently from the background. In background tiles, the palettes are applied to squares of 2x2 tiles, meaning that each 16x16 pixel area uses only 3 colors (from the chosen palette) + the background color.
256*240, but some games only used 256*224. What is the split like?
How many games ignored those 16 lines? If it's like only 1/3 I'll add them, etc.
Some TVs will hide those lines, but don't count on it. The basic rule is: If you can, avoid garbage in those lines, but don't pretend they don't exist. Treat them like part of the picture, just don't place anything important there.

I believe you'll have a better understanding of this if you play for a while with an emulator with good PPU debugging features. Grab FCEUXD and try a few games with it. Open up the PPU viewer and the Nametable viewer. By looking at the pieces, try to undesrtand how the image is formed.
captainrhythm
Posts: 5
Joined: Thu Oct 23, 2008 11:00 pm

Post by captainrhythm »

Thanks a lot folks. I really wish this information was going towards an
actual game, oh well.

I'm sure some of this type of information you learn as you go, but it'd be
nice if some of the documents detailed these things a little more plainly. I
mean, I must have read 10 or so descriptions of the PPU workings and 20+
screen shots and still came up short.

One follow up question; can there be 256 unique tiles for the background
displayed at once? Or do they just add up to 256 allowed on screen at a
time, duplicated how ever many times?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

captainrhythm wrote:can there be 256 unique tiles for the background
displayed at once? Or do they just add up to 256 allowed on screen at a
time, duplicated how ever many times?
There is a "library" of 256 unique tiles, but each screen has space for 960 (32x30), so there must be some repetition. This is usually not a problem for games, because they have many repeating blocks, a lot of sky, and so on.

There are ways to get around this limitation though. Through special tricks, it's possible to change your "library" multiple times as the image is rendered, so that you can use more than 256 tiles in a single screen (although still only 256 at any given time). There is also a somewhat uncommon mapper, the MMC5, that has a special video mode where up to 16384 unique tiles are available at a time. In fact, the MMC5 can change a lot of other graphical aspects of the NES, so much that many of the answers we gave you already would be different if considering this mapper's capabilities.

But you surely don't want to be confused by the MMC5, so we'd better focus on what a stock NES can do.
captainrhythm
Posts: 5
Joined: Thu Oct 23, 2008 11:00 pm

Post by captainrhythm »

Indeed about the MMC5. It'd be cool if I went into that much detail to
specify the mapper for the mock up, but that adds another layer of
explanation to the recipients of the project.

They aren't as big of NES's inner workings as fans of the games and system.
Post Reply