Japanese

★Cell settings



ListReference

function

slCharNbg0



ListReference

function

slCharNbg1



ListReference

function

slCharNbg2



ListReference

function

slCharNbg3



ListReference

function

slCharRbg0


Setting the character size and number of colors on the scroll surface

Format

    #include "sgl.h"

    Uint16 type;
    Uint16 size;

    void slCharNbg0( type, size );
    void slCharNbg1( type, size );
    void slCharNbg2( type, size );
    void slCharNbg3( type, size );
    void slCharRbg0( type, size );

argument

    Uint16 type - Number of character colors (described later).
Uint16 size - Character size (described later).

Return number

    void - returns nothing.

function

Set the character size of each scroll surface and the number of colors used for scrolling.
Parameter description.
type:
         COL_TYPE_16 : Palette format 16 colors
         COL_TYPE_256 : Palette format 256 colors
         COL_TYPE_2048 : Palette format 2048 colors
         COL_TYPE_32768 : RGB format 32768 colors
         COL_TYPE_1M : RGB format 16.77 million colors size: 
         CHAR_SIZE_1x1 : Set character size to 1x1 cell.
CHAR_SIZE_2x2 : Set character size to 2x2 cells.

example

    Set NBG1 to 256 color palette format and character size to 1x1 cell.
slCharNbg1 ( COL_TYPE_256 , CHAR_SIZE_1x1 );

reference

 slPageNbg0
 slPageNbg1
 slPageNbg2
 slPageNbg3
 slPageRbg0
 slPlaneNbg0
 slPlaneNbg1
 slPlaneNbg2
 slPlaneNbg3
 slPlaneRA
 slPlaneRB
 slMapNbg0
 slMapNbg1
 slMapNbg2
 slMapNbg3
 sl1MapRA
 sl1MapRB
 slOverPatRA
 slOverPatRA
 sl16MapRA
 sl16MapRB
 VDP2_CHCTLA
 VDP2_CHCTLB 



ListReference

function

slPageNbg0



ListReference

function

slPageNbg1



ListReference

function

slPageNbg2



ListReference

function

slPageNbg3



ListReference

function

slPageRbg0


Scroll page page settings

Format

    #include "sgl.h"

    void *celaddr;
    void *coladdr;
    Uint16 type;

    void slPageNbg0( celaddr, coladdr, type );
    void slPageNbg1( celaddr, coladdr, type );
    void slPageNbg2( celaddr, coladdr, type );
    void slPageNbg3( celaddr, coladdr, type );
    void slPageRbg0( celaddr, coladdr, type );

argument

    void *celaddr - VRAM start address of cell data.
void *coladdr - VRAM start address of color data.
Uint16 type - Pattern name data (described later).

Return number

    void - returns nothing.

function

Configure the page settings for each scroll surface.
celaddr can be either an offset from the beginning of VDP2 (25E00000H) or an absolute address. (Only the lower 20 bits are valid.) coladdr can be either an offset from the beginning of the color RAM (25F00000H) or an absolute address. (Only the lower 12 bits are valid.) Type contains the following parameters.
       PNB_1WORD : 1 word, lower 10 bits
       PNB_1WORD | CN_12BIT : 1 word, lower 12 bits
       PNB_2WORD : 2 words, lower 16 bits

example

    slPageNbg1 ( ( void * )0x20000, 0, PNB_1WORD | CN_10BIT );

reference

 slCharNbg0
 slCharNbg1
 slCharNbg2
 slCharNbg3
 slCharRbg0
 slPlaneNbg0
 slPlaneNbg1
 slPlaneNbg2
 slPlaneNbg3
 slPlaneRA
 slPlaneRB
 slMapNbg0
 slMapNbg1
 slMapNbg2
 slMapNbg3
 sl1MapRA
 sl1MapRB
 slOverPatRA
 slOverPatRA
 sl16MapRA
 sl16MapRB
 VDP2_RAMCTL
 VDP2_PNCN0
 VDP2_PNCN1
 VDP2_PNCN2
 VDP2_PNCN3
 VDP2_PNCR
 nbg0_char_adr
 nbg1_char_adr
 nbg2_char_adr
 nbg3_char_adr
 nbg0_char_adr
 ra_char_adr
 rb_char_adr 



ListReference

function

slPlaneNbg0



ListReference

function

slPlaneNbg1



ListReference

function

slPlaneNbg2



ListReference

function

slPlaneNbg3



ListReference

function

slPlaneRA



ListReference

function

slPlaneRB


