PROGRAMMER'S GUIDEVDP2 library
BackForward
VDP2 library

2.1 Data specifications

 
List
 Title

Data specifications

 Data

Two-dimensional data structure

 Data Name

SclXy

 No

1

 typedef struct SclXy {
       Fixed32 x;
       Fixed32 y;
} SclXy; 


 List
 Title

Data specifications

 Data

Three-dimensional data structure

 Data Name

SclXyz

 No

2

 typedef struct SclXyz {
      Fixed32 x;
      Fixed32 y;
      Fixed32 z;
} SclXyz; 


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


 List
 Title

Data specifications

 Data

Line window table data structure

 Data Name

SclLinWindowTb

 No

Four

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


 List
 Title

Data specifications

 Data

RGB color table data structure

 Data Name

SclRgb

 No

Five

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


 List
 Title

Data specifications

 Data

VRAM configuration data structure

 Data Name

SclVramConfig

 No

6

typedef struct SclVramConfig {
     Uint32 ktboffsetA; / * Coefficient table for rotation parameters with relative address of VRAM * /
                                   / * Specified (* / 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 split VRAM A into two banks * /
                                   / * ON / OFF * /
     Uint8 vramModeB; / * Specifies whether to split VRAM B into two banks * /
                                   / * ON / OFF * /
     Uint8 vramA0; / * Specify what to use VRAM A0 on the surface of revolution * /
                                   / * Valid for the entire VRAM A if not split * /
                                   / * SCL_NON * /
                                   / * No data on the surface of revolution * /
                                   / * SCL_RBG0_K * /
                                   / * Put the coefficient data of RBG0 * /
                                   / * SCL_RBG0_PN * /
                                   / * Place the pattern name data of RBG0 * /
                                   / * Scl_RBG0_CHAR * /
                                   / * Place the character of RBG0 * /
     Unit8 vramA1; / * Specify what to use VRAMA1 on the surface of revolution * /
                                   / * Invalid if VRAMA is not split * /
     Uint8 vramB0; / * Specify what to use VRAM B0 on the surface of revolution * /
                                   / * Valid for the entire VRAM B if not split * /
     Uint8 vramB1; / * Specify what to use VRAM B1 on the surface of revolution * /
                                   / * Invalid if VRAM B is not split * /
     Uint8 colram; / * Specify whether to put coefficient data in color RAM * /
                                   / * Unusable if coefficient data is placed in VRAM * /
                                   / * Color RAM mode is SCL_CRM15-2048 * /
                                   / * Cannot be specified without * /
                                   / * Specify with SCL_RBG0_K or SCL_NON * /
} SclVramConfig;

No other data can be placed in the VRAM bank where some data on the surface of revolution is placed.
However, for coefficient data, other data can be placed by specifying ktboffsetA and ktboffsetB.


 List
 Title

Data specifications

 Data

Scroll configuration data structure

 Data Name

Sclconfig

 No

7

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

 typedef struct Sclconfig {
     Uint8 dispenbl; / * Display ON / OFF * /
                              / * Screen display enable register (180020h) * /
                              / * ON Display a picture on the screen * /
                              / * OFF No picture is displayed on the screen * /
     Uint8 charsize; / * Character size * /
                              / * Character control register (180028h ~ 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-180038h) * /
                              / * SCL_PN2WORD * /
                              / * Set in 2 Word units * /
                              / * SCL_PN1WORD * /
                              / * 1 Word unit setting * /
     Uint8 platesize; / * Plain size * /
                              / * Plain 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 ~ 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 ~ 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 enabled * /
                              / * Character control register (180028h ~ 18002ah) * /
                              / * SCL_BITMAP * /
                              / * Specify in bitmap format * /
                              / * SCL_CELL * /
                              / * Specify in cell format * /
     Uint8 mapover; / * Screen over processing * /
                              / * Screen over-processing register (18003ah) * /
                              / * SCL_OVER_0 * /
                              / * Set outside the display area as the display area * /
                              / * Repeat the image. * /
                              / * SCL_OVER1 * /
                              / * Screen over pattern outside the display area * /
                              / * Repeat the pattern specified in the name register * /
                              / * (Rotating surface only) * /
                              / * SCL_OVER_2 * /
                              / * Make the outside of the display area transparent * /
                              / * SCL_OVER_3 * /
                              / * Set the display area to 512x512 and it * /
                              Make everything except / * transparent * /
     Uint8 flip; / * Character number auxiliary mode * /
                              / * Special features when the size of pattern name data is 1 Word and * /
                              / * Specifies whether to use the inversion function. * /
                              / * If specified, the character number will be 10 bits and specified * /
                              / * If not, it will be 12bit * /
                              / * Pattern name control register (180030h-180038h) * /
                              / * SCL_PN_10BIT * /
                              / * Enable special and flip functions * /
                              / * SCL_PN_12BITT * /
                              / * Disable special and flip functions * /
     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 * /
                              /* specify */
                              / * In the case of bitmap format, the start address of bitmap data * /
                              Specify / * * /
                              / * Normal (180040h ~ 18004eh) * /
                              / * Rotation (180050h ~ 18006eh) * /
     } Sclconfig; 


 List
 Title

Data specifications

 Data

Line & Vertical Cell Scroll Parameter Data Structure

 Data Name

SclLineParam

 No

8

For details on the parameters, refer to "VDP2 User's Manual / ■ 5.3 Line & Vertical Cell Scroll Function ".
 typedef struct SclLineParam {
     Uint8 delta_enbl; / * Line zoom enabled * /
                                   / * 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 enabled * /
                                   / * Line & Vertical Cell Scroll Register (18009ah) * /
                                   / * ON / OFF * /
     Uint8 interval; / * Line 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 for every 2 lines * /
                                   / * Set * /
                                   / * SCL_4_LINE * /
                                   / * Every 4 lines in the line scroll data table * /
                                   / * Set * /
                                   / * SCL_8_LINE * /
                                   / * Every 8 lines in the line scroll data table * /
                                   / * Set * /
     Uint32 line_addr; / * Line scroll address register (18009ch ~ 18909eh) * /
                                   / * Set the address on VRAM where the line scroll table is placed * /
     Uint32 cell_addr; / * Vertical cell scroll table address register (18009c ~ 18909e) * /
                                   / * Set the address on VRAM to put the vertical cell scroll table * /
     GlbLineTb line_tbl []; / * Line scroll table * /
     Fixed32 cell_tbl []; / * Vertical cell scroll address register * /
} SclLineParam; 


 List
 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 enabled * /
     Uint16 mosaic; / * 180022H Mosaic control * /
     Uint16 specialcode_sel; / * 180024H Special code select * /
     Uint16 specialcode; / * 180026H Special function code * /
 } SclSysreg;

