7800 compared to the NES

Okay, I've been looking at some NES development docs, so i have a better feel for what the NES can do.

One important item is the NES is more "fixed function" than the 7800, though it appears there are "tricks" which can be done in code or via "mappers" (logic in the cart, mostly for bankswitching, but sometimes for much more) which involve changing the PPU (the NES GPU) state in the middle of the frame. Typically these tricks are CPU intensive since they require tight syncronization between the CPU and PPU. The 7800 has very few "tricks" both because they typically aren't necessary (i.e. the flexibility exists already), and also because the CPU mostly can't change MARIA GPU processing on the fly.

Resolution

The NES has a fixed 256x240 resolution, although not all 240 lines are visible/available on NTSC televisions. The 7800 can display either 160 or 320 pixels per line (changable on a per-line basis in mid-screen if desired). However, in 320 modes, positioning is only on even pixels and the color selection is significantly reduced (artifacts must also be considered). 

NTSC NES pixels are also more square as the pixel aspect ratio is  8:7 (1.143), while the NTSC 7800  pixel aspect ratio is 12:7 (1.714) for 160 modes or 6:7 (0.857) for 320 modes. However a PAL 7800 in 320 modes has pixels which are very close to square (1.040), while the pixel aspect ratio of a PAL NES is 1.386.

from http://wiki.nesdev.com/w/index.php/Overscan

The master clock of an NES is 6 times the colorburst frequency and the color generator uses a double-pumped counter to generate the hue signal for 12 possible hues.  The NTSC PPU pixel rate is 1/4 the master clock or 6/4 of the colorburst frequency.  This yeilds 280 pixels per line, of which 256 are active (although not all may be visible).  The PAL PPU pixel rate is 1/5 the master clock or 6/5 of the colorburst frequency for 277 pixels per line.

Contrast with the NTSC 7800 where the MARIA  pixel rate is the colorburst frequency in 160 modes and double the colorburst frequency in 320 modes.  The PAL 7800 pixel clock is independent of the colorburst frequency and is 7.093788MHz.

supercat elaborated:

One issue which is quite important is chroma artifacting. To understand this, one must understand that in NTSC video, color is indicated by the presence of a 3.579545MHz signal in the video. The intensity of the signal indicates the saturation, and the phase of the signal (as compared with a reference signal) indicates the hue. It does not take a very strong signal to produce a very bold color.

On the Atari 5200 or 7800 in 320-pixel mode, a pattern of alternating light and dark pixels will generate a very strong 3.579545Mhz signal. This will often tend to produce saturated and ugly colors where there should be none. There are times when this effect can be exploited, but it's more often than not annoying.

The NES avoids this problem in two ways:

  1. A somewhat lower pixel rate means that alternating black and white pixels would yield an output frequency of about 2.86Mhz; this is far enough away from 3.579545Mhz to largely avoid color artifacting;
  2. The NES outputs 227.5 color clocks per line instead of 228. This means that even if such a pattern of pixels would be slightly tinted, the tint on alternate lines would itself be alternating, such that consecutive lines' tints would largely cancel out.
Advantage NES - because the 320H modes are difficult to use effectively

CPU <-> GPU coupling

The 7800 MARIA GPU shares RAM, ROM & access time with the 6502. So while MARIA is creating each line of the display, the 6502 is halted. A 7800 game may also have to spend significant time creating the display lists. The NES PPU has it's own address space, which is only indirectly accessible by the CPU. This gives the game more processing time since the 6502 is not halted during picture processing. However, the CPU can only access PPU address space (to update the tile maps) during VBLANK.

Advantage NES - more CPU processing time

One interesting item is the 7800 MARIA/TIA registers are mapped to zero page addresses while the NES PPU/pAPU registers are not. So register accesses require one less byte and one less cycle on the 7800, but an NES game uses these registers far more than a 7800 game. Interesting design choices.

Cartridge RAM/ROM

As mentioned, the NES CPU and PPU have separate address spaces. The NES cartridge connector reflects this, having separate CPU and GPU address and data buses, and separate ROMs for the CPU and PPU. This automatically makes NES carts larger and more expensive than the basic 7800 cartridge. The big N also went with a hardware lockout chip while Atari went with a software digital signature. It goes without saying that later NES cartridges were more complicated (RAM, battery backed RAM, mappers, huge ROMs) than Atari made 7800 carts.

Advantage NES - 'cause Nintendo spent more $$

System RAM

While both the NES and the 7800 contain 4K of RAM, there are some important differences. The NES splits the RAM into 2K usable by the CPU for general storage and 2K for the PPU (indirectly accessible by the CPU) used for the tile maps (with additional on cart CPU and PPU RAM possible). The 4K of 7800 RAM is completely accessible by the CPU, but a large chunk of it (2K or more) will be used for display lists and tile maps (depending on the game). A few 7800 carts also had additional RAM for general storage.

Advantage NES - fixed function uses less RAM

Tile processing

The NES has a fixed 32x30 tile map (with scrolling), with 8x8 tiles. The tiles are 3 colors (plus background/transparent), with a block of 2x2 tiles having the same palette (of 4). The 7800 has more flexible, though similar, tile capabilites; but they consume a large chunk of the processing power of the MARIA GPU (tiled background = fewer sprites per line). (In fact, there is insufficient MARIA GPU time for a fully tiled background in the higher colored write mode = 1 graphics modes.) The NES also requires less CPU power to achieve the same result. Scrolling tiled backgrounds on the NES are simple, accomplishing the same on the 7800 is not (especially vertical scrolling).

Advantage NES - simple & effective fixed function versus CPU & GPU hungry flexibility

Sprite processing

