Japanese
PROGRAMMER'S GUIDEVDP2 library
BackForward
VDP2 library

2.1 Data specifications

 
one
View
table
 Title

data specifications

 Data

two-dimensional data structure

 Data Name

SclXy

 No

1

 typedef struct SclXy {
       Fixed32x;
       Fixed32y;
} SclXy; 


 one
View
table
 Title

data specifications

 Data

3D data structure

 Data Name

SclXyz

 No

2

 typedef struct SclXyz {
      Fixed32x;
      Fixed32y;
      Fixed32z;
} SclXyz; 


 one
View
table
 Title

data specifications

 Data

Line parameter table data structure

 Data Name

SclLineTb

 No

3

 typedef struct SclLineTb {
      Fixed32 h; /* Horizontal screen scroll value */
      Fixed32 v; /* Vertical screen scroll value */
      Fixed32 dh; /* Horizontal coordinate increment */
} SclLineTb; 


 one
View
table
 Title

data specifications

 Data

Line window table data structure

 Data Name

SclLinWindowTb

 No

4

 typedef struct SclLinWindowTb {
     Uint16 start; /* Horizontal starting point coordinates */
     Uint16 end; /* Horizontal end point coordinates */
} SclLinWindowTb; 


 one
View
table
 Title

data specifications

 Data

RGB color table data structure

 Data Name

SclRgb

 No

5

 typedef struct SclRgb {
     Sint16 red; /* red */
     Sint16 green; /* green */
     Sint16 blue; /* Blue */
} SclRgb; 


 one
View
table
 Title

data specifications

 Data

VRAM configuration data structure

 Data Name

SclVramConfig

 No

6

typedef struct SclVramConfig{
     Uint32 ktboffsetA; /* Coefficient table for rotation parameters with VRAM relative address */
                                   /* Specification (If SCL_RBGO_K is specified, */
                                   /* Specify the relative address from there. ) */
     Uint32 ktboffsetB; /* The specified unit is 2048(0x400)Byte */
                                   /* Coefficient table for rotation parameter B in VRAM */
                                   /* Specify by relative address */
     Uint8 vramModeA; /* Specify whether to divide VRAM A into two banks */
                                   /* ON/OFF */
     Uint8 vramModeB; /* Specify whether to divide VRAM B into two banks */
                                   /* ON/OFF */
     Uint8 vramA0; /* Specify what to use VRAM A0 on the rotating surface */
                                   /* Valid for the entire VRAM A if not divided */
                                   /* SCL_NON */
                                   /* Do not store rotation surface data */
                                   /* SCL_RBG0_K */
                                   /* Put RBG0 coefficient data */
                                   /* SCL_RBG0_PN */
                                   /* Put RBG0 pattern name data */
                                   /* Scl_RBG0_CHAR */
                                   /* Place RBG0 character */
     Unit8 vramA1; /* Specify what VRAMA1 is used for on the rotating surface */
                                   /* Invalid if VRAMA is not split */
     Uint8 vramB0; /* Specify what to use VRAM B0 on the rotating surface */
                                   /* Valid for the entire VRAM B if not divided */
     Uint8 vramB1; /* Specify what to use VRAM B1 for on the rotating surface */
                                   /* Invalid if VRAM B is not partitioned */
     Uint8 colram; /* Specify whether to store coefficient data in color RAM */
                                   /* If coefficient data is placed in VRAM, it becomes unusable */
                                   /* Color RAM mode is SCL_CRM15-2048 */
                                   /* Cannot be specified without */
                                   /* Specified by SCL_RBG0_K or SCL_NON */
} SclVramConfig;

No other data can be placed in a VRAM bank that contains some rotation surface data.
However, other data can be placed in the coefficient data by specifying ktboffsetA and ktboffsetB.


 one
View
table
 Title

data specifications

 Data

scroll
Configuration data structure

 Data Name

Sclconfig

 No

7