Set the plane size of the scroll surface

Format

    #include "sgl.h"

    Uint16 type;

    void slPlaneNbg0( type );
    void slPlaneNbg1( type );
    void slPlaneNbg2( type );
    void slPlaneNbg3( type );
    void slPlaneRA( type );
    void slPlaneRB( type );

argument

    Uint16 type - Plane size (described later)

Return number

    void - returns nothing.

function

Sets the plane size of each scroll surface.
Type contains the following parameters.
       PL_SIZE_1x1 : Width 1 x Height 1
       PL_SIZE_2x1 : Width 2 x Height 1
       PL_SIZE_2x2 : Width 2 x Height 2

example

    slPlaneNBG0( PL_SIZE_2x2 );

Note

reference

 slCharNbg0
 slCharNbg1
 slCharNbg2
 slCharRbg0
 slPageNbg0
 slPageNbg1
 slPageNbg2
 slPageNbg3
 slPageRbg0
 slMapNbg0
 slMapNbg1
 slMapNbg2
 slMapNbg3
 sl1MapRA
 sl1MapRB
 slOverPatRA
 sl16MapRB
 VDP2_PLSZ 



ListReference

function

slOverRA



ListReference

function

slOverRB


Setting the screen overflow processing mode for the rotating scroll surface

Format

    #include "sgl.h"

    Uint16 type;

    void slOverRA( type );
    void slOverRB( type );

argument

    Uint16 type - Screen overflow processing mode (described later)

Return number

    void - returns nothing.

function

Set the screen over processing mode for each rotating scroll surface.
Specify the following value for type.
0: The image set in the display area is repeated outside the area.
1: Repeats the specified character pattern outside the area.
2: Everything outside the area is transparent.
3: Everything outside the 512 vertical x 512 horizontal area is transparent.
slOverRA sets coefficient table A, and slOverRB sets coefficient table B.

example

    slOverRA ( 3 );

reference

 slCharRbg0
 slPageRbg0
 slPlaneRA
 slPlaneRB
 sl1MapRA
 sl1MapRB
 slOverPatRA
 sl16MapRB
 VDP2_PLSZ 



ListReference

function

slMapNbg0



ListReference

function

slMapNbg1



ListReference

function

slMapNbg2



ListReference

function

slMapNbg3


Map settings for normal scroll surface

Format

    #include "sgl.h"

    void *map_a, *map_b, *map_c, *map_d;

    void slMapNbg0( map_a, map_b, map_c, map_d );
    void slMapNbg1( map_a, map_b, map_c, map_d );
    void slMapNbg2( map_a, map_b, map_c, map_d );
    void slMapNbg3( map_a, map_b, map_c, map_d );

argument

    void *map_a - Start address in VRAM of the pattern name data table of plane A.
void *map_b - Start address in VRAM of the pattern name data table of plane B.
void *map_c - Start address in VRAM of the pattern name data table of plane C.
void *map_d - Start address in VRAM of the pattern name data table of plane D.

Return number

    void - returns nothing.

function

Configure the map settings for each normal scroll surface.
The configuration of the plane is as follows.
              (0,0)
                ┌─┬─┐
                │A│B│
                ├─┼─┤
                │C│D│
                └─┴─┘
For map_a, map_b, map_c, and map_d, you can specify an offset from the beginning of VDP2 (25E00000H) or an absolute address. (Only the lower 20 bits are valid.)

example

    slMapNbg0 ( ( void * )0x50000, ( void * )0x25e50000, ( void * )0x50000,
               ( void * )0x50000 );

reference

 slCharNbg0
 slCharNbg1
 slCharNbg2
 slCharNbg3
 slPageNbg0
 slPageNbg1
 slPageNbg2
 slPageNbg3
 slPlaneNbg0
 slPlaneNbg1
 slPlaneNbg2
 slPlaneNbg3
 VDP2_CHCTLA
 VDP2_CHCTLB
 VDP2_PNCN0
 VDP2_PNCN1
 VDP2_PNCN2
 VDP2_PNCN3
 VDP2_MPOFN
 VDP2_MPABN0
 VDP2_MPCDN0
 VDP2_MPABN1
 VDP2_MPCDN1
 VDP2_MPABN2
 VDP2_MPCDN2
 VDP2_MPABN3
 VDP2_MPCDN3
 nbg0_page_adr
 nbg1_page_adr
 nbg2_page_adr
 nbg3_page_adr 



ListReference

function

sl1MapRA



ListReference

function

sl1MapRB


