Japanese
PROGRAMMER'S GUIDEVDP1 library
BackForward
VDP1 library

5.3 Function specifications


 one
View
table
 Title

function specification

 Function

VDP1 extended processing work area
definition macro

 Function name

SPR_2DefineWork

 No

1

Format
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 Gouraud 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 expansion processing in the data area within the AP. If DRAW_PRTY_MAX=1, command drawing is not prioritized.

 one
View
table
 Title

function specification

 Function

VDP1 extended processing library
Initialization process

 Function name

SPR_2Initial

 No

2

Format
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 and initializing the display environment, initialize the work area of this library.

 one
View
table
 Title

function specification

 Function

TV mode set

 Function name

SPR_2SetTvMode

 No

3

Format
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 TV mode.
doubleInterlace: Sets double-dense interlace usage mode.
output
none
function value
none
function
It is the same as the TV mode set routine in the VDP1 basic processing library.

 one
View
table
 Title

function specification

 Function

Frame change V blank
set of interval numbers

 Function name

SPR_2FrameChgIntr

 No

4

Format
void SPR_2FrameChgIntr(Uint16 interval)
input
interval: V blank interval number
output
none
function value
none
function
Frame change V blank interval number set. The value of the interval number has the following meanings.
 number of intervals
meaning
0 Set the frame switching to auto change mode and set the interval number to 1. Synchronization using SCL_DisplayFrame() is not possible.
1 Set the frame switching to auto change mode and set the interval number to 1. You can synchronize using SCL_DisplayFrame().
0xffff Erase and write the drawing frame using polygons in indefinite interval manual change mode. Confirm that VDP1 has finished drawing and change the frame.
0xfffe Indeterminate interval manual change mode with V blank erase. For areas that are not erased, the user should erase and write the drawing frame using polygons. Performs a frame change without checking that VDP1 has finished drawing.
others This is a constant interval manual change mode based on the specified number of intervals.
b14 0: Perform erase write.
1: Erase write is not performed.
Calling the SCL_SetFrameInterval() routine.

 one
View
table
 Title

function specification

 Function

Set frame buffer erase data

 Function name

SPR_2FrameEraseData

 No

5

Format
void SPR_2FrameEraseData(Uint16 rgbColor)
input
rgbColor: Erase data (RGB color)
output
none
function value
none
function
Specify what color to fill when the erase process is executed.

 one
View
table
 Title

function specification

 Functio

gouraud shading table set

 Function name

SPR_2SetGourTbl

 No

6

Format
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.

 one
View
table
 Title

function specification

 Function

set of lookup tables

 Function name

SPR_2SetLookupTbl

 No

7

Format
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.

 one
View
table
 Title

function specification

 Function

set of characters

 Function name

SPR_2SetChar

 No

8

Format
void SPR_2SetChar(Uint16 charNo, Uint16 colorMode,Uint16 color, Uint16 width, Uint16 height, Uint8 *charImage)
input
charNo: Character number
colorMode: Color mode (b5 to b3: same as drawing mode word)
color: Color data
          Lookup table number when color mode = 1
          Color bank code when color mode = 0, 2, 3, 4
          Ignored when color mode = 5

width: X size height: Y size charImage: Character data pointer If =0, only the character area is acquired.

output
none
function value
none
function
If the specified charNo character has not been allocated or has already been allocated but the size of the acquired area is smaller than the character size to be set, calculate the character storage size and acquire the necessary block from the block pool. to copy the character data. If overwriting is possible, copy the character data to the same area.

 one
View
table
 Title

function specification

 Function

Character area release

 Function name

SPR_2ClrChar

 No

9

Format
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.

 one
View
table
 Title

function specification

 Function

Unlocking all character areas

 Function name

SPR_2ClrAllChar

 No

10

Format
void SPR_2ClrAllChar(void)
input
none
output
none
function value
none
function
Frees all character areas.

 one
View
table
 Title

function specification

 Functio

gouraud shading table number
Convert to VRAM address

 Function name

SPR_2GourTblNoToVram

 No

11

Format
SprVaddr addr = SPR_2GourTblNoToVram(Uint16 gourTblNo)
input
gourTblNo: Gouraud shading table number
output
none
function value
addr: Relative address in VRAM/8
function
Convert Gouraud shading table number to VRAM address.

 one
View
table
 Title

function specification

 Function

VRAM lookup table number
convert to address

 Function name

SPR_2LookupTblNoToVram

 No

12

Format
SprVaddr addr = SPR_2LookupTblNoToVram(Uint16 lookupTblNo)
input
lookupTblNo: Lookup table number
output
none
function value
ddr: Relative address in VRAM/8
function
Convert lookup table number to VRAM address.

 one
View
table
 Title

function specification

 Function

Convert character number to VRAM address

 Function name

SPR_2CharNoToVram

 No

13

Format
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.

 one
View
table
 Title

function specification

 Function

Command write open processing

 Function name

SPR_2OpenCommand

 No

14

Format
void SPR_2OpenCommand(Uint16 drawPrtyFlag)
input
drawPrtyFlag: Command drawing priority enable/disable 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 writing start position of the sprite command to the beginning of the VRAM command area. Therefore, this routine must be called 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()

 one
View
table
 Title

function specification

 Function

Command write close processing

 Function name

SPR_2CloseCommand

 No

15

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

 one
View
table
 Title

function specification

 Function

set of local coordinates

 Function name

SPR_2LocalCoord

 No

16

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

 one
View
table
 Title

function specification

 Function

Set system clipping area

 Function name