For details on the parameters, please refer to the " VDP2 User's Manual ".

 typedef struct Sclconfig {
     Uint8 dispenbl; /* Display ON/OFF */
                              /* Screen display enable register (180020h) */
                              /* ON Display picture on screen */
                              /* OFF Do not display the picture on the screen */
     Uint8 charsize; /* Character size */
                              /* Character control register (180028h to 18002ah) */
                              /* SCL_CHAR_SIZE_1X1 */
                              /* Set to 1X1 */
                              /* SCL_CHAR_SIZE_2x2 */
                              /* Set to 2x2 */
     Uint8 pnamesize; /* pattern name size */
                              /* Pattern name control register (180030h to 180038h)*/
                              /* SCL_PN2WORD */
                              /* Set in 2word units */
                              /* SCL_PN1WORD */
                              /* 1 word unit setting */
     Uint8 platesize; /* Plane size */
                              /* Plane size register (18003ah) */
                              /* SCL_PL_SIZE_1X1 */
                              /* Set to 1X1 */
                              /* SCL_PL_SIZE_2X1 */
                              /* Set to 2X1 */
                              /* SCL_PL_SIZE_2X2 */
                              /* Set to 2x2 */
     Uint8 bmpsize; /* Bitmap size*/
                              /* Character control register (180028h to 18002ah) */
                              /* SCL_BMP_SIZE_512X256 */
                              /* Set to 512X256 */
                              /* SCL_BMP_SIZE_512X512 */
                              /* Set to 512X512 */
                              /* SCL_BMP_SIZE_1024X256 */
                              /* Set to 1024X256 */
                              /* SCL_BMP_SIZE_1024X512 */
                              /* Set to 1024X512 */
     Uint8 coltype; /* Number of character colors */
                              /* Character control register (180028h to 18002ah) */
                              /* SCL_COL_TYPE_16 */
                              /* Set to 16 colors */
                              /* SCL_COL_TYPE_256 */
                              /* Set to 256 colors */
                              /* SCL_COL_TYPE_2048 */
                              /* Set to 2048 colors */
                              /* SCL_COL_TYPE_32K */
                              /* Set to 320,000 colors */
                              /* SCL_COL_TYPE_1M */
                              /* Set to 16.77 million colors */
     Uint8 datatype; /* Bitmap enable */
                              /* Character control register (180028h to 18002ah) */
                              /* SCL_BITMAP */
                              /* Specify bitmap format */
                              /* SCL_CELL */
                              /* Specify cell format */
     Uint8 mapover; /* Screen overflow processing */
                              /* Screen overflow processing register (18003ah) */
                              /* SCL_OVER_0 */
                              /* Set the area outside the display area to the display area */
                              /* Repeat the image. */
                              /* SCL_OVER1 */
                              /* Outside the display area, screen over pattern */
                              /* Repeat the pattern specified in the name register */
                              /* Yes (rotated surface only) */
                              /* SCL_OVER_2 */
                              /* Make the area outside the display area transparent */
                              /* SCL_OVER_3 */
                              /* Set the display area to 512x512 */
                              /* Make everything else transparent */
     Uint8 flip; /* Character number auxiliary mode */
                              /* Special functions when the pattern name data size is 1 word */
                              /* Specify whether to use the reverse function. */
                              /* If specified, the character number will be 10 bits */
                              /* If not, it will be 12bit */
                              /* Pattern name control register (180030h to 180038h) */
                              /* SCL_PN_10BIT */
                              /* Enable special and invert features */
                              /* SCL_PN_12BITT */
                              /* Disable special and invert features */
     Uint16 patnamecontrl; /* Auxiliary data in pattern name control register */
     Uint32 plate_addr[16]; /* Scroll screen map register */
                              /* For cell format, enter the start address of the pattern name table */
                              /* designation */
                              /* For bitmap format, start address of bitmap data */
                              /* Specify */
                              /* Normal (180040h ~ 18004eh) */
                              /* Rotation (180050h ~ 18006eh) */
     } Sclconfig; 


 one
View
table
 Title

data specifications

 Data

Line & vertical cell scrolling parameters
data structure

 Data Name

SclLineParam

 No

8

