Sprites As Tiles On The 7800

From 8BitDev.org - Atari 7800 Development Wiki
Jump to: navigation, search


The 7800 has two kinds of display objects, namely sprite objects and character objects (aka tiles). Each of these object types has different advantages and disadvantages, when compared to the other.

Character graphics allows for quick update of displayed graphics by simply modifying the character index at a particular character position. The main disadvantage when using character objects, is they take longer for Maria to render than sprites, and so using a lot of character objects may limit the overall number of objects you can display. Since any particular character object can only be in one palette, you either you wind up with a less colorful screen of graphics, or you reduce your render time even more by using multiple character objects whenever you need different palettes.

Maria can render individual sprite objects much quicker than individual character objects, and while sprites aren't character tiles, you can create display lists with many sprites tiled across the screen. This technique can allow you to create very colorful tiled game screens, while maximizing both the number of display objects and the cycles available to the 6502.

DMA Cost of Sprites Vs Tiles

There are two factors that need to be considered when when weighing consider when weighing sprites vs tiles.

The first factor to consider is the cost of the DMA object setup - i.e. the processing required by Maria to parse the DL structure, prior to fetching any graphics. This overhead only happens once per object, but since we need to replace our single character object with multiple sprite objects, it imposes a cost to sprite-tile DMA time. For a 5 byte object (sprite or tile) the DMA object setup cost is 10 cycles, and for a 4 byte object (sprite) the cost is 8 cycles.

The second factor is the cost of fetching consecutive bytes of graphics. Maria uses 3 cycles for each byte of sprite graphics it fetches, and 6 cycles for each byte of character graphics it fetches. In double-wide mode, Maria will use 9 cycles for each pair of bytes, instead of the usual 12.

The following table shows the comparative DMA cost for fetching 24 bytes worth of graphics, using one single-wide character object vs. one double-wide character object vs. sprites of varying byte widths. Bear in mind that each sprite object can have an independent palette, which the characters in the character object must all be of the same palette.

DMA Comparison.png