Copyright: © 1998, Owen Gunter.  All rights reserved.


Contents:  C Functions
 C Functions

abs

atoi

atol

bcmp

bcopy

bsearch

bzero

calloc

free

getc

getchar

gets

labs

longjmp

malloc

memchr

memcmp

memcpy

memmove

memset

printf

putc

putchar

puts

qsort

rand

realloc

setjmp

sprintf

srand

strcat

strchr

strcmp

strcpy

strcspn

strlen

strncat

strncmp

strncpy

strpbrk

strrchr

strspn

strstr

strtok

strtol

strtoul

tolower

toupper


Contents:  Graphic Functions
 Graphic Functions

ApplyMatrix

ApplyMatrixLV

ApplyMatrixSV

ClearImage

DrawSync

FntFlush

FntLoad

FntOpen

FntPrint

GetClut

GetTPage

GsClearOt

GsDefDispBuff

GsDrawOt

GsGetActiveBuff

GsGetLs

GsGetLw

GsGetLws

GsGetTimInfo

GsGetWorkBase

GsInit3D

GsInitCoordinate2

GsInitFixBg16

GsInitGraph

GsLinkObject4

GsMapModelingData

GsScaleScreen

GsSetAmbient

GsSetClip

GsSetClip2D

GsSetDrawBuffClip

GsSetDrawBuffOffset

GsSetFlatLight

GsSetFogParam

GsSetLightMatrix

GsSetLightMode

GsSetLsMatrix

GsSetOffset

GsSetOrign

GsSetProjection

GsSetRefView2

GsSetView2

GsSetWorkBase

GsSortBoxFill

GsSortClear

GsSortFastSprite

GsSortFixBg16

GsSortGLine

GsSortLine

GsSortObject4

GsSortOt

GsSortSprite

GsSwapDispBuff

gteMIMefunc

KanjiFntClose

KanjiFntFlush

KanjiFntOpen

KanjiFntPrint

Krom2Tim

Krom2Tim2

LoadImage

MoveImage

MulMatrix0

PutDispEnv

PutDrawEnv

ResetGraph

RotMatrix

RotMatrixX

RotMatrixY

RotMatrixZ

ScaleMatrix

ScaleMatrixL

SetDispMask

StoreImage

TransMatrix

TransposeMatrix

VSync

VSyncCallback


Contents:  Sound Functions
 Sound Functions

SsGetMute

SsGetMVol

SsGetSerialAttr

SsGetSerialVol

SsIsEos

SsPlayBack

SsSeqClose

SsSeqGetVol

SsSeqOpen

SsSeqPause

SsSeqPlay

SsSeqReplay

SsSeqSetAccelerando

SsSeqSetNext

SsSeqSetRitardando

SsSeqSetVol

SsSeqStop

SsSetMute

SsSetMVol

SsSetSerialAttr

SsSetSerialVol

SsSetTempo

SsUtAllKeyOff

SsUtChangePitch

SsUtGetReverbType

SsUtGetVVol

SsUtKeyOff

SsUtKeyOn

SsUtPitchBend

SsUtReverbOff

SsUtReverbOn

SsUtSetReverbDelay

SsUtSetReverbDepth

SsUtSetReverbFeedback

SsUtSetReverbType

SsUtSetVVol

SsVabClose

SsVabTransfer


Contents:  Mathematical Functions
 Mathematical Functions

acos

asin

atan

atan2

atof

ceil

cos

cosh

exp

floor

fmod

frexp

hypot

ldexp

log

log10

modf

pow

printf2

sin

sinh

sprintf2

sqrt

strtod

tan

tanh


Contents:  Miscellaneous Functions
 Miscellaneous Functions

_get_errno

CdPlay

CdReadExec

CdReadFile

CdReadSync

CdSearchFile

close

delete

EnterCriticalSection

Exec

ExitCriticalSection

firstfile

FlushCashe

format

GetPadBuf

GetRCnt

GetVideoMode

InitHeap

Load

LoadTest

lseek

nextfile

open

read

rename

ResetRCnt

SetVideoMode

StartRCnt

TestCard

write


Contents: Macros
Macros

fabs

GsIncFrame


Contents: Overviews
Overviews

Copyright


Contents: Structures and Enums
Structures and Enums

CdlFILE

CdlLOC

CVECTOR

DIRENTRY

DISPENV

DRAWENV

EXEC

GsBG

GsBOXF

GsCELL

GsCOORD2PARAM

GsCOORDINATE2

GsDOBJ2

GsF_LIGHT

GsFOGPARAM

GsGLINE

GsIMAGE

GsLINE

GsMAP

GsOT

GsOT_TAG

GsRVIEW2

GsSPRITE

GsVIEW2

MATRIX

RECT

SndVolume

SVECTOR

VECTOR


Copyright

Copyright ©  1996 Sony Computer Entertainment Inc.
All Rights Reserved.

Converted to WinHelp by Owen Gunter.
Copyright ©  1998 Enigma Software.
All Rights Reserved.

EMail : OAGunter@btinternet.com


_get_errno

long _get_errno(void)

Gets adjacent input/output error code.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Error code.

Remarks

_get_errno gets adjacent error code through all file descriptors. The error code is defined in sys/errno.h.


abs

int abs(int i)

Calculates the absolute value.

Defined in: C:/PSX/INCLUDE/ABS.H

Return Value

The absolute value of the argument is returned.

Parameters

i  Integer value

Remarks

abs calculates the absolute value of the integer i. This function is primarily for searching the absolute value of int type integers. However, as int type and long type have the same meaning in R3000, on this system it is a function equivalent to labs.

See Also

labs.


acos

double acos(double x)

acos looks for the arccosine function of x.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Arccosine function of x. The range is [0 to pi]. A domain error occurs if fabs(x) > 1.

Parameters

x  Arccosine calculation value. Range is [-1 to 1].

See Also

cos, asin, atan.


ApplyMatrix

VECTOR* ApplyMatrix(MATRIX* m, SVECTOR* v0, VECTOR* v1)

Multiplies vector by matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

v1.

Parameters

m  Input multiplication matrix.

v0  Input short vector.

v1  Output vector.

Remarks

ApplyMatrix multiplies from the right the short vector v0 by the matrix m and stores the result in the vector v1.

The argument format is as follows:
m->m[i][j] : (1,3,12)
v0->vx,vy,vz :(1,15,0)
v1->vx,vy,vz :(1,31,0)

Notes: The rotation matrix is fragmented.

See Also

MATRIX, SVECTOR, VECTOR.


ApplyMatrixLV

VECTOR* ApplyMatrixLV(MATRIX* m, VECTOR* v0, VECTOR* v1)

Multiplies vector by matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

v1.

Parameters

m  Input multiplication matrix.

v0  Input vector.

v1  Output vector.

Remarks

ApplyMatrixLV multiplies from the right the vector v0 by the matrix m and stores the result in the vector v1.

The argument format is as follows:
m->m[i][j] : (1,3,12)
v0->vx,vy,vz :(1,31,0)
v1->vx,vy,vz :(1,31,0)

Notes: The rotation matrix is fragmented

See Also

MATRIX, VECTOR.


ApplyMatrixSV

VECTOR* ApplyMatrixSV(MATRIX* m, SVECTOR* v0, SVECTOR* v1)

Multiplies vector by matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

v1.

Parameters

m  Input multiplication matrix.

v0  Input short vector.

v1  Output short vector.

Remarks

ApplyMatrixSV multiplies from the right the short vector v0 by the matrix m and stores the result in the short vector v1.

The argument format is as follows:
m->m[i][j] : (1,3,12)
v0->vx,vy,vz :(1,15,0)
v1->vx,vy,vz :(1,15,0)

Notes: The rotation matrix is fragmented.

See Also

MATRIX, SVECTOR.


asin

double asin(double x)

asin looks for the arcsine function of x.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Arcsine function of x. The range is [-pi/2, pi/2]. A domain error occurs if fabs(x) > 1.

Parameters

x  Arcsine calculation value. Range is [-1 to 1].

See Also

sin, acos, atan.


atan

double atan(double x)

Calculates the arctangent of x

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Arctangent function of x. The range is [-pi/2 to pi/2]

Parameters

x  Arctangent calculation value.

See Also

tan, asin, acos, atan2.


atan2

double atan2(double x, double y)

Calculates the arctangent of x/y.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Arctangent function of x/y. The range is [-pi to pi]. A domain error occurs if x==0 && y==0.

Parameters

x  Floating-point value.

y  Floating-point value.

See Also

atan.


atof

double atof(const char* s)

Convert strings to double.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The result of converting the input value s to double type is returned. If the correct value exceeds the range that can be expressed, either +HUGE_VAL(1.797693134862316e+308) or -HUGE_VAL is returned according to the sign. 0 is returned if an underflow occurs.

Parameters

s  Character string.

Remarks

atof converts character strings to floating-point numbers (double type).

See Also

strtod.


atoi

long atoi(const char* s)

Converts character strings to integers.

Defined in: C:/PSX/INCLUDE/CONVERT.H

Return Value

The result of converting the input value s to an integer is returned.

Parameters

s  Character string.

Remarks

atoi is the same as (long)strtol(s,(char**)NULL). On this system it is a function equivalent to atol.

See Also

atol, strtol.


atol

long atol(const char* s)

Converts character strings to integers.

Defined in: C:/PSX/INCLUDE/CONVERT.H

Return Value

The result of converting the input value s to an integer is returned.

Parameters

s  Character string.

Remarks

atol is the same as (long)strtol(s,(char**)NULL).

See Also

atoi, strtol


bcmp

long bcmp(char* b1, char* b2, long n)

Compares memory blocks.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

The next value depending on the comparison result of b1 and b2 is returned:

Result	Return Value
b1<b2	<0
b1=b2	=0
b1>b2	>0
Parameters

b1  Comparison source 1.

b2  Comparison source 2.

n  Comparison byte number.

Remarks

bcmp compares the first n byte of b1 and b2.

See Also

memcmp.


bcopy

void bcopy(char* src, char* dest, long n)

Copies memory blocks.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Parameters

src  Copy source.

dest  Copy destination.

n  Copy byte number.

Remarks

bcopy copies the first n byte of src to dest.

See Also

memcpy.


bsearch

void* bsearch(const void* key, const void* base, size_t n, size_t w,  long(*compare)(const void*, const void*))

Performs a binary search of a sorted array.

Defined in: C:/PSX/INCLUDE/STDLIB.H

Return Value

The address of the first item matching the retrieval key is returned. 0 is returned if there is no matching item.

Parameters

key  Object to search for.

base  Pointer to base of search data.

n  Number of elements.

w  Wodth of an element.

compare  Comparison function,

Remarks

With compare as a comparison function, bsearch carries out a binary search of tables of n items (size of item = w) starting from base, looking for items matching key.


bzero

void* bzero(unsigned char* p, int n)

Pads memory blocks with zeros.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

Returns the pointer to the address where write starts.

Parameters

p  Pointer to write start position.

n  Write byte number.

Remarks

Writes n byte zeros from the address specified by p.

See Also

bcopy, bcmp.


calloc

void* calloc(size_t n, size_t s)

Allocates an array in memory with elements initialized to 0..

Defined in: C:/PSX/INCLUDE/MALLOC.H

Return Value

The pointer to the secured memory block is returned. NULL is returned in the event of failure.

Parameters

n  Number of elements.

s  Length in bytes of each element.

Remarks

calloc secures the n x s byte block from the heap memory.

See Also

malloc, realloc, free.


CdPlay

int CdPlay(int mode, int* tracks, int offset)

Plays back CD-DA tracks.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The track currently being played. The index of the tracks array is returned instead of the track number. The performance is shown as ended if -1 is returned.

Parameters

mode  Mode.

tracks  Array that specifies track to be played. Ends with 0..

offset  Index of tracks starting the performance.

Remarks

CdPlay plays consecutively in the background multiple tracks specified by the array tracks. When the last track of the array is played, it repeats or ends the performance, according to the mode. Values that can be specified in mode are as follows:

0 : Stops performance.

1 : The tracks specified by tracks are played consecutively, and the performance is stopped when all the specified tracks have been played.

2 : The tracks specified by tracks are played consecutively, and the performance is returned to the start and repeated when all the specified tracks have been played.

3 : The index of the tracks array for the track currently being played is returned.

Notes: The performance is carried out in track units, Performance and stopping etc. in mid track is not possible.


CdReadExec

struct EXEC* CdReadExec(char* file)

Loading executable files from CD-ROM.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

EXEC that holds executable files that have been read.

Parameters

file  Executable filename.

Remarks

Executable files specified by file are loaded by CdReadExec from CD-ROM to the appropriate address in the main memory. Reading is carried out in the background, and CdReadSync is used to determine the end of reading. The loaded file is executed as a child process by using Exec.

Notes: The load address of the executable file should not overlap the area used by the parent process


CdReadFile

int CdReadFile(char* file, u_long* addr, int nbyte)

Reads files on CD-ROM.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The data number (bytes) read is returned if successful, and 0 is returned in the case of a reading error.

Parameters

file  Filename.

addr  Read memory address.

nbyte  Read size.

Remarks

CdReadFile reads nbyte of a file on CD-ROM. The entire file is read if 0 is specified in nbyte. If NULL is specified in file, reading starts from the last location read by CdReadFile immediately before.

Notes: The filename must be an absolute path. Lower case characters are automatically changed to upper case characters. Reading is carried out in the background, and CdReadSync is used to determine the end of reading.


CdReadSync

int CdReadSync(int mode, u_char* result)

Waits for termination of CdRead.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The following values are returned:

0 : Termination.

-1 : Read error.

Parameters

mode  Mode.

0 : Waits for termination of read.

1 : Current condition is checked and immediately returned result.

result  Status of most recently terminated command.

Remarks

CdReadSync waits for reading by CdReadFile and CdReadExec to terminate.


CdSearchFile

CdlFILE * CdSearchFile(CdlFILE* fp, char* name)

Gets location and size from filename on CD-ROM.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The pointer of the CD-ROM file structure obtained is returned. 0 is returned if the file is not found, and -1 is returned if the search fails.

Parameters

fp  CD-ROM file structure (CdlFILE) pointer.

name  Filename,

Remarks

CdSearchFile recognises the absolute location (minute, second, sector) and size from the filename on CD-ROM. The result is stored in fp.

Notes: The filename must be an absolute path. File location information in the same directory as files specified by fp are cached in memory. For this reason, if CdSearchFile is carried out continuously in files within the same directory, access becomes faster from the second time. Cases where the return value is -1 show that the directory read has failed for some reason.


ceil

double ceil(double x)

Calculates the ceiling of a value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The ceil function returns a floating-point value representing the smallest integer that is greater than or equal to x. There is no error return.

Parameters

x  Floating-point value.

See Also

floor.


ClearImage

int ClearImage(RECT* recp, u_char r, u_char g, u_char b)

Frame buffer high speed painting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Queue number.

Parameters

recp  A pointer to the painting RECT area.

r  Painting pixel r value.

g  Painting pixel g value.

b  Painting pixel b value.

Remarks

ClearImage paints the rectangular area of the frame buffer specified by recp with the (r,g, b) brightness value.

Notes: Actual completion of the transmission needs to be identified by DrawSync because it is a non-blocking function. The transmission area is not affected by the drawing environment (clip and offset).


close

int close(int fd)

Closing file.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

fd is returned when successful, and -1 in all other cases.

Parameters

fd  File descriptor.

Remarks

close releases the file descriptor.

See Also

open.


cos

double cos(double x)

cos looks for the cosine function of x.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The cos function returns the cosine of x.

Parameters

x  Angle in radian units.

See Also

sin, tan, acos.


cosh

double cosh(double x)

Calculates hyperbolic cosines.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Hyperbolic cosine function of x (cosh(x)).

Parameters

x  Angle in radian units.

See Also

sinh, tanh.


delete

int delete(char* name)

Deletes files.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 in all other cases.

Parameters

name  Filename.

Remarks

delete deletes the file name.


DrawSync

int DrawSync(int mode)

Waits for completion of all drawing.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Actual queue rank number.

Parameters

mode  Mode.

0 : Waits for completion of all non-block functions registered in the queue.

1 : The current rank number of the queue is checked and returned.


EnterCriticalSection

void EnterCriticalSection(void)

Enter a critical section.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

EnterCriticalSection inhibits interruption.


Exec

long Exec(struct EXEC* exec, long argc, char** argv)

Executing executable files.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 in the event of failure.

Parameters

exec  Executable file information.

argc  Argument number.

argv  Argument.

Remarks

Exec executes the module loaded on the memory in accordance with the executable file information specified by exec. Neither the stack nor the frame buffer are set if exec->s_addr is 0. The contents of the operation are as follows:

(1) Data session is zero cleared without an initial value.
(2) sp, fp and gp are initialised after evacuation (the value of fp is equal to that of sp).
(3) The argument of main() is set (by the a0 and a1 registers).
(4) The execution start address is called.
(5) sp, fp and gp are returned after return.