For details on the parameters, please set them referring to "VDP2 User's Manual/ ■5.3 Line & Vertical Cell Scroll Function ".
 typedef struct SclLineParam {
     Uint8 delta_enbl; /* Line zoom enable */
                                   /* Line & vertical cell scroll register (18009ah) */
                                   /* ON/OFF */
     Uint8 v_enbl; /* Line scroll enable (vertical) */
                                   /* Line & vertical cell scroll register;(18009ah) */
                                   /* ON/OFF */
     Uint8 h_enbl; /* Cell scroll enable (horizontal) */
                                   /* Line & vertical cell scroll register (18009ah) */
                                   /* ON/OFF */
     Uint8 cell_enbl; /* Vertical cell scroll enable */
                                   /* Line & vertical cell scroll register (18009ah) */
                                   /* ON/OFF */
     Uint8 interval; /* Line-in scroll interval */
                                   /* Line & vertical cell scroll register (18009ah) */
                                   /* SCL_1_LINE */
                                   /* Line scroll data table for each line */
                                   /* Set */
                                   /* SCL_2_LINE */
                                   /* Line scroll data table every 2 lines */
                                   /* Set */
                                   /* SCL_4_LINE */
                                   /* Line scroll data table every 4 lines */
                                   /* Set */
                                   /* SCL_8_LINE */
                                   /* Line scroll data table every 8 lines */
                                   /* Set */
     Uint32 line_addr; /* Line scroll address register (18009ch to 18009eh) */
                                   /* Set the address on VRAM where the line scroll table will be placed */
     Uint32 cell_addr; /* Vertical cell scroll table address register (18009c to 18009e) */
                                   /* Set the address on VRAM where the vertical cell scroll table is placed */
     GlbLineTb line_tbl[]; /* Line scroll table */
     Fixed32 cell_tbl[]; /* Vertical cell scroll address register */
} SclLineParam; 


 one
View
table
 Title

data specifications

 Data

VDP2 register buffer 1

 Data Name

SclSysreg

 No

9

 typedef struct SclSysreg{
                                        /* Address Contents */
     Uint16 tvmode; /* 180000H TV screen mode */
     Uint16 extenbl; /* 180002H external signal */
     Uint16 tvstatus; /* 180004H screen status */
     Uint16 vramsize; /* 180006H VRAM size */
     Uint16 H_val; /* 180008H H counter */
     Uint16 V_val; /* 18000AH V counter */
     Uint16 vramchg; /* 18000CH */
     Uint16 ramcontrl; /* 18000EH RAM control */
     Uint16 vramcyc[8]; /* 180010H VRAM cycle pattern */
     Uint16 dispenbl; /* 180020H Screen display enable */
     Uint16 mosaic; /* 180022H mosaic control */
     Uint16 specialcode_sel; /* 180024H special code select */
     Uint16 specialcode; /* 180026H special function code */
 } SclSysreg;

Symbols are registered in this library as follows. After writing to this symbol, if you write 1 to the global variable "SclProcess", it will be reflected in the register at the next V-Blank.

SclSysreg Scl_s_reg;


 one
View
table
 Title

data specifications

 Data

VDP2 register buffer 2

 Data Name

SclDataset

 No

10

 typedef struct SclDataset{
                                        /* Address Contents */
     Uint16 charcontrl0; /* 180028H character control(NBG0,NBG1) */
     Uint16 charcontrl1; /* 18002AH character control(NBG2,NBG3,RBG0) */
     Uint16 bmpalnum0; /* 18002CH bitmap palette number (NBG0,NBG1) */
     Uint16 bmpalnum1; /* 18002EH Bitmap palette number (RBG0) */
     Uint16 patnamecontrl[5]; /* 180030H pattern name control */
     Uint16 platesize; /* 18003AH plane size */
     Uint16 mapoffset0; /* 18003CH map offset (NBG0 to NBG3) */
     Uint16 mapoffset1; /* 18003EH map offset (rotation parameter AB) */
        Uint16 normap[8]; /* 180040H map (normal scroll) */
     Uint16 rotmap[16]; /* 180050H map (rotation parameters A, B) */
} SclDataset;

Symbols are registered in this library as follows. After writing to this symbol, if you write 1 to the global variable “SclProcess”, it will be reflected in the register at the next V-Blank.

SclDataset Scl_d_reg;


 one
View
table
 Title

data specifications

 Data

VDP2 register buffer 3

 Data Name

SclNorscl

 No

