Japanese

★Basic data type



ListReference

data type

Uint8


unsigned 1-byte integer

function

    typedef unsigned char Uint8;




ListReference

data type

Sint8


signed 1-byte integer

function

    typedef signed char Sint8;




ListReference

data type

Uint16


unsigned 2-byte integer

function

    typedef unsigned short Uint16;




ListReference

data type

Sint16


signed 2-byte integer

function

    typedef signed short Sint16;




ListReference

data type

Uint32


unsigned 4-byte integer

function

    typedef unsigned long Uint32;



ListReference

data type

Sint32


signed 4-byte integer

function

    typedef signed long Sint32;




ListReference

data type

Float32


4 byte real number

function

    typedef float Float32;




ListReference

data type

Float64


8 byte real number

function

    typedef double Float64;




ListReference

data type

Int


INT type

function

    typedef int Int;




ListReference

data type

Bool


Logical type (value is a logical constant)

function

    typedef int Bool;



★Application data type



ListReference

data type

ANGLE


Representing 360 degrees in 16 bits

function

    typedef Sint16 ANGLE;




ListReference

data type

FIXED


Fixed-point type where the upper 16 bits represent the integer part and the lower 16 bits represent the decimal part.

function

    typedef Sint32 FIXED;




ListReference

data type

MATRIX


matrix data

function

    typedef FIXED MATRIX[4][3];




ListReference

data type

VECTOR


vector data

function

    typedef FIXED VECTOR[ XYZ ];




ListReference

data type

POINT


Vertex position data

function

    typedef FIXED POINT[ XYZ ];




ListReference

data type

TEXDAT


texture data

function

    typedef Uint16 TEXDAT;




ListReference

data type

GOURAUDTBL


gouraud shading table

function

    typedef Uint16 GOURAUDTBL[4];




ListReference

data type

CELL


1 cell size

function

    typedef Uint16 CELL;




ListReference

data type

DmaCpuStatus


function

    typedef Uint32 DmaCpuStatus;




ListReference

Structure

WORK


Data container for events

structure

    typedef struct work {
      struct work *next;
      Uint8 user[ WORK_SIZE - sizeof( struct work * ) ];
    } WORK;

function

    next - pointer to the next work.
user - data body.



ListReference

Structure

EVENT


Event container for events

structure

    typedef struct evnt {
      WORK *work;
      struct evnt *next;
      struct evnt *before;
      void ( *exad )();
      Uint8 user[ EVENT_SIZE - (sizeof( WORK *) + sizeof(struct evnt *) 
                       * 2 + sizeof(void (*)()))];
      } EVENT;

function

    work - pointer to the WORK structure.
next - pointer to the next EVENT .
before - pointer to the previous EVENT .
exad - the execution address of the callback function.
user - user area.



ListReference

Structure

POLYGON


Polygon data management structure

structure

    typedef struct {
      VECTOR norm;
      Uint16 Vertices[4];
    } POLYGON;

function

    norm - normal vector
    Vertices - number of vertices that make up the polygon 



ListReference

Structure

ATTR


texture attributes

structure

    typedef struct {
      Uint8 flag;
      Uint8 sort;
      Uint16 texno;
      Uint16 atrb;
      Uint16 colno;
      Uint16 gstb;
      Uint16 dir;
    } ATTR;

function

    flag - Single-sided or double-sided flag
    sort - Sort reference position and option settings 
    texno - texture number
    atrb - attribute data (display mode)
    colno - Color number
    gstb - Gouraud shading table
    dir - Texture inversion and function number 



ListReference

Structure

SPR_ATTR


sprite attributes

structure

    typedef struct {
      Uint16 texno;
      Uint16 atrb;
      Uint16 colno;
      Uint16 gstb;
      Uint16 dir;
    } SPR_ATTR;

function

    texno - Picture number
    atrb - Attribute data (display mode)
    colno - Color number
    gstb - Gouraud shading table
    dir - Texture inversion and function number 




ListReference

Structure

PDATA


model data management structure