Notes: Must be executed by critical section.

See Also

EXEC, Load.


ExitCriticalSection

void ExitCriticalSection(void)

Exits a critical section.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

ExitCriticalSection permits interruption.


exp

double exp(double x)

Calculates the exponential.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

e to the power of x [image].

Parameters

x  Floating-point value.

Remarks

exp looks for the exponent function of x.

See Also

pow, log.


firstfile

struct DIRENTRY* firstfile(char* name, struct DIRENTRY* dir)

First file retrieval.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

dir is returned when successful, and 0 in all other cases.

Parameters

name  Filename.

dir  Buffer that stores information relating to retrievable files.

Remarks

firstfile retrieves files corresponding to the name pattern name, and stores information relating to them in dir

Notes: (one optional character) * (entire character string of optional length) can be used as a wildcard character in the filename pattern. The character specification after * is disregarded.

See Also

DIRENTRY, nextfile.


floor

double floor(double x)

Calculates the floor of a value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The floor function returns a floating-point value representing the largest integer that is less than or equal to x. There is no error return.

Parameters

x  Floating-point value.

See Also

ceil.


FlushCashe

void FlushCashe(void)

Flushing I cache.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

FlushCashe flushes the I cache. It is executed when the program code is written in the memory.

Notes: Memory content cannot be changed.


fmod

double fmod(double x, double y)

Calculates the floating-point remainder.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

fmod looks for the remainder of the floating-point number resulting from x/y.

Parameters

x  Floating-point value.

y  Floating-point value.

Notes: Return value sign is the same as x. 0 is returned if y is 0.


FntFlush

u_long* FntFlush(int id)

Draws print stream contents.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Temporary OT top pointer used in drawing.

Parameters

id  Print Stream ID.

Remarks

FntFlush draws the print stream in the frame buffer.

Notes: After completion of drawing, the print stream contents are also flushed.


FntLoad

void FntLoad(int tx, int ty)

Transmits font pattern.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

tx  Left coordinate of the area of frame buffer that arranges the font patterns

ty  Top coordinate of the area of frame buffer that arranges the font patterns

Remarks

FntLoad transmits to the frame buffer the font pattern used for debugging. FntLoad loads the basic font pattern (4bit texture 256x128) to the frame buffer, and initialises all print streams.

Notes: FntLoad must without fail be executed before FntOpen and FntFlush. The font area must not conflict with the frame buffer area used by the application.


FntOpen

int FntOpen(int x, int y, int w, int w, int isbg, int n)

Opens print stream.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Print stream ID.

Parameters

x  Left start position.

y  Top start position.

w  Display width area.

w  Display height area.

isbg  Background automatic clearance.
0 : Background is cleared to (0,0,0) when displayed.
1 : Background is not cleared to (0,0,0) when displayed.

n  Number of letters.

Remarks

FntOpen opens the stream used for printing on screen. Thereafter, the largest n character string of letters can be printed in the rectangular area of the frame buffer (x, y)-(x+w, y+h) using the FntPrint function. If 1 is specified in isbg, the background is cleared when a character string is drawn.

Notes: Up to 8 streams can be opened at the same time. Opened streams cannot be closed until the next FntLoad is called.


FntPrint

int FntPrint(char* format, ...)

Print formatted output to the standard output stream.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Character string within the stream.

Parameters

format  Print format.

...   Optional arguments.

Remarks

FntPrint sends the character string to the print stream by the printf2 interface.

Notes: The actual display of the character string occurs when FntFlush is executed.


format

int format(char* fs)

Initialises file system.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 in all other cases.

Parameters

fs  File system name.

Remarks

format initialises the file system fs.

Notes: Valid only for file systems that can be written.


free

void free(void* block)

Deallocates or frees a memory block.

Defined in: C:/PSX/INCLUDE/MALLOC.H

Parameters

block  Previously allocated memory block to be freed.

Remarks

The free function deallocates a memory block (block) that was previously allocated by a call to calloc, malloc, or realloc. The number of freed bytes is equivalent to the number of bytes requested when the block was allocated (or reallocated, in the case of realloc). If block is NULL, the pointer is ignored and free immediately returns.

See Also

calloc, malloc, realloc.


frexp

double frexp(double x, int* n)

Resolution into normalised fractional part and [image] part.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Normalised fractional part [1/2, 1).

Parameters

x  Floating-point value.

n  Pointer to the buffer that stores the [image] part.

Remarks

frexp resolves x into fractional parts normalised to [1/2,1) and [image] parts. The fractional part becomes the return value and the [image] part is stored in n.


getc

char getc(FILE* stream)

Gets a single character from a stream.

Defined in: C:/PSX/INCLUDE/STDIO.H

Return Value

NULL is returned in the case of file end or error.

Parameters

stream  Input stream.

Remarks

Gets a single character from input stream stream.

See Also

getchar, gets.


getchar

char getchar(void)

Gets a single character from the standard input stream.

Defined in: C:/PSX/INCLUDE/STDIO.H

Return Value

Same as getc.

Remarks

getchar gets a single character from the standard input stream. It is the same as getc(stdin).

See Also

getc, gets.


GetClut

u_short GetClut(int x, int y)

Calculates primitive clut member value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

CLUT id.

Parameters

x  CLUT frame buffer address.

y  CLUT frame buffer address.

Remarks

GetClut calculates the texture CLUT ID and returns it.

Notes: The CLUT address is limited to multiples of 16 in the x direction.


GetPadBuf

void GetPadBuf(volatile unsigned char** buf1, volatile unsigned char** buf2)

Gets controller buffers.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

buf1  Pointer to the buffer that stores data from the port 1 controller.

buf2  Pointer to the buffer that stores data from the port 2 controller.

Remarks

Communication with the controller is carried out every vertical synchronisation interruption, and the result stored in controller buffers within the system. The GetPadBuf function can get the pointers to those buffers. Two sets of controller buffers are available for the ports, and the following data is stored:

Bytes	Content
0	0xff: Without controller 0x00: With controller
1	Upper 4bit: Terminal type Lower 4bit: Received data size (1/2 byte number)
2	Reception data (largest 32 bytes)

The received data is different according to the controller type shown by ‘terminal type’.  The terminal types supported by this library are as follows:

Terminal Classification	Device Name
0x1	Mouse
0x2	NeGCon
0x4	Standard controller
0x5	Joystick

Please refer to the "Programmer's Guide" for the contents of received data corresponding to terminal type.


GetRCnt

long GetRCnt(unsigned long spec)

Getting root counter.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The counter value that is expanded without the sign in 32bit is returned when successful, and -1 is returned in the event of failure.

Parameters

spec  Root counter specification.

Remarks

GetRCnt returns the current value of the root counter spec.

See Also

StartRCnt, ResetRCnt.


gets

char* gets(char* s)

Reads in a character string from the standard input stream

Defined in: C:/PSX/INCLUDE/STDIO.H

Return Value

The character string argument s is returned when successful. NULL is returned in the case of file end or error.

Parameters

s  Input array storage destination.

Remarks

gets reads in the array that ends with a line feed character from the standard input stream (stdin) and stores it in s.

See Also

getc, getchar.


GetTPage

u_short GetTPage(int tp, int abr, int x, int y)

Calculates primitive tpage member value

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Texture page ID.

Parameters

tp  Texture mode.
0 : 4bitCLUT
1 : 8bitCLUT
2 : 16bitDirect

abr  Semi-transparency rate.
0 : 0.5 x Back + 0.5 x Forward
1 : 1.0 x Back + 1.0 x Forward
2 : 1.0 x Back - 1.0 x Forward
3 : 1.0 x Back + 0.25 x Forward

x  Texture page address.

y  Texture page address.

Remarks

GetTPage calculates the texture page ID and returns it.

Notes: The semi-transparency rate is also valid for polygons that do not carry out texture mapping. The texture page address is limited to multiples of 64 in the x direction and multiples of 256 in the y direction.


GetVideoMode

long GetVideoMode(void)

Obtains the present video signaling system.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Return value contents is the video signaling system mode:

MODE_NTSC

NTSC system video signaling system.

MODE_PAL

PAL system video signaling system.

Remarks

Returns the present video signaling system declared in SetVideoMode.

Notes: When SetVideoMode is not called, no matter what the machine, it will return MODE_NTSC.

See Also

SetVideoMode.


GsClearOt

void GsClearOt(unsigned short offset, unsigned short point, GsOT* otp)

OT initialisation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

offset  Ordering table offset value.

point  Ordering table representative value Z.

otp  Pointer to ordering table.

Remarks

GsClearOT initialises the ordering table displayed by otp. offset is the Z value at the top of that ordering table, and point is the Z value referred to when inserting that ordering table into another ordering table. Also, the length of OT must be specified in advance in order to confirm the size to be cleared.

See Also

GsOT, GsDrawOt.


GsDefDispBuff

void GsDefDispBuff(unsigned short x0, unsigned short y0, unsigned short x1, unsigned short y1)

Double buffer definition.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

x0  Buffer 0 origin left-hand coordinate.

y0  Buffer 0 origin top coordinate.

x1  Buffer 1 origin left-hand coordinate.

y1  Buffer 1 origin top coordinate.

Remarks

GsDefDispBuff defines the double buffer. (x0, y0) and (x1, y1) are specified by the coordinate value within the frame buffer. In default, the buffer 0 becomes (0, 0) and buffer 1 becomes (0, y_res). y_res is the vertical resolution specified by GsInitGraph. The double buffer is cancelled when (x0, y0) and (x1, y1) have the same coordinate values. Switching the double buffer of the even number field and odd number field is automatically carried out if it is left in this mode when the interlace mode is specified. Double buffer switching is carried out by the GsSwapDispBuff function. The double buffer is executed by GPU or GTE offset. GsInitGraph sets whether execution of offset is by GPU or by GTE. If the double buffer is executed using the GPU offset, the coordinate value is created in the coordinate system whose origin is the top left-hand point of the double buffer in the packet. On the other hand, if the double buffer is executed using the GTE offset, the coordinate value is created in the coordinate system whose origin is the origin (top left-hand point) of the frame buffer in the packet.

See Also

GsInitGraph, GsSwapDispBuff


GsDrawOt

void GsDrawOt(GsOT* ot)

Execution of drawing command allocated to OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

ot  Pointer to OT.


GsGetActiveBuff

int GsGetActiveBuff(void)

Gets drawing buffer number.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The double buffer index (0 when buffer 0 and 1 when buffer 1) is returned.

Remarks

GsGetActiveBuff gets the double buffer index (PSDIDX). The index value is either 0 or 1. The frame buffer top 2 dimensional address of the double buffer origin (top left coordinate) is found by entering the index in the external variables PSDOFSX[ ] and PSDOFSY[ ].

See Also

PSDIDX.


GsGetLs

void GsGetLs(GsCOORDINATE2* coord, MATRIX* m)

Calculates local screen matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

coord  Pointer to local coordinate system.

m  Pointer to MATRIX.

Remarks

GsGetLs calculates the perspective conversion matrix of the local screen from coord of the matrix type coordinate system GsCOORDINATE2 specified by the argument, and the result is stored in the MATRIX type structure m. Also, the calculated result of each node of the hierarchical coordinate system is held in order to increase speed, and calculation up to nodes that are not changed is omitted even when the GsGetLw function is next called. This is controlled by the GsCOORDINATE2 flag (1 is substituted for the GsCOORDINATE2 flag after calculation). However, even when 1 is substituted for the flag, note that calculation will be carried out if the parent node has been changed.

See Also

GsSetLsMatrix.


GsGetLw

void GsGetLw(GsCOORDINATE2* coord, MATRIX* m)

Calculates local world matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

coord  Pointer to local coordinate system.

m  Pointer to MATRIX.

Remarks

GsGetLw calculates the local world perspective conversion matrix from coordinates of the matrix type coordinate system GsCOORDINATE2 specified by the argument and stores the result in the MATRIX type structure m. Also, the calculation result of each node of the hierarchical coordinate systems is held in order to increase speed, and calculation up to nodes that are not changed is omitted even when the GsGetLw function is next called. This is controlled by the GsCOORDINATE2 flag (1 is substituted for the GsCOORDINATE2 flag after calculation). However, even when 1 is substituted for the flag, note that calculation will be carried out if the parent node has been changed.

See Also

GsGetLws, GsSetLightMatrix.


GsGetLws

void GsGetLws(GsCOORDINATE2* coord, MATRIX* lw, MATRIX* ls)

Calculates both local world and local screen matrices.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

coord  Pointer to local coordinate system.

lw  Pointer to local world coordinate system.

ls  Pointer to local screen coordinate system.

Remarks

GsGetLws calculates both the local world coordinates and the local screen coordinates at the same time from the local coordinate system coord2, and stores them in lw and ls. It is faster than continuously calling GsGetLw and GsGetLs. The local world matrix must be specified if light source calculation is carried out at the time of execution, but in this case it is faster to search once with GsGetLws.

See Also

GsGetLs, GsGetLws, GsCOORDINATE2, MATRIX.


GsGetTimInfo

void GsGetTimInfo(unsigned long* tim, GsIMAGE* im)

Checks TIM format header.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

tim  TIM data top address.

im  Pointer to image structure.

Remarks

TIM format information specified by the argument tim is stored in im. The top of the TIM data is the address that skipped the ID. In other words, it has an offset 4 bytes forward from the top of the TIM file. For file format, please refer to the Net Yaroze Members' Web site.

See Also

GsIMAGE.


GsGetWorkBase

PACKET * GsGetWorkBase(void)

Gets current drawing command storage address.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The address that creates the next drawing primitive packet.

Remarks

GsGetWorkBase gets the current drawing primitive packet address. The top address of the unused area can be got.

See Also

GsSetWorkBase, PACKET, GsOUT_PACKET_P.


GsInit3D

void GsInit3D(void)

3D graphics system initialisation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

GsInit3D initialises the 3D graphics system within the library. 3D graphics system needs to be initialised by this function first, so that 3D processing functions such as GsSetRefView2, GsInitCoordinate2 and GsSortObject4 can be used.

The following process is executed:
(1) The screen origin is held in the screen centre.
(2) The light source defaults to LIGHT_NORMAL.

Notes: With this function, the graphics system must firstly be intialised by GsInitGraph.

See Also

GsInitGraph, GsSetRefView2, GsInitCoordinate2, GsSortObject4


GsInitCoordinate2

void GsInitCoordinate2(GsCOORDINATE2* super, GsCOORDINATE2* base)

Local coordinate system initialisation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

super  Pointer to parent coordinate system.

base  Pointer to (initialising) coordinate system.

Remarks

GsInitCoordinate2 initialises the local coordinate system. Initialisation of base->coord is by the unit matrix, and base- >super by the coordinate system specified by the argument.

See Also

GsCOORDINATE2


GsInitFixBg16

void GsInitFixBg16(GsBG* bg, unsigned long* work)

Initialises high-speed BG working area.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

bg  Pointer to GsBG.

work  Pointer to working area (primitive area).

Remarks

GsInitFixBg16 initialises the working area used by the GsSortFixBg16 function. The size of the necessary array varies according to the screen resolution. The size can be found by the following formula (unit is long):

Size = (((ScreenW/CellW+1)*(ScreenH/CellH+1+1)*6+4)*2+2)

ScreenH: Screen height vertical dot number (240/480)
ScreenW: Screen height horizontal dot number (256/320/384/512/640)
CellH: Cell height (pixel number)
CellW: Cell width (pixel number)
GsInitFixBg16 should only be executed once, and does not need to be executed every frame.

See Also

GsSortFixBg16, GsBG.


GsInitGraph

void GsInitGraph(unsigned short x, unsigned short y, unsigned short intmode, unsigned short dith, unsigned short varmmode)

Graphics system initialisation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

x  Horizontal resolution (256/320/384/512/640).

y  Vertical resolution (240/480).

intmode  Interlace display flag (bit 0).

dith  Whether or not dither when drawing.

varmmode  Frame buffer mode.

Remarks

GsInitGraph initialises the graphics system. The GPU setting is notified by the global variables GsDISPENV and GsDRAWENV, so the program GPU setting can be confirmed and changed by referring to GsDISPENV and GsDRAWENV. The double buffer offset mode decides whether the double buffer offset is executed by GTE or by GPU. It is easier to handle when executed by GPU because the double buffer offset value is not included in the packet. In the 24-bit mode, only image display is possible. Polygon drawing etc. is not possible. Because initialisation of the graphics system includes GsIDMATRIX and GsIDMATRIX2 initialisation, none of the Gs... functions operate normally unless GsInitGraph has been called.


GsLinkObject4

void GsLinkObject4(unsigned long* tmd_base, GsDOBJ2* obj_base, int n)

Links object and TMD data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

tmd_base  Top address of the linking TMD data.

obj_base  Array of the object structure to be linked.

n  Index of the linking object.

Remarks

GsLinkObject4 links the TMD data (nth) object with the object structure of GsDOBJ2, so that TMD 3D objects can be handled by GsDOBJ2.

