★ TV screen output



ListReference

function

slTVOn


Start output to monitor

Form

    #include "sgl.h"

    void slTVOn ();

argument

    void --Do not give anything.

Number of returns

    void --Nothing is returned.

function

    Starts outputting to the monitor.

Example

    The output to the monitor that was stopped by slTVOff is resumed.
slTVOff (); :: slTVOn ();

caution


    When this function is executed, it is immediately set in the VDP2 register.

reference

 slTVOff
 VDP2_TVMD 



ListReference

function

slTVOff


Stop outputting to the monitor

Form

    #include "sgl.h"

    void slTVOff ();

argument

    void --Do not give anything.

Number of returns

    void --Nothing is returned.

function

    Stops output to the monitor.
Nothing is displayed on the monitor.

Example

    Stops output to the monitor.
slTVOff ();

caution


    When this function is executed, it is immediately set in the VDP2 register.
There have been some reports of problems using this function before running slInitSystem. This function can only be executed after running slInitSystem.

reference

 slTVOn
 VDP2_TVMD 


★ External signal and screen scanning



ListReference

function

slGetHCount


Read the VDP2 H counter

Form

    #include "sgl.h"

    Uint16 slGetHCount (void);

argument

    void --Do not give anything.

Number of returns

    Uint16 --VDP2 H counter value

function

    Read the VDP2 H counter.

Example

    h_cnt = slGetHCount ();

reference

 slGetVCount
 VDP2_EXTEN
 VDP2_HCNT 



ListReference

function

slGetVCount


Read the V counter of VDP2

Form

    #include "sgl.h"

    Uint16 slGetVCount (void);

argument

    void --Do not give anything.

Number of returns

    Uint16 --V counter value of VDP2

function

    Read the V counter of VDP2.

Example

    v_cnt = slGetVCount ();

reference

 slGetHCount
 VDP2_EXTEN
 VDP2_VCNT 



ListReference

function

slExtSignal


Operate the external signal enable register

Form

    #include "sgl.h"

    Uint16 signal;
    Uint16 mask;

    void slExtSignal (signal, mask);

argument

    Uint16 signal --The name of the signal you want to set.
Uint16 mask --The name of the signal you want to manipulate.

Number of returns

    void --Nothing is returned.

function

    Operates the external signal enable register.
The signal names are the following four.
EXLTEN : Specify when the timing to latch the value of the HV counter is adjusted to the external signal.
EXSYEN : Specify when displaying the TV screen according to the external sync signal.
DASEL: Specify when the image display area is used to fill the standard area.
EXBGEN : Specify when inputting external screen data.

Example

    slExtSignal ( EXLTEN | DASEL , DASEL );

caution


    This function is used for business use such as ST-V and for karaoke machines (Prologue).
    It is never used in SATURN.

reference

 VDP2_EXTEN 


★ Bitmap screen



ListReference

function

slBitMapNbg0



ListReference

function

slBitMapNbg1



ListReference

function

slBitMapRbg0


Scroll bitmap screen settings

Form

    #include "sgl.h"

    Uint16 type;
    Uint16 size;
    void * addr_A;

    void slBitMapNbg0 (type, size, addr_A);
    void slBitMapNbg1 (type, size, addr_A);
    void slBitMapRbg0 (type, size, addr_A);

argument

    Uint16 type --Color mode.
Uint16 size --Bitmap size.
void * addr_A --V-RAM address to set the bitmap data.

Number of returns

    void --Nothing is returned.

function

    Set the NBG0 / 1 screen to bitmap mode and set the size of the bitmap.
For type, specify the following parameters.
COL_TYPE_16 , COL_TYPE_256 , COL_TYPE_2048 , COL_TYPE_32768 COL_TYPE_1M For size, specify the following parameters.
BM_512x256 , BM_512x512 , BM_1024x256 , BM_1024x512 In addr_A, set the V-RAM address to set the bitmap data.
This should be an address with a 0x20000 boundary.

Example

    slBitMapNbg0 ( COL_TYPE_256 , BM_1024x256 , (void *) (0x25e40000));