structure

    typedef struct {
      POINT *pntbl;
      Uint32 nbPoint;
      POLYGON *pltbl;
      Uint32 nbPolygon;
      ATTR *attbl;
   }PDATA;

function

    pntbl - Vertex position data table
    nbPoint - Number of vertices
    pltbl - Polygon definition table
    nbPolygon - Number of polygons
    attbl - Polygon attribute table 



ListReference

Structure

XPDATA


Model data management structure for real-time Gouraud

structure

    typedef struct {
      POINT *pntbl;
      Uint32 nbPoint;
      POLYGON *pltbl;
      Uint32 nbPolygon;
      ATTR *attbl;
      VECTOR *vntbl;
    }XPDATA;

function

    pntbl - Vertex position data table
    nbPoint - Number of vertices
    *pltbl - Polygon definition table
    nbPolygon - Number of polygons
    attbl - Polygon attribute table
    *vntbl - Normal vector table for each vertex 



ListReference

Structure

OBJECT


Hierarchical model management structure

structure

    typedef struct obj{
      PDATA *pat;
      FIXED pos[ XYZ ];
      ANGLE ang[ XYZ ];
      FIXED scl[ XYZ ];
      struct obj *child;
      struct obj *sibling;
    } OBJECT;

function

    pat - polygon model data table
    pos - relative position data
    ang - rotation angle data
    scl - scaling data
    child - pointer to child object data
    sibling - pointer to sibling object data 



ListReference

Structure

TEXTURE


Sprite data information index

structure

    typedef struct {
      Uint16Hsize ;
      Uint16 Vsize;
      Uint16 CGadr;
      Uint16 HVsize;
    } TEXTURE;

function

    Hsize - Sprite H size
    Vsize - Sprite V size
    CGadr - Sprite CG address/8
    HVsize - H size/8×V size (for hard)




ListReference

Structure

PICTURE


Picture data information for sprites

structure

    typedef struct {
      Uint16 texno;
      Uint16 cmode;
      void *pcsrc;
    } PICTURE ;

function

    texno - texture number
    cmode - color mode
    pcsrc - location of original data

Note


    This structure is used as auxiliary information when transferring texture data to VRAM, etc.
    It is used and is not related to the operation of the SGL system itself.



ListReference

Structure

SPRITE


Sprite management structure with the same configuration as the VDP1 command table

structure

    typedef struct {
      Uint16 CTRL;
      Uint16 LINK;
      Uint16 PMOD;
      Uint16 COLR;
      Uint16 SRCA;
      Uint16 SIZE;
      Sint16 XA;
      Sint16 YA;
      Sint16 XB;
      Sint16 YB;
      Sint16XC ;
      Sint16 YC;
      Sint16 XD;
      Sint16 YD;
      Uint16 GRDA;
      Uint16 DMMY;
    } SPRITE;

function

    CTRL - Control function
    LINK - Link address
    PMOD - Put mode
    COLR - Color data
    SRCA - CG address
    SIZE - Character size
    XA, YA - Display position A
    XB, YB - Display position B
    XC, YC - Display position C
    XD, YD - Display position D
    GRDA - Gouraud shading table
    DMMY - Dummy data for size matching

Note


    The structure of this structure is exactly the same as the command table structure of VDP1.
For more information, Please see Chapter 7 "Commands" in the VDP1 User's Manual.



ListReference

Structure

ROTSCROLL


Rotation parameter table

structure

    typedef struct rdat{
      FIXED XST;
      FIXED YST;
      FIXED ZST;
      FIXEDDXST ;
      FIXED DYST;
      FIXEDDX ;
      FIXED DY;
      FIXED MATA;
      FIXED MATB;
      FIXED MATC;
      FIXED MATD;
      FIXED MATE;
      FIXED MATF;
      Sint16 PX;
      Sint16 PY;
      Sint16 PZ;
      Sint16 dummy0;
      Sint16 CX;
      Sint16 CY;
      Sint16 CZ;
      Sint16 dummy1;
      FIXED MX;
      FIXED MY;
      FIXED KX;
      FIXED KY;
      Uint32 KAST;
      Sint32 DKAST;
      Sint32 DKA;
    } ROTSCROLL;

