Sprites

From NeoGeo Development Wiki
Revision as of 11:17, 25 January 2011 by Furrtek (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

"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 in 4 bits per pixel (128 bytes per tile). Each tile can then use up to 15 colors, one index being used as transparency.

Sprites are vertical strips of tiles, with a fixed width of 1 tile (16 pixels), 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 bypass their width limitation and make huge moveable objects.

Limitations

No more than 96 sprites can be rendered by scanline. Any others will be ignored.

Even if the VRAM has space for 448 sprites, only 384 can be displayed per frame (unmultiplexed).

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. A lot of games contain pre-stretched graphics for sprites which are seen scaled down most of the time (logos in title screens for example).

Sprite control banks

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

SCB1: Tilemaps

SCB1 is $7000 words long, it's used to store the tilemaps and tile attributes of each sprite (448 sprites) Adresses $7000 to $7FFF are used by the Fix layer.

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

Attribute word definition: TODO. Palette, flip, bank.

SCB2: Shrinking coefficients

SCB2 is $200 words long. It's used to specify the shrinking coefficients of each sprite. The lower byte is the vertical shrinking. $FF is full size. The lower nibble of the upper byte (bits 8 to 11) is the horizontal shrinking. $F is full size.

Default value: $0FFF

SCB3: Y positions

SCB3 is $200 words long. It's used to specify the sprites's Y position, its link mode (Sticky bit) and its size (height in tiles). The actual position is 496-Y, from the top border of the screen.

SCB4: X positions

SCB4 is $200 words long. It's used to specify the sprite's X position. The actual position is from the left border of the screen.