Configuring a map for rotational scrolling using rotation parameters

Format

    #include "sgl.h"

    void *addr_A;

    void sl1MapRA( addr_A );
    void sl1MapRB( addr_A );

argument

    void *addr_A - Start address on VRAM of pattern name data table of rotation parameters

Return number

    void - returns nothing.

function

Set up a map for rotational scrolling using their respective rotation parameters.

example

    sl1MapRA ( ( void * )( 0x25e20000 ) );

reference

 slCharRbg0
 slPageRbg0
 slPlaneRA
 slPlaneRB
 slOverPatRA
 sl16MapRA
 sl16MapRB
 VDP2_RAMCTL
 VDP2_CHCTLB
 VDP2_PNCR
 VDP2_MPOFR
 VDP2_MPABRA
 VDP2_MPCDRA
 VDP2_MPEFRA
 VDP2_MPGHRA
 VDP2_MPIJRA
 VDP2_MPKLRA
 VDP2_MPMNRA
 VDP2_MPOPRA
 VDP2_MPABRB
 VDP2_MPCDRB
 VDP2_MPEFRB
 VDP2_MPGHRB
 VDP2_MPIJRB
 VDP2_MPKLRB
 VDP2_MPMNRB
 VDP2_MPOPRB
 ra_page_adr 



ListReference

function

slOverPatRA



ListReference

function

slOverPatRB


Define pattern name for off-map character for rotating scroll.

Format

    #include "sgl.h"

    Uint16 pname;

    void slOverPatRA( pname );
    void slOverPatRB( pname );

argument

    Uint16 pname - Pattern name of off-map character for rotating scroll.

Return number

    void - returns nothing.

function

Sets the pattern name of the rotating scroll off-map character.

example

    /* For pattern name data 2 Word. */
    slOverRA ( 1 );
    slOverPatRA( 2 << 30 | 0 << 28 | 4 << 16 | 0x240 );
    /*           ^^^^^^^   ^^^^^^^   ^^^^^^^   ^^^^^      */
    /*       Vertical↑ No special↑   ↑Palette  ↑Character */
    /*           flip    function     No.4     ↑240H      */

Note

The pattern name data specified with this function is valid only when mode 1 is set with the slOverRA function. If any other settings are made, the pattern name data set by this function will be invalid.

reference

 slCharRbg0
 slPageRbg0
 slPlaneRA
 slPlaneRB
 sl1MapRA
 sl1MapRB
 sl16MapRA
 sl16MapRB
 VDP2_OVPNRA
 VDP2_OVPNRB 



ListReference

function

sl16MapRA



ListReference

function

sl16MapRB


Define 16 pages of rotating scroll map

Format

    #include "sgl.h"

    Uint8 map[ 16 ];

    void sl16MapRA( map );
    void sl16MapRB( map );

argument

    Uint8 map[ 16 ] - Map number for 16 pages (details will be explained later).

Return number

    void - returns nothing.

function

Set 16 pages of rotating scroll maps.
Set the map numbers for 16 pages in the array passed as an argument.
Please enter the page number in units of 0x800 from the beginning of VRAM.) ABCD EFGH IJKL MNOP Set the above 4x4 pages in an array in ABC...NOP order.

example

      #define MAPOFFSET (RBG0_MAP_ADR-VDP_VRAM_A0)/0x800
      #define DD 4+MAPOFFSET
      Uint8 map[16] = {
         0*DD, 1*DD, 2*DD, 3*DD,
         4*DD, 5*DD, 6*DD, 7*DD,
         8*DD, 9*DD,10*DD,11*DD,
        12*DD,13*DD,14*DD,15*DD,
      };
      #undef DD
      sl16MapRA (map);

Note

There are many cases where the page number table passed to the sl16MapRA function does not match the actual VRAM, so it does not work properly.
The sl16MapRA and sl16MapRB functions assume that the page numbers in the table are serial numbers counted from the beginning of VRAM. Multiply the 0th element of the table by 0x800 and register that value as an address.
for example,
      #define RBG0_CEL_ADR (VDP2_VRAM_A0)
      #define RBG0_MAP_ADR (VDP2_VRAM_B0)
      #define RBG0_COL_ADR (VDP2_COLRAM)
      #define RBG0_KTB_ADR (VDP2_VRAM_A1)
      #define RBG0_PRA_ADR (VDP2_VRAM_A1+ 0x1fe00)
As in the example above, if the VRAM-B0 bank has a pattern name, the table must be populated with values such as 128,132,136...