reference

 slBMPaletteNbg0
 slBMPaletteNbg1
 slBMPaletteRbg0
 VDP2_CHCTLA
 VDP2_CHCTLB
 VDP2_MPOFN
 VDP2_MPOFR
 nbg0_page_adr
 nbg1_page_adr
 ra_page_adr 



ListReference

function

slBMPaletteNbg0



ListReference

macro

slBMPaletteNbg1



ListReference

macro

slBMPaletteRbg0


Define the palette number of the bitmap screen

Form

    #include "sgl.h"

    Uint16 num;

    void slBMPaletteNbg0 (num);
    void slBMPaletteNbg1 (num);
    void slBMPaletteRbg0 (num);

argument

    Uint16 num --Palette number for displaying bitmap screens.

Number of returns

    void --Nothing is returned.

function

    Set the palette number for displaying the bitmap screen.

Example

    Uses a palette starting with 0x25f00200 in 16Bit color mode.
slBMPaletteNbg1 (1);

reference

 slBitMapNbg0
 slBitMapNbg1
 slBitMapRbg0
 VDP2_BMPNA 


★ Sprite



ListReference

function

slSpriteWinMode


Specifying whether to enable or disable the pret window

Form

    #include "sgl.h"

    Uint16 flag;

    void slSpriteWinMode (flag);

argument

    Uint16 flag --A flag parameter that specifies whether the sprite window is enabled or disabled.

Number of returns

    void --Nothing is returned.

function

    Specifies whether to enable or disable the sprite window.
flag has ON : Sprite window enabled OFF : Sprite window disabled.

Example

    Display the NBG2 screen only inside the sprite window.
/ * Set the sprite color mode to palette-only mode. * / slSpriteColMode ( SPR_PAL ); / * Declared the use of sprite windows. * / slSpriteWinMode ( ON ); / * Display NBG2 inside the sprite window. * / slScrWindowModeNbg2 ( spw_IN );

caution


    When using the sprite window, it cannot be used when the color mode of the sprite is RGB palette mixed mode, so use slSpriteWinMode to set it to palette mode.

reference

 slSpriteColMode
 slScrWindowMode
 slScrWindowModeNbg0
 slScrWindowModeNbg1
 slScrWindowModeNbg2
 slScrWindowModeNbg3
 slScrWindowModeRbg0
 slScrWindowModeSPR
 slScrWindowModeROT
 slScrWindowModeCCAL
 slSpriteType
 VDP2_SPCTL 



ListReference

function

slSpriteCCalcCond


Specifying sprite color calculation conditions

Form

    #include "sgl.h"

    Uint16 cond;

    void slSpriteCCalcCond (cond);

argument

    Uint16 cond --Sprite color arithmetic condition.

Number of returns

    void --Nothing is returned.

function

    Specify the sprite color calculation condition.
Specify the following parameters for cond.
CC_pr_CN : Performs color calculation when the priority is the same as or smaller than the color calculation condition number. (Priority <= ConditionNumber) CC_PR_CN : Performs color calculation when the priority is the same as the color calculation condition number. (Priority == ConditionNumber) CC_PR_cn : Performs color calculation when the priority is the same as or greater than the color calculation condition number. (Priority> = Condition Number) CC_MSB : Performs color calculation when the most significant bit of color data is 1.

Example

    Specify a sprite with sprite type 5 and set its priority number to 6.
Next, only sprites that match the color calculation number and the priority number, Specifies to perform color calculation with NBG0. SPR_ATTR attr = SPR_ATTRIBUTE [macro] (0, 0x100 | (6 << 12) | (1 << 11), / * ^^^^^^^ ^^^^^^^ * / / * Priority number 6 color arithmetic ratio bits * / No_Gouraud, CL256Bnk, sprNoflip | _ZmCC); :: / * Set any sprite parameters. * / slSpriteType (5); slPrioritySpr4 (6); slSpriteCCalcCond ( CC_PR_CN ); slSpriteCCalcNum (6); / * Set and Color calculation parameter. * / slColorCalc ( CC_RATE | CC_2ND | NBG0ON | SPRON ); slColRateNbg0 ( CLRate20_12 ); :: / * Display sprite. * / slPutSprite (& attr, pos, DEGtoANG (90.0));

