★ 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

Form

    #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 (see below).
Uint16 size-Character size (see below).

Number of returns

    void --Nothing is returned.

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 : Character size in 1x1 cell.
CHAR_SIZE_2x2 : Character size in 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 surface page settings

Form

    #include "sgl.h"

    void * celaddr;
    void * coldaddr;
    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 * coldaddr --VRAM start address of color data.
Uint16 type --Pattern name data (described later).

Number of returns

    void --Nothing is returned.

function

    Set the page for each scroll surface.
For celaddr, either the offset from the beginning of VDP2 (25E00000H) or the absolute address can be used. (Only the lower 20 bits are valid.) The 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.) The following parameters are entered in type.
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

Form

    #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 --Plain size (described later)

Number of returns

    void --Nothing is returned.

function

    Sets the plane size of each scroll plane.
The following parameters are entered in type.
PL_SIZE_1x1 : Horizontal 1 x Vertical 1 PL_SIZE_2x1 : Horizontal 2 x Vertical 1 PL_SIZE_2x2 : Horizontal 2 x Vertical 2

Example

    slPlaneNBG0 ( PL_SIZE_2x2 );

caution



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 over processing mode for the rotating scroll surface

Form

    #include "sgl.h"

    Uint16 type;

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

argument

    Uint16 type --Screen over processing mode (described later)

Number of returns

    void --Nothing is returned.

function

    Set the screen over processing mode for each rotating scroll surface.
Specify the following values for type.
0: Outside the area, the image set in the display area is repeated.
1: The specified character pattern is repeated outside the area.
2: Everything outside the area is transparent.
3: Everything outside the area of 512 vertical x 512 horizontal is transparent.
slOverRA sets the coefficient table A, and slOverRB sets the 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 setting of normal scroll surface

Form

    #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 --VRAM start address of plane A pattern name data table.
void * map_b --VRAM start address of plane B pattern name data table.
void * map_c --VRAM start address of plane C pattern name data table.
void * map_d --VRAM start address of plane D pattern name data table.

Number of returns

    void --Nothing is returned.

function

    Make map settings for each normal scroll plane.
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 the offset from the beginning of VDP2 (25E00000H) or the 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


Setting a map for a rotation scroll that uses rotation parameters

Form

    #include "sgl.h"

    void * addr_A;

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

argument

    void * addr_A --Rotation parameter pattern name Data table start address in VRAM

Number of returns

    void --Nothing is returned.

function

    Set up a rotation scroll map that uses each rotation parameter.

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 names for off-map characters in rotary scrolling

Form

    #include "sgl.h"

    Uint16 pname;

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

argument

    Uint16 pname-Pattern name for unmapped characters in rotary scrolling.

Number of returns

    void --Nothing is returned.

function

    Set the pattern name of the unmapped character of the rotary scroll.

Example

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

caution


    The pattern name data specified by this function is valid only when mode 1 is set by the slOverRA function. If any other settings have been 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 rotary scroll map

Form

    #include "sgl.h"

    Uint8 map [16];

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

argument

    Uint8 map [16] --Map number for 16 pages (details below).

Number of returns

    void --Nothing is returned.

function

    Set 16 pages of rotary scroll map.
Set the map number for 16 pages in the array passed as an argument.
For the page number, enter the one counted in 0x800 units from the beginning of VRAM) ABCD EFGH IJKL MNOP Set the above 4x4 pages in the array in the order of ABC ... NOP.

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);

caution


    It is often the case that the page number table passed to the sl16MapRA function is not working properly because it does not match the actual VRAM.
In the sl16MapRA function and sl16MapRB function, it is assumed 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 the 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) If the VRAM-B0 bank has a pattern name, the table must have values such as 128,132,136 ...
(It seems that there are 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); If you set it by the above method, you can set it correctly.

reference

 slCharRbg0
 slPageRbg0
 slPlaneRA
 slPlaneRB
 slOverPatRA
 sl1MapRA
 sl1MapRB
 VDP2_CHCTLB
 VDP2_PNCR
 VDP2_MPABRB 


★ ASCII characters



ListReference

function

slScrAscSet


ASCII character settings

Form

    #include "sgl.h"

    void * addr_A;

    void slScrAscSet (addr_A);

argument

    void * addr_A --Address on VRAM to set ASCII

Number of returns

    void --Nothing is returned.

function

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

Example

    slScrAscSet ((void *) 0x25e00000);

caution


    There is no problem if you specify a direct value in the argument,
    slScrAscSet (symb); <-(A)
    * ( Uint32 *) (symb) = 0x20000000; <-(B)
    If you specify a symbol like, and you want to use that symbol later,
    The operation of (B) may not be performed correctly. (Depending on the optimization level of the compiler, etc.) When using this function, avoid such usage as much as possible.

reference

 setASC_1to8
 setASC_1to4
 SGL_ASCII_CG
 slPrint
 slPrintFX
 slPrintHex
 slDispHex 



ListReference

function

setASC_1to8


Extraction of ASCII character data with 1 pixel compressed to 1 bit

Form

    #include "sgl.h"

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

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

argument

    Uint8 * src_A --The address of the original data.
void * dst_A --Forwarding address.
Uint32 cel --Number of characters to expand.
Uint8 pal --The base palette number of the character to expand.

Number of returns

    void --Nothing is returned.

function

    Expands ASCII character data, where one pixel is compressed to 1 (4) bits, into character data for scrolling 256-color 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


Extraction of ASCII character data with 1 pixel compressed to 1 bit

Form

    #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 --The address of the original data.
void * dst_A --Forwarding address.
Uint32 cel --Number of characters to expand.
Uint8 pal --The base palette number of the character to expand.
Sint32 skip --how many bytes to skip after expanding one cell for skip.

Number of returns

    void --Nothing is returned.

function

    Expands ASCII character data with 1 pixel compressed to 1 bit into character data for scrolling 16-color 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

Form

    #include "sgl.h"

    Uint8 SGL_ASCII_CG []

function

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

reference

 slScrAscSet
 setASC_1to8
 setASC_1to4
 slPrint
 slPrintFX
 slPrintHex
 slDispHex

return
Copyright SEGA ENTERPRISES, LTD., 1997