11

 typedef struct SclNorscl{
                                 /* Address Contents */
     Fixed32 n0_move_x; /* 180070H Horizontal screen scroll value (NBG0) */
     Fixed32 n0_move_y; /* 180074H Vertical screen scroll value (NBG0) */
     Fixed32 n0_delta_x; /* 180078H Horizontal coordinate increment (NBG0) */
     Fixed32 n0_delta_y; /* 18007CH Vertical coordinate increment (NBG0) */
     Fixed32 n1_move_x; /* 180080H Horizontal screen scroll value (NBG1) */
     Fixed32 n1_move_y; /* 180084H Vertical screen scroll value (NBG1) */
     Fixed32 n1_delta_x; /* 180088H Horizontal coordinate increment (NBG1) */
     Fixed32 n1_delta_y; /* 18008CH Vertical coordinate increment (NBG1) */
     Uint16 n2_move_x; /* 180090H Horizontal screen scroll value (NBG2) */
     Uint16 n2_move_y; /* 180092H Vertical screen scroll value (NBG2) */
     Uint16 n3_move_x; /* 180094H Horizontal screen scroll value (NBG3) */
     Uint16 n3_move_y; /* 180096H Vertical screen scroll value (NBG3) */
     Uint16 zoomenbl; /* 180098H zoomenbl; enable */
     Uint16 linecontrl; /* 18009AH line & vertical cell scroll control (NBG0,NBG1)*/
     Uint32 celladdr; /* 18009CH Vertical cell scroll table address (NBG0,NBG1) */
     Uint32 lineaddr[2]; /* 1800A0H line scroll table address */
     Uint32 linecolmode; /* 1800A8H line color screen table address */
     Uint32 backcolmode; /* 1800ACH back screen table address */
} SclNorscl;

Symbols are registered in this library as follows. After writing to this symbol, if you write 1 to the global variable “SclProcess”, it will be reflected in the register at the next V-Blank.

SclNorscl Scl_n_reg;


 one
View
table
 Title

data specifications

 Data

VDP2 register buffer 4

 Data Name

SclRotscl

 No

12

 typedef struct SclRotscl{
                                   /* Address Contents */
     Uint16 paramode; /* 1800B0H rotation parameter mode */
     Uint16 paramcontrl; /* 1800B2H rotation parameter read control */
     Uint16 k_contrl; /* 1800B4H coefficient table control */
     Uint16 k_offset; /* 1800B6H coefficient table address offset */
     Uint16 mapover[2]; /* 1800B8H screen over pattern name */
     Uint32 paramaddr; /* 1800BAH rotation parameter table address */
} SclRotscl;

Symbols are registered in this library as follows. After writing to this symbol, if you write 1 to the global variable “SclProcess”, it will be reflected in the register at the next V-Blank.

SclRotscl Scl_r_reg;


 one
View
table
 Title

data specifications

 Data

VDP2 register buffer 5

 Data Name

SclWinscl

 No

13

 typedef struct SclWinscl{
                                   /* Address Contents */
     Uint16 win0_start[2]; /* 1800C0H window position (W0, starting point XY) */
     Uint16 win0_end[2]; /* 1800C4H window position (W0, end point XY) */
     Uint16 win1_start[2]; /* 1800C8H window position (W1, starting point XY) */
     Uint16 win1_end[2]; /* 1800CCH window position (W1, end point XY) */
     Uint16 wincontrl[4]; /* 1800D0H window control */
     Uint32 linewin0_addr; /* 1800D8H line window table address (W0) */
     Uint32 linewin1_addr; /* 1800DCH line window table address (W0) */
} SclWinscl;

Symbols are registered in this library as follows. After writing to this symbol, if you write 1 to the global variable "SclProcess", it will be reflected in the register at the next V-Blank.

SclWinscl Scl_w_reg;


 one
View
table
 Title

data specifications

 Data

used within the library
Screen XY size

 Data Name

SclDisplayX,
SclDisplayY

 No

14

This is a 2Byte global variable. By referring to this variable, you can find out the vertical and horizontal sizes of the screen. If you set the screen mode etc. using the library, it will be reflected automatically. It is defined in the library as follows.

Uint16 SclDisplayX;
Uint16 SclDisplayY;


BackForward
PROGRAMMER'S GUIDEVDP2 library
Copyright SEGA ENTERPRISES, LTD., 1997