The symbols are registered in this library as follows. If 1 is written to the global variable "SclProcess" after writing to this symbol, it will be reflected in the register at the next V-Blank.

SclSysreg Scl_s_reg;


 List
 Title

Data specifications

 Data

VDP2 register buffer 2

 Data Name

SclDataset

 No

Ten

 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 Plain size * /
     Uint16 mapoffset0; / * 18003CH Map offset (NBG0 ~ 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;

The symbols are registered in this library as follows. If 1 is written to the global variable "SclProcess" after writing to this symbol, it will be reflected in the register at the next V-Blank.

SclDataset Scl_d_reg;


 List
 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 Zooming 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;

The symbols are registered in this library as follows. If 1 is written to the global variable "SclProcess" after writing to this symbol, it will be reflected in the register at the next V-Blank.

SclNorscl Scl_n_reg;


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

The symbols are registered in this library as follows. If 1 is written to the global variable "SclProcess" after writing to this symbol, it will be reflected in the register at the next V-Blank.

SclRotscl Scl_r_reg;


 List
 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, start point XY) * /
     Uint16 win0_end [2]; / * 1800C4H Window position (W0, end point XY) * /
     Uint16 win1_start [2]; / * 1800C8H Window position (W1, start 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;

The symbols are registered in this library as follows. If 1 is written to the global variable "SclProcess" after writing to this symbol, it will be reflected in the register at the next V-Blank.

SclWinscl Scl_w_reg;


 List
 Title

Data specifications

 Data

XY size of the screen used in the library

 Data Name

SclDisplayX,
SclDisplayY

 No

14

This is a 2Byte global variable. You can see the vertical and horizontal size of the screen by referring to this variable. 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