function

    XST - Screen screen start coordinate Xst
    YST - Screen screen start coordinate Yst
    ZST - Screen screen start coordinate Zst
    DXST - Screen vertical coordinate increment dXst
    DYST - Screen vertical coordinate increment dYst
    DX - Screen horizontal coordinate increment dX
    DY - Screen horizontal coordinate increment dY
    MATA - rotation matrix parameter A
    MATB - rotation matrix parameter B
    MATC - rotation matrix parameter C
    MATD - rotation matrix parameter D
    MATE - rotation matrix parameter E
    MATF - rotation matrix parameter F
    PX - viewpoint coordinate Px
    PY - viewpoint coordinate Py
    PZ - viewpoint coordinate Pz
    dummy0 - Dummy to match VDP2 rotation coefficient parameter and bite position
    CX - Center coordinate Cx
    CY - center coordinate Cy
    CZ - center coordinate Cz
    dummy1 - Dummy to match VDP2 rotation coefficient parameter and bite position
    MX - Parallel movement amount Mx
    MY - Amount of parallel movement My
    KX - scaling factor kx
    KY - scaling factor ky
    KAST - Coefficient table start address KAst
    DKAST - Coefficient table vertical address increment ΔKAst
    DKA - Coefficient table horizontal address increment KA

Note


    The structure of this structure is exactly the same as the rotation parameter of VDP2.
For more information, Please see 6.3 Rotation Parameters in Chapter 6 "Rotating Scroll" of the VDP2 User's Manual.



ListReference

Structure

P.C.M.


PCM regeneration structure

structure

    typedef struct{
      Uint8 mode;
      Uint8 channel;
      Uint8 level;
      Sint8 pan;
      Uint16 pitch;
      Uint8 eflevelR;
      Uint8 efselectR;
      Uint8 eflevelL;
      Uint8 efselectL;
      Uint8 totalLevel;
    }PCM;

function

    mode - Stereo/mono
    channel - Channel number of the PCM being played
    level - 7 levels of playback volume
    pan - Pan
    pitch - Playback pitch
    eflevelR - R channel effect level
    efselectR - R channel effect selector
    eflevelL - R channel effect level Degree
    efselectL - R channel effect selector
    totalLevel - Total level of playback slot 256 levels 



ListReference

Structure

SmpcDateTime


RTC time information

structure

    typedef struct {
      Uint16 year;
      Uint8 month;
      Uint8 date;
      Uint8 hours;
      Uint8 minute;
      Uint8 second;
      Uint8 dummy;
    } SmpcDateTime;

function

    year - Western calendar year
    month - Day of the week/month
    date - Day
    hour - Hour
    minute - Minute
    second - Second
    dummy - Dummy 



ListReference

Structure

SmpcStatus


SMPC status

structure

    typedef struct {
      Uint8 cond;
      Uint8 dummy1;
      Uint16 dummy2;
      SmpcDateTime rtc;
      Uint8 ctg;
      Uint8 area;
      Uint16 system;
      Uint32 smem;
    } SmpcStatus;

function

    cond - state status
    dummy1 - dummy1
    dummy2 - dummy2
    rtc - RTC time
    ctg - Cartridge code
    area - Area code
    system - System status
    smem - SMPC memory retention data 



ListReference

Structure

PerDigital


digital device

structure

    typedef struct {
      Uint8 id;
      Uint8 ext;
      Uint16 data;
      Uint16 push;
      Uint16 pull;
      Uint32 dummy2[4];
    } PerDigital;

function

    id - peripheral ID
    ext - Extended data size
    data - Button current data
    push - Button press data
    pull - Button pull data
    dummy2[4] - Dummy 



ListReference

Structure

PerAnalog


analog device

structure

    typedef struct {
      Uint8 id;
      Uint8 ext;
      Uint16 data;
      Uint16 push;
      Uint16 pull;
      Uint8x ;
      Uint8y ;
      Uint8z ;
      Uint8 dummy1;
      Uint32 dummy2[3];
    } PerAnalog;

