Overscan

From NESdev Wiki
Revision as of 15:20, 12 June 2009 by Banshaku (talk | contribs) (Created page with 'The NES PPU always generates a 256x240 pixel picture. But there is a recurring misconception that the picture is 256x224 pixels on NTSC. This article explains how both ar...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The NES PPU always generates a 256x240 pixel picture. But there is a recurring misconception that the picture is 256x224 pixels on NTSC. This article explains how both are true.

Consumer TV monitors draw the picture slightly larger than the screen, with some of the picture hidden by the border. This is called "overscan".[1][2] The BBC recommends keeping a 5 percent margin inside the screen and putting all important information, such as text, within the center 90 percent of the width and height of the screen.[3] Most TVs show slightly more than 90 percent, so make sure to keep any glitch pixels well outside this margin.

NTSC

CCIR 601 is a standard for digital processing of component video signals. It describes a way to sample NTSC video at exactly 135/11 MHz to produce 640x480 square pixels in the "clean aperture".[4] This means the signal associated with one scanline is 640/(135,000,000/11) s = 52.148 microseconds long.

The NTSC color subcarrier is at 39,375,000/11 Hz = 3.5795 MHz. The NES master clock is always 6 times the color subcarrier frequency because there are 12 hues on the NES PPU, and the color generator uses a double-pumped counter to generate the hue signal. So the PPU's pixel rate is 1/4 of the master clock, or 6/4 of the color subcarrier, or 39,375,000*6/4/11 = 5.3693 million pixels per second.

Multiplying the pixel rate by the scanline length gives 39,375,000*6/4/11*640/(135,000,000/11) = 280 pixels per scanline. (The PPU puts signal in 256 of these and color 0 in the rest.) This makes the pixel aspect ratio on a 4:3 TV to be 240/280*4/3 = exactly 8:7, or about 1.143:1.

For a 280x240 pixel picture, the 90 percent safe area is 252x216 pixels. Due to a quirk of the NES PPU's sync generation that places the image roughly two pixels to the right of center, these 252 pixels are actually the leftmost ones. Some CRT TVs have rounded corners; it's a good idea to keep text away from the corners if possible.

This, however, doesn't give developers a free pass to ignore glitches caused by background mirroring. Actual TVs show about 224 lines of the signal, hence the commonly reported 256x224 resolution. But the vertical position may be slightly off center. Emulators and LCD HDTVs tend to use lines 8 to 231, but some TVs have been seen to show lines 12 to 235. In fact, even some CRT SDTVs made in the 2000s show more of the bottom than the top; this may be so that tickers on cable news channels aren't cut off.

PAL

When sampled at 14.75 MHz (768x576) or 7.375 MHz (384x288), PAL video has square pixels. The width of a scanline is 768 pixels, or 768/14750000 seconds, or 52.068 microseconds.

The PAL color subcarrier is exactly 4,433,618.75 Hz. The PAL NES master clock is six times that, and the PPU generates one pixel for every 5 master clock cycles, or 5320342.5 Hz. This makes the width of a scanline 5320342.5*768/14750000 = 277 pixels, and the pixel aspect ratio 7375000/5320342.5 = (59*125000)/(165*64489/2) = 1.3862:1.

The width of the picture is nearly the same as on NTSC, so we need not reconsider horizontal placement. However, the total picture is 288 lines tall, making the safe area roughly 260 lines tall. This means every TV shows blank bars at the top and bottom of the 240-line active area that the NES generates. So for a PAL-only title, the developer need not concern himself with TVs cutting off the status bar, but minimizing artifacts caused by nametable mirroring and sprite pop-on at the top becomes paramount.