reference

 slSpriteType
 slSpriteCCalcCond
 slSpriteCCalcNum
 slColorCalc
 slColorCalcOn
 slColorCalcMode
 slColRateSpr0
 slColRateSpr1
 slColRateSpr2
 slColRateSpr3
 slColRateSpr4
 slColRateSpr5
 slColRateSpr6
 slColRateSpr7
 slColRate
 slPrioritySpr0
 slPrioritySpr1
 slPrioritySpr2
 slPrioritySpr3
 slPrioritySpr4
 slPrioritySpr5
 slPrioritySpr6
 slPrioritySpr7
 VDP2_SPCTL 



ListReference

function

slSpriteCCalcNum


Specifying the sprite color calculation condition number

Form

    #include "sgl.h"

    Uint16 num;

    void slSpriteCCalcNum (num);

argument

    Uint16 num --Sprite color calculation condition number.

Number of returns

    void --Nothing is returned.

function

    Specify the sprite color calculation condition number.
Specify num in the range 0-7.

Example

    slSpriteCCalcCond ( CC_PR_cn );
    slSpriteCCalcNum (2);

reference

 slSpriteType
 slSpriteCCalcCond
 slSpriteCCalcCond
 slColorCalc
 slColorCalcOn
 slColorCalcMode
 slColRateSpr0
 slColRateSpr1
 slColRateSpr2
 slColRateSpr3
 slColRateSpr4
 slColRateSpr5
 slColRateSpr6
 slColRateSpr7
 slColRate
 slPrioritySpr0
 slPrioritySpr1
 slPrioritySpr2
 slPrioritySpr3
 slPrioritySpr4
 slPrioritySpr5
 slPrioritySpr6
 slPrioritySpr7
 VDP2_SPCTL 



ListReference

function

slSpriteColMode


Specifying the color mode of the sprite

Form

    #include "sgl.h"

    Uint16 mode;

    void slSpriteColMode (mode);

argument

    Uint16 mode --Sprite color mode

Number of returns

    void --Nothing is returned.

function

    Specifies the color mode of the sprite.
SPR_PAL , SPR_PAL_RGB for mode Specify one of.
SPR_PAL : Specify when the sprite data is in palette data format only.
SPR_PAL_RGB: Specify when the sprite data is a mixture of palette format and RGB format.

Example

    Set the sprite color mode to palette mode.
slSpriteColMode ( SPR_PAL )

reference

 slInitSystem
 slSetSprTVMode
 slSpriteWinMode
 VDP2_SPCTL 



ListReference

function

slSpriteType


Sprite type specification

Form

    #include "sgl.h"

    Uint16 type;

    void slSpriteType (type);

argument

    Uint16 type --Sprite data type

Number of returns

    void --Nothing is returned.

function

    Specifies the type of sprite data.
type is specified from 0 to 15.
0 to 7 are for low resolution (320 or 352) and 8 to 15 are for high resolution (640 or 704).

Example

    Set the sprite type to 2.
slSpriteType (2);

caution


    The default value for SGL sprite types is type 3. (When you set it to high resolution,
    It will be type B. )

reference

 slDispSprite
 slSetSprite
 slPutSprite
 slDispSpriteHV
 slDispSpriteSZ
 slDispSprite4P
 slSpriteWinMode
 VDP2_SPCTL 


★ Mosaic



ListReference

function

slScrMosaicOn


Specifying the scroll surface to be mosaicked

Form

    #include "sgl.h"

    Uint16 mode;

    void slScrMosaicOn (mode);

argument

    Uint16 mode --Scroll surface to be mosaicked

Number of returns

    void --Nothing is returned.

function

    Specify the scroll surface to be mosaicked.
In mode, NBG0ON , NBG1ON , NBG2ON , NBG3ON , RBG0ON , LNCLON , SPRON Is entered.

Example

    slScrMosaicOn ( NBG2ON | NBG3ON );

reference

 slScrMosSize
 VDP2_MZCTL 



ListReference

function

slScrMosSize


Specifying the size of mosaic processing

Form

    #include "sgl.h"

    Uint16 h_size, v_size;

    void slScrMosSize (h_size, v_size);

argument

    Uint16 h_size --Horizontal size. 
    Uint16 v_size --Vertical size.