function

    id - peripheral ID
    ext - Extended data size
    data - Button current data
    push - Button press data
    pull - Button pull data
    x - X-axis data absolute value
    y - Y-axis data absolute value
    z - Z-axis data absolute value
    dummy1 - Dummy 1
    dummy2[3] - dummy2



ListReference

Structure

PerPoint


pointing device

structure

    typedef struct {
      Uint8 id;
      Uint8 ext;
      Uint16 data;
      Uint16 push;
      Uint16 pull;
      Uint16x ;
      Uint16y ;
      Uint32 dummy2[3];
    } PerPoint;

function

    id - peripheral ID
    ext - Extended data size
    data - Button current data
    push - Button press data
    pull - Button pull data
    x - X coordinate
    y - Y coordinate
    dummy2[3] - Dummy 1





ListReference

Structure

PerKeyBoard


keyboard device

structure

    typedef struct {
      Uint8 id;
      Uint8 ext;
      Uint16 data;
      Uint16 push;
      Uint16 pull;
      Uint8 cond;
      Uint8 code;
      Uint16 dummy1;
      Uint32 dummy2[3];
    } PerKeyBoard;

function

    id - peripheral ID
    ext - Extended data size
    data - Button current data
    push - Button press data
    pull - Button pull data
    cond - Status data
    code - Key code
    dummy1 - Dummy 1
    dummy2[3] - dummy2




ListReference

Structure

Per3DPad


sega multi controller

structure

    typedef struct {
      Uint8 id;
      Uint8 ext;
      Uint16 data;
      Uint16 push;
      Uint16 pull;
      Uint8x ;
      Uint8y ;
      Uint8 r;
      Uint8 l;
      Uint32 dummy2[3];
    } Per3DPad;

function

    id; /* Peripheral ID */
    ext; /* Extended data size */
    data; /* Button current data */
    push; /* Button press data */
    pull; /* button pull data */     
    x; /* X-axis data absolute value */
    y; /* Y-axis data absolute value */
    r; /* R-axis data absolute value */
    l; /* L axis data absolute value */
    dummy2[3]; /* dummy2 */




ListReference

Structure

DmaCpuComPrm


structure

    typedef struct {
      Uint32 pr;
      Uint32dme ;
      Uint32msk ;
    }DmaCpuComPrm;

function

    pr - priority mode
    dme - DMA master enable
    msk - mask bit 



ListReference

Structure

DmaCpuPrm


DMA source address transfer parameters (when using SBL function)

structure

    typedef struct {
      Uint32 sar;
      Uint32dar ;
      Uint32tcr ;
      Uint32dm ;
      Uint32 sm;
      Uint32ts ;
      Uint32 ar;
      Uint32ie ;
      Uint32 drcr;
      Uint32msk ;
    }DmaCpuPrm;

function

    sar - DMA source address
    dar - DMA destination address
    tcr - DMA transfer count
    dm - destination address mode bit
    sm - source address mode bit
    ts - transfer size
    ar - auto request mode
    ie - interrupt enable
    drcr - DMA request/response selection control
    msk - mask bit 



ListReference

Structure

DmaCpuComStatus


structure

    typedef struct {
      Uint32 ae;
      Uint32nmif ;
    }DmaCpuComStatus;

function

    ae - address error flag
    nmif - NMI flag 



ListReference

Structure

DmaScuPrm


structure

    typedef struct {
      Uint32dxr ;
      Uint32dxw ;
      Uint32dxc ;
      Uint32dxad_r ;
      Uint32dxad_w ;
      Uint32dxmod ;
      Uint32dxrup ;
      Uint32dxwup ;
      Uint32dxft ;
      Uint32msk ;
    }DmaScuPrm;

function

    dxr - Read address
    dxw - Write address
    dxc - Number of transferred bytes
    dxad_r - Read address addition value
    dxad_w - Write address addition value
    dxmod - Mode bit
    dxrup - Read address update bit
    dxwup - Write address update bit
    dxft - Activation factor selection bit
    msk - Mask bit 



