The Amiga 8 sprite myth

The Amiga 8 sprite myth

There seems to be a common misconception regarding the sprite hardware used in the Commodore Amiga line of computers. I do hear it every once and a while being repeated when people are comparing systems, so I decided to write this post to try and set the record straight. The misconception is:

"The Amiga has only 8 hardware sprites, to display more than 8 sprites you need to use Copper tricks"

This is not true, not for any of the three classic Amiga chipsets. The sprite hardware supports considerably more than 8 sprites on the screen without the programmer needing to resort to any tricks. Please allow me to elaborate..

DMA channels

The custom chips can directly access data that is stored in the Amiga's chip RAM without using the CPU. For example, the sound hardware can read the sample data directly from chip RAM as and when required - all the CPU does is tell the sound hardware where the data is, how long the data is and at what speed it needs to be played. The same is true for the graphics displayed on the screen - the display hardware reads the data directly from chip RAM. This directly accessing of the memory without using the CPU is called "Direct Memory Access" and is abbreviated as DMA.

Each subsystem has its own DMA channel. This allows the system to police which sub system gets access at what time. There is a system of priorities and timeslots to govern who gets access when, but I won't go into that at this point. The only important thing to mention about DMA channels is that there are 8 separate DMA channels for the sprite hardware, numbered from 0 to 7.

Sprite DMA

"Ha!" I may hear you shout. "See! 8 channels is 8 sprites!". And that misconception is indeed the origin of the "only 8 sprites" myth. After a sprite DMA channel has finished transferring its data it becomes available to be used for another sprite. And this does not require any trickery at all - the sprite DMA hardware is designed to transfer multiple sprites in sequence on the same channel.

To use this functionality the programmer needs to lay out all the sprites for one channel in memory as a single block. One sprite structure after the other without anything else in between. Each sprite structure contains the location for the sprite, the size of the sprite as well as the data that make up its graphic. The sprite DMA will start with the first structure, then move to the next and so on until the last of the structures has been processed.

This simple system allows each sprite DMA channel to transfer (and display) more than one sprite. If each of the 8 channels processed a block of 6 sprites then there will be a total of 48 hardware sprites visible on the screen. A bit more than 8, isn't it?

Limitations

This is where I mumble a bit and look at my feet a lot. You see, there still is an important limitation and I can't really leave that bit conveniently out.

Each display line is written from left to right and the lines are written from top to bottom. When a sprite channel transfers a sprite that is positioned on line 50 and is 20 lines high then the channel will only become available for the next sprite when the display is writing line 71. The sprite channel will  then read the position and size of the next sprite, which therefore can't be displayed earlier than line 72.

This means that all sprites that share the same channel will need to be ordered in memory. Starting with the one that is highest on the screen to the one that is the lowest, and there must be at least 1 display line between the line where the previous sprite ends and the start position of the next one.

The sprite DMA hardware therefore does not allow for more than 8 sprites on a single display line. To do that you will indeed need to resort to (Copper) tricks. Or use the AGA mode where the same sprite is shown twice on the same display line - but that is not really the same.

Concluding

You can have more than 8 hardware sprites on an Amiga without resorting to tricks. Unless you want more than 8 on the same display line - then you do (need to resort to tricks).

In my Amiga hardware programming book I briefly touch on the subject of multiple sprites per channel, but I neglected to actually include an example of how this can be done. I remedied this by adding another example to the set, which can be found in my downloads section.

Posted on