Number of returns

    void --Nothing is returned.

function

    Specify the size for mosaic processing.
The size that can be specified is 1 to 16 dots in both the horizontal and vertical directions.

Example

    slScrMosSize (4, 6);

caution


    When double-dense interlace is used, it is forced to be single-dense interlace, and the actual display size is in units of 2 dots in the V direction.
(v_size is doubled internally.)

reference

 slScrMosaicOn
 Resolution
 VDP2_MZCTL 


★ Window



ListReference

function

slScrWindow0



ListReference

function

slScrWindow1


Rectangle window area settings

Form

    #include "sgl.h"

    Uint16 left, top, right, bottom;

    void slScrWindow0 (left, top, right, bottom);
    void slScrWindow1 (left, top, right, bottom);

argument

    Uint16 left --Coordinates of the right corner Uint16 top --Coordinates of the top Uint16 right --Coordinates of the left corner Uint16 bottom --Coordinates of the bottom

Number of returns

    void --Nothing is returned.

function

    Set the area of rectangular window 0/1 for scrolling.
If a line window is specified, the line window will be disabled.

Example

    slScrWindow1 (50, 50, 180, 150);

reference

 slSpriteWinMode
 slScrLineWindow0
 slScrLineWindow1
 slScrWindowMode
 slScrWindowModeNbg0
 slScrWindowModeNbg1
 slScrWindowModeNbg2
 slScrWindowModeNbg3
 slScrWindowModeRbg0
 slScrWindowModeSPR
 slScrWindowModeROT
 slScrWindowModeCCAL
 VDP2_TVMD
 VDP2_WPSX0
 VDP2_WPEX0
 VDP2_WPSX1
 VDP2_WPEX1
 VDP2_LWTA0
 VDP2_LWTA1 



ListReference

function

slScrLineWindow0



ListReference

function

slScrLineWindow1


Line window table settings

Form

    #include "sgl.h"

    void * addr_A;

    void slScrLineWindow0 (addr_A);
    void slScrLineWindow1 (addr_A);

argument

    void * addr_A --Address of line window data table

Number of returns

    void --Nothing is returned.

function

    Specifies the address of the line window data table 0/1.
When using a line window, set the most significant bit to 1.
Specify NULL if not used.

Example

    -When using the line window Address = 0x25E3F00
    slScrLineWindow0 ((void *) (0x25E3F000 | 0x80000000));

    -If the address is a pointer variable Sint16 * lnptr;
    lnptr = ( Sint16 *) 0x25e3f000;
    slScrLineWindow1 ((void *) (lnptr + 0x40000000));
    (Double the value to add Sint16 )> Because)

    -When the line window is no longer used slScrLineWindow0 ((void *) NULL );

caution


    Even if you set the line window, the data in the rectangular window remains valid (hardware specification), so both areas are within window 0.
If you want to invalidate the data of the rectangular window, you can use the top and bottom of the window and Set the data so that there is a contradiction in the positional relationship between the left and right.
example) slScrWindow0 (10, 0, 0, 10); / * The left-right positional relationship is strange * / | | | | __ Bottom | | | _____ Right | | _______ Top | _________ Left slScrWindow0 (10,10,0,0); / * The positional relationship between the top and bottom and left and right is strange * /

reference

 slSpriteWinMode
 slScrLineWindow0
 slScrLineWindow1
 slScrWindowMode
 slScrWindowModeNbg0
 slScrWindowModeNbg1
 slScrWindowModeNbg2
 slScrWindowModeNbg3
 slScrWindowModeRbg0
 slScrWindowModeSPR
 slScrWindowModeROT
 slScrWindowModeCCAL
 VDP2_LWTA0
 VDP2_LWTA1 



ListReference

function

slScrWindowMode



ListReference

macro

slScrWindowModeNbg0



ListReference

macro

slScrWindowModeNbg1



ListReference

macro

slScrWindowModeNbg2



ListReference

macro

slScrWindowModeNbg3



ListReference

macro

slScrWindowModeRbg0



ListReference

macro

slScrWindowModeSPR



ListReference

macro

slScrWindowModeROT



ListReference

macro

slScrWindowModeCCAL


Setting the usage mode of the scroll surface window

