PROGRAMMER'S GUIDEVDP1 library
BackForward
VDP1 library

5.3 Function specifications


 List
 Title

Function specifications

 Function

VDP1 extended processing work area definition macro

 Function Name

SPR_2DefineWork

 No

1

Form
SPR_2DefineWork (WORK2D, COMMAND_MAX, GOUR_TBL_MAX, LOOKUP_TBL_MAX, CHAR_MAX, DRAW_PRTY_MAX)
input
WORK2D: Work area name COMMAND_MAX: Maximum number of commands                        
GOUR_TBL_MAX: Maximum number of gouro tables                
LOOKUP_TBL_MAX: Maximum number of lookup tables            
CHAR_MAX: Maximum number of characters (> 0)                
DRAW_PRTY_MAX: Maximum number of drawing priority blocks (> 0)
output
none
Function value
none
function
Define the work area used for VDP1 extension processing in the data area in the AP. If DRAW_PRTY_MAX = 1, command drawing is not prioritized.

 List
 Title

Function specifications

 Function

Initialization process of VDP1 extension processing library

 Function Name

SPR_2 Initial

 No

2

Form
void SPR_2Initial (Spr2WorkArea * workArea)
input
workArea: Work area definition table
output
none
Function value
none
function
After calling the initialization routine of the VDP1 basic processing library to initialize the display environment, initialize the work area of this library.

 List
 Title

Function specifications

 Function

TV mode set

 Function Name

SPR_2SetTvMode

 No

3

Form
void Spr_2SetTvMode (Uint16 mode, Uint16 screenSize, Unit16 doubleInterlace)
input
mode: Set the TV mode definition value.
screenSize: Set the definition value of the screen resolution corresponding to the TV mode.
doubleInterlace: Sets the double-dense interlace usage mode.
output
none
Function value
none
function
Same as the TV mode set routine in the VDP1 basic processing library.

 List
 Title

Function specifications

 Function

Frame change V Blank interval number set

 Function Name

SPR_2FrameChgIntr

 No

Four

Form
void SPR_2FrameChgIntr (Uint16 interval)
input
interval: V blank interval number
output
none
Function value
none
function
Frame change V A set of blank intervals. It has the following meaning depending on the value of the number of intervals.
 Number of intervals
meaning
0 Set the frame switching to auto change mode and set the number of intervals to 1. Synchronization by SCL_DisplayFrame () is not possible.
1 Set the frame switching to auto change mode and set the number of intervals to 1. You can synchronize with SCL_DisplayFrame ().
0xffff Indefinite interval manual change mode, erases the drawing frame with polygons. Confirm the end of drawing of VDP1 and change the frame.
0xfffe It is an indefinite interval manual change mode by V blank erase. For the part that is not erased, the user should erase the drawing frame with polygons. The frame is changed without confirming the end of drawing of VDP1.
others This is a fixed interval manual change mode with a specified number of intervals.
b14 0: Erase light is performed.
1: Do not erase light.
You are calling the SCL_SetFrameInterval () routine.

 List
 Title

Function specifications

 Function

Set of framebuffer erase data

 Function Name

SPR_2FrameEraseData

 No

Five

Form
void SPR_2FrameEraseData (Uint16 rgbColor)
input
rgbColor: Erase data (RGB color)
output
none
Function value
none
function
Specifies what color to fill when the erase process is performed.

 List
 Title

Function specifications

 Functio

Gouraud shading table set

 Function Name

SPR_2SetGourTbl

 No

6

Form
void SPR_2SetGourTbl (Uint16 gourTblNo, SprGourTbl * gourTbl);
input
gourTblNo: Gouraud shading table number gourTbl: Gouraud shading table
output
none
Function value
none
function
Copies the contents of the specified Gouraud shading table to the Gouraud shading table area in VRAM.

 List
 Title

Function specifications

 Function

Look-up table set

 Function Name

SPR_2SetLookupTbl

 No

7

Form
void SPR_2SetLookupTbl (Uint16 lookupTblNo, SprLookupTbl * lookupTbl)
input
lookupTblNo: Lookup table number lookupTbl: Lookup table
output
none
Function value
none
function
Copies the contents of the specified lookup table to the lookup table area in VRAM.

 List
 Title

Function specifications

 Function

Set of characters

 Function Name

SPR_2SetChar

 No

8

Form
void SPR_2SetChar (Uint16 charNo, Uint16 colorMode, Uint16 color, Uint16 width, Uint16 height, Uint8 * char Image)
input
charNo: Character number colorMode: Color mode (b5 to b3: Same as drawing mode word)
color: Color data Look-up table number when color mode = 1 Color bank code when color mode = 0, 2, 3, 4 Ignore when color mode = 5

width: X size height: Y size charImage: When the pointer of the character data = 0 Only the character area is acquired.

output
none
Function value
none
function
If the character with the specified charNo is not assigned, or if the size of the area that has already been assigned but is acquired is smaller than the character size to be set, the character storage size is calculated and the required block is acquired from the block pool. And copy the character data. If overwriting is possible, copy the character data to the same area.

 List
 Title