ListReference

Structure

DmaScuStatus


structure

    typedef struct {
      Uint32dxmv ;
    }DmaScuStatus;

function

    dxmv - DMA operation flag 


★Global variables



ListReference

global variables

MasterStack


Bottom of master CPU stack

Format

    const void* MasterStack;

function

    This is the address of the master SH2CPU's stack pointer.



ListReference

global variables

MaxVertices


Maximum number of vertices that can be calculated

Format

    const Uint16 MaxVertices;

function

    The number of vertices that can be calculated. The SGL system will not perform calculations for calculation requests that exceed this number of vertices. This value is used to determine whether the buffer is overflowing, so please calculate the buffer size from this value.



ListReference

global variables

MaxPolygons


Maximum number of polygons that can be calculated

Format

    const Uint16 MaxPolygons;

function

    The number of polygons that can be calculated. If this upper limit is exceeded, the model data will be
    No calculations are performed. This value is used to determine whether the buffer is overflowing, so please calculate the buffer size from this value.



ListReference

global variables

EventSize


event size

Format

    const Uint16 EventSize;

function

    This is the size of the EVENT structure. By default, it is 128.



ListReference

global variables

WorkSize


work size

Format

    const Uint16 WorkSize;

function

    The size of the WORK structure. By default, it is 64.



ListReference

global variables

MaxEvents


Maximum number of events

Format

    const Uint16 MaxEvents;

function

    slGetEvent is the number of events that can be performed. Default is 64.



ListReference

global variables

MaxWorks


Maximum number of works

Format

    const Uint16 MaxWorks;

function

    slGetWork This is the number of works that can be done. Default is 128.



ListReference

global variables

SortList


sprite sort buffer

Format

    const void* SortList;

function

    The start address of the buffer used to sort sprites.



ListReference

global variables

SortListSize


Sprite data transfer request table size

Format

    const Uint32 SortListSize;

function

    The size of the buffer used to sort sprites.



ListReference

global variables

TransList


Format

    const void* TransList;

function

    This is a queue for user transfer registration at V-Blank In interrupt.
Since SCU DMA is used in indirect mode, please adjust the area by a power of 2 that exceeds the table size.
Maximum of 20 entries.



ListReference

global variables

Zbuffer


Z buffer

Format

    const void* Zbuffer;

function

    Z buffer used to sort sprites. Please specify using a 4-byte boundary.



ListReference

global variables

SpriteBuf


sprite control data buffer

Format

    const void* SpriteBuf;

function

    This is a buffer that sets sprite control data. Switch between the first half and the second half for each frame.



ListReference

global variables

SpriteBufSize


Sprite control data buffer size

Format

    const Uint32 SpriteBufSize;

function

    This is a buffer that sets sprite control data. Since the first half and the second half are used by switching each frame, it is necessary to specify the buffer as the number of sprites (polygons) actually displayed + 5) x 36 bytes x 2 banks.



ListReference

global variables

Pbuffer


Vertex calculation buffer

Format

    const void* Pbuffer;

function

    Buffer for coordinate transformation and perspective transformation calculations for polygon display functions.
It is only used for polygon display functions.



ListReference

global variables

CLOfstBuf


Buffer for color offset

Format

    const void* CLOfstBuf;

function

    Buffer for color offset, 4-byte boundary    



ListReference

global variables

CommandBuf


Command buffer for slave transfer

Format

    const void* CommandBuf;

function

    In SGL, this buffer is used to perform calculation requests from the master side to the slave side. Types of commands for passing include initialization requests,
    There are sprite creation requests, DMA transfer table creation requests, etc. 



ListReference

global variables

PCM_Work


PCM work area

Format

    const void* PCM_Work;

function

    This is the address of the internal buffer for PCM playback.



ListReference

global variables

PCM_WkSize


PCM work size

Format

    const Uint32 PCM_WkSize;

function

    This is the size of the internal buffer for PCM playback. When changing the size, specify a boundary of 2000H.

return
Copyright SEGA ENTERPRISES, LTD., 1997