The TMS9918a provides hardware collision detection between sprites; the SMS and GG VDPs inherit this.

How it works

During screen display, the VDP will set an internal flag if any two sprites are drawn such that one or more of their opaque pixels overlap.

This flag can be read from the control port; bit 5 of the byte read contains the contents of the collision flag (1 if a collision has occurred, 0 otherwise); as soon as it is read, it is reset to 0.

Thus, a game may continuously poll this flag. It seems that line-accurate emulation (changing the flag's value after each line is drawn) is sufficient for all known software to work correctly; software that relies on more accurate timing is unlikely to work on most emulators.

It is up to the game engine to determine which two (or more) sprites have overlapped, considering that there are probably more than two sprites on-screen at the time. Because they have to do this software sprite-sprite collision detection anyway, and sprite-background collision detection is also useful, most games of any complexity do not bother to use this flag and instead run their software collision detection routines once per frame.

Games relying on collision detection

The following Master System and Game Gear games are known to use the hardware collision detection flag:

Return to top