Difference between revisions of "Sprites"

From C256 Foenix Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
Originally sprites referred to independent objects that are composited together, by hardware, with other elements such as a background or tiles. The composition occurs as each scan line is prepared for the video output device, without involvement of the main CPU and without the need for a full-screen frame buffer. Sprites can be positioned or altered by setting attributes used during the hardware composition process.  
 
Originally sprites referred to independent objects that are composited together, by hardware, with other elements such as a background or tiles. The composition occurs as each scan line is prepared for the video output device, without involvement of the main CPU and without the need for a full-screen frame buffer. Sprites can be positioned or altered by setting attributes used during the hardware composition process.  
  
Vicky is able to render 32 non-multiplexed sprites with a resolution of 32x32 pixels each. Just as bitmaps, a [[LUT]] is required for selecting 256 out of 16.777.216 colors.
+
Vicky is able to render 64 non-multiplexed sprites with a resolution of 32x32 pixels each. Just as bitmaps, a [[LUT]] is required for selecting 256 out of 16.777.216 colors.
  
 
== Sprite Registers ==
 
== Sprite Registers ==
  
Each Sprite has registers composed of a total of 8 bytes for manipulation, starting at $AF:0200 and spanning through to $AF:02FF. The first one of each 8 byte block is always the control register with the following attributes:
+
Each Sprite has registers composed of a total of 8 bytes for manipulation, starting at $AF:0C00 and spanning through to $AF:0DFF.  
 +
 
 +
The first set of sprite manipulation registers are shown below:
  
 
{| {{Wikitable}}
 
{| {{Wikitable}}
 
!Attribute
 
!Attribute
!Bit
+
!Address
 +
|-
 +
|SP00_CONTROL_REG||= $AF:0C00
 
|-
 
|-
|SPRITE_Enable||= $01
+
|SP00_ADDY_PTR_L||= $AF:0C01
 
|-
 
|-
|SPRITE_LUT0||= $02
+
|SP00_ADDY_PTR_M||= $AF:0C02
 
|-
 
|-
|SPRITE_LUT1||= $04
+
|SP00_ADDY_PTR_H||= $AF:0C03
 
|-
 
|-
|SPRITE_LUT2||= $08
+
|SP00_X_POS_L||= $AF:0C04
 
|-
 
|-
|SPRITE_DEPTH0||= $10
+
|SP00_X_POS_H||= $AF:0C05
 
|-
 
|-
|SPRITE_DEPTH1||= $20
+
|SP00_Y_POS_L||= $AF:0C06
 
|-
 
|-
|SPRITE_DEPTH2||= $40
+
|SP00_Y_POS_H||= $AF:0C07
 
|}
 
|}
 +
For each successive sprite, add +8 to the address registers.
  
The following is an overview of all the attributes of the 8 byte block:
+
The sprite control register (SPxy_CONTROL_REG) is always the first byte of the 8 byte block.  The register is configured as follows:
  
 
{| {{Wikitable}}
 
{| {{Wikitable}}
 
!Attribute
 
!Attribute
!Address
+
!Bit
 
|-
 
|-
|SP00_CONTROL_REG||= $AF02*0
+
|SPRITE_Enable||= $01
 
|-
 
|-
|SP00_ADDY_PTR_L||= $AF02*1
+
|SPRITE_LUT0||= $02
 
|-
 
|-
|SP00_ADDY_PTR_M||= $AF02*2
+
|SPRITE_LUT1||= $04
 
|-
 
|-
|SP00_ADDY_PTR_H||= $AF02*3
+
|SPRITE_LUT2||= $08
 
|-
 
|-
|SP00_X_POS_L||= $AF02*4
+
|SPRITE_DEPTH0||= $10
 
|-
 
|-
|SP00_X_POS_H||= $AF02*5
+
|SPRITE_DEPTH1||= $20
 
|-
 
|-
|SP00_Y_POS_L||= $AF02*6
+
|SPRITE_DEPTH2||= $40
 
|-
 
|-
|SP00_Y_POS_H||= $AF02*7
+
|SPRITE_Collision_On||= $80
 
|}
 
|}

Revision as of 18:37, 27 June 2021

Sprite is a computer graphics term for a two-dimensional bitmap that is integrated into a larger scene.

Originally sprites referred to independent objects that are composited together, by hardware, with other elements such as a background or tiles. The composition occurs as each scan line is prepared for the video output device, without involvement of the main CPU and without the need for a full-screen frame buffer. Sprites can be positioned or altered by setting attributes used during the hardware composition process.

Vicky is able to render 64 non-multiplexed sprites with a resolution of 32x32 pixels each. Just as bitmaps, a LUT is required for selecting 256 out of 16.777.216 colors.

Sprite Registers

Each Sprite has registers composed of a total of 8 bytes for manipulation, starting at $AF:0C00 and spanning through to $AF:0DFF.

The first set of sprite manipulation registers are shown below:

Attribute Address
SP00_CONTROL_REG = $AF:0C00
SP00_ADDY_PTR_L = $AF:0C01
SP00_ADDY_PTR_M = $AF:0C02
SP00_ADDY_PTR_H = $AF:0C03
SP00_X_POS_L = $AF:0C04
SP00_X_POS_H = $AF:0C05
SP00_Y_POS_L = $AF:0C06
SP00_Y_POS_H = $AF:0C07

For each successive sprite, add +8 to the address registers.

The sprite control register (SPxy_CONTROL_REG) is always the first byte of the 8 byte block. The register is configured as follows:

Attribute Bit
SPRITE_Enable = $01
SPRITE_LUT0 = $02
SPRITE_LUT1 = $04
SPRITE_LUT2 = $08
SPRITE_DEPTH0 = $10
SPRITE_DEPTH1 = $20
SPRITE_DEPTH2 = $40
SPRITE_Collision_On = $80