Difference between revisions of "Sprite and Layers System Register"

From SpecNext official Wiki
Jump to: navigation, search
(disti)
(blend modes change half-documented (waiting for final confirmation it's not a bug but design))
(6 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
|Readable=Yes
 
|Readable=Yes
 
|Writable=Yes
 
|Writable=Yes
|ShortDesc=Enables/disables [[Sprites]] and [[Enhanced ULA|Lores Layer]], and chooses priority of sprites and [[Layer 2]].
+
|ShortDesc=Enables/disables [[Sprites]] and [[Video_Modes#LoRes_Layer.2FRadasjimian_Mode|Lores Layer]], and chooses priority of sprites and [[Layer 2]].
 
}}
 
}}
 
 
Bitmapped as follows:
 
Bitmapped as follows:
  
Line 11: Line 10:
 
! Bit !! Function
 
! Bit !! Function
 
|-
 
|-
| 7 || Enable [[Enhanced ULA|Lores Layer]]
+
| 7 || Enable [[Video_Modes#LoRes_Layer.2FRadasjimian_Mode|Lores Layer]]
 
|-
 
|-
| 6 || If 1, the sprite rendering order is reversed, i.e. sprite 0 is on top (0 after reset)
+
| 6 || If 1, the sprite rendering priority is flipped, i.e. sprite 0 is on top of other sprites (0 after reset)
 
|-
 
|-
 
| 5 || If 1, the clipping works even in "over border" mode (doubling X-axis coordinates of clip window) (0 after reset)
 
| 5 || If 1, the clipping works even in "over border" mode (doubling X-axis coordinates of clip window) (0 after reset)
Line 27: Line 26:
 
! Bits 4-2 !! Priority and mixing of layers
 
! Bits 4-2 !! Priority and mixing of layers
 
|-
 
|-
| %000 || S L U ([[Sprites]] are at top, [[Layer 2]] under, [[Enhanced ULA]] at bottom)
+
| %000 || S L U ([[Sprites]] are at top, [[Layer 2]] under, [[Video_Modes#Enhanced_ULA|Enhanced_ULA]] at bottom)
 
|-
 
|-
 
| %001 || L S U
 
| %001 || L S U
Line 39: Line 38:
 
| %101 || U L S
 
| %101 || U L S
 
|-
 
|-
| %110 || S (U+L) Colours from ULA and Layer 2 are added (per R/G/B channel) and clamped to 7.
+
| %110 || | since core3.1.1: (U|T)S(T|U)(B+L) Blending layer and Layer 2 combined, colours clamped to [0,7]
 +
<del>S (U+L) Colours from ULA and Layer 2 are added (per R/G/B channel) and clamped to 7.</del>
 
|-
 
|-
| %111 || S (U+L-5) Similar as previous, but per R/G/B channel (U+L-5) is calculated and result is clamped by 0..7 range.
+
| %111 || | since core3.1.1: (U|T)S(T|U)(B+L-5) Blending layer and Layer 2 combined, colours clamped to [0,7]
 +
<del>S (U+L-5) Similar as previous, but per R/G/B channel (U+L-5) is calculated and result is clamped by 0..7 range.</del>
 
|}
 
|}
  
In layer mixing modes (%110 and %111) the "priority bit 7" of Layer 2 colour is propagated through the calculation, i.e. such pixel will raise above sprites even in mixing modes. If either U or L layer contains ''transparent'' colour pixel, the other layer pixel is drawn unchanged (skipping mixing calculation).
+
In layer mixing modes (%110 and %111) the "priority bit 7" of Layer 2 colour is propagated through the calculation, i.e. such pixel will raise above sprites even in mixing modes. If either U|T or L layer contains ''transparent'' colour pixel, <del>the other layer pixel is drawn unchanged (skipping mixing calculation)</del> (modified in 3.1.1, precise description to be added).
  
When both "over border" (bit 1) and "clipping over border" (bit 5) is enabled, the Sprite clipping window {{NextRegNo|$19}} '''X-axis''' coordinates are "doubled", and coordinates origin is moved from pixel [0,0] position to sprite [0,0] position ([-32,-32] pixel position). For example: setting clip coordinates as {x1:5, x2:155, y1:7, y2:248} will make sprites visible in area [10,7]..[309,248] (inclusively) in sprite coordinates.
+
Since core3.1.1 the blending modes allow for layer non-contributing-to-blending (use {{NextRegNo|$68}} to configure blending sub-mode) to show independently in front of sprites, but modifies the transparency handling rules (to be documented soon)
  
[[User:Ped7g|Ped7g]] ([[User talk:Ped7g|talk]]) 07:41, December 24, 2018 (UTC) note the doubled coordinates behave (core version 2.00.22 is described above) differently to normal coordinates, for example in X1=X2 case: normal clip window will display one pixel, but doubled coordinates will test X2*2-1 < X1*2, so no pixel should be displayed. This inconsistency has been raised in forum, and may change eventually (I would personally expect X2*2+1 boundary applied, so X1=X2 would produce 2-pixel-wide visible area, or even X2*2 producing odd-sized areas (up till full 320 sprite coordinate range) sounds reasonable), as new core was not yet released. So the details are "to be confirmed" by final version in published 2.00.22+ core.
+
When both "over border" (bit 1) and "clipping over border" (bit 5) is enabled, the Sprite clipping window {{NextRegNo|$19}} '''X-axis''' coordinates are "doubled", and coordinates origin is moved from pixel [0,0] position to sprite [0,0] position ([-32,-32] pixel position). For example: setting clip coordinates as {x1:5, x2:155, y1:7, y2:248} will make sprites visible in area [10,7]..[311,248] (inclusively) in sprite coordinates, i.e. the first visible pixel is at X1*2 coordinate, and last visible pixel is at X2*2+1 coordinate.

Revision as of 07:07, 10 June 2020

Number $15
Readable Yes
Writable Yes
Short Description Enables/disables Sprites and Lores Layer, and chooses priority of sprites and Layer 2.

Bitmapped as follows:

Bit Function
7 Enable Lores Layer
6 If 1, the sprite rendering priority is flipped, i.e. sprite 0 is on top of other sprites (0 after reset)
5 If 1, the clipping works even in "over border" mode (doubling X-axis coordinates of clip window) (0 after reset)
4-2 Layers priority and mixing
1 Enable sprites over border (0 after reset)
0 Enable sprite visibility (0 after reset)
Bits 4-2 Priority and mixing of layers
%000 S L U (Sprites are at top, Layer 2 under, Enhanced_ULA at bottom)
%001 L S U
%010 S U L
%011 L U S
%100 U S L
%101 U L S
%110 since core3.1.1: (U|T)S(T|U)(B+L) Blending layer and Layer 2 combined, colours clamped to [0,7]

S (U+L) Colours from ULA and Layer 2 are added (per R/G/B channel) and clamped to 7.

%111 since core3.1.1: (U|T)S(T|U)(B+L-5) Blending layer and Layer 2 combined, colours clamped to [0,7]

S (U+L-5) Similar as previous, but per R/G/B channel (U+L-5) is calculated and result is clamped by 0..7 range.

In layer mixing modes (%110 and %111) the "priority bit 7" of Layer 2 colour is propagated through the calculation, i.e. such pixel will raise above sprites even in mixing modes. If either U|T or L layer contains transparent colour pixel, the other layer pixel is drawn unchanged (skipping mixing calculation) (modified in 3.1.1, precise description to be added).

Since core3.1.1 the blending modes allow for layer non-contributing-to-blending (use ULA Control Register ($68) to configure blending sub-mode) to show independently in front of sprites, but modifies the transparency handling rules (to be documented soon)

When both "over border" (bit 1) and "clipping over border" (bit 5) is enabled, the Sprite clipping window Clip Window Sprites Register ($19) X-axis coordinates are "doubled", and coordinates origin is moved from pixel [0,0] position to sprite [0,0] position ([-32,-32] pixel position). For example: setting clip coordinates as {x1:5, x2:155, y1:7, y2:248} will make sprites visible in area [10,7]..[311,248] (inclusively) in sprite coordinates, i.e. the first visible pixel is at X1*2 coordinate, and last visible pixel is at X2*2+1 coordinate.