+---------+-------+--------+--------+- - - - +--------+-------+ | Control | Extn | | | | | Free | | Block | area | Sprite | Sprite | | Sprite | space | | | (opt) | | | | | | +---------+-------+--------+--------+- - - - +--------+-------+There are two slight variations on the above arrangement:
The format of the Control Block is as follows (remember multibyte
values are little-endian):
Offset Size Description ------ ----- ------------------------------------------------- 0 4 Byte offset to last byte + 1 (ie total size of sprite area, including free space) 4 4 Number of sprites in area 8 4 Byte offset to first sprite 12 4 Byte offset to first free word (ie byte after last sprite) 16 n Extension words (usually none)For sprite files the first word is not included, but all offsets are set as if it was still there (ie when examining the file, all offsets appear to be 4 bytes too large).
Also when saved as a file, the word at offset 12, should be set to point to the byte after the last sprite (ie the 'free space' should be removed).
+---------+---------+--------+----------+ | Sprite | Palette | Sprite | Plotting | | Control | area | image | mask | | Block | (opt) | | (opt) | +---------+---------+--------+----------+The Sprite Control Block contains the following:
Offset Size Description ------ ----- ------------------------------------------------- 0 4 Offset to next sprite (from here) 4 12 Sprite name (up to 12 characters with trailing zeroes) 16 4 Width in words - 1 20 4 Height in scan lines 24 4 First bit used (left end of row) 28 4 Last bit used (right end of row) 32 4 Offset to sprite image 36 4 Offset to transparency mask (or sprite image if there is no mask) 40 4 Screen mode sprite was defined in 44 n Palette data (optional)
Each palette entry is two words long:
Offset Size Description ------ ----- ------------------------------------------------- 0 4 First colour of flashing pair 4 4 Second colour of flashing pairNote: although flashing colours are still supported, it is very rare to find flashing palettes in sprites nowadays.
Each palette value is of the form:
Bits Meaning ---------- ------------------------- 0 - 7 0 8 - 15 Amount of red 16 - 23 Amount of green 24 - 31 Amount of blue