SPR_2SysClip

 No

17

Format
void SPR_2SysClip(Sint32 drawPrty, XyInt *xy)
input
drawPrty: Command drawing priority number
xy: Bottom right coordinate
output
none
function value
none
function
Set the system clipping area.

 one
View
table
 Title

function specification

 Function

Set user clipping area

 Function name

SPR_2UserClip

 No

18

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

 one
View
table
 Title

function specification

 Function

line drawing

 Function name

SPR_2Line

 No

19

Format
void SPR_2Line(Sint32 drawPrty, Uint16 drowMode, Uint16 color, XyInt xy[2], Uint16 gourTblNo)
input
drawPrty: Command drawing priority number
drowMode: Drawing mode (same as drawing mode word)
color: Color mode or lookup table number
xy[2]: Line 2 points
gourTblNo: Glow shading table number
           NO_GOUR(=0xffff)=No glow shading table specified
output
none
function value
none
function
Draw a line.

 one
View
table
 Title

function specification

 Function

polyline drawing

 Function name

SPR_2PolyLine

 No

20

Format
void SPR_2PolyLine(Sint32 drawPrty, Uint16 drowMode, Uint16 color, XyInt xy[4], Uint16 gourTblNo)
input
drawPrty: Command drawing priority number
drowMode: Drawing mode (same as drawing mode word)
color: Color mode or lookup table number
xy[4]: 4-point polyline
gourTblNo: Glow shading table number
           NO_GOUR(=0xffff) = No glow shading table specified
output
none
function value
none
function
Draw a polyline.

 one
View
table
 Title

function specification

 Function

drawing polygons

 Function name

SPR_2Polygon

 No

21

Format
void SPR_2Polygon(Sint32 drawPrty, Uint16 drowMode, Uint16 color, XyInt xy[4], Uint16 gourTblNo)
input
drawPrty: Command drawing priority number
drowMode: Drawing mode (same as drawing mode word)
color: Color mode or lookup table number
xy[4]: 4-point polygon
gourTblNo: Glow shading table number
           NO_GOUR(=0xffff) = No glow shading table specified
output
none
function value
none
function
Draw a polygon.

 one
View
table
 Title

function specification

 Function

Drawing normal sprites

 Function name

SPR_2NormSpr

 No

22

Format
void SPR_2NormSpr(Sint32 drawPrty, Uint16 dir, Uint16 drowMode, Uint16 color, Unit16 charNo, XyInt *xy, Uint16 gourTblNo)
input
drawPrty: Command drawing priority number
dir: Character inversion instruction (b5 to b4: same as control word)
drowMode: drawing mode (same as drawing mode word)
color: Color code or lookup table number
           If 0xffff, the color data specified with SPR_2SetChar() will be 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
Draw a normal sprite.

 one
View
table
 Title

function specification

 Function

Drawing scale sprites

 Function name

SPR_2ScaleSpr

 No

23

Format
void SPR_2ScalSpr(Sint32 drawPrty, Uint16 zoomDir, Uint16 drowMode, Uint16 color, Uint16 charNo, XyInt xy[2], Uint16 gourTblNo)
input
drawPrty: Command drawing 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: Color code or lookup table number
           If 0xffff, the color data specified with SPR_2SetChar() will be 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.

 one
View
table
 Title

function specification

 Function

Drawing deformed sprites

 Function name

SPR_2DisSpr

 No

24

Format
void SPR_2DistSpr(Sint32 drawPrty, Uint16 dir, Uint16 drowMode, Uint16 color, Uint16 charNo, XyInt xy[4], Uint16 gourTblNo)
input
drawPrty: Command drawing priority number dir: Character inversion instruction (b5 to b4: same as control word)
drowMode: drawing mode (same as drawing mode word)
color: Color code or lookup table number
           If 0xffff, the color data specified with SPR_2SetChar() will be set.
charNo: Character number
xy[4]: 4 vertex coordinates
gourTblNo: Gouraud shading table number
           NO_GOUR(=0xffff) = No Gouraud shading table specified
output
none
function value
none
function
Draws a deformed sprite.

 one
View
table
 Title

function specification

 Function

command set

 Function name

SPR_2Cmd

 No

25

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

 one
View
table
 Title

function specification

 Function

Command drawing priority chain
flash

 Function name

SPR_2FlushDrawPrty

 No

26

Format
void SPR_2FlashDrawPrty(void)
input
none
output
none
function value
none
function
If command drawing priority is enabled, commands in VRAM are chained according to the priority value and the drawing priority management area is cleared.

 one
View
table
 Title

function specification

 Function

Acquisition of VRAM block area (static)

 Function name

SPR_2AllocBlock

 No

27

Format
SprVaddraddr =SPR_2AllocBlock(Uint16 size)
input
size: Block size (32 bytes as a unit)
output
none
function value
addr: Returns the acquired block area position as relative address in VRAM/8.
function
Acquires a block of the specified size from the block pool area in VRAM. Although this routine is not released externally, we have included the specifications for reference when adding functionality to this library.

 one
View
table
 Title

function specification

 Function

Freeing VRAM block area (static)

 Function name

SPR_2FreeBlock

 No

28

Format
void SPR_2FreeBlock(SprVaddr addr, Uint16 size)
input
addr: Returns the free block area position as a relative address in VRAM/8.
size: Block size (1 unit is 32 bytes)
output
none
function value
none
function
Although this routine that releases the specified block area in the VRAM block pool is not released externally, we have included the specifications for reference when adding functionality to this library.

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