Japanese
HARDWARE ManualVDP2 User's Manual
BackForward
VDP2 User's Manual

Chapter 14 Shadow Function


The shadow function is a function that uses sprites to cast shadows on themselves or on the scroll screen. There are two types of sprites that act as shadows, depending on their data: normal shadows and MSB shadows. MSB shadows can only be used when the sprite type is type 2-7. Shadowing is only used when the shadowing sprite has the highest priority.

Shadow functions are processed after color calculation and color offset functions. The shadow function is shown in Figure 14.1.

Figure 14.1 Shadow function

■14.1 Shadow processing

In shadow processing, when a normal shadow or MSB shadow sprite has the highest priority, that sprite is forcibly made transparent, and the brightness of the part where the sprite was in the top image determined on the screen excluding the sprite is is to be halved.

●Normal shadow

For normal shadow sprites, only the least significant bit of the dot color data for the specified sprite type is 0, and all other dot color data are 1, and the number of bits to be determined changes depending on the sprite type.

For normal shadow sprite data, specify a color control word in which all bits of the dot color data except the dot color code are 1, with only the least significant bit being 0 and all remaining bits being 1. It is created by writing a dot color coded sprite character to the frame buffer. At this time, it will overwrite the frame buffer data that has already been written, so it will not be possible to add shadows to the sprite. Therefore, you should normally write to the frame buffer first. For information on color control words, please refer to the " VDP1 User's Manual ".

The scroll screen and back screen that are shaded by normal shadow sprites can be specified for each screen.

Normal shadow is shown in Figure 14.2, and normal shadow sprite data is shown in Figure 14.3.

Figure 14.2 Writing normal shadow sprite data

Figure 14.3 Normal shadow sprite data
●For sprite types 0 to 3 and 5
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │-│-│-│-│-│1│1│1│1│1│1│1│1│1│1│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●For sprite types 4 and 6
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │-│-│-│-│-│-│1│1│1│1│1│1│1│1│1│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●For sprite type 7 Bits
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │-│-│-│-│-│-│-│1│1│1│1│1│1│1│1│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●For sprite types C to F
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │-│-│-│-│-│-│-│-│1│1│1│1│1│1│1│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●For sprite type 8
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │−│−│−│−│−│−│−│−│−│1│1│1│1│1│1│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●For sprite types 9 to B
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │−│−│−│−│−│−│−│−│−│−│1│1│1│1│1│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

Note: The bits in the "-" part are not used to determine normal shadows.

●MSB Shadow

MSB shadow is valid only when the sprite type is type 2 to 7, and the most significant bit (MSB) of the sprite data is 1. Sprite shadow and transparent shadow are determined by the value of 15 bits other than MSB. There are two types. A sprite shadow has a MSB of 1 and all 15 bits other than the MSB are non-zero. A transparent shadow has an MSB of 1 and all 15 bits other than the MSB of 0. However, if the dot color data satisfies the conditions for a normal shadow, it will be determined as a normal shadow even if it satisfies the conditions for a sprite shadow.

MSB shadow sprite data is created by changing only the MSB to 1 in the form of an MSB shadow sprite from the frame buffer data in which VDP1 has already been written. (Please refer to " ■MSB On " in the "VDP1 User's Manual".) At this time, if all bits of the frame buffer data before changing the MSB are not 0, that is, if a normal sprite has already been written. If it is, it becomes a sprite shadow and casts a shadow on that sprite character.

If all bits of the frame buffer data before changing the MSB were 0, that is, if it was transparent, it becomes a transparent shadow, and the scroll screen whose priority is one level lower than the sprite of the transparent shadow. to add a shadow. Scroll screens and back screens that are shaded by transparent shadow sprites can be specified for each screen.
Please note that the priority number of the transparent shadow sprite uses the value set in sprite register 0 of the priority number register.

If you use a sprite window, you will no longer be able to use this MSB shadow. For information on sprite windows, see 8.1 Window Area .

Figure 14.4 shows sprite shadows and transparent shadows, and Figure 14.5 shows sprite data for MSB shadows.

Figure 14.4 Sprite shadows and transparent shadows

Figure 14.5 MSB shadow sprite data
●Sprite shadow
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │1│×│×│×│×│×│×│×│×│×│×│×│×│×│×│×│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

× can be 0 or 1 as long as the dot color data for the specified sprite type does not meet the normal shadow conditions.


●Transparent shadow
Bit15             8 7             0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │1│0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│
   └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●Shadow control register

The shadow control register specifies whether to use the shadow function for the scroll screen and back screen. This is a 16-bit write-only register located at address 1800E2H. The value is cleared to 0 after power-on or reset, so be sure to set it.

SDSTL 1800E2H
   15   
   14   
   13   
   12   
   11   
   10   
   09   
   08   
 -
 -
 -
 -
 -
 -
 -
 TPSDSL

   07   
   06   
   05   
   04   
   03   
   02   
   01   
   00   
 -
 -
 BKSDEN
 R0SDEN
 N3SDEN
 N2SDEN
 N1SDEN
 N0SDEN

Shadow enable bit : Shadow enable bit
(N0SDEN, N1SDEN, N2SDEN, N3SDEN, R0SDEN, BKSDEN)
Specifies whether to use the shadow function for the scroll screen and back screen for normal shadow and transparent shadow sprites.

N0SDEN 1800E2H Bit 0 For NBG0 (or for RBG1)
N1SDEN 1800E2H Bit 1 For NBG1 (or for EXBG)
N2SDEN 1800E2H Bit 2 For NBG2
N3SDEN 1800E2H Bit 3 For NBG3
R0SDEN 1800E2H bit 4 For RBG0
BKSDEN 1800E2H Bit 5 For BACK

Sprite shadow sprites always use shadowing on themselves.

xxSDEN process
0 Do not use the shadow function (do not add shadows)
1 Using the shadow function (adding a shadow)

Transparent shadow select bit : Transparent shadow select bit (TPSDSL), bit 8
Specifies whether transparent shadow sprites are enabled.

TPSDSL process
0 Disable transparent shadow sprites
1 Enable transparent shadow sprites

If you disable transparent shadow sprites, you will no longer be able to cast shadows on any screen with transparent shadow sprites.


BackForward
HARDWARE ManualVDP2 User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997