Sprites

"Sprites" as defined by SNK


Sprites on the NeoGeo aren't like those on other systems.

They're made of tiles (sometimes called characters) coming from the C ROMs, or from the .SPR files on the NeoGeo CD. Those tiles are always 16x16 pixels in size and can contain 15 colors (the color index 0 is used for transparency).

Sprites are vertical strips of tiles, with a fixed width of 1 tile (16 pixels), and an adjustable height (up to 32 tiles, 512 pixels). Each sprite has its own tilemap, defining which tile number goes in which place. Sprites can be stuck together horizontally to make huge moveable objects.

Limitations
A lot of games contain pre-stretched graphics for sprites which are seen scaled down most of the time ("crashing" logos in title screens for example).
 * No more than 96 sprites can be rendered by scanline. Any others will be ignored (priority: 1 is in the back ?).
 * Even if the VRAM has space for 448 sprites, only 381 can be displayed per frame (without sprite multiplexing tricks).
 * Contrary to common belief, sprites can't be zoomed. They can only be shrinken. Graphics for sprites then have to made to the biggest size needed.
 * $100000 tiles can be addressed (20 bits, 128MiB of graphics), if more tiles are needed then the sprites graphics need to be bankswitched.

Graphics format
Sprite tiles are 16x16 pixels in a 4BPP planar format, handled as 8x8 tiles by the GPU. See sprite graphics format.

A sprite tile is 128 bytes.

Horizontal shrinking
Per-sprite 4 bit value (1 to 16 pixels width). For each shrinking value, 1 means the pixel line will be used, 0 won't (info from MAME's source).


 * 00: 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
 * 01: 0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0
 * 02: 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0
 * 03: 0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0
 * 04: 0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0
 * 05: 0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0
 * 06: 0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
 * 07: 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
 * 08: 1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0
 * 09: 1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0
 * 10: 1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1
 * 11: 1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1
 * 12: 1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1
 * 13: 1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1
 * 14: 1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1
 * 15: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

Table internal to the GPUs, not in LO ROM ?

= Sprite control blocks =

There are 4 Sprite Control Banks located in VRAM: SCB1 to SCB4. They respectively start at adresses $0000, $8000, $8200 and $8400. They aren't mirrored in any way.

Please see VRAM to learn more about read/writing to these locations.

Sprites wrap around the screen on a 512 pixels boundary.

(All sprites are mapped with tiles $01~$21)

SCB1 (VRAM $0000~$6FFF): Tilemaps
SCB1 is used to store the tilemaps and tile attributes of each sprite.

(Note that the $7000~$7FFF locations in VRAM are used for the Fix layer).

Each sprite has a 64 words table, organized as a linear up to down tile/attributes pairs. This means even locations are the tile numbers, and odd ones are attributes.

The 8-frame auto animation bit has priority over the 4-frame one.

SCB2 (VRAM $8000~$81FF): Shrinking coefficients
SCB2 is used to specify the shrinking values of each sprite.

The lower byte is the vertical shrinking. $FF is full size.

The lower nibble of the upper byte is the horizontal shrinking. $F is full size.

SCB3 (VRAM $8200~$83FF): vertical positions
SCB3 is used to specify the sprites's Y position, its(Sticky bit and its size (height in tiles). The actual position is 496-Y, from the top border of the screen.

A sprite size of 33 makes it 32 tiles high, and loops borders when shrinking (see example sprite 6).

The sprite's height is actually the "window" size in which the sprite will be drawn. Shrinking isn't calculated from this.

SCB4 (VRAM $8400~$85FF): horizontal positions
SCB4 is used to specify the sprite's X position. The actual position is from the left border of the screen.