Notes: Objects linked by GsLinkObject4 can be registered in OT by GsSortObject4.

See Also

GsSortObject4, GsDOBJ2.


GsMapModelingData

void GsMapModelingData(unsigned long* p)

Maps TMD data to an actual address.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

p  Top address of TMD data.

Remarks

The offset address from the top of the TMD data is stored because at the time of TMD data creation it is uncertain where it is going to be loaded onto the memory. The GsMapModelingData function converts this offset address into an actual address, and this conversion must be carried out first of all in order to use the TMD data. The TMD data top address is the one that skipped the ID. In other words, it has an offset 4 bytes forward from the top of the TMD file. For file format, please refer to the Net Yaroze Members' Web site.

Notes: A flag stands in the TMD data converted to an actual address, so that no side effects will occur even if GsMapModelingData is called for a second time.


GsScaleScreen

void GsScaleScreen(SVECTOR* scale)

Scales screen coordinate system.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

scale  The scale factor (12bit fixed decimal point format) GsScaleScreen sets the scale factor for the original screen coordinate system normally set by GsSetView2 and GsSetRefView2. By entering ONE for vx, vy and vz, it returns to the original.

Remarks

GsScaleScreen carries out scaling of the screen coordinate system with respect to the world coordinate system. Problems such as the closeness of Far Clip occur because the screen coordinate system is only 16bit whereas the world coordinate system has a 32bit space. GsScaleScreen is a function that resolves this problem, carries out scaling of the screen coordinates and covers a wider area for the world coordinates. For example, the screen coordinate system expands to a 17bit equivalent size when ONE/2 is specified in (vx,vy,vz). However, as precision is 16bit, the bottom 1 bit is invalid. At this time, screen coordinate systems with different scales should not be registered in OT with the same scale. For example, registration must be carried out by shifting to one extra bit, in order to register objects, calculated with the screen coordinate system of the normal scaling, to the OT that registered the objects that were half the scale of the screen coordinate system.

See Also

SVECTOR.


GsSetAmbient

void GsSetAmbient(long r, long g, long b)

Ambient colour setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

r  r value of the ambient colour (0~4095).

g  g value of the ambient colour (0~4095).

b  b value of the ambient colour (0~4095).

Remarks

GsSetAmbient sets ambience (ambient light). Setting is carried out in each of r, g and b according to what fraction of unlit parts there are to lit parts. 1/1 becomes 4096 and 1/8 becomes 4096/8.

GsDrawOt starts execution of the drawing command registered in OT displayed by otp. GsDrawOt immediately returns because the drawing process is carried out in the background.

Notes: If GPU is drawing, this function does not operate smoothly and it needs to be called immediately after drawing completion has been confirmed by DrawSync(0) or after drawing has been ended by ResetGraph(1).

See Also

GsSetFlatLight.

GsOT, GsClearOt.


GsSetClip

void GsSetClip(RECT* clip)

Drawing clipping area setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

clip  RECT structure for setting the clipping area.

Remarks

GsSetClip sets the clip for drawing. The set value is valid until the GsSwapDispBuff function is called next. It is different from GsSetDrawBuffClip in that the place where the clip area can be specified by the argument and the validity period of the set value are different. Moreover, this clip value is relative within the double buffer.

Notes: This function does not operate smoothly if GPU is drawing, and it needs to be called immediately after completion of drawing has been confirmed by DrawSync(0) or after drawing has been ended by ResetGraph(1).

See Also

GsSetDrawBuffClip.


GsSetClip2D

void GsSetClip2D(RECT* rectp)

2 dimensional clipping setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

rectp  A pointer to a clip area.

Remarks

GsSetClip2D sets the area displayed by rectp as the clipping area. This setting is not influenced by the double buffer, and so once it is set, the same area is automatically clipped even if the double buffer is switched. GsSetDrawBuffClip needs to be called in order to validate this setting immediately afterwards. If GsSetDrawBuffClip is not called, the setting becomes valid from the next frame.

See Also

GsSetDrawBuffClip, RECT.


GsSetDrawBuffClip

void GsSetDrawBuffClip(void)

Drawing clipping area update.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

GsSetDrawBuffClip updates the drawing clip. It actually represents the clip value set by GsSetClip2D. The set value is valid until the GsSetDrawBuffClip function is called once more by a different clip value. Moreover, this clip value is relative within the double buffer, and the position of the clip does not change even if the double buffer is switched.

Notes: This function does not operate smoothly if GPU is drawing, and it needs to be called immediately after completion of drawing has been confirmed by DrawSync(0) or after drawing has been ended by ResetGraph(1).

See Also

GsSetClip2D, GsSetClip


GsSetDrawBuffOffset

void GsSetDrawBuffOffset(void)

Drawing offset update.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

GsSetDrawBuffOffset updates the offset for drawing. The set value is represented in the global conversion POSITION. This offset is relative within the double buffer, and the offset value is maintained even if the double buffer is switched. The setting of GTE or GPU is executed if this function is called. The third argument of GsInitGraph decides whether the offset is executed by GTE or by GPU (GsOFSGPU or GsOFSGTE is specified).

Notes: This function does not operate smoothly if GPU is drawing, and it needs to be called immediately after completion of drawing has been confirmed by DrawSync(0) or after drawing has been ended by ResetGraph(1).

See Also

GsSetOrign, GsSetOffset, POSITION


GsSetFlatLight

int GsSetFlatLight(unsigned short id, GsF_LIGHT* lt)

Parallel light source setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

id  Light source number (0,1,2).

lt  Light source information.

Remarks

GsSetFlatLight sets the parallel light source. The light source can be set up to three (id = 0, 1, 2). Light source information is given by the GsF_LIGHT structure.

Notes: Even if the contents of the GsF_LIGHT structure are rewritten, the setting is not represented unless this function is called.

See Also

GsF_LIGHT, GsSetAmbient.


GsSetFogParam

void GsSetFogParam(GsFOGPARAM* fogparam)

Fog parameter setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

fogparam  Pointer to fog parameter structure.

Remarks

GsSetFogParam carries out fog parameter setting. Fog is only effective if the light mode is 1.

See Also

GsFOGPARAM, GsSetLightMode.


GsSetLightMatrix

void GsSetLightMatrix(MATRIX* mp)

Sets light matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mp  Local screen matrix to be set.

Remarks

GsSetLightMatrix multiplies the matrix of three light source vectors and the local screen light matrix mp supplied by the argument, and sets in GTE. Depending on the type of modelling data to be handled, the GsSortObject4 function may perform light source calculation at the time of execution. In this case too, the light matrix needs to be pre-set using GsSetLightMatrix. The matrix set as the GsSetLightMatrix argument is normally the local world matrix.

See Also

GsSortObject4, GsGetLw, MATRIX.


GsSetLightMode

void GsSetLightMode(unsigned short mode)

Light source mode setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mode  Light source mode (0~1).

0 : normal lighting.
1 : normal lighting fog ON.

Remarks

GsSetLightMode sets the light source mode. The light source calculation method can also be set by the status bit (attribute) of each object (GsDOBJ2). Setting by the status bit is used in precedence to the status setting.


GsSetLsMatrix

void GsSetLsMatrix(MATRIX* mp)

Sets local screen matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mp  Local screen MATRIX to be set.

Remarks

GsSetLsMatrix sets the local screen matrix in GTE. If perspective conversion process is carried out using GTE, the local screen matrix needs to be pre-set in GTE. Because the GsSortObject4 function performs perspective conversion using GTE, GetLsMatrix needs to be called beforehand.

See Also

GsSortObject4, GsGetLs, MATRIX.


GsSetOffset

void GsSetOffset(long x, long y)

Offset setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

x  Drawing offset X.

y  Drawing offset Y.

Remarks

GsSetOffset specifies the drawing offset. It is different from GsSetDrawBuffOffset in that GsSetDrawBuffOffset sets the value of the global variable POSITION, whereas GsSetOffset sets the offset supplied by the argument. Also, the value set by GsSetOffset is temporary and the offset values that are set on execution of GsSwapDispBuff and GsSetDrawBuffOffset become invalid. On the other hand, the set values of GsSetDrawBuffOffset are valid until changed by GsSetOrign. The offset supplied by the argument is relative within the double buffer. In other words, the offset actually set is the base offset of the double buffer added to the offset supplied by the argument. The third argument of GsInitGraph decides whether the offset is executed by GTE or by GPU (GsOFSGPU or GsOFSGTE is specified).

Notes: This function does not operate smoothly if GPU is drawing, and it needs to be called immediately after completion of drawing has been confirmed by DrawSync(0) or after drawing has been ended by ResetGraph(1).

See Also

GsSetDrawBuffOffset.


GsSetOrign

void GsSetOrign(long x, long y)

Screen origin position setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

x  Screen origin position X.

y  Screen origin position Y

Remarks

GsSetOrign specifies the drawing offset. The offset value set by GsSetOffset is temporary and whereas the offset set when GsSwapDispBuff or GsSetDrawBuffOffset is called becomes invalid, the offset value set by GsSetOrign is valid until next changed by GsSetOrign. The offset supplied by the argument is relative within the double buffer. In other words, the offset actually set is the offset supplied by the argument added to the offset of the double buffer base. In reality, it is set by offx and offy of the global variable POSITION.

Notes: The third argument of GsInitGraph decides whether the offset is executed by GTE or by GPU (GsOFSGPU or GsOFSGTE is specified).


GsSetProjection

void GsSetProjection(unsigned short h)

Projection plane position setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

h  Distance between viewpoint and projection plane (projection distance), default is 1000.

Remarks

GsSetProjection regulates the field of view. The projection is the distance from the viewpoint to the projection plane. The size of the projection plane is set by the GsInitGraph arguments xres, yres. The field of view narrows if the projection distance is enlarged and expands if it is reduced, because the size of the projection plane is fixed according to the resolution. Be careful, because sometimes aspect ratio is not 1 to 1, depending on the resolution. In this case, the scale of Y coordinates is made 1/2 and the aspect ratio is adjusted.

Resolution	640x480	640x240	320x240
Aspect ratio	1:1	2:1	1:1


GsSetRefView2

int GsSetRefView2(GsRVIEW2* pv)

Viewpoint position setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Returns:

0 : is returned when viewpoint setting is successful.

1 : when it fails.

Parameters

pv  Viewpoint position information (viewpoint: steady viewpoint type).

Remarks

GsSetRefView2 calculates the WSMATRIX (World Screen Matrix) from the viewpoint information. If the viewpoint does not move, the WSMATRIX does not change and does not need to be called each frame. However, when the viewpoint moves, changes are not represented unless the WSMATRIX is called each frame. When super of the GsRVIEW2 member is set outside WORLD, even if other parameters are not changed, GsSetRefView2 needs to be called each frame because the viewpoint moves if the parent coordinate system parameters change.

See Also

GsRVIEW2 ,GsWSMATRIX , GsSetView2.


GsSetView2

int GsSetView2(GsVIEW2* pv)

Viewpoint setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Returns:

0 : is returned when viewpoint setting is successful.

1 : when it fails.

Parameters

pv  Viewpoint position information (matrix type).

Remarks

GsSetView2 directly sets the WSMATRIX (World Screen Matrix). If the viewpoint is moved, errors can arise due to inaccuracy in the process that searches WSMATRIX from the viewpoint steady viewpoint using GsSetRefView2, and so it is advantageous to use GsSetView2. When super of the GsVIEW2 member is set outside WORLD, GsSetRefView2 needs to be called each frame even if other parameters are not changed. This is because the viewpoint moves unless the parent coordinate system parameters change. The screen aspect ratio is regulated automatically if GsIDMATRIX2 is used in the basic matrix.

See Also

GsVIEW2, GsWSMATRIX, GsSetRefView2.


GsSetWorkBase

void GsSetWorkBase(PACKET* outpacketp)

Sets drawing command storage address.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

outpacketp  Address that stores the drawing command.

Remarks

GsSetWorkBase sets the memory address that stores the drawing primitives generated by such functions as GsSortObject4 and GsSortSprite. At the start of the process of each frame, it must be set in the top address of the packet area secured by the user.

See Also

GsSortObject4, GsSortSprite, GsSortFastSprite, PACKET, GsOUT_PACKET_P.


GsSortBoxFill

void GsSortBoxFill(GsBOXF* bp, GsOT* ot, unsigned short pri)

Registers rectangles to OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

bp  Pointer to GsBOXF.

ot  Pointer to OT.

pri  Position in OT.

Remarks

GsSortBoxFill allocates rectangles displayed by bp to ordering table displayed by otp.

See Also

GsBOXF, GsOT.


GsSortClear

void GsSortClear(unsigned char r, unsigned char g, unsigned char b, GsOT* otp)

Registers drawing clear command in OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

r  Background colour r value.

g  Background colour g value.

b  Background colour b value.

otp  Pointer to OT.

Remarks

GsSortClear sets the drawing clear command at the top of OT displayed by otp.

Notes: GsSortClear only registers the clear command in the ordering table, and is not executed unless the drawing is started by the GsDrawOt function.

See Also

GsOT.


GsSortFastSprite

void GsSortFastSprite(GsSPRITE* sp, GsOT* ot, unsigned short pri)

Registers sprite in OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

sp  Pointer to sprite.

ot  Pointer to OT.

pri  Position in OT.

Remarks

GsSortFastSprite allocates the sprite displayed by sp to the ordering table displayed by otp. The parameters of sprite display positions, etc. are all supplied by the sp members. pri is the priority order on the sprite ordering table. The highest value is 0 and the lowest value depends on the size of the ordering table. If a numerical value of the size of the ordering table or more is specified, it is clipped to the maximum value got by the ordering table. In comparison with the GsSortSprite function, GsSortFastSprite is processed at high speed, although the scaling rotation function cannot be used. At this time, the value of the sprite structure members, mx, my, scalex, scaley and rotate are disregarded.

See Also

GsSortSprite, GsSPRITE.


GsSortFixBg16

void GsSortFixBg16(GsBG* bg, unsigned long* work, GsOT* otp, unsigned short pri)

Registers high-speed BG to OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

bg  Pointer to GsBG.

work  Pointer to working area (primitive area).

otp  Pointer to OT.

pri  Position in OT.

Remarks

GsSortFixBg16 carries out BG data registration processing to the ordering table. BG rotation/scaling/reduction not possible. Cell size fixed (16x16). Texture pattern colour mode 4bit/8bit only. Map size is optional. Scrolling possible (1 pixel unit) Full screen only This function needs working area for storing the drawing primitives. The working area is prepared as an unsigned long type array, and initialisation by GsInitFixBg16 needs to be carried out in advance. Packet Area (the area set by GsSetWorkBase) is not used.

See Also

GsInitFixBg16, GsBG, GsOT.


GsSortGLine

void GsSortGLine(GsLINE* lp, GsOT* ot, unsigned short pri)

Registers straight lines to OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

lp  Pointer to GsLINE.

ot  Pointer to OT.

pri  Position in OT.

Remarks

GsSortGLine allocates straight lines that are displayed by lp in the ordering table displayed by otp. Straight lines with gradation are registered in OT by GsSortGLine.

See Also

GsSortLine, GsLINE, GsOT.


GsSortLine

void GsSortLine(GsLINE* lp, GsOT* ot, unsigned short pri)

Registers straight lines to OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

lp  Pointer to GsLINE.

ot  Pointer to OT.

pri  Position in OT.

Remarks

GsSortLine allocates straight lines that are displayed by lp to ordering table displayed by otp. Single colour straight lines are registered in OT by GsSortLine.

See Also

GsSortGLine, GsLINE, GsOT.


GsSortObject4

void GsSortObject4(GsDOBJ2* objp, GsOT* ot, int shift, u_long* scratch)

Allocates object to ordering table.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

objp  Pointer to object.

ot  Pointer to OT.

shift  How many bits the value of Z is shifted to the right at the time of allocation to OT.

scratch  Specifies scratchpad address.

Remarks

GsSortObject4 carries out perspective conversion and light source calculation for 3D objects to be handled by GsDOBJ2, and generates the drawing command in the packet area specified by GsSetWorkBase. Next, it Z sorts the generated drawing command and allocates it to OT displayed by otp. The precision of Z can be adjusted by the value of shift. The maximum value of the ordering table size (resolution) is 14bit. However, if for example it is 12bit, then the value of shift is 2 (=14 - 12). At this time take care not to go over the area of the ordering table. scratch is used as work when automatic division is carried out. In order to validate the division by attribute which is the member of objp, OR is carried out by GsDIV5, which is the member of macro GsDIV1~ objp defined by libps.h. One polygon is divided into 4 sections of 2x2 at the time of GsDIV1 and into 1024 sections of 32x32 at the time of GsDIV5. Also, scratchpad is cache memory and 256 words are packaged from 0x1f800000.

See Also

GsDOBJ2, GsSetWorkBase.


GsSortOt

GsOT * GsSortOt(GsOT* ot_src, GsOT* ot_dest)