(There seem to be many cases where data such as 0,4,8... is set)
      #define MAPOFFSET (RBG0_MAP_ADR-VDP_VRAM_A0)/0x800
      #define DD 4+MAPOFFSET
      Uint8 map[16] = {
         0*DD, 1*DD, 2*DD, 3*DD,
         4*DD, 5*DD, 6*DD, 7*DD,
         8*DD, 9*DD,10*DD,11*DD,
        12*DD,13*DD,14*DD,15*DD,
      };
      #undef DD
sl16MapRA (map); You can set it correctly by using the method described above.

reference

 slCharRbg0
 slPageRbg0
 slPlaneRA
 slPlaneRB
 slOverPatRA
 sl1MapRA
 sl1MapRB
 VDP2_CHCTLB
 VDP2_PNCR
 VDP2_MPABRB 


★ASCII characters



ListReference

function

slScrAscSet


ASCII character settings

Format

    #include "sgl.h"

    void *addr_A;

    void slScrAscSet( addr_A );

argument

    void *addr_A - VRAM address to set ASCII

Return number

    void - returns nothing.

function

Sets the default ASCII characters (for 256 color mode, 128 cells) to the specified address.
Specify addr_A as an absolute address.

example

    slScrAscSet ( ( void * )0x25e00000 );

Note

There is no problem if you specify a direct value as an argument, but slScrAscSet ( symb ); <-- (A) *( Uint32 * )( symb ) = 0x20000000; <-- (B) If you specify it with a symbol like , and you want to use that symbol later, (B) may not work correctly. (It depends on the optimization level of the compiler, etc.) When using this function, please avoid using it in this way as much as possible.

reference

 setASC_1to8
 setASC_1to4
 SGL_ASCII_CG
 slPrint
 slPrintFX
 slPrintHex
 slDispHex 



ListReference

function

setASC_1to8


Expansion of ASCII character data where 1 pixel is compressed to 1 bit

Format

    #include "sgl.h"

    Uint8 *src;
    void *dst;
    Uint32 cel;
    Uint8 pal;

    void setASC_1to8( src, dst ,cell ,pal );

argument

    Uint8 *src_A - Address of original data.
void *dst_A - Destination address.
Uint32 cel - Number of characters to expand.
Uint8 pal - Base palette number of the character to expand.

Return number

    void - returns nothing.

function

Expands ASCII character data compressed to 1 (4) bits per pixel into character data for 256 color scroll mode.
Each pixel has a palette number of 0 or 1.

example

    Uint8 src[] = {
             :
    } 
    setASC_1to8 ( src, ( void * )0x25e20000, sizeof( src ), 2 );

reference

 slScrAscSet
 setASC_1to4
 SGL_ASCII_CG
 slPrint
 slPrintFX
 slPrintHex
 slDispHex 



ListReference

function

setASC_1to4


Expansion of ASCII character data where 1 pixel is compressed to 1 bit

Format

    #include "sgl.h"

    Uint8 *src;
    void *dst;
    Uint32 cel;
    Uint8 pal;
    Sint32 skip;

    void setASC_1to4( src, dst, cel, pal, skip );

argument

    Uint8 *src_A - Address of original data.
void *dst_A - Destination address.
Uint32 cel - Number of characters to expand.
Uint8 pal - Base palette number of the character to expand.
Sint32 skip - For skip, how many bytes to skip after expanding one cell.

Return number

    void - returns nothing.

function

Expands ASCII character data compressed to 1 bit per pixel into character data for 16-color scroll mode. Each pixel has a palette number of 0 or 1.
For skip, specify CG_Size/2 when using a function dedicated to 256-color mode such as slPrint in 16-color mode.

example

    Uint8 src[] = {
             :
    } 
    setASC_1to4 ( src, ( void * )0x25e20000, sizeof( src ), 
                 2, sizeof( src ) / 2 );

reference

 slScrAscSet
 setASC_1to8
 SGL_ASCII_CG
 slPrint
 slPrintFX
 slPrintHex
 slDispHex 



ListReference

global variables

SGL_ASCII_CG


ASCII characters that SGL has by default

Format

    #include "sgl.h"

    Uint8 SGL_ASCII_CG[]

function

This is ASCII character data that SGL has as default character data, and is expanded using the setASC_1to8 function above.
The number of characters is 128.

reference

 slScrAscSet
 setASC_1to8
 setASC_1to4
 slPrint
 slPrintFX
 slPrintHex
 slDispHex

return
Copyright SEGA ENTERPRISES, LTD., 1997