Sprites

From SpecNext official Wiki
Revision as of 18:14, 18 August 2017 by wiki>Hyphz (Created page with "= Sprites = Sprites are 16x16 independently moving images. Each can use up to 256 colors, independently selected from a palette. To enable sprites, bit 0 of {{NextRegNo|$21}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sprites

Sprites are 16x16 independently moving images. Each can use up to 256 colors, independently selected from a palette.

To enable sprites, bit 0 of ($21) must be set. If bit 1 is set also, sprites are permitted to cross the border.

The Next supports up to 64 sprites on screen at a time. It also supports 64 "patterns" (bitmap images used for sprites). These can be independent - for example, you could have several sprites with the same pattern.

To upload a pattern, write the pattern number to Sprite Status/Slot Select ($303B / 12347). Then write the pattern, byte by byte in reading order, to Sprite Pattern Upload ($xx5B / 91). The pattern must be exactly 256 bytes long, filling the 16x16 available area. Each byte is the index into the palette of the color of that pixel. The default palette simply maps the indexes 0-255 to colors 0-255 which are decoded as in ULAPlus, except that %11100011 (pink) is treated as transparent. Sprites smaller that 16x16 thus must pad the extra space with the transparent color. After 256 bytes are written, continuing to write will write to the next pattern number, and so on.

Sprites are displayed and controlled using Sprite Attribute Upload ($xx57 / 87) to which 4 byte packets are set. Full details of the packet contents are given on the page for that port.