Form

    #include "sgl.h"

    Uint16 mode;
    Uint16 type;

    void slScrWindowMode (mode, type);
    void slScrWindowModeNbg0 (type);
    void slScrWindowModeNbg1 (type);
    void slScrWindowModeNbg2 (type);
    void slScrWindowModeNbg3 (type);
    void slScrWindowModeRbg0 (type);
    void slScrWindowModeSPR (type);
    void slScrWindowModeROT (type);
    void slScrWindowModeCCAL (type);

argument

    Uint16 mode --Scroll surface to use (described later)
    Uint16 type --Condition / mode.

Number of returns

    void --Nothing is returned.

function

    Sets the usage mode of the window on each scroll plane.
In mode, scnNBG0 , scnNBG1 , scnNBG2 , scnNBG3 , scnRBG0 , scnSPR , scnROT , scnCCAL One of For type, select from the following elements and specify.
[ win_OR | win_AND ] Conditions for multiple windows [ win0_IN | win0_OUT ] [ win1_IN | win1_OUT ] ... _IN shows the inside of the window [ spw_IN | spw_OUT ] ... _OUT shows the outside of the window

Example

    NBG0 is only inside window 0,
    NBG1 is only outside window 1,
    NBG2 is inside window 0 and window 1,
    If NBG3 is only inside the overlapping part of window 0 and window 1 slScrWindowModeNbg0 ( win0_IN );
    slScrWindowModeNbg1 ( win1_OUT );
    slScrWindowModeNbg2 ( win_OR | win0_IN | win1_IN );
    slScrWindowModeNbg3 ( win_AND | win0_IN | win1_IN );

reference

 slSpriteWinMode
 slScrWindow0
 slScrWindow1
 slScrLineWindow0
 slScrLineWindow1
 VDP2_WCTLA 


★ Priority



ListReference

function

slPriority



ListReference

macro

slPriorityNbg0



ListReference

macro

slPriorityNbg1



ListReference

macro

slPriorityNbg2



ListReference

macro

slPriorityNbg3



ListReference

macro

slPriorityRbg0



ListReference

macro

slPrioritySpr0



ListReference

macro

slPrioritySpr1



ListReference

macro

slPrioritySpr2



ListReference

macro

slPrioritySpr3



ListReference

macro

slPrioritySpr4



ListReference

macro

slPrioritySpr5



ListReference

macro

slPrioritySpr6



ListReference

macro

slPrioritySpr7


Priority number setting

Form

    #include "sgl.h"

    Uint16 mode;
    Uint16 num;

    void slPriority (mode, num);
    void slPriorityNbg0 (num);
    void slPriorityNbg1 (num);
    void slPriorityNbg2 (num);
    void slPriorityNbg3 (num);
    void slPriorityRbg0 (num);
    void slPrioritySpr0 (num);
    void slPrioritySpr1 (num);
    void slPrioritySpr2 (num);
    void slPrioritySpr3 (num);
    void slPrioritySpr4 (num);
    void slPrioritySpr5 (num);
    void slPrioritySpr6 (num);
    void slPrioritySpr7 (num);

argument

    Uint16 num --Priority number.
Uint16 mode --A face to set the priority (described later).

Number of returns

    void --Nothing is returned.

function

    Set the priority number for each screen.
The following parameters are entered in mode.
scnNBG0 , scnNBG1 , scnNBG2 , scnNBG3 , scnRBG0 , scnSPR0 , scnSPR1 scnSPR2 , scnSPR3 , scnSPR4 , scnSPR5 , scnSPR6 , scnSPR7 num specifies a value between 0 and 7 (but not displayed if 0 is specified).

Example

    slPriority ( scnSPR5 , 6);
    slPriorityRbg0 (5);

reference

 slSpriteType 


★ Shadow



ListReference

function

slShadowOn


Setting the scroll surface where the shadow works

Form

    #include "sgl.h"

    Uint16 mode;

    void slShadowOn (mode);

argument

    Uint16 mode --The side that activates the shadow function (described later).

Number of returns

    void --Nothing is returned.

function

    Specifies which scroll surface the shadow function works for.
In mode, NBG0ON , NBG1ON , NBG2ON , NBG3ON , RBG0ON , BACKON Give either.