The NES has 64 sprites (max 8? per line), though it may be possible to change this on the fly to increase the total number of sprites displayed. Each 8x8 or 8x16 sprite has 3 colors (plus background/transparent) out of 4 different palettes (different palettes than tiles). The 7800 can display an enormous number of sprites (not fixed size either and with better color capabilities) both onscreen (256 easy) and on a single line (30 with no background). The problem is the CPU processing required to build the dynamic display lists.

For my balldemo each sprite requires 224 cycles, or two scanlines, to add to the display list. Plus the MARIA GPU will steal in total half a scanline of CPU time per (two byte 16 line) sprite to draw it onscreen.

Advantage 7800 for pure sprite capabilities, but NES gets the nod for easier to use

Colors

The Atari consoles (and probably the computers) all create color via direct Y/C. And because the Y output is linear, that means (due to how gamma works) that ~50% of the colors are fairly dark on a normal TV. This probably is more an issue for current developers (who use emulators with over-bright palettes) than the original developers (who would have tested on real hardware, though maybe with "hot" TVs). Also, the onscreen color has the same amplitude as the colorburst signal, which limits it's saturation somewhat.

The NES can produce 53 colors (black + 4 grey/white + 4 shades of 12 colors), using a method very similar to the 2600/7800 (which had 256 colors: 16 shades of 15 colors & greyscale) with 4 luma values for each chroma phase. The 3 NES color emphasis bits could be used to create additional colors, but not on a per pixel basis (maybe per line). The one advantage with the NES is all of the colors (other than black) have a higher base luma than the 7800, so are inherently brighter than 50% of the colors on the 7800.

It should also be noted the NES colors are absolute (based on counter running at 12 times the colorburst frequency) while the 7800 colors are relative (based on a delay line with an adjustable potentiometer).

Advantage 7800 but only on a numerical basis

Sound

The NES sound generator is integrated into the 6502 CPU. (Part of the same IC, but no additional instructions.) It also puts the TIA and POKEY to shame. Specs from http://nesdev.parodius.com/2A03/

  • 5 sound channels: 2 pulse (square), 1 triangle, 1 white noise, 1 digital.
  • Pulse channels have 4 duty cycle settings: 87.5%, 75%, 50%, and 25%. If you know how a pulse wave works, you will notice that the difference between 25% and 75% is indistinguishable to the human ear.
  • Pulse and triangle channels have an 11-bit frequency control, and is capable of producing tones ranging from approximately A-1 to B-8. The triangle channel is one octave lower.
  • Pulse channels have a built-in frequency-sweep function, often used for sound effects.
  • Pulse and noise channels have 16 volume levels. Pulse channels have a built-in primitive volume envelope function.
  • The triangle waveform is synthesized by modulating 16 volume steps, hence the lack of volume control and subtle metallic resonance-type sound noticable at low frequencies.
  • Noise channel has 4-bit frequency control, and is capable of producing 16 frequencies.
  • Noise channel has a special 'looped noise' setting that allows it to produce a metallic sound.
  • Digital channel can use a DMA method to play a sample, the sample depth is only 1-bit but it retains good quality by using a technique called "delta modulation", in which only the changes in the waveform are recorded.
  • Digital channel is capable of playing 7-bit samples through a method similar to a digital-to-analogue-converter, or DAC.
  • Digital channel's DMA method allows access to only 16k of sample data, but by using external bankswitching hardware you can overcome this limitation.
  • All sound channels except digital have built-in time-length control.
Compare this with the TIA which has 2 channels selectable LFSR pseudo-random waveforms and 5 bit frequency control. POKEY which has 2 channels with 16 bit frequency control or 4 channels 8 or 16 bit frequency control using the same LFSR pseudo-random waveforms.

Advantage NES unless playing 2 channel music with a POKEY

Conclusion:

Although the 7800 MARIA GPU has the capability of creating better graphics than the NES, it is hamstrung by the amount of CPU power required to maintain the display lists needed to create those graphics. Plus, the 7800 GPU halts the CPU while the graphics are being created, further reducing the amount of CPU time available to the game. The NES wins out with it's easy to use fixed function GPU which leaves the CPU free to execute more code per frame.

More available CPU time allows for better AI, improved responsiveness, and generally smoother gameplay.

This is not to say that the 7800 is not capable, nor that there aren't games where the 7800 version is better than the NES equivalent. But, other than a pure # of sprites, the 7800 isn't a clear winner over the NES from any standpoint. To say otherwise requires very narrow view.

Porting from the NES to the 7800, a think exercise

Needless to say, and NES to 7800 port will require a lot of changes to the graphics and sound due to the very different capabilities of the two consoles.

In order to duplicate the color capabilities of NES tiles (each 2x2 block of tiles is 1 of 4 three color palettes), it will be necessary to use the 7800 160B graphics mode. Each tile will be 2 bytes = 4 pixels wide, and the NES has 32 tiles per line, so the screen will be only 128 (of 160) pixels wide. This may be a blessing in disguise since it will make it easier to scale the NES sprites which are twice the width.

Although you could use all 160 pixels to show more tiles, this would leave no time for the GPU to display any sprites. Even with only 32 tiles per line there's only enough time to display 6 160A sprites per line (plus a border to mask the horizontal scrolling).

The alternative would be to drop the background tiles to 160A, but that would only allow 4 colors for the whole background.

The sprites can use either 160A or 160B graphics modes, although 160A is closer to the NES capabilities.

Sound would have to be recreated by ear because the sound capabilities of the NES and the 7800 (even with a POKEY) are radically different.

Game logic (outside of GPU and controller interfacing) should be largely portable (assuming you have commented source code), depending on whether it has any other hardware dependencies and how much game logic processing it does per frame. 

Comments