Difference between revisions of "Sprites"
(Created page with "== SPRITES == 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...") |
(→Sprite Registers) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
Sprite is a computer graphics term for a two-dimensional bitmap that is integrated into a larger scene. | 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. | 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 | + | 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. |
+ | |||
+ | '''NOTE: The upper left corner of the sprite is offset by 32 pixels. Using (0,0) will hide the sprite. Position (32,32) is mapped to the upper left corner of the screen.''' | ||
== Sprite Registers == | == Sprite Registers == | ||
− | Each Sprite has registers composed of a total of 8 bytes for manipulation, starting at $AF: | + | 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: |
+ | |||
+ | {| class="wikitable" | ||
+ | !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: | ||
+ | |||
+ | {| {{Wikitable}} | ||
+ | !Attribute | ||
+ | !Bit | ||
+ | |- | ||
|SPRITE_Enable||= $01 | |SPRITE_Enable||= $01 | ||
+ | |- | ||
|SPRITE_LUT0||= $02 | |SPRITE_LUT0||= $02 | ||
+ | |- | ||
|SPRITE_LUT1||= $04 | |SPRITE_LUT1||= $04 | ||
+ | |- | ||
|SPRITE_LUT2||= $08 | |SPRITE_LUT2||= $08 | ||
+ | |- | ||
|SPRITE_DEPTH0||= $10 | |SPRITE_DEPTH0||= $10 | ||
+ | |- | ||
|SPRITE_DEPTH1||= $20 | |SPRITE_DEPTH1||= $20 | ||
+ | |- | ||
|SPRITE_DEPTH2||= $40 | |SPRITE_DEPTH2||= $40 | ||
− | | | + | |- |
− | + | |SPRITE_Collision_On||= $80 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
|} | |} |
Latest revision as of 19:49, 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.
NOTE: The upper left corner of the sprite is offset by 32 pixels. Using (0,0) will hide the sprite. Position (32,32) is mapped to the upper left corner of the screen.
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 |