Example

    slShadowOn ( NBG2ON );

caution


    It is valid for both normal shadows and MSB shadows.

reference

 slSpriteType
 slTpShadowMode
 VDP2_SDCTL
 VDP2_PRISA 



ListReference

function

slTpShadowMode


Specifies whether to enable transparent shadow sprites

Form

    #include "sgl.h"

    Uint16 flag;

    void slTpShadowMode (flag);

argument

    Uint16 flag-A flag that indicates whether to enable transparent shadow sprites.

Number of returns

    void --Nothing is returned.

function

    Specifies whether to enable transparent shadow sprites.
flag has ' ON ' or'OFF ' Is specified.

Example

    Apply a transparent shadow.
slTpShadowMode ( ON );

caution


    The MSB of the sprite data is to apply a transparent shadow ON must have been to.

reference

 slSpriteType
 slShadowOn
 VDP2_SDCTL 


★ Line / vertical cell scroll



ListReference

function

slLineScrollMode



ListReference

macro

slLineScrollModeNbg0



ListReference

macro

slLineScrollModeNbg1


Setting the line scroll mode of the scroll surface

Form

    #include "sgl.h"

    Uint16 mode;
    Uint16 type;

    slLineScrollMode (mode, type);
    slLineScrollModeNbg0 (type);
    slLineScrollModeNbg1 (type);

argument

    Uint16 mode --The surface to set the line scroll mode (described later).
Uint16 type --Line scroll mode

Number of returns

    void --Nothing is returned.

function

    Sets the line scroll mode for the scroll surface.
In mode, scnNBG0 , scnNBG1 One of the types is lineSZ1 | lineSZ2 | lineSZ4 | lineSZ8 : Line width lineZoom : Horizontal scaling lineVScroll : Vertical scroll lineHScroll : Horizontal scroll VCellScroll : Vertical cell scroll Specify the mode you want to use by connecting with'|'.

Example

    slLineScrollMode ( scnNBG1 , lineSZ2 | lineVScroll | VCellScroll );
    slLineScrollModeNbg1 ( lineSZ8 | lineZoom );

reference

 slScrCycleSet
 slScrDisp
 slLineScrollTable0
 slLineScrollTable0
 slVCellTable
 VDP2_SCRCTL 



ListReference

function

slLineScrollTable0



ListReference

function

slLineScrollTable1


Specifying a table for line scroll data

Form

    #include "sgl.h"

    void * addr_A;

    void slLineScrollTable0 (addr_A);
    void slLineScrollTable1 (addr_A);

argument

    void * addr_A --VRAM address where line scroll data is set

Number of returns

    void --Nothing is returned.

function

    Specifies a table of line scrolling data.

Example

    void slLineScrollTable0 ((void *) 0x25e20000);

reference

 slLineScrollMode
 slLineScrollModeNbg0
 slLineScrollModeNbg1
 slVCellTable
 VDP2_VCSTA
 VDP2_LSTA0
 VDP2_LSTA1 



ListReference

function

slVCellTable


Specifying a table for vertical cell scroll data

Form

    #include "sgl.h"

    void * addr_A;

    void slVCellTable (addr_A);

argument

    void addr_A --VRAM address where vertical cell scroll data is set

Number of returns

    void --Nothing is returned.

function

    Specifies a table of vertical cell scroll data.
If you want to use vertical cell scrolling, you need to set the VRAM access cycle.
Set by the functions slScrCycleSet , slScrDisp.

Example

    Scroll NBG0 vertically.
slScrCycleSet (0xc0feeeee, 0x44feeeee, 0xfeeeeeee, 0xfeeeeeee); slScrDisp ( NBG0ON ); void slVCellTable ((void *) 0x25e10000);

caution


    Vertical cell scrolling is not available in high resolution mode.
Also, it is not allowed to use the same bank as the data (coefficient, CG, etc.) used for rotary scrolling.

reference

 slLineScrollMode
 slLineScrollModeNbg0
 slLineScrollModeNbg1
 slLineScrollTable0
 slLineScrollTable0
 VDP2_VCSTA

return
Copyright SEGA ENTERPRISES, LTD., 1997