Function specifications

 Function

Release the character area

 Function Name

SPR_2ClrChar

 No

9

Form
void SPR_2ClrChar (Uint16 charNo)
input
charNo: Character number
output
none
Function value
none
function
Releases the VRAM block used by the character with the specified character number.

 List
 Title

Function specifications

 Function

Release of all character areas

 Function Name

SPR_2ClrAllChar

 No

Ten

Form
void SPR_2ClrAllChar (void)
input
none
output
none
Function value
none
function
Releases the entire character area.

 List
 Title

Function specifications

 Functio

Gouraud shading table number
Convert to VRAM address

 Function Name

SPR_2GourTblNoToVram

 No

11

Form
SprVaddr addr = SPR_2GourTblNoToVram (Uint16 gourTblNo)
input
gourTblNo: Gouraud shading table number
output
none
Function value
addr: Relative address in VRAM / 8
function
Converts Gouraud shading table numbers to VRAM addresses.

 List
 Title

Function specifications

 Function

Lookup table number to VRAM
Convert to address

 Function Name

SPR_2LookupTblNoToVram

 No

12

Form
SprVaddr addr = SPR_2LookupTblNoToVram (Uint16 lookupTblNo)
input
lookupTblNo: Lookup table number
output
none
Function value
ddr: Relative address in VRAM / 8
function
Converts the lookup table number to a VRAM address.

 List
 Title

Function specifications

 Function

Convert character number to VRAM address

 Function Name

SPR_2CharNoToVram

 No

13

Form
SprVaddr addr = SPR_2CharNoToVram (Uint16 charNo)
input
charNo: Character number
output
none
Function value
addr: Relative address in VRAM / 8
function
Converts a character number to a VRAM address.

 List
 Title

Function specifications

 Function

Command write open processing

 Function Name

SPR_2OpenCommand

 No

14

Form
void SPR_2OpenCommand (Uint16 drawPrtyFlag)
input
drawPrtyFlag: Command drawing priority enabled / disabled flag SPR_2DRAW_PRTY_ON = Command drawing priority enabled SPR_2DRAW_PRTY_OFF = Command drawing priority disabled
output
none
Function value
none
function
Set the write start position of the sprite command to the beginning of the VRAM command area. Therefore, it is necessary to call this routine before calling the following series of sprite command setting routines.
SPR_2LocalCoord () SPR_2SysClip () SPR_2UserClip () SPR_2line () SPR_2polyLine () SPR_2Polygon () SPR_2NormSpr () SPR_2ScaleSpr () SPR_2DistSpr () SPR_2Cmd ()

 List
 Title

Function specifications

 Function

Command write close processing

 Function Name

SPR_2CloseCommand

 No

15

Form
void SPR_2CloseCommand (void)
input
none
output
none
Function value
none
function
If the command drawing priority is enabled, the commands in VRAM are chained according to the priority number. Write an endsprite command and toggle the VRAM area reference switch command.

 List
 Title

Function specifications

 Function

Set of local coordinates

 Function Name

SPR_2LocalCoord

 No

16

Form
void SPR_2LocalCoord (Sint32 drawPrty, XyInt * xy)
input
drawPrty: Command draw priority number xy: Relative coordinates of local coordinates
output
none
Function value
None A
function
Set local coordinates.

 List
 Title

Function specifications

 Function

Set of system clipping areas

 Function Name

SPR_2SysClip

 No

17

Form
void SPR_2SysClip (Sint32 drawPrty, XyInt * xy)
input
drawPrty: Command draw priority number xy: Lower right coordinates
output
none
Function value
none
function
Set the system clipping area.

 List
 Title

Function specifications

 Function

Set of user clipping areas

 Function Name

SPR_2UserClip

 No

18

Form
void SPR_2UserClip (Sint32 drawPrty, XyInt xy [2])
input
drawPrty: Command draw priority number xy [0]: Upper left coordinate xy [1]: Lower right coordinate
output
none
Function value
none
function
Set the user clipping area.

 List
 Title

Function specifications

 Function

Line drawing

 Function Name

SPR_2Line

 No

19

Form
void SPR_2Line (Sint32 drawPrty, Uint16 drowMode, Uint16 color, XyInt xy [2], Uint16 gourTblNo)
input
drawPrty: Command draw priority number drawMode: Draw mode (same as draw mode word)
color: Color mode or lookup table number xy [2]: Line 2 points gourTblNo: Gouraud shading table number NO_GOUR (= 0xffff) = Gouraud shading table not specified
output
none
Function value
none
function
Draw a line.

 List
 Title

Function specifications

 Function

Polyline drawing

 Function Name

SPR_2PolyLine

 No

20

Form
void SPR_2PolyLine (Sint32 drawPrty, Uint16 drowMode, Uint16 color, XyInt xy [4], Uint16 gourTblNo)
input
drawPrty: Command draw priority number drawMode: Draw mode (same as draw mode word)
color: Color mode or lookup table number xy [4]: Polyline 4 points gourTblNo: Gouraud shading table number NO_GOUR (= 0xffff) = Gouraud shading table not specified
output
none
Function value
none
function
Draw a polyline.

 List
 Title