Allocates OT to another OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Pointer to integrated OT.

Parameters

ot_src  Pointer to assigned source OT.

ot_dest  Pointer to assigned destination OT.

Remarks

GsSortOt assigns the OT displayed by ot_src to ot_dest. The OTZ value used at this time is the representative value in the ot_src point field. The integrated OT is assigned to ot_dest.

See Also

GsOT.


GsSortSprite

void GsSortSprite(GsSPRITE* sp, GsOT* ot, unsigned short pri)

Registers sprite in OT.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

sp  Pointer to sprite.

ot  Pointer to OT.

pri  Position in OT.

Remarks

GsSortSprite allocates the sprite displayed by sp to the ordering table displayed by otp. The parameters of sprite display positions, etc. are all supplied by the sp members. pri is the priority order on the sprite ordering table. The highest value is 0 and the lowest value depends on the size of the ordering table. If a numerical value of the size of the ordering table or more is specified, it is clipped to the maximum value got by the ordering table.

See Also

GsOT, GsSPRITE, GsSortFastSprite.


GsSwapDispBuff

void GsSwapDispBuff(void)

Double buffer switching.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

GsSwapDispBuff changes the display buffer and drawing buffer according to double buffer information that has been set by GsDefDispBuff. Execution is usually carried out immediately after vertical return section surge.

Also, the following processes are executed within the function:
(1) Display commencement address setting
(2) Cancellation of blanking
(3) Double buffer index setting
(4) 2 dimensional clipping switched
(5) GTE or GPU offset setting
(6) Offset setting
(7) PSDCNT increment
The double buffer is executed by the offset. The third argument of GsInitGraph decides whether the offset is set by GTE or by GPU (GsOFSGPU or GsOFSGTE is specified).

Notes: If GPU is drawing, this function does not operate smoothly and it needs to be called immediately after drawing completion has been confirmed by DrawSync(0) or after the drawing has been ended by ResetGraph(1).

See Also

GsDefDispBuff


gteMIMefunc

void gteMIMefunc(SVECTOR* otp, SVECTOR* dfp, long n, long p)

Adds differential data array from multiplication of vertex data array by coefficient.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

otp  Input/output vertex array.

dfp  Input differential array.

n  Input vertex (differential) data number.

p  Input MIMe weight (control) coefficient.

Remarks

gteMIMefunc is a subroutine which executes interpolation using the differential data array and the vertex data array used in the multiple interpolation (MIMe) operation. p is the fixed decimal point data of the decimal 12bit.

Example

This function executes at high speed the same operation as the following program:

void gteMIMefunc(SVECTOR *otp, SVECTOR *dfp, long n, long p)

{

   int i;

   for( i = 0; i < n; i++) {

   (otp+i)->x += ( (int)((dfp+i)->x) * p )>>12;

   (otp+i)->y += ( (int)((dfp+i)->y) * p )>>12;

   (otp+i)->z += ( (int)((dfp+i)->z) * p )>>12;

   }

}

The argument format is as follows:
p: (1,19,12)
otp, dfp optional

See Also

SVECTOR.


hypot

double hypot(double x, double y)

Calculates a complex number absolute value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Square root of the sum of [image].

Parameters

x  Floating-point value.

y  Floating-point value.

Remarks

hypot looks for the absolute value of the complex number (x+iy).


InitHeap

void InitHeap(unsigned long* head, unsigned long size)

Initialisation of heap area.

Defined in: C:/PSX/INCLUDE/MALLOC.H

Parameters

head  Heap head address.

size  Heap size (multiples of 4 byte units).

Remarks

InitHeap initialises the group of memory control functions. Thereafter, malloc, etc. can be used. Not all the size bytes can be used because of the presence of overhead.

Notes: Do not carry out multiple execution.

See Also

malloc.


KanjiFntClose

void KanjiFntClose(void)

Closes print stream.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

This function closes all the streams currently open ans are used by KanjiFntPrint and initialize the state.

Notes: Since KanjiFntClose only initializes the internal state, this function operations even when there is no stream.

See Also

KanjiFntPrint.


KanjiFntFlush

u_long* KanjiFntFlush(int id)

Draws print stream contents.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Temporary OT top pointer used in drawing.

Parameters

id  Print stream ID.

Remarks

FntFlush draws the print stream contents in the frame buffer.

Notes: After completion of drawing, the print stream contents are also flushed.

See Also

KanjiFntPrint.


KanjiFntOpen

int KanjiFntOpen(int x, int y, int w, int h, int dx, int dy, int cx, int cy, int isbg, int n)

Opens print stream.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Print stream ID.

Parameters

x  Display start left position.

y  Display start top position.

w  Display area width.

h  Display area height.

dx  Kanji font pattern frame buffer address.

dy  Kanji font pattern frame buffer address.

cx  Kanji clut frame buffer address.

cy  Kanji clut frame buffer address.

isbg  Background automatic clearance.
0 : Background is cleared to (0,0,0) when displayed.
1 : Background is not cleared to (0,0,0) when displayed.

n  Number of letters.

Remarks

KanjiFntOpen opens the stream used for printing on screen. Thereafter, the largest n character string can be printed in the rectangular area of the frame buffer (x,y)-(x+w, y+h) using the KanjiFntPrint function. If 1 is specified in isbg, the background is cleared when a character string is drawn.

Notes: Up to 8 streams can be opened at the same time. Opened streams cannot be closed until the next KanjiFntLoad is called. The Kanji font area must not conflict with the frame buffer area used by the application.

See Also

KanjiFntPrint, KanjiFntLoad.


KanjiFntPrint

int KanjiFntPrint(void)

Outputs to print stream.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Character string within the stream

Remarks

KanjiFntPrint sends the SHIFT-JIS full-width character string to the print stream by the printf interface.

Notes: The Kanji code must be SHIFT-JIS. Full-width and half-width characters can be mixed in the character string, but they are all changed to full-width at the time of display. Half-width kana are not supported. The actual display of the character string occurs when KanjiFntFlush is executed.

See Also

KanjiFntFlush.


Krom2Tim

int Krom2Tim(u_char* sjis, u_long* taddr, int dx, int dy, int cx, int cy, u_int fg, u_int bg)

Converts SHIFT-JIS character strings to 4 bit CLUT data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

-1 is returned if an irregular code is transferred.

Parameters

sjis  SHIFT-JIS Character String.

taddr  Data storage area.

dx  Pixel data left coordinate on VRAM.

dy  Pixel data top coordinate on VRAM.

cx  Clut data left coordinate on VRAM.

cy  Clut data top coordinate on VRAM.

fg  Character colour.

bg  Background colour.

Remarks

Krom2Tim converts the SHIFT-JIS character string to 4 bits clut TIM data and returns to taddr.

Notes: The Kanji code must be SHIFT-JIS. Full-width and half-width characters can be mixed in the character string , but they are all changed to full-width at the time of display. Half-width kana are not supported. For the area specified by taddr, the size shown in the following formula must be secured in advance.
128 x (character string specified by sjis) + 84(byte)


Krom2Tim2

int Krom2Tim2(u_char* sjis, u_long* taddr, int dx, int dy, int cx, int cy, u_int fg, u_int bg)

Converts SHIFT-JIS character strings to 4 bit CLUT Tim data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

-1 is returned if an invalid code is transferred.

Parameters

sjis  SHIFT-JIS Character String.

taddr  Data storage area.

dx  Pixel data left coordinate on VRAM.

dy  Pixel data top coordinate on VRAM.

cx  Clut data left coordinate on VRAM.

cy  Clut data top coordinate on VRAM.

fg  Character colour.

bg  Background colour.

Remarks

Krom2Tim2 converts the SHIFT-JIS character string to 4 bits clut TIM data and returns the starting address in taddr. This is user defined character support version of Krom2Tim.

