Difference between revisions of "Sprite Attribute Upload"

From SpecNext official Wiki
Jump to: navigation, search
(Core 2.00.22 changes.)
Line 1: Line 1:
 
{{Port
 
{{Port
 
|Number=$xx57
 
|Number=$xx57
|ShortDesc=Uploads sprite positions, visibility and effect flags.
+
|ShortDesc=Uploads sprite positions, visibility, colour type and effect flags.
 
|PortMask=%---- ---- 0101 0111
 
|PortMask=%---- ---- 0101 0111
 
|Readable=No
 
|Readable=No
Line 7: Line 7:
 
|Subsystem=Sprites
 
|Subsystem=Sprites
 
}}
 
}}
Uploads attributes of the sprite slot selected by {{PortNo|$303B}}. Attributes are in 4 byte blocks sent in the following order; after sending 4 bytes the address auto-increments to the next sprite. This auto-increment is independent of other sprite ports. The 4 bytes are as follows:
+
Uploads attributes of the sprite slot selected by {{PortNo|$303B}}. Attributes are in 4-5 byte blocks sent in the following order; after sending 4 or 5 bytes the address auto-increments to the next sprite. This auto-increment is independent of other sprite ports. The 4-5 bytes are as follows:
  
 
Byte 1 is the low bits of the X position. Legal X positions are 0-319 if sprites are allowed over the border or 32-287 if not. The MSB is in byte 3.
 
Byte 1 is the low bits of the X position. Legal X positions are 0-319 if sprites are allowed over the border or 32-287 if not. The MSB is in byte 3.
  
Byte 2 is the Y position. Legal Y positions are 0-255 if sprites are allowed over the border or 32-223 if not.
+
Byte 2 is the Y position. Legal Y positions are 0-255 if sprites are allowed over the border or 32-223 if not (with "core 2.00.22" there's now Y8 bit in b0 of byte 5, allowing for positions 0-511, but I'm not sure at this moment what are legal values).
  
 
Byte 3 is bitmapped:
 
Byte 3 is bitmapped:
Line 28: Line 28:
 
|}
 
|}
  
Byte 4 is also bitmapped:
+
Byte 4 is bitmapped:
 
{|class="wikitable"
 
{|class="wikitable"
 
! Bit !! Description
 
! Bit !! Description
Line 34: Line 34:
 
| 7 || Enable visibility
 
| 7 || Enable visibility
 
|-
 
|-
| 6 || Reserved
+
| 6 || If 1, the optional 5th attribute byte should follow. If 0, only four attribute bytes are expected.
 
|-
 
|-
 
| 5-0 || Pattern index ("Name")
 
| 5-0 || Pattern index ("Name")
 +
|}
 +
 +
Optional (when bit 6 is set in byte 4) byte 5 is bitmapped:
 +
{|class="wikitable"
 +
! Bit !! Description
 +
|-
 +
| 7 || If 1, the pattern will be treated as 4-bit colour one (128 bytes), 0 is for 8-bit colour patterns (256 bytes)
 +
|-
 +
| 6 || Chooses top/bottom part of pattern slot (for 4-bit colour patterns)
 +
|-
 +
| 5 || Reserved, use always 0
 +
|-
 +
| 4-3 || x-axis scale factor: %00 = 1x (16 pixels), %01 = 2x, %10 = 4x, %11 = 8x (128 pixels)
 +
|-
 +
| 2-1 || y-axis scale factor: %00 = 1x (16 pixels), %01 = 2x, %10 = 4x, %11 = 8x (128 pixels)
 +
|-
 +
| 0 || MSB of Y coordinate
 
|}
 
|}

Revision as of 03:49, 20 December 2018

Number $xx57
Decimal
Short desc. Uploads sprite positions, visibility, colour type and effect flags.
Bit Mask %---- ---- 0101 0111
Readable No
Writable Yes
Subsystem Sprites

Uploads attributes of the sprite slot selected by Sprite Status/Slot Select ($303B / 12347). Attributes are in 4-5 byte blocks sent in the following order; after sending 4 or 5 bytes the address auto-increments to the next sprite. This auto-increment is independent of other sprite ports. The 4-5 bytes are as follows:

Byte 1 is the low bits of the X position. Legal X positions are 0-319 if sprites are allowed over the border or 32-287 if not. The MSB is in byte 3.

Byte 2 is the Y position. Legal Y positions are 0-255 if sprites are allowed over the border or 32-223 if not (with "core 2.00.22" there's now Y8 bit in b0 of byte 5, allowing for positions 0-511, but I'm not sure at this moment what are legal values).

Byte 3 is bitmapped:

Bit Description
4-7 Palette offset, added to each palette index from pattern before drawing
3 Enable X mirror
2 Enable Y mirror
1 Enable rotation
0 MSB of X coordinate

Byte 4 is bitmapped:

Bit Description
7 Enable visibility
6 If 1, the optional 5th attribute byte should follow. If 0, only four attribute bytes are expected.
5-0 Pattern index ("Name")

Optional (when bit 6 is set in byte 4) byte 5 is bitmapped:

Bit Description
7 If 1, the pattern will be treated as 4-bit colour one (128 bytes), 0 is for 8-bit colour patterns (256 bytes)
6 Chooses top/bottom part of pattern slot (for 4-bit colour patterns)
5 Reserved, use always 0
4-3 x-axis scale factor: %00 = 1x (16 pixels), %01 = 2x, %10 = 4x, %11 = 8x (128 pixels)
2-1 y-axis scale factor: %00 = 1x (16 pixels), %01 = 2x, %10 = 4x, %11 = 8x (128 pixels)
0 MSB of Y coordinate