Function specifications

 Function

Drawing polygons

 Function Name

SPR_2Polygon

 No

twenty one

Form
void SPR_2Polygon (Sint32 drawPrty, Uint16 drowMode, Uint16 color, XyInt xy [4], Uint16 gourTblNo)
input
drawPrty: Command draw priority number drawMode: Draw mode (same as draw mode word)
color: Color mode or lookup table number xy [4]: Polygon 4 points gourTblNo: Gouraud shading table number NO_GOUR (= 0xffff) = Gouraud shading table not specified
output
none
Function value
none
function
Draw a polygon.

 List
 Title

Function specifications

 Function

Drawing a normal sprite

 Function Name

SPR_2NormSpr

 No

twenty two

Form
void SPR_2NormSpr (Sint32 drawPrty, Uint16 dir, Uint16 drowMode, Uint16 color, Unit16 charNo, XyInt * xy, Uint16 gourTblNo)
input
drawPrty: Command draw priority number dir: Character inversion instruction (b5 to b4: Same as control word)
drowMode: Drawing mode (same as drawing mode word)
color: If the color code or lookup table number is 0xffff, the color data specified by SPR_2SetChar () is set.
charNo: Character number xy: Upper left coordinate gourTblNo: Gouraud shading table number NO_GOUR (= 0xffff) = Gouraud shading table not specified
output
none
Function value
none
function
Draws a normal sprite.

 List
 Title

Function specifications

 Function

Drawing scale sprites

 Function Name

SPR_2ScaleSpr

 No

twenty three

Form
void SPR_2ScalSpr (Sint32 drawPrty, Uint16 zoomDir, Uint16 drowMode, Uint16 color, Uint16 charNo, XyInt xy [2], Uint16 gourTblNo)
input
drawPrty: Command draw priority number zoomDir: Zoom & character inversion instruction (b11 to b8, b5, b4: Same as control word)
drowMode: Drawing mode (same as drawing mode word)
color: If the color code or lookup table number is 0xffff, the color data specified by SPR_2SetChar () is set.
charNo: Character number xy [2]: 2 vertex coordinates or fixed point coordinates / display width gourTblNo: Gouraud shading table number NO_GOUR (= 0xffff) = Gouraud shading table not specified
output
none
Function value
none
function
Draw a scale sprite.

 List
 Title

Function specifications

 Function

Drawing deformed sprites

 Function Name

SPR_2DisSpr

 No

twenty four

Form
void SPR_2DistSpr (Sint32 drawPrty, Uint16 dir, Uint16 drowMode, Uint16 color, Uint16 charNo, XyInt xy [4], Uint16 gourTblNo)
input
drawPrty: Command draw priority number dir: Character inversion instruction (b5 to b4: Same as control word)
drowMode: Drawing mode (same as drawing mode word)
color: If the color code or lookup table number is 0xffff, the color data specified by SPR_2SetChar () is set.
charNo: Character number xy [4]: 4 Vertex coordinates gourTblNo: Gouraud shading table number NO_GOUR (= 0xffff) = Gouraud shading table not specified
output
none
Function value
none
function
Draw a deformed sprite.

 List
 Title

Function specifications

 Function

Command set

 Function Name

SPR_2Cmd

 No

twenty five

Form
void SPR_2Cmd (Sint32 drawPrty, SprSpCmd * spCmd);
input
drawPrty: Command draw priority number spCmd: 32-byte sprite command
output
none
Function value
none
function
Set the specified sprite command as it is in the user command area.

 List
 Title

Function specifications

 Function

Command drawing priority chain flash

 Function Name

SPR_2FlushDrawPrty

 No

26

Form
void SPR_2FlashDrawPrty (void)
input
none
output
none
Function value
none
function
When command drawing priority is enabled, commands in VRAM are chained according to the priority value to clear the drawing priority management area.

 List
 Title

Function specifications

 Function

Acquisition of VRAM block area (static)

 Function Name

SPR_2AllocBlock

 No

27

Form
SprVaddraddr = SPR_2AllocBlock (Uint16 size)
input
size: Block size (32 bytes as one unit)
output
none
Function value
addr: Returns the acquired block area position as a relative address in VRAM / 8.
function
Acquires a block of the specified size from the block pool area in VRAM. This routine is not released to the outside, but the specifications are provided for reference when adding functions to this library.

 List
 Title

Function specifications

 Function

Free VRAM block area (static)

 Function Name

SPR_2FreeBlock

 No

28

Form
void SPR_2FreeBlock (SprVaddr addr, Uint16 size)
input
addr: Returns the release block area position as a relative address in VRAM / 8.
size: Block size (32 bytes is one unit)
output
none
Function value
none
function
This routine, which releases the specified block area in the VRAM block pool, is not released to the outside, but the specifications have been added for reference when adding functions to this library.

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