Difference between revisions of "Sprite Pattern Upload"

From SpecNext official Wiki
Jump to: navigation, search
m
(core 2.00.23 changes)
Line 9: Line 9:
 
Used to upload sprite patterns. Sprite patterns are 16x16 (256 bytes for 8 bit colour and 128 bytes for 4 bit colour sprites) and are sent in English reading order. Each byte is the offset, 0-255 (or two 0-15 for 4-bit graphics), within the active sprite palette. After sending 256 bytes, the target pattern slot is auto-incremented. This auto-increment is independent of other sprite registers.
 
Used to upload sprite patterns. Sprite patterns are 16x16 (256 bytes for 8 bit colour and 128 bytes for 4 bit colour sprites) and are sent in English reading order. Each byte is the offset, 0-255 (or two 0-15 for 4-bit graphics), within the active sprite palette. After sending 256 bytes, the target pattern slot is auto-incremented. This auto-increment is independent of other sprite registers.
  
With 4 bit sprites each pattern slot contains effectively two patterns, each 128 bytes long, the sub-pattern displayed is selected by 7th bit "N6" in 5th sprite-attribute byte. With four bit graphics the top bits (of each pattern byte) 7-4 are "left" pixel on display and bits 3-0 are "right next to it" pixel on display (in default mode, no mirror, no rotate).
+
Auto-increment from pattern slot 63 is officially "undefined behaviour" and you must explicitly reset the slot number back into 0..63 range before next pattern byte upload (port {{PortNo|$303B}}) (to keep your code behaving predictably in future).
 +
 
 +
With 4 bit sprites each pattern slot contains effectively two patterns, each 128 bytes long, the sub-pattern displayed is selected by 7th bit "N6" in 5th sprite-attribute byte (6th bit for "relative" sprites). With four bit graphics the top bits (of each pattern byte) 7-4 are "left" pixel on display and bits 3-0 are "right next to it" pixel on display (in default mode, no mirror, no rotate).

Revision as of 17:34, 28 December 2018

Number $xx5B
Decimal
Short desc. Used to upload the pattern of the selected sprite.
Bit Mask %---- ---- 0101 1011 ??
Readable No
Writable Yes
Subsystem Sprites

Used to upload sprite patterns. Sprite patterns are 16x16 (256 bytes for 8 bit colour and 128 bytes for 4 bit colour sprites) and are sent in English reading order. Each byte is the offset, 0-255 (or two 0-15 for 4-bit graphics), within the active sprite palette. After sending 256 bytes, the target pattern slot is auto-incremented. This auto-increment is independent of other sprite registers.

Auto-increment from pattern slot 63 is officially "undefined behaviour" and you must explicitly reset the slot number back into 0..63 range before next pattern byte upload (port Sprite Status/Slot Select ($303B / 12347)) (to keep your code behaving predictably in future).

With 4 bit sprites each pattern slot contains effectively two patterns, each 128 bytes long, the sub-pattern displayed is selected by 7th bit "N6" in 5th sprite-attribute byte (6th bit for "relative" sprites). With four bit graphics the top bits (of each pattern byte) 7-4 are "left" pixel on display and bits 3-0 are "right next to it" pixel on display (in default mode, no mirror, no rotate).