Notes: The Kanji code must be in SHIFT-JIS. Although both ZENKAKU (double byte) and HANKAKU (single byte) can be mixed witha string, all of them will not be converted to ZENKAKU. Please note thant HANKAKU KANA is not supported. Prior to calling this function, the area specified by taddr must be reserved with the size derived from the equation below.
Num: number of characters specified by sjis.
If (num<16)
(32 * num + 16) * 4 (bytes)
else
(32 * 16* ((num-1/16 + 1) +16) * 4 (bytes)


labs

long labs(long l)

Calculates absolute value.

Defined in: C:/PSX/INCLUDE/CONVERT.H

Return Value

The absolute value of the argument is returned.

Parameters

l  Long value.

Remarks

labs calculates the absolute value of the long l. On this system, it is a function equivalent to abs.

See Also

abs.


ldexp

double ldexp(double x, long n)

Computes a real number from the mantissa and exponent.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The value of [image].

Parameters

x  Floating-point value.

n  Integer exponent.


Load

long Load(char* name, struct EXEC* exec)

Loading executable file.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 if unsuccessful.

Parameters

name  Filename.

exec  Executable file information.

Remarks

Load reads the PS-EXE format file name in the address specified by its internal header, and writes the internal information to exec.

See Also

EXEC, Exec.


LoadImage

int LoadImage(RECT* recp, u_long* p)

Transmits data to frame buffer

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Queue number.

Parameters

recp  A pointer to a transmission destination RECT area.

p  Transmission source main memory address.

Remarks

LoadImage transmits data below the address p to the rectangular area of the frame buffer specified by recp.

Notes: Actual completion of the transmission needs to be identified by DrawSync because it is a non-blocking function. The transmission area is not affected by the drawing environment (clip and offset). The transmission area needs to fit into the area in which drawing is possible (0, 0)-(1023, 511).


LoadTest

long LoadTest(char* name, struct EXEC* exec)

Load test execution.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The execution start address is returned when successful, and 0 if unsuccessful.

Parameters

name  Filename.

exec  Executable file information.

Remarks

LoadTest writes the information contained in the PS-EXE format file name to exec.

See Also

EXEC, Load.


log

double log(double x)

Natural logarithm.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

x logarithm (ln(x))

Parameters

x  Logarithm calculated value.

Remarks

log looks for the logarithm function of x.

Notes: x is greater than 0. Range error in the case of others:

Condition	Return Value	Error
x < 0	0	Domain error
x == 0	1	Range error

See Also

exp, log10.


log10

double log10(double x)

Base 10 logarithm.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

x base 10 logarithm (log10(x))

Parameters

x  Logarithm calculated value.

Remarks

log looks for the base 10 logarithm function of x.

Notes: x is greater than 0. Range error in the case of others:

Condition	Return Value	Error
x < 0	0	Domain error
x == 0	1	Range error
See Also

log.


longjmp

void longjmp(jmp_buf p, int val)

Non-local jump

Defined in: C:/PSX/INCLUDE/SETJMP.H

Return Value

None. Not returned when executed normally.

Parameters

p  Environment evacuation variable.

val  Return value of setjmp.

Remarks

Jumps non-locally to arrival point specified by p.

See Also

setjmp.


lseek

int lseek(int fd, unsigned int offset, int flag)

Moving file pointer.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The current file pointer is returned when successful, and -1 in all other cases.

Parameters

fd  File descriptor.

offset  Offset.

flag  Refer to the comments.

Remarks

lseek moves the file pointer of the device showing the descriptor specified by fd. offset is the movement byte number. The movement start point changes according to the value of flag. It cannot be applied to character type drivers. Macros that can be specified in flag are as follows:

SEEK_SET

Top of file.

SEEK_CUR

Current location.

See Also

open, read , write.


malloc

void* malloc(size_t s)

Allocates main memory.

Defined in: C:/PSX/INCLUDE/MALLOC.H

Return Value

The pointer to the secured memory block is returned. NULL is returned in the event of failure to secure.

*At the time of user program activation the heap memory is defined as follows:

Lowest address	Module’s highest address + 4
Highest address	Package memory • 64KB
Parameters

s  Bytes to allocate.

Remarks

The malloc function allocates a memory block of at least s bytes.

See Also

calloc, realloc, free.


memchr

void* memchr(const void* s, long c, size_t n)

Searches for characters in memory blocks.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

The pointer to the located character is returned. NULL is returned when c cannot be discovered.

Parameters

s  Retrieved characters storage destination.

c  Retrieved characters.

n  Number of retrieved bytes.

Remarks

memchr locates the first appearance of the character c in the memory block of the n byte starting from s.


memcmp

long memcmp(const void* s1, const void* s2, size_t n)

Carries out memory block comparison.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

The following values are returned depending on the comparison result of s1 and s2:

Result	Return Value
s1<s2	<0
s1=s2	=0
s1>s2	>0
Parameters

s1  Comparison source 1.

s2  Comparison source 2.

n  Comparison byte number.

Remarks

memcmp compares the first n bytes of s1 and s2.

See Also

bcmp.


memcpy

void* memcpy(void* dest, const void* src, size_t n)

Copies memory blocks.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

dest is returned.

Parameters

dest  Copy destination.

src  Copy source.

n  Copy byte number.

Remarks

memcpy copies the first n bytes of src to dest.

See Also

bcopy.


memmove

void* memmove(void* dest, const void* src, size_t n)

Copies memory blocks.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

dest is returned.

Parameters

dest  Copy destination.

src  Copy source.

n  Copy byte number.

Remarks

memmove copies the first n bytes of src to dest. Accurate copying is performed even among duplicated objects.


memset

void* memset(const void* s, long c, size_t n)

Writes specified characters to memory blocks.

Defined in: C:/PSX/INCLUDE/MEMORY.H

Return Value

s is returned.

Parameters

s  Memory block.

c  Character.

n  Character number.

Remarks

memset writes c to the n byte memory block starting from s.


modf

double modf(double x, double* y)

Separation into integer parts and fractional parts

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Fractional part of x.

Parameters

x  Floating-point value.

y  Pointer to the buffer for storing integer part.

Remarks

The integer part is stored in y and the fractional part becomes the return value.

Notes: The sign for both integer parts and fractional parts is the same as x.

Example

MODF.C

#include <math.h>

#include <stdio.h>

void main(void)

{

   double x, y, n;

   x = -14.87654321;	// Divide x into its fractional

   y = modf(x, &n);	// and integer parts

   printf("For %f, the fraction is %f and the integer is %.f\n",

   x, y, n);

}

Output: For -14.876543, the fraction is -0.876543 and the integer is -14


MoveImage

int MoveImage(RECT* rect, int x, int y)

Transmits data between frame buffer.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Queue number.

Parameters

rect  Transmission source RECT area address.

x  Transmission destination rectangular area left-hand point.

y  Transmission destination rectangular area top point.

Remarks

MoveImage transmits the rectangular area of the frame buffer specified by recp to a rectangular area of the same size starting from x, y.

Notes: Actual completion of the transmission needs to be identified by DrawSync because it is a non-blocking function. The transmission area is not affected by the drawing environment (clip and offset). The transmission area needs to fit into the area in which drawing is possible (0,0)-(1023,511) for both the transmission source and transmission destination. The content of the transmission source is stored. Also, the function cannot be guaranteed if the areas of transmission source and transmission destination are overlapping.


MulMatrix0

MATRIX* MulMatrix0(MATRIX* m0, MATRIX* m1, MATRIX* m2)

Takes product of two matrices.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m2.

Parameters

m0  First input matrix.

m1  Second input matrix.

m2  Output matrix.

Remarks

MulMatrix0 takes the product of the two matrices m0 and m1. The value is stored in m2.

The argument format is as follows:
m0,m1,m2->m[i][j] : (1,3,12)

Notes: The rotation matrix is fragmented.

See Also

MATRIX.


nextfile

struct DIRENTRY* nextfile(struct DIRENTRY* dir)

Next file retrieval.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

dir is returned when successful, and 0 in all other cases.

Parameters

dir  Buffer that stores information relating to retrievable files.

Remarks

nextfile continuously carries out retrieval in the same way as the firstfile function executed directly before. When relevant files are found, information relating to them is stored in dir.

Notes: Execution will be unsuccessful if the CD-ROM drive shell cover is opened after firstfile, and there will be a report that the file cannot be found.

See Also

DIRENTRY, firstfile.


open

int open(char* devname, int flag)

Opening file.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The file descriptor is returned when successful, and -1 in the event of failure.

Parameters

devname  Filename.

flag  Open mode.

Remarks

open opens the file devname and returns its descriptor.

Macro	Open mode
O_RDONLY	Read only
O_WRONLY	Write only
O_RDWR	Read and write
O_CREAT	Create file
O_NOBUF	No buffer mode
O_NOWAIT	No synchronisation mode
See Also

close.


pow

double pow(double x, double y)

Calculates x to the power of y.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

x to the power of y [image].

Parameters

x  Base.

y  Exponent.

Notes: Error processing is as follows:

Condition	Return Value	Error
x==0 && y>0	0
x==0 && y<=0	1	Domain error
x<0 && “y is not Integer value”	0	Domain error
See Also

exp.


printf

int printf(const char* fmt, ...)

Carries out formatted output to standard output stdout.

Defined in: C:/PSX/INCLUDE/STDIO.H

Return Value

The length of the output character string is returned. NULL is returned when an error occurs.

Parameters

fmt  Input format character string.

...   Optional arguments.

Remarks

Please refer to C language reference books for a detailed explanation of input format. Not compatible with conversion specifiers "f", "e", "E", "g" and "G". printf2 of the mathematical function service is used in floating-point display.

See Also

sprintf, printf2.


printf2

int printf2(const char * fmt, ...)

Formatted output of standard output stdout (supports float and double type)

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The length of the output character string is returned.

Parameters

fmt  Output format character string.

...   Optional arguments.

Remarks

The conversion specifiers "f", "e", "E", "g" and "G" can be used. The stack consumption amount is greater than printf.

See Also

sprintf2.


putc

void putc(long c, FILE* stream)

Outputs a single character to the stream.

Defined in: C:/PSX/INCLUDE/STDIO.H

Parameters

c  Output character.

stream  Output stream.

Remarks

putc outputs the character c to the output stream stream.

See Also

putchar, puts.


putchar

void putchar(char c)

Outputs a single character to standard output stream

Defined in: C:/PSX/INCLUDE/STDIO.H

Parameters

c  Output character,

Remarks

putchar outputs a single character to the standard output stream. It is the same as putc(stdout).

See Also

putc, puts.


PutDispEnv

DISPENV* PutDispEnv(DISPENV* env)

Sets display environment.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Top address of env.

Parameters

env  A pointer to a display environment (DISPENV).

Remarks

PutDispEnv sets the display environment. The display environment is immediately executed at the point in time when the function is called.

Notes: The drawing environment specified by PutDispEnv is valid until PutDispEnv is executed or GsSwapDispBuff is called.

See Also

GsSwapDispBuff, DISPENV.


PutDrawEnv

DRAWENV* PutDrawEnv(DRAWENV* env)

Sets drawing environment.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Top address of env.

Parameters

env  A pointer a drawing environment (DRAWENV).

Remarks

Sets the basic parameters relating to drawing, e.g. drawing offset and drawing clip area.

Notes: The drawing environment specified by PutDrawEnv is valid until PutDrawEnv is executed or GsSwapDispBuff is called.

See Also

GsSwapDispBuff, DRAWENV.


puts

void puts(const char* s)

Outputs a character string to the standard output stream.

Defined in: C:/PSX/INCLUDE/STDIO.H

Parameters

s  Output character string.

Remarks

puts outputs the character string closed by NULL to the standard output stream (stdout), and finally outputs the line feed character.

See Also

putc, putchar.


qsort

void qsort(void* base, size_t n, size_t w,  long (*compare)(const void*, const void*))

Performs a quick sort.

Defined in: C:/PSX/INCLUDE/QSORT.H

Parameters

base  Storage destination of array to be sorted.

n  Number of elements.

w  Size of 1 element.

compare  Comparison function.

Remarks

With compare as a comparison function, qsort sorts a table of n number of items (size of item = w) starting from base. Take care with the empty heap area because malloc is called internally.


rand

long rand(void)

Generates random numbers. The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand.

Defined in: C:/PSX/INCLUDE/RAND.H

Return Value

A generated pseudo random number is returned.

See Also

srand.


read

int read(int fd, char * buf, int n)

Reads data from file.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The byte number read in the area at the time of normal termination is returned, and -1 in all other cases.

Parameters

fd  File descriptor.

buf  Read buffer address.

n  Read byte number.

Remarks

read reads n bytes from the descriptor specified by fd to the buf specified area.

See Also

open.


realloc

void* realloc(void* block, size_t s)

Reallocates heap memory.

Defined in: C:/PSX/INCLUDE/MALLOC.H

Return Value

The reallocated block address is returned. This address may be different from the original address. NULL is returned in the event of failure to allocate. At this time the original block cannot be opened.

Parameters

block  Pointer to previously allocated memory block.

s  New size in bytes.

Remarks

realloc reduces or enlarges the block block that was previously secured to s byte. If block is NULL, it has the same operation as malloc.

See Also

calloc, malloc, free


rename

int rename(char * src, char * dest)

Renaming files.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 in all other cases.

Parameters

src  Source filename.

dest  New filename.

Remarks

rename changes the filename from src to dest. It specifies the full path from the device name to both src and dest.

Notes: Valid only for file systems that can be written.


ResetGraph

int ResetGraph(int mode)

Initialises graphics system.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mode  Set mode.
0 : All reset. The drawing environment and display environment are initialised.
1 : The current drawing is cancelled and the command queue is flushed.

Remarks

It resets the graphics system with the mode that is specified by mode.


ResetRCnt

long ResetRCnt(unsigned long spec)

Resetting root counter.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 in the event of failure.

Parameters

spec  Root counter specification.

Remarks

ResetRCnt resets the root counter spec.

See Also

GetRCnt, StartRCnt.


RotMatrix

MATRIX* RotMatrix(SVECTOR* r, MATRIX* m)

Searches for rotation matrix from rotation angle.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

r  Input rotation angle.

m  Output rotation matrix.

Remarks

RotMatrix supplies to matrix m the rotation matrix according to the rotation angle (r->vx, r->vy, r->vz). The rotation angle supplies 4096 as 360°, and 4096 is given as 1.0 for the matrix component.

The matrix is an expansion of the following product. Using the GTE coordinate conversion function, the vectors are multiplied from the right, thus the matrix rotates around the Z, Y and X axes in that order.

Angle value:
c0=cos(r->vx), s0=sin(r->vx)
c1=cos(r->vy), s1=sin(r->vy)
c2=cos(r->vz), s2=sin(r->vz)

The argument format is as follows:

m->m[i][j] : (1,3,12)

r->vx,vy,vz :(1,3,12) (however 360° is 1.0)

See Also

MATRIX, SVECTOR.


RotMatrixX

MATRIX* RotMatrixX(long r, MATRIX* m)

Searches for rotation matrix around the X Axis.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

r  Input rotation angle.

m  Input and output rotation matrix.

Remarks

RotMatrixX supplies to matrixm the matrix multiplied by the rotation matrix around the X axis according to the rotation angler. The rotation angle supplies 4096 as 360°, and 4096 is given as 1.0 for the matrix component. The matrix is as follows:

Angle value:
c=cos(r), s=sin(r)

The argument format is as follows:

m->m[i][j] : (1,3,12)
r:(1,3,12) (however 360° is 1.0)

See Also

MATRIX.


RotMatrixY

MATRIX* RotMatrixY(long r, MATRIX* m)

Searches for rotation matrix around the Y Axis.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

r  Input rotation angle.

m  Input and output rotation matrix.

Remarks

RotMatrixY supplies to matrix m the matrix multiplied by the rotation matrix around the Y axis according to the rotation angler. The rotation angle supplies 4096 as 360°, and 4096 is given as 1.0 for the matrix component. The matrix is as follows:

Angle value:
c=cos(r), s=sin(r)

The argument format is as follows.
m->m[i][j] : (1,3,12)
r:(1,3,12) (however 360° is 1.0)

See Also

MATRIX.


RotMatrixZ

MATRIX* RotMatrixZ(long r, MATRIX* m)

Searches for rotation matrix around the Z Axis.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

r  Input rotation angle.

m  Input and output rotation matrix.

Remarks

RotMatrixZ supplies to matrixm the matrix multiplied by the rotation matrix around the Z axis according to the rotation angler. The rotation angle supplies 4096 as 360°, and 4096 is given as 1.0 for the matrix component. The matrix is as follows:

Angle value:
c=cos(r), s=sin(r)

The argument format is as follows.
m->m[i][j] : (1,3,12)
r:(1,3,12) (however 360° is 1.0)

See Also

MATRIX.


ScaleMatrix

MATRIX* ScaleMatrix(MATRIX* m, VECTOR* v)

Supplies scaling factor.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

m  Output matrix.

v  Input shift vector.

Remarks

ScaleMatrix supplies to matrix m the scaling factor shown by v. It is a fixed decimal point number with 4096 as 1.0 for the v component.

The argument format is as follows:
m->m[i][j] : (1,3,12)
v->vx,vy,vz : (1,19,12)

See Also

MATRIX, VECTOR.


ScaleMatrixL

MATRIX* ScaleMatrixL(MATRIX* m, VECTOR* v)

Supplies scaling factor.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

m  Output matrix.

v  Input shift vector.

Remarks

ScaleMatrixL supplies to matrix m the scaling factor shown by v. It is a fixed decimal point number with 4096 as 1.0 for the v component.

The argument format is as follows:
m->m[i][j] : (1,3,12)
v->vx,vy,vz : (1,19,12)

See Also

MATRIX, VECTOR.


SetDispMask

void SetDispMask(int mask)

Sets display mask.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mask  Display mask.
0 : Display is not carried out in ‘Display’.
1 : Display is carried out in ‘Display’.

Remarks

It allows display to ‘Display’.


setjmp

int setjmp(jmp_buf p)

Defines arrival point of non-local jump.

Defined in: C:/PSX/INCLUDE/SETJMP.H

Return Value

With direct calling 0 is returned. When jump is carried out the value supplied to the second argument of longjmp is returned.

Parameters

p  Environment evacuation variable.

Remarks

Stores non-local jump arrival point information in p. When longjmp(p,val) is executed, it returns from setjmp.

See Also

longjmp.


SetVideoMode

long SetVideoMode(long mode)

Declares current video signaling system.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Previously-set video signaling system mode:

MODE_NTSC

NTSC system video signaling system.

MODE_PAL

PAL system video signaling system.

Parameters

mode  Video signaling system mode.

Remarks

Declares the video signaling system indicated by mode to the libraries. Related libraries will be able to conform to the actions of the declared video signaling system environment.

Notes: Gets called in advance of all library functions.

See Also

GetVideoMode.


sin

double sin(double x)

sin looks for the sine function of x.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

sin returns the sine of x.

Parameters

x  Angle in radian units.

See Also

cos, tan, asin.


sinh

double sinh(double x)

Calculates hyperbolic sines.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Hyperbolic sine function of x (sinh(x)).

Parameters

x  Angle in radian units.

See Also

cosh, tanh


sprintf

int sprintf(char* s, char* fmt, ...)

Format output to array.

Defined in: C:/PSX/INCLUDE/STDIO.H

Return Value

The length of the output character string is returned. NULL is returned when an error occurs.

Parameters

s  Storage destination of conversion character string.

fmt  Input format character string.

...   Optional arguments.

Remarks

Please refer to C language reference books for a detailed explanation of input format. Not compatible with conversion specifiers "f", "e", "E", "g" and "G". sprintf2 of the mathematical function service is used in floating-point display.

See Also

printf, sprintf2.


sprintf2

int sprintf2(char * s, const char * fmt, ...)

Formatted output to array (supports float and double type)

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The length of the output character string is returned.

Parameters

s  Storage destination of converted character string.

fmt  Output format character string.

...   Optional arguments.

Remarks

The conversion specifiers "f", "e", "E", "g" and "G" can be used. The stack consumption amount is greater than printf.

See Also

printf2.


sqrt

double sqrt(double x)

Calculates the square root.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Square root of x.  A domain error occurs if x < 0.

Parameters

x  Non negative floating-point value.


srand

void srand(unsigned int seed)

Initialises random number generator.

Defined in: C:/PSX/INCLUDE/RAND.H

Parameters

seed  Seed for random-number generation.

Remarks

srand sets the new starting point of the random number generation. Default is 1.

See Also

rand.


SsGetMute

char SsGetMute(void)

Gets mute attributes.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Mute attributes:

SS_MUTE_ON

Mute on.

SS_MUTE_OFF

Mute off.

Remarks

SsGetMute gets mute attributes.

See Also

SsSetMute.


SsGetMVol

void SsGetMVol(SndVolume* m_vol)

Gets main volume value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

m_vol  Main volume value

Remarks

SsGetMVol assigns the main volume value to m_vol.

See Also

SsSetMVol.


SsGetSerialAttr

char SsGetSerialAttr(char s_num, char attr)

Gets CD audio attribute value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Indicates whether on or off:

1 : is returned if attribute on.

0 : if attribute off.

Parameters

s_num  Fixed as SS_CD.

attr  Attribute value.

Remarks

SsGetSerialAttr returns the CD audio attribute value, where attr:

SS_MIX

Mixing.

SS_REV

Reverberation.

See Also

SsSetSerialAttr.


SsGetSerialVol

void SsGetSerialVol(char s_num, SndVolume* s_vol)

Gets CD audio volume value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

s_num  Fixed at SS_CD.

s_vol  CD audio volume value.

Remarks

SsGetSerialVol returns the CD audio volume value to s_vol.

See Also

SsSetSerialVol.


SsIsEos

short SsIsEos(short access_num, short seq_num)

Judges whether or not in mid-performance.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Indicates performance status.

1 : Is returned if in mid-performance.

0 : Not in mid-performance.

Parameters

access_num  SEQ access number.

seq_num  Fixed at 0.

Remarks

SsIsEos judges whether or not the specified tune is in mid-performance.


SsPlayBack

void SsPlayBack(short access_num, short seq_num, short l_count)

SEQ data reading.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

access_num  SEQ access number.

seq_num  Fixed at 0.

l_count  Number of tune repetitions.

Remarks

SsPlayBack stops the tune during the current performance, and starts performance by returning to the top of that tune. It specifies the number of tune repetitions in l_count. SSPLAY_INFINITY is specified in the case of an infinite number of performances.

See Also

SsSeqPlay.


SsSeqClose

void SsSeqClose(short seq_access_num)

Closes SEQ data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

Remarks

SsSeqClose closes the SEQ data holding the seq_acces_num that is no longer necessary.

See Also

SsSeqOpen.


SsSeqGetVol

void SsSeqGetVol(short seq_access_num, short seq_num, short * voll, short * volr)

Gets SEQ volume.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

seq_num  Fixed at 0.

voll  SEQ L volume value.

volr  SEQ R volume value.

Remarks

SsSeqGetVol returns the current L and R volume values of SEQ to voll and volr respectively.

See Also

SsSeqSetVol.


SsSeqOpen

short SsSeqOpen(unsigned long* addr, short vab_id)

Opens SEQ data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

SEQ access number (the number to be used within the SEQ data access function and the number of the SEQ data control table held internally).

Parameters

addr  SEQ data main memory top address.

vab_id  VAB id.

Remarks

SsSeqOpen analyses the SEQ data in the main memory, and returns the SEQ access number. A maximum of 32SEQ data can be opened at the same time and if more than that are opened, -1 becomes the return value.

See Also

SsSeqClose.


SsSeqPause

void SsSeqPause(short seq_access_num)

Temporarily stops SEQ data reading (pause).

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

Remarks

SsSeqPause temporarily stops the reading (performance) of SEQ data holding seq_access_num.

See Also

SsSeqPlay, SsSeqReplay.


SsSeqPlay

void SsSeqPlay(short seq_access_num, char play_mode, short l_count)

SEQ data reading (musical performance).

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

play_mode  Performance mode.

l_count  Number of tune repetitions

Remarks

According to the play_mode value, SsSeqPlay can select whether to begin reading (performing) the SEQ data immediately or switch to the pause state at the SEQ data top (tune top). At this time, it specifies the number of tune repetitions in l_count.

Notes: play_mode can have the following values:

SSPLAY_PAUSES

switches to pause state.

SSPLAY_PLAY

Performs immediately.

SSPLAY_INFINITY

is specified if there are an infinite number of performances.

See Also

SsSeqPause, SsPlayBack, SsSeqStop.


SsSeqReplay

void SsSeqReplay(short seq_access_num)

Restarts SEQ data reading (replay).

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

Remarks

SsSeqReplay restarts the reading of the SEQ data holding seq_access_num that has been temporarily suspended by SsSeqPause.

See Also

SsSeqPlay, SsSeqPause.


SsSeqSetAccelerando

void SsSeqSetAccelerando(short seq_access_num, long tempo, long v_time)

Accelerates tempo.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

tempo  Tune tempo.

v_time  Time (tick unit).

Remarks

SsSeqSetAccelerando accelerates the data holding seq_access_num until resolution of tempo in v_time. However, if the specified resolution is smaller (slower) than the current resolution, the same operation as SsSeqSetRitardando is carried out.

See Also

SsSeqSetRitardando.


SsSeqSetNext

void SsSeqSetNext(short seq_access_num1, short seq_access_num2)

Next SEQ data specification.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num1  SEQ access number.

seq_access_num2  SEQ access number.

Remarks

SsSeqSetNext specifies the access number seq_access_num2 of the SEQ data next to be performed from SEQ data holding seq_access_num1.


SsSeqSetRitardando

void SsSeqSetRitardando(short seq_access_num, long tempo, long v_time)

Slows tempo.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

tempo  Tune tempo.

v_time  Time (tick unit).

Remarks

SsSeqSetRitardando slows the data holding seq_access_num until resolution of tempo in v_time. However, if the specified resolution is greater (faster) than the current resolution, the same operation as SsSeqSetAccelerando is carried out.

See Also

SsSeqSetAccelerando.


SsSeqSetVol

void SsSeqSetVol(short seq_access_num, short voll, short volr)

SEQ volume setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

voll  L channel main volume value.

volr  R channel main volume value.

Remarks

SsSeqSetVol sets the main volume of the tune holding seq_access_num in sizes specified in the L and R channels respectively. 0 to 127 can be set.

See Also

SsSeqGetVol.


SsSeqStop

void SsSeqStop(short seq_access_num)

Stops SEQ data reading (stop).

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

seq_access_num  SEQ access number.

Remarks

SsSeqStop ends the reading (performance) of the SEQ data holding seq_access_num.

See Also

SsSeqPlay.


SsSetMute

void SsSetMute(char mode)

Mute setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mode  Setting mode.  Valid values for mode are:

SS_MUTE_ON

Mute on.

SS_MUTE_OFF

Mute off.

Remarks

SsSetMute carries out mute setting.

See Also

SsGetMute.


SsSetMVol

void SsSetMVol(short voll, short volr)

Main volume value setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

voll  L channel volume value.

volr  R channel volume value.

Remarks

SsSetMVol sets the main volume value in voll and volr respectively. Each can be set from 0 to 127. It is essential to set it before SEQ data is played.

See Also

SsGetMVol.


SsSetSerialAttr

void SsSetSerialAttr(char s_num, char attr, char mode)

CD audio attribute setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

s_num  Fixed as SS_CD.

attr  Attribute value.

mode  Setting mode.

Remarks

SsSetSerialAttr carries out attribute setting relating to CD audio. Valid vlaues for attr:

SS_MIX

Mixing.

SS_REV

Reverberation. And for mode:

SS_SON

attribute on.

SS_SOFF

attribute off.

See Also

SsGetSerialAttr.


SsSetSerialVol

void SsSetSerialVol(char s_num, short voll, short volr)

CD audio volume value setting.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

s_num  Fixed as SS_CD.

voll  L channel volume value.

volr  R channel volume value.

Remarks

SsSetSerialVol sets the CD volume value in voll and volr. The volume value can be set from 0 to 127.

See Also

SsGetSerialVol.


SsSetTempo

void SsSetTempo(short access_num, short seq_num, short l_count)

Sets tempo.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

access_num  SEQ access number.

seq_num  Fixed at 0.

l_count  Number of tune repetitions.

Remarks

SsSetTempo sets the tempo. This is valid if the tempo set by SsSeqPlay is to be changed. After this function has been called, the performance is changed to the newly set tempo and played.

See Also

SsSeqPlay.


SsUtAllKeyOff

void SsUtAllKeyOff(short mode)

Keys off all voices.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

mode  Always 0.

Remarks

SsUtAllKeyOff compulsorily keys off all voices used by the sound service.

See Also

SsUtKeyOn, SsUtKeyOff, SsSeqPlay.


SsUtChangePitch

short SsUtChangePitch(short voice, short vabId, short prog, short old_note, short old_fine, short new_note, short new_fine)

Changes pitch.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

0 is returned if successful, -1 if it fails.

Parameters

voice  Voice number.

vabId  VAB number.

prog  Program number.

old_note  Note number at the time of SsUtKeyOn.

old_fine  Detailed pitch at the time of SsUtKeyOn (note number).

new_note  Note number to be changed.

new_fine  Detailed pitch to be changed (note number).

Remarks

SsUtChangePitch changes the pitch of the voice keyed on by SsUtKeyOn.

See Also

SsUtPitchBend.


SsUtGetReverbType

short SsUtGetReverbType(void)

Gets reverberation type.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Current reverberation type value.

Remarks

SsUtGetReverbType gets the current reverberation type value.

See Also

SsUtSetReverbType.


SsUtGetVVol

short SsUtGetVVol(short vc, short* voll, short* volr)

Gets voice volume.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

0 is returned if successful, -1 if it fails.

Parameters

vc  Voice number.

voll  Volume (left).

volr  Volume (right).

Remarks

SsUtGetVVol returns the detailed value of the voice volume keyed on by SsUtKeyOn.

See Also

SsUtSetVVol.


SsUtKeyOff

short SsUtKeyOff(short voice, short vabId, short prog, short tone, short note)

Keys off voice.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

0 is returned if successful, -1 if it fails.

Parameters

voice  Voice number.

vabId  VAB number.

prog  Program number.

tone  Tone number.

note  Half tone unit pitch specification (note number).

Remarks

SsUtKeyOff keys off the voice that was keyed on by SsUtKeyOn.

See Also

SsUtKeyOn, SsUtAllKeyOff.


SsUtKeyOn

short SsUtKeyOn(short vabId, short prog, short tone, short note, short fine, short voll, short volr)

Keys on voice.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The voice number (0 to 23) used by key-on is returned. 1 is returned in the event of failure.

Parameters

vabId  VAB number.

prog  Program number.

tone  Tone number.

note  Half tone unit pitch specification (note number).

fine  Detailed pitch specification (100/127 cent specification).

voll  Volume (left).

volr  Volume (right).

Remarks

SsUtKeyOn specifies and keys on the volume number (0 to 127), tone number (0 to 15) and VAB number for SE, and returns the allocated voice number.

See Also

SsUtKeyOff, SsUtAllKeyOff.


SsUtPitchBend

short SsUtPitchBend(short voice, short vabId, short prog, short note, short pbend)

Bends pitch.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

0 is returned if successful, -1 if it fails.

Parameters

voice  Voice number.

vabId  VAB number.

prog  Program number.

note  Half tone unit pitch specification (note number).

pbend  Pitch bend value.

Remarks

SsUtPitchBend bends pitch of voice keyed on by SsUtKeyOn.

See Also

SsUtChangePitch.


SsUtReverbOff

void SsUtReverbOff(void)

Reverberation off.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

SsUtReverbOff turns the reverberation off.

See Also

SsUtReverbOn.


SsUtReverbOn

void SsUtReverbOn(void)

Reverberation on.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

SsUtReverbOn turns on the reverberation with the set type and depth.

See Also

SsUtReverbOff.


SsUtSetReverbDelay

void SsUtSetReverbDelay(short delay)

Sets delay amount.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

delay  Delay 0~127.

Remarks

SsUtSetReverbDelay sets the delay amount if the echo and delay type reverberation is used.

See Also

SsUtSetReverbType.


SsUtSetReverbDepth

void SsUtSetReverbDepth(short ldepth, short rdepth)

Sets reverberation depth.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

ldepth  Depth (left) 0~127.

rdepth  Depth (rigth) 0~127.

Remarks

SsUtSetReverbDepth sets the reverberation depth.

See Also

SsUtSetReverbType.


SsUtSetReverbFeedback

void SsUtSetReverbFeedback(short feedback)

Sets feedback amount.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

feedback  Feedback 0~127.

Remarks

SsUtSetReverbFeedback sets the feedback amount if the echo type reverberation is used.

See Also

SsUtSetReverbType.


SsUtSetReverbType

short SsUtSetReverbType(short type)

Sets reverberation type.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

If setting is carried out correctly, the set type number is returned. If setting is carried out incorrectly, -1 is returned.

Parameters

type  Reverberation type.

Remarks

SsUtSetReverbType sets the reverberation type. The reverberation depth is automatically set to 0 when the reverberation type is set. When data is left in the reverberation work area, noise appears as soon as the depth is set.

Example

The following procedure should be used.

SsUtSetReverbType(SS_REV...);

SsUtReverbOn();

:

Takes several seconds

:

SsUtSetReverbDepth(64,64);

Number and type response as above.

Type	Mode	Delay time *	Feedback*
SS_REV_TYPE_OFF	Off	X	X
SS_REV_TYPE_ROOM	Room	X	X
SS_REV_TYPE_STUDIO_A	Studio (small)	X	X
SS_REV_TYPE_STUDIO_B	Studio (medium)	X	X
SS_REV_TYPE_STUDIO_C	Studio (large)	X	X
SS_REV_TYPE_HALL	Hall	X	X
SS_REV_TYPE_SPACE	Space echo	X	X
SS_REV_TYPE_ECHO	Echo	O	O
SS_REV_TYPE_DELAY	Delay	O	O
SS_REV_TYPE_PIPE	Pipe echo	X	X
* Delay time and Feedback specification by reverberation type is possible

See Also

SsUtGetReverbType, SsUtSetReverbDepth, SsUtSetReverbFeedback, SsUtSetReverbDelay.


SsUtSetVVol

short SsUtSetVVol(short vc, short voll, short volr)

Sets voice volume.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

0 is returned if successful, -1 if it fails.

Parameters

vc  Voice number.

voll  Volume (left).

volr  Volume (right).

Remarks

SsUtSetVVol sets in detail the voice volume keyed on by SsUtKeyOn.

See Also

SsUtGetVVol.


SsVabClose

void SsVabClose(short vab_id)

Closes VAB data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

vab_id  VAB data id.

Remarks

SsVabClose closes VAB data that holds vab_id.

See Also

SsVabTransfer.


SsVabTransfer

short SsVabTransfer(unsigned char* vh_addr, unsigned char* vb_addr, short vabid, short i_flag)

Recognises and transmits sound source data.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

VAB identification number.  In the case of failure, the following values are returned according to the cause:

-1 : VAB ID cannot be assigned or VH abnormality.

-2 : VB abnormality.

-3 or below : Other abnormalities.

Parameters

vh_addr  VH data top address.

vb_addr  VB data top address.

vabid  VAB identification number.

i_flag  Fixed at 1.

Remarks

SsVabTransfer recognises the sound source header list (VH data) specified by vh_addr, and transmits the sound source data (VB data) specified by vb_addr to the SPU sound buffer. It specifies the VAB identification number in vabid. It searches and allocates an available VAB identification number (0 - 15) when vabid is -1.

See Also

SsVabClose.


StartRCnt

long StartRCnt(unsigned long spec)

Root counter activation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

1 is returned when successful, and 0 in the event of failure.

Parameters

spec  Root counter specification.

Remarks

StartRCnt activates the root counter spec.

See Also

GetRCnt, ResetRCnt.


StoreImage

int StoreImage(RECT* rect, u_long* p)

Transmits data from frame buffer

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Queue number.

Parameters

rect  A pointer to a transmission source rectangular area.

p  Transmission destination main memory address.

Remarks

StoreImage transmits the rectangular area of the frame buffer specified by recp to below the address p.

Notes: Actual completion of the transmission needs to be identified by DrawSync because it is a non-blocking function. The transmission area is not affected by the drawing environment (clip and offset). The transmission area needs to fit into the area in which drawing is possible (0,0)-(1023,511).


strcat

char* strcat(char* dest, const char* src)

Append a string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

dest is returned.

Parameters

dest  Null-terminated destination string.

src  Null-terminated source string.

Remarks

The strcat function appends src to dest and terminates the resulting string with a null character.

See Also

strncat.


strchr

char* strchr(const char* s, long c)

Find a character in a string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The address of the appearance position of c is returned. NULL is returned if c does not appear.

Parameters

s  Null-terminated source string.

c  Character to be located.

Remarks

strchr searches for the position where the character c first appears in the character string s.


strcmp

long strcmp(const char* s1, const char* s2)

Compare strings.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The following values are returned depending on the comparison result of s1 and s2:

Result	Return
s1<s2	<0
s1=s2	=0
s1>s2	>0
Parameters

s1  Comparison source 1.

s2  Comparison source 2.

Remarks

strcmp compares each character of s1 and s2 as unsigned char.


strcpy

char* strcpy(char* dest, const char* src)

Copies one character string to another.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

dest is returned.

Parameters

dest  Null-terminated destination string.

src  Null-terminated source string.

Remarks

strcpy copies src to the character string dest.

See Also

strncpy.


strcspn

size_t strcspn(const char* s1, const char* s2)

Find a substring in a string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

An integer value specifying the length of the initial segment of s1 that consists entirely of characters not in s2. If s1 begins with a character that is in s2, the function returns 0.

Parameters

s1  Null-terminated searched string.

s2  Null-terminated character set.

Remarks

The strcspn function returns the index of the first occurrence of a character in s1 that belongs to the set of characters in s2. Terminating null characters are not included in the search.


strlen

long strlen(const char* s)

Get the length of a string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The number of characters in s, excluding the terminal NULL. No return value is reserved to indicate an error.

Parameters

s  Null-terminated string.

Remarks

strlen counts number of characters in the character string s.


strncat

char* strncat(char* dest, const char* src, size_t n)

Append characters of a string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

dest is returned.

Parameters

dest  Null-terminated destination string.

src  Null-terminated source string.

n  Number of characters to append.

Remarks

The strncat function appends, at most, the first n characters of src to dest. The initial character of src overwrites the terminating null character of dest. If a null character appears in src before count characters are appended, strncat appends all characters from src, up to the null character. If n is greater than the length of src, the length of src is used in place of n. The resulting string is terminated with a null character.


strncmp

long strncmp(const char * s1, const char * s2, size_t n)

Compare characters of two strings.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The following values are returned depending on the result of the comparison:

Result	Return
s1<s2	<0
s1=s2	=0
s1>s2	>0
Parameters

s1  Comparison source 1.

s2  Comparison source 2.

n  Number of characters to compare.

Remarks

strncmp lexicographically compares, at most, the first n characters in s1 and s2 and returns a value indicating the relationship between the substrings.


strncpy

char* strncpy(char* dest, const char* src, size_t n)

Copy characters of one string to another.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

dest is returned. No return value is reserved to indicate an error.

Parameters

dest  Null-terminated destination string.

src  Null-terminated source string.

n  Number of characters to append.

Remarks

The strncpy function copies the initial count characters of src to dest and returns dest. If n is less than or equal to the length of src, a null character is not appended automatically to the copied string. If n is greater than the length of src, the destination string is padded with null characters up to length n.


strpbrk

char* strpbrk(const char* s1, const char* s2)

Scan strings for characters in specified character sets. strpbrk checks the character string s1 and searches the position where any one character included in the character group s2 first appears.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The address of the found character is returned. NULL is returned if it is not found.

Parameters

s1  Null-terminated searched string.

s2  Null-terminated character set.


strrchr

char* strrchr(const char* s, long c)

Scan a string for the last occurrence of a character.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The address of the appearance position of c is returned. NULL is returned if c does not appear.

Parameters

s  Null-terminated source string.

c  Character to be located.

Remarks

strrchr searches the position where the character c last appears in the character string s.


strspn

size_t strspn(const char * s1, const char * s2)

Find the first substring.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The length of the found section of the character string is returned.

Parameters

s1  Retrieved character string.

s2  Character group.

Remarks

strspn returns the length of the first section that comprises only characters that are included in the character group s2 within the character string s1.


strstr

char* strstr(const char* s1, const char* s2)

Searches for position of appearance of specified partial character string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The address of the position found is returned. NULL is returned if it is not found.

Parameters

s1  Null-terminated string to search.

s2  Null-terminated string to search for.

Remarks

The strstr function checks the character string s1 and searches the position where the character string s2 first appears.


strtod

double strtod(const char* s, char** endp)

Convert strings to a double-precision value.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The result of converting the input value s to double type is returned. If the correct value exceeds the range that can be expressed, either +HUGE_VAL(1.797693134862316e+308) or -HUGE_VAL is returned, according to the sign. 0 is returned if an underflow occurs.

Parameters

s  Character string.

endp  Storage destination of pointer to non-convertible character string.

Remarks

strtod converts the character string s to double type. s must be in the following format:
[ws][sn][ddd]
[ws] White space (can be omitted)
[sn] Sign (can be omitted)
[ddd] Number string (can be omitted)
strtod stops conversion when a character is encountered that cannot be converted and, unless endp is NULL, it sets the pointer to the character that stopped conversion to endp.

See Also

atof.


strtok

char* strtok(char* s1, const char* s2)

Find the next token in a string.

Defined in: C:/PSX/INCLUDE/STRINGS.H

Return Value

The top address of the tokens found in s1 is returned. NULL is returned if nothing is found.

Parameters

s1  String containing token(s).

s2  Set of delimiter characters.

Remarks

strtok takes the character string s1 as a set of tokens bounded by one or more characters within the separate character string s2. The first token top address of s1 is returned when strtok is first called, and directly after the token, the character NULL is written. After the s1 address is stored in the function, when NULL is entered in the first argument and strtok is called, a search is carried out until the token in the character string s1 disappears.


strtol

long strtol(const char* s, char** endp, int base)

Converts character strings to integers.

Defined in: C:/PSX/INCLUDE/CONVERT.H

Return Value

The result of converting the input value s to an integer is returned. 0 is returned when an error occurs.

Parameters

s  Character string.

endp  Storage destination of pointer to non-convertible character string.

base  Number base to use.

Remarks

strtol converts the character string s to long type (same as int type in R3000). s must be in the following format:
[ws][sn][ddd]
[ws] White space (can be omitted)
[sn] Sign (can be omitted)
[ddd] Number string (can be omitted)
strtol stops conversion when a character is encountered that cannot be converted and, unless endp is NULL, it sets the pointer to the character that stopped conversion to endp.

See Also

strtoul.


strtoul

unsigned long strtoul(const char* s, char** endp, int base)

Converts character string into unsigned integer.

Defined in: C:/PSX/INCLUDE/CONVERT.H

Return Value

The result of converting the input value s to an integer is returned.

Parameters

s  Character string.

endp  Storage destination of pointer to non-convertible character string.

base  Number base to use.

Remarks

strtoul converts the character string s to unsigned long type (same as unsigned int type in R3000). s must be in the following format:
[ws][sn][ddd]
[ws] White space (can be omitted)
[sn] Sign (can be omitted)
[ddd] Number string (can be omitted)
strtoul stops conversion when a character is encountered that cannot be converted and, unless endp is NULL, it sets the pointer to the character that stopped conversion to endp.

See Also

strtol.


tan

double tan(double x)

tan looks for the tangent function of x.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The tan function returns the tangent of x.

Parameters

x  Angle in radian units.

See Also

sin, cos, atan.


tanh

double tanh(double x)

Calculates hyperbolic tangents.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Hyperbolic tangent function of x (tanh(x)).

Parameters

x  Angle in radian units.

See Also

sinh, cosh.


TestCard

long TestCard(long chan)

Memory card test.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The following values may be returned:

0 : No card.

1 : Card present.

2 : New card detected.

3 : Communication or card abnormality detected.

4 : Non-initialised card detected.

Parameters

chan  Slot numbers.

0 : Slot 1.

1 : Slot 2.

Remarks

TestCard tests the memory card set in the slot specified by chan and returns the result. Card initialisation is carried out on the memory card control screen of the PlayStation. One to four vertical synchronisation interruptions at the end of the operation are necessary (17m to 68m seconds).


tolower

char tolower(char c)

Convert character to lowercase.

Defined in: C:/PSX/INCLUDE/CTYPE.H

Return Value

Converts a copy of c, if possible, and returns the result.

Parameters

c  Character to convert.

Remarks

tolower converts a given uppercase letter to a lowercase letter if possible and appropriate.


toupper

char toupper(char c)

Convert character to uppercase.

Defined in: C:/PSX/INCLUDE/CTYPE.H

Return Value

Converts a copy of c, if possible, and returns the result.

Parameters

c  Character to convert.

Remarks

toupper converts a given lowercase letter to an uppercase letter if possible and appropriate.


TransMatrix

MATRIX* TransMatrix(MATRIX* m, VECTOR* v)

Supplies amount of translation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m.

Parameters

m  Output matrix.

v  Input shift vector.

Remarks

TransMatrix supplies to matrix m the amount of translation shown by v.

The argument format is as follows:
m->m[i][j] : (1,3,12)
m->t[i]: (1,31,0)
v->vx,vy,vz : (1,31,0)

See Also

MATRIX, VECTOR.


TransposeMatrix

MATRIX* TransposeMatrix(MATRIX* m0, MATRIX* m1)

Supplies rotation value matrix.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

m1.

Parameters

m0  Input matrix.

m1  Output matrix.

Remarks

TransposeMatrix supplies to m1 the rotation value matrix of matrix m0.

The argument format is as follows:
m0->m[i][j] : (1,3,12)
m1->m[i][j] : (1,3,12)

See Also

MATRIX.


VSync

int VSync(int mode)

Waits for vertical synchronisation.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

Elapsed time.

mode>=0

Time elapsed from point in time when VSync was previously called (horizontal return unit)

mode<0

Time elapsed from program activation (vertical return unit)

Parameters

mode  Mode.
0 : Blocking until vertical synchronisation occurs.

1 : The time elapsed from the point in time when VSync was previously called is returned in units of one horizontal synchronisation interval.

(mode >1) : Counting from the point in time when VSync was previously called and blocking up to n times the occurrence of vertical synchronisation.

(mode <0) : Absolute time from program activation is returned in vertical synchronisation interval units.


VSyncCallback

int VSyncCallback(void (*function)())

Sets vertical synchronisation callback function.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Parameters

(*function)()  Callback function.

Remarks

The function function is called when vertical return section commence. Callback does not occur when 0 is specified in function.

Notes: Subsequent drawing completion interruptions are masked within function. Therefore, function needs to return as soon as possible after completion of the necessary processing.


write

int write(int fd, char * buf, int n)

Writes data to file.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

The byte number written in the area at the time of normal termination is returned, and -1 in all other cases.

Parameters

fd  File descriptor.

buf  Write data address.

n  Write byte number.

Remarks

write writes n bytes from the descriptor specified by fd to the buf specified area.

See Also

open.


fabs
fabs (MACRO)

fabs(x)
the absolute value of the floating-point argument.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Return Value

fabs returns the absolute value of its argument x. There is no error return.

Parameters

x  Value.

Remarks

fabs Looks for the absolute value.


GsIncFrame
GsIncFrame (MACRO)

GsIncFrame()
frame ID.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Remarks

GsIncFrame is the macro called inside GsSwapDispBuff. It applies one increment to PSDCNT. Although PSDCNT is 32bit, it does not become 0 even if it is recycled, and it starts from 1. PSDCNT is referred to when the validity of the matrix cache is determined by GsGetLw, GsGetLs and GsGetLws. If the double buffer is switched without using GsSwapDispBuff and GsGetLw, GsGetLs and GsGetLws are used, this macro needs to be called every time the double buffer is switched.

See Also

PSDCNT, GsGetLw, GsGetLs, GsGetLws, GsSwapDispBuff.


CdlFILE
CdlFILE Structure

typedef struct {

CdlLOC pos;

u_long size;

char name[16];

} CdlFILE;

ISO-9660 file descriptor.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

pos

File position.

size

File size.

name[16]

Filename.

Remarks

CdIFILE gets the ISO-9660 CD-ROM file location and size.


CdlLOC
CdlLOC Structure

typedef struct {

u_char minute;

u_char second;

u_char sector;

u_char track;

} CdlLOC;

CD-ROM location.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

minute

(BCD) Minute.

second

(BCD) Second.

sector

(BCD) Sector.

track

Track number.

Remarks

CD location specification structure.

Notes: Track members are not currently used.


CVECTOR
CVECTOR Structure

typedef struct {

u_char r;

u_char g;

u_char b;

u_char cd;

} CVECTOR;

8bit 3D vectors (colour vectors).

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

r

Vector components.

g

Vector components.

b

Vector components.

cd

Padding.

Remarks

CVECTOR defines the structure of 8 bit colour vectors.


DIRENTRY
DIRENTRY Structure

typedef struct {

char name[20];

long attr;

long size;

struct DIRENTRY * next;

long head;

char system[4];

} DIRENTRY;

Directory entry data structure

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

name[20]

Filename.

attr

Attribute (depends on file system).

size

File size (byte units).

next

Next file entry (for user).

head

Head sector.

system[4]

Reserved for the system.

Remarks

DIRENTRY stores information relating to files that are registered in the file system.

See Also

firstfile, nextfile.


DISPENV
DISPENV Structure

typedef struct {

RECT disp;

RECT screen;

unsigned char isinter;

unsigned char isrgb24;

unsigned char pad0;

unsigned char pad1;

} DISPENV;

Display environment.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

disp

Display area within the frame buffer.

screen

Display area on the output screen.

isinter

Interlaced mode flag.

isrgb24

24bit mode flag.

pad0

Reserved.

pad1

Reserved.

Remarks

The width of the area can be set to 256, 320, 360, 512 or 640. The height of the area can be set to 240 or 480. The screen area is calculated on the basis of a standard monitor screen in which the coordinates are (0, 0) for the top left corner and (256, 240) for the bottom right corner, regardless of the disp value. DISPENV specifies parameters for screen display mode, frame buffer display position, etc.


DRAWENV
DRAWENV Structure

typedef struct {

RECT clip;

short ofs[2];

RECT tw;

unsigned short tpage;

unsigned char dtd;

unsigned char dfe;

unsigned char isbg;

unsigned char r0;

unsigned char g0;

unsigned char b0;

DR_ENV dr_env;

} DRAWENV;

Drawing environment.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

clip

Drawing area. Drawing is limited to the rectangular area specified by clip. Drawing cannot be performed outside the clip area.

ofs[2]

Offset. The values (ofs[0], ofs[1]) are added to all coordinate values to give the address values used by all drawing commands when drawing in the frame buffer.

tw

Texture window. Repeated use is made of the texture pattern contained in the rectangular area within the texture page defined by tw.

tpage

Texture page initial value.

dtd

Dither treatment flag.

dfe

Flag for drawing to the display area.

isbg

Clear drawing area flag.

r0

The entire clipped area is painted with the brightness value r when the drawing environment is set up.

g0

The entire clipped area is painted with the brightness value g when the drawing environment is set up.

b0

The entire clipped area is painted with the brightness value b when the drawing environment is set up.

dr_env

Reserved for this system.

Remarks

DRAWENV sets the basic parameters relating to drawing offset, drawing clip area, etc.

Notes: Within the drawing space, drawing can actually be carried out in the region (0, 0)-(1023, 511). Offset values and address values to which the offset has been added are wrapped around using (-1024, -1024)-(1023, 1023). Values that can be specified for the texture window are limited to the combinations shown in the following table:

tw.w	0(=256)	16	32	64	128
tw.x	0	multiple of 16	multiple of 32	multiple of 64	multiple of 128
tw.h	0(=256)	16	32	64	128
tw.y	0	multiple of 16	multiple of 32	multiple of 64	multiple of 128


EXEC
EXEC Structure

typedef struct {

unsigned long pc0;

unsigned long gp0;

unsigned long t_addr;

unsigned long t_size;

unsigned long d_addr;

unsigned long d_size;

unsigned long b_addr;

unsigned long b_size;

unsigned long s_addr;

unsigned long s_size;

unsigned long sp;

unsigned long fp;

unsigned long gp;

unsigned long ret;

unsigned long base;

} EXEC;

Executable file data structure

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

pc0

Execution start address.

gp0

gp register initial value.

t_addr

Data session top address with text session + initial value.

t_size

Data session size with text session + initial value.

d_addr

Reserved for the system.

d_size

Reserved for the system.

b_addr

Data session top address without initial value.

b_size

Data session size without initial value.

s_addr

Stack area top address (for user specification).

s_size

Stack area size (for user specification).

sp

Register evacuation area.

fp

Register evacuation area.

gp

Register evacuation area.

ret

.

base

.

Remarks

EXEC is arranged in the top 2k bytes of the executable file (PS-X EXE structure). It holds information for loading and executing the program that is stored in the file. It activates the program by adding stack information and delivering it to the Exec function.

See Also

Exec.


GsBG
GsBG Structure

typedef struct {

unsigned long attribute;

short x;

short y;

short w;

short h;

short scrollx;

short scrolly;

unsigned char r;

unsigned char g;

unsigned char b;

GsMAP* map;

short mx;

short my;

short scalex;

short scaley;

long rotate;

} GsBG;

BG (background picture) handler.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

attribute

Attribute.

x

Display position of the left-hand point.

y

Display position of the top point.

w

BG display width (pixel unit).

h

BG display height (pixel unit).

scrollx

x scroll value.

scrolly

y scroll value.

r

Brightness of r when displayed.

g

Brightness of g when displayed.

b

Brightness of b when displayed.

map

Pointer to map data.

mx

Rotation/expansion central coordinates.

my

Rotation/expansion central coordinates.

scalex

x direction scaling values.

scaley

y direction scaling values.

rotate

Rotation angle (Units: 4096 = 1°).

Remarks

BG (Background) is a function for drawing one large rectangle constructed by the GsMAP data combining small rectangles defined by GsCELL data. BG can be operated via the structure of this GsBG, which exists in each BG. The on-screen display position is specified as (x, y). The display size of BG is specified as (w, h). Units are pixels and do not depend on the cell size or the size of map. The content of the map is also displayed repeatedly if the display area is larger than the size of the map. (Tiling function) (scrollx, scrolly) are the display position offsets in the map and are specified in dot units. Brightness is specified for each of r, g and b. It becomes the original colour at 128 and double the brightness at 255. map is the pointer to the GsMAP format map data to which the top address of the map data is specified. Rotation expansion central coordinates are given as (mx, my) as relative coordinates whose origins are the top left-hand points of BG. For example, one half of the width and length is specified if it is rotated at the centre BG. The scaling values are given for the x and y directions as (scalex, scaley). The unit is 4096 = 1.0 (original size). It can be set up to a maximum of eight times. The rotation angle around the z axis is specified as rotate (4096 = 1°). Please refer to GsSPRITE regarding attribute.


GsBOXF
GsBOXF Structure

typedef struct {

unsigned long attribute;

short x;

short y;

unsigned short w;

unsigned short h;

unsigned char r;

unsigned char g;

unsigned char b;

} GsBOXF;

Rectangle handler.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

attribute

Attribute.

x

Display position of the left-hand point.

y

Display position of the top point.

w

Width of rectangle.

h

Height of rectangle.

r

r drawing colour.

g

g drawing colour.

b

b drawing colour.

Remarks

attribute is 32bit, and various attributes are set here for the purpose of display.
(a) Semi-transparency rate (bit28-29) GsBOXF sets the pixel blending method when semi-transparency is turned ON by bit30. Normal semi-transparency processing is performed when set to 0, pixel addition when set to 1, pixel subtraction when set to 2, and 25% addition when set to 3.

(b) Semi-transparency ON/OFF (bit30) Turns semi-transparency ON/OFF

(c) Display ON/OFF (bit31) Turns display ON/OFF

GsBOXF is the structure that holds information necessary for rectangles painted by single colours. The GsSortBoxFill function is used to register GsBOXF in the ordering table.


GsCELL
GsCELL Structure

typedef struct {

unsigned char u;

unsigned char v;

unsigned short cba;

unsigned short flag;

unsigned short tpage;

} GsCELL;

BG configuration cell.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

u

Offset from within the page (X direction).

v

Offset from within the page (Y direction).

cba

CLUT ID.

flag

Inversion information.

tpage

Texture page number.

Remarks

GsCELL is the structure holding information about the cell that composes BG and it is secured in the memory as an array. The position of the sprite pattern corresponding to its cell is specified as (u, v) by offset in the page specified as tpage. cba is the data that displays the position within the frame buffer of the CLUT corresponding to its cell, as follows. Bit	Value bit0~5	X position of CLUT/16 bit6~15 Y position of CLUT flag holds information as to whether or not that cell displays the original texture pattern inversely. Bit	Value bit0	Vertical inversion (no inversion when set to 0, inversion when set to 1) bit1	Horizontal inversion (no inversion when set to 0, inversion when set to 1) bit2~15 Reserved tpage is the page number displaying the position within the frame buffer of the sprite pattern.


GsCOORD2PARAM
GsCOORD2PARAM Structure

typedef struct {

VECTOR scale;

SVECTOR rotate;

VECTOR trans;

} GsCOORD2PARAM;

Encapsulates scale, rotation and translation

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

scale

3D VECTOR identifying scale.

rotate

3D SVECTOR identifying rotation.

trans

3D VECTOR identifying translation.


GsCOORDINATE2
GsCOORDINATE2 Structure

typedef struct {

unsigned long flg;

MATRIX coord;

MATRIX worldm;

GsCOORD2PARAM* param;

struct _GsCOORDINATE2* super;

struct _GsCOORDINATE2* sub;

} GsCOORDINATE2;

Matrix type coordinate system.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

flg

Flag as to whether or not coordinate has been rewritten.

coord

MATRIX.

worldm

The result from this coordinate system to the WORLD coordinate system.

param

Pointer for using GsCOORD2PARAM parameters.

super

Pointer to the parent coordinates.

sub

Not documented.

Remarks

GsCOORDINATE2 holds parent coordinates and is defined according to the MATRIX type coord. When the matrix is multiplied by the GsGetLw or GsGETLs function in each node of GsCOORDINATE2 from the WORLD coordinates, its result is held in worldm. However, it does not store the result in workm of the coordinate system that is directly connected to the WORLD coordinate system.  At the time of GsGetLw and GsGetLs calculation, flg is referred to in order to avoid calculation of nodes that have already been calculated. 1 is to set, 0 is to clear. The programmer must take responsibility for clearing this flag if the content of coord is changed. Otherwise, the GsGetLw and GsGetLs functions will be defective.


GsDOBJ2
GsDOBJ2 Structure

typedef struct {

unsigned long attribute;

GsCOORDINATE2* coord2;

unsigned long* tmd;

unsigned long id;

} GsDOBJ2;

GsCOORDINATE2 3D object handler

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

attribute

Object attribute (32bit).

coord2

Pointer to local coordinate system.

tmd

Pointer to modelling data.

id

Reserved for the system.

Remarks

3D models can be manipulated via the structure GsDOBJ2, which is used as the handler for each 3D model. GsLinkObject4 is used to link GsDOBJ2 to the modelling data of the TMD file. Access to linked TMD data is possible via GsDOBJ2. GsSortObject4 is used to register GsDOBJ2 in the ordering table. coord2 is the pointer to the coordinate system inherent in the object.  The position, gradient and size of the object are reflected in the coordinate system pointed by coord2 by setting the matrix. tmd holds the top address of the modelling data stored in memory in TMD format. tmd is calculated and set by GsLinkObject4. attribute is 32bit, and various attributes are set here for the purpose of display.

Comments on each bit are as follows:
(a) Light source calculation ON/OFF switch (bit 6) This bit is used when the light source calculation is removed. Texture-mapped polygons are displayed in original texture colour when the light source calculation is removed. Unmapped polygons are displayed in modelling data colour as they are.

(b) Automatic division function switch (bit 9-11)
0: No automatic division
1: 2x2 division
2: 4x4 division
3: 8x8 division
4: 16x16 division
5: 32x32 division
This bit specifies the division number of automatic division. Automatic division is the function for automatically dividing one polygon at the time of execution. It is used for decreasing texture distortion and preventing deficiency in neighbouring polygons. However, division should be kept to a minimum in order to increase the number of polygons in exponential function terms.

(c) Semi-transparency ON/OFF (bit30) This puts semi-transparency ON/OFF. The highest order bit (STP bit) of the texture colour field (texture pattern when direct is set, CLUT colour field when indexed is set) must be used together with this bit in order to set semi-transparency. Pixel unit semi-transparency/opacity can also be controlled by using this STP bit.

(d) Display ON/OFF (bit31) This puts display ON/OFF.


GsF_LIGHT
GsF_LIGHT Structure

typedef struct {

long vx;

long vy;

long vz;

unsigned char r;

unsigned char g;

unsigned char b;

} GsF_LIGHT;

Parallel light source.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

vx

Light source direction vectors.

vy

Light source direction vectors.

vz

Light source direction vectors.

r

Light colours.

g

Light colours.

b

Light colours.

Remarks

GsF_LIGHT holds parallel light source information and is set in the system by the GsSetFlatLight function. Up to three parallel light sources can be set at the same time. Sets the direction vectors of the light source in (vx, vy, vz). The programmer does not have to carry out standardisation as this is done by the GsSetFlatLight function. The light shines strongest on normal vector polygons whose directions are opposite to these vectors. Sets the colours of the light source in (r, g, b) by 8bit.


GsFOGPARAM
GsFOGPARAM Structure

typedef struct {

short dqa;

long dqb;

unsigned char rfc;

unsigned char gfc;

unsigned char bfc;

} GsFOGPARAM;

Fog (depth queue) information

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

dqa

Parameter of the degree of merging in relation to depth.

dqb

Parameter of the degree of merging in relation to depth.

rfc

r background colour.

gfc

g background colour.

bfc

b background colour.

Remarks

dqa and dqb are the attenuation coefficients to the background colour. dqa and dqb can be shown according to the following formula:
dqa = -df * 4096/64/h
dqb = 1.25 * 4096 * 4096
df is where the attenuation coefficients become one. In other words it is the distance from the viewpoint to the point where the background colour completely merges into the distant view. h is the distance from the viewpoint to the screen. In other words it indicates the projection distance.


GsGLINE
GsGLINE Structure

typedef struct {

unsigned long attribute;

short x0;

short y0;

short x1;

short y1;

unsigned char r0;

unsigned char g0;

unsigned char b0;

unsigned char r1;

unsigned char g1;

unsigned char b1;

} GsGLINE;

Gradation straight line handler.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

attribute

Attribute.

x0

x position of drawing start point.

y0

y position of drawing start point.

x1

x position of drawing end point.

y1

y position of drawing end point.

r0

r start point drawing colour.

g0

g start point drawing colour.

b0

b start point drawing colour.

r1

r end point drawing colour.

g1

g end point drawing colour.

b1

b end point drawing colour.

Remarks

GsGLINE is the structure that holds information necessary for drawing gradation straight lines. It is the same as for GsLINE except that drawing colour specification can be separately set at the start point and end point.

See Also

GsLine.


GsIMAGE
GsIMAGE Structure

typedef struct {

short pmode;

short px;

short py;

unsigned short pw;

unsigned short ph;

unsigned long* pixel;

short cx;

short cy;

unsigned short cw;

unsigned short ch;

unsigned long* clut;

} GsIMAGE;

Image data configuration information.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

pmode

Pixel mode.

px

Pixel data storage left-hand position.

py

Pixel data storage top position.

pw

Pixel data storage width.

ph

Pixel data storage height.

pixel

Pointer to pixel data.

cx

CLUT data storage left-hand position.

cy

CLUT data storage top position.

cw

CLUT data storage width.

ch

CLUT data storage height.

clut

Pointer to CLUT data.

Remarks

GsImage is the structure for storing TIM format data information using the GsGetTimInfo function. For file format, please refer to the Net Yaroze Members' Web site.


GsLINE
GsLINE Structure

typedef struct {

unsigned long attribute;

short x0;

short y0;

short x1;

short y1;

unsigned char r;

unsigned char g;

unsigned char b;

} GsLINE;

Straight line handler.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

attribute

Attribute.

x0

x position of drawing start point.

y0

y position of drawing start point.

x1

x position of drawing end point.

y1

y position of drawing end point.

r

r drawing colour.

g

g drawing colour.

b

b drawing colour.

Remarks

GsLINE is the structure that holds information necessary for drawing straight lines. The GsSortLine function is used to register GsLINE in the ordering table. attribute is 32bit, and various attributes are set here for the purpose of display.
(a) Semi-transparency rate (bit28-29) GsLINE sets the pixel blending method when semi-transparency is turned ON by bit30. Normal semi-transparency processing is performed when set to 0, pixel addition when set to 1, pixel subtraction when set to 2, and 25% addition when set to 3.

(b) Semi-transparency ON/OFF (bit30) Turns semi-transparency ON/OFF

(c) Display ON/OFF (bit31) Turns display ON/OFF


GsMAP
GsMAP Structure

typedef struct {

unsigned char cellw;

unsigned char cellh;

unsigned short ncellw;

unsigned short ncellh;

GsCELL* base;

unsigned short* index;

} GsMAP;

BG composition MAP.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

cellw

Cell width (taken as 256 in the case of 0).

cellh

Cell height (taken as 256 in the case of 0).

ncellw

Width of BG (unit is cell).

ncellh

Height of BG (unit is cell).

base

Pointer to the GsCELL structure array.

index

Pointer to the cell array information.

Remarks

GsMAP is map data (cell array information) for composing BG with GsCELL. The map data controls the information by cell index array. The size of one cell is specified in pixel units as (cellw, cellh). Note A BG is formed from a cell of the same size. The size of map held by BG is specified in cell units as (ncellw, ncellh). The top address of the GsCell array is set as base. The top address of the cell array information table is set as index. The cell array information indicates the index value for the above array shown in base as ncellw x ncellh. A NULL cell (transparent cell) is indicated if the index value is 0xffff.


GsOT
GsOT Structure

typedef struct {

unsigned short length;

GsOT_TAG* org;

unsigned short offset;

unsigned short point;

GsOT_TAG* tag;

} GsOT;

Ordering table headers.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

length

OT bit length.

org

Top address of the GsOT_TAG table.

offset

OT offset on the Z axis in the screen coordinate system.

point

OT representative value on the Z axis in the screen coordinate system.

tag

Pointer to the current top GsOT_TAG.

Remarks

GsOT indicates the ordering table header. This header holds the pointers, org and tag that point to the actual ordering table. org and tag are both initialised using the GsClearOt function. tag points to the top of the ordering table.  The GsDrawOt function draws the ordering table to which tag points. The value of tag changes because the top is changed using the GsSortClear or GsSortOt functions.  org is therefore provided to continue to hold the top of the ordering table.

The size of the ordering table is set by length. length can be set to any value between 1 and 14. When length is set to 1, org points to a 0~1 GsOT_TAG array, and when length is set to 14, org points to a 0~16384 GsOT_TAG array. The GsClearOt function initialises an area of memory from org up to the size specified by length. Accordingly, it is important to be aware that if the size of the GsOT_TAG array pointed to by org is less than the size indicated by length, memory may be damaged. point refers to the representative value of the ordering table when ordering tables are sorted among themselves by means of the GsSortOt function. offset sets the ordering table offset on the Z axis. For example, if offset = 256 the top of the ordering table will be at Z = 256†.

Notes: The values of length and org must be set at the initialisation stage. The other members are set using the GsClearOt function.

†Not supported at present.

See Also

GsClearOt, GsDrawOt, GsSortOt, GsCutOt.


GsOT_TAG
GsOT_TAG Structure

typedef struct {

unsigned p;

unsigned char num;

} GsOT_TAG;

Ordering table units.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

p

OT ring pointer.

num

Word number packet.

Remarks

The ordering table array will be the array of this GsOT_TAG. The ordering table is the "list structure" that points to successive addresses. In the case of the 32bit address, the lower order 24bit can be displayed by p. The GsOT_TAG array of the size set by the GsOT member length is secured when the ordering table is placed in memory.


GsRVIEW2
GsRVIEW2 Structure

typedef struct {

long vpx;

long vpy;

long vpz;

long vpx;

long vpy;

long vpz;

long rz;

GsCOORDINATE2 * super;

} GsRVIEW2;

Viewpoint position (REFERENCE type)

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

vpx

Viewpoint coordinates.

vpy

Viewpoint coordinates.

vpz

Viewpoint coordinates.

vpx

Reference point coordinates.

vpy

Reference point coordinates.

vpz

Reference point coordinates.

rz

Viewpoint twist.

super

Pointer to the coordinate system that sets the viewpoint (GsCOORDINATE2 type).

Remarks

GsVIEW2 holds the viewpoint information, and is set according to the GsSetRefView2 function. The coordinates of the viewpoint in the coordinate system displayed by super are set in (vpx, vpy, vpz). The coordinates of the reference point in the coordinate system displayed by super are set in (vrx, vry, vrz). rz is specified in fixed decimal point format with the gradient for the screen z axis when the z axis is the vector from the viewpoint to the reference point, set so that 4096 is one degree.  The coordinate systems of the viewpoint and reference point are set in super. For example, a cockpit view can be easily created with this function by setting super in the coordinate system of an aeroplane.


GsSPRITE
GsSPRITE Structure

typedef struct {

unsigned long attribute;

short x;

short y;

unsigned short w;

unsigned short h;

unsigned short tpage;

unsigned char u;

unsigned char v;

short cx;

short cy;

unsigned char r;

unsigned char g;

unsigned char b;

short mx;

short my;

short scalex;

short scaley;

long rotate;

} GsSPRITE;

Sprite handler.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

attribute

32bit length attribute (details are given below).

x

Left-hand point display positions.

y

Top point display positions.

w

Width - not displayed when w = 0.

h

Height - not displayed when h = 0.

tpage

Sprite pattern texture page number.

u

Sprite pattern in-page offset.

v

Sprite pattern in-page offset.

cx

Sprite CLUT address.

cy

Sprite CLUT address.

r

Brightness is set for r when they are displayed.

g

Brightness is set for g when they are displayed.

b

Brightness is set for b when they are displayed.

mx

Rotation central coordinates.

my

Expansion central coordinates.

scalex

x direction scaling values.

scaley

y direction scaling values.

rotate

Rotation angle (Units: 4096 = 1°).

Remarks

attribute bits:
6: Brightness regulation
0: ON
1: OFF
24-25: Sprite pattern bit mode
0: 4bitCLUT
1: 8bitCLUT
2: 15bitDirect
27: Rotation scaling function
0: ON
1: OFF
28-29: Semi-transparency rate
0: 0.5 x Back + 0.5 x Forward
1: 1.0 x Back + 1.0 x Forward
2: 1.0 x Back - 1.0 x Forward
3: 1.0 x Back + 0.25 x Forward
30: Semi-transparency ON /OFF
0: Semi-transparency OFF
1: Semi-transparency ON
31: Displayed/ Not displayed
0: Display
1: No display

GsSPRITE is the structure that holds information for displaying sprites and prepares one for each sprite displayed. The sprites can be operated via the parameters. Either GsSortSprite or GsSortFastSprite may be used to register GsSPRITE in the ordering table.

The on-screen display position is specified as (x, y). The points specified as (mx, my) in the sprite pattern are the positions specified in the GsSortSprite function, and the top left-hand points of the sprites are the positions specified in the GsSortFastSprite function.

The width and length of the sprites are specified in pixel units as (w, h). Texture page numbers, where there are sprite patterns, are specified as tpage (0~31). The top left-hand points of the sprite patterns are specified with in-page offset as (u, v). A range (0,0)~(255,255) can be specified. The top positions of CLUT (Colour palette) are specified by the VRAM address as (cx, cy) (only valid at the time of 4bit/8bit).

Brightness is specified for each of r, g and b as (r, g, b). Values from 0~255 can be specified. The brightness of the original pattern is attained at 128 and double the brightness at 255.

Rotation expansion central coordinates are given as (mx, my) as relative coordinates whose origins are the top left-hand points of the sprites. For example, one half of the width and length is specified if it is rotated at the centre of the sprite.

The scaling values are given for the x and y directions as (scalex, scaley). The unit is 4096 = 1.0 (original size). It can be set up to a maximum of eight times.

rotate sets rotation around the Z axis in fixed decimal point format with 4096 as 1 degree.

attribute is 32bit in which various attributes are set for display. Comments on each bit are as follows:
(a) Brightness adjustment ON/OFF switch (bit 6) This sets whether or not the sprite pattern pixel colours are to be drawn with brightness adjusted according to the (r,g,b) values. When it is 1, brightness is not adjusted and the (r,g,b) values are disregarded.
(b) Bit mode (bit 24-25) In the sprite patterns there are 4bit and 8bit modes that use colour tables and a 15bit mode that displays colour directly. This is specified here.
(c) Rotation scaling function (bit 27) Switches the sprite expansion function ON/OFF. If it is switched off when sprite rotation and expansion are not carried out, processing will be speeded up. This bit is also disregarded in the case of the GsSortFastSprite function, and the expansion function is always turned OFF.
(d) Semi-transparency rate (bit 28-29) Sets the method of pixel blending when semi-transparency is turned ON with bit 30. Normal semi-transparent processing is performed when set to 0, pixel addition when set to 1, pixel subtraction when set to 2, and 25% addition when set to 3.
(e) Semi-transparency ON/OFF (bit 30) It turns semi-transparency ON/OFF. The highest order bit (STP bit) of the texture colour field (texture pattern when direct is set, CLUT colour field when indexed is set) must be used together with this bit in order to set semi-transparency.
Pixel unit semi-transparency/opacity can also be controlled by using this STP bit. (f) Display ON/OFF (bit 31) Turns display ON/OFF.


GsVIEW2
GsVIEW2 Structure

typedef struct {

MATRIX view;

GsCOORDINATE2* super;

} GsVIEW2;

Viewpoint position (MATRIX type).

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

view

MATRIX for conversion from parent coordinates to viewpoint coordinates.

super

Pointer to the coordinate system that sets the viewpoint.

Remarks

GSVIEW2 sets the viewpoint coordinate system. It directly specifies the matrix for converting from the parent coordinate system to the viewpoint coordinate system in view. The setting function is GsSetView2.


MATRIX
MATRIX Structure

typedef struct {

short m[3][3];

long t[3];

} MATRIX;

3 x 3 matrices.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

m[3][3]

3x3 matrix coefficient values.

t[3]

Amount of translation.

Remarks

Each component is specified using the m[i][j] part of MATRIX. The amount of translation after conversion is specified using the t[i] part of MATRIX.


RECT
RECT Structure

typedef struct {

short x;

short y;

short w;

short h;

} RECT;

Frame buffer rectangular area.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

x

Coordinate for the left-hand corner of the rectangular area.

y

Coordinate for the top corner of the rectangular area.

w

Width of the rectangular area.

h

Height of the rectangular area.

Remarks

RECT specifies the area of the frame buffer to be accessed. Negative values or values that exceed the size of the frame buffer (1024x512) cannot be used.


SndVolume
SndVolume Structure

typedef struct {

unsigned short left;

unsigned short right;

} SndVolume;

Controls the volume of the sound.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

left

L channel volume value.

right

R channel volume value.


SVECTOR
SVECTOR Structure

typedef struct {

short vx;

short vy;

short vz;

short pad;

} SVECTOR;

16bit 3D vectors.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

vx

Vector component

vy

Vector component

vz

Vector component

pad

Padding

Remarks

SVECTOR defines the structure of 16 bit 3D vectors.


VECTOR
VECTOR Structure

typedef struct {

long vx;

long vy;

long vz;

long pad;

} VECTOR;

32bit (long word) type 3D vectors.

Defined in: C:/PSX/INCLUDE/LIBPS.H

Members

vx

Vector component

vy

Vector component

vz

Vector component

pad

Padding

Remarks

VECTOR defines the structure of 32 bit 3D vectors.