PSXSDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Functions
psxbios.h File Reference

Go to the source code of this file.

Data Structures

struct  DIRENTRY
 Directory entry. More...
 

Functions

void PAD_init (unsigned long mode, unsigned long *pad_buf)
 
int PAD_dr (void)
 
unsigned long GetKernelDate (void)
 Returns PSX kernel date.
 
const char * GetKernelRomVersion (void)
 Returns a pointer to a zero-terminated string which contains the kernel ROM version.
 
const char * GetSystemRomVersion (void)
 Returns a pointer to a zero-terminated string which contains the system ROM version.
 
unsigned int GetRamSize (void)
 GetRamSize() should return size of RAM in bytes.
 
void EnterCriticalSection (void)
 Enters a critical section.
 
void ExitCriticalSection (void)
 Exits a critical section.
 
void SysEnqIntRP (int index, unsigned int *buf)
 
void SysDeqIntRP (int index, unsigned int *buf)
 
void ResetEntryInt (void)
 
struct DIRENTRYfirstfile (char *name, struct DIRENTRY *dirent)
 Gets information about the first file which matches the pattern.
 
struct DIRENTRYnextfile (struct DIRENTRY *dir)
 Finds a file with the same conditions as the previous call to firstfile().
 
int get_file_size (char *name)
 Gets the file size of the file named "name".
 
int get_real_file_size (char *name)
 This function is like get_file_size() but doesn't round the file size to the block size.
 
void InitHeap (void *block, int size)
 
void FlushCache (void)
 
void SetRCntHandler (void(*callback)(), int spec, unsigned short target)
 
void RemoveRCntHandler (int spec)
 
int OpenEvent (int desc, int spec, int mode, int *(*func)(void))
 Opens an event, and returns its identifier Must be executed in a critical section.
 
int EnableEvent (unsigned int event)
 Enables an event by its identifier returned by OpenEvent()
 
int CloseEvent (unsigned int event)
 Closes an event by its identifier.
 
int DisableEvent (unsigned int event)
 Disables an event by its identifier.
 
int DeliverEvent (unsigned int ev1, int ev2)
 Generates an event.
 
int TestEvent (unsigned int event)
 Checks if the event specified by its identifier has occured.
 
int WaitEvent (unsigned int event)
 Waits until the event specified by identifier occurs.
 
void LoadExec (char *name, int argc, char **argv)
 Replaces the executable image in memory with the one contained in another executable file in PSX-EXE format.
 

Function Documentation

int CloseEvent ( unsigned int  event)

Closes an event by its identifier.

Parameters
eventNumerical event identifier
Returns
???
int DeliverEvent ( unsigned int  ev1,
int  ev2 
)

Generates an event.

This must be executed in a critical section. If the event to deliver is set to generate an interrupt, the handler function is called.

Parameters
ev1Numerical cause descriptor
ev2Numerical event class
Returns
???
int DisableEvent ( unsigned int  event)

Disables an event by its identifier.

Parameters
eventNumerical event identifier
Returns
???
int EnableEvent ( unsigned int  event)

Enables an event by its identifier returned by OpenEvent()

Parameters
eventNumerical event identifier
Returns
???
void EnterCriticalSection ( void  )

Enters a critical section.

void ExitCriticalSection ( void  )

Exits a critical section.

struct DIRENTRY* firstfile ( char *  name,
struct DIRENTRY dirent 
)
read

Gets information about the first file which matches the pattern.

? and * wildcards can be used. Characters after * are ignored.

Parameters
nameFile name string
direntPointer to a struct DIRENTRY object.
Returns
dirent on success, NULL on failure.
void FlushCache ( void  )
int get_file_size ( char *  name)

Gets the file size of the file named "name".

It is actually just a wrapper around firstfile. It rounds the file size to the block size (2048).

Parameters
nameFIle name string
Returns
File size in bytes, rounded.
int get_real_file_size ( char *  name)

This function is like get_file_size() but doesn't round the file size to the block size.

Parameters
nameFile name string
Returns
File size in bytes, unrounded.
unsigned long GetKernelDate ( void  )

Returns PSX kernel date.

Returns
Kernel date n 0xYYYYMMDD BCD format.
const char* GetKernelRomVersion ( void  )

Returns a pointer to a zero-terminated string which contains the kernel ROM version.

Returns
Pointer to a zero-terminated string which contains the kernel ROM version.
unsigned int GetRamSize ( void  )

GetRamSize() should return size of RAM in bytes.

It doesn't seem to work most times. On SCPH1001, it returns 0. On SCPH1000, it returns 2 (which is the number of megabytes of RAM the PSX has.)

Returns
Size of RAM in bytes.
const char* GetSystemRomVersion ( void  )

Returns a pointer to a zero-terminated string which contains the system ROM version.

Returns
Zero-terminated string which contains the system ROM version.
void InitHeap ( void *  block,
int  size 
)
void LoadExec ( char *  name,
int  argc,
char **  argv 
)

Replaces the executable image in memory with the one contained in another executable file in PSX-EXE format.

WARNING: Does not work right now.

Most likely you want PSX_RunExe()

Parameters
namePath name of PSX-EXE executable
argcNumber of arguments
argvPointer to an array of string pointers for each argument
struct DIRENTRY* nextfile ( struct DIRENTRY dir)
read

Finds a file with the same conditions as the previous call to firstfile().

If a corresponding file is found, file information is stored to the structure pointed to by dir.

Parameters
dirPointer to a struct DIRENTRY object.
Returns
dir on success, NULL on failure.
int OpenEvent ( int  desc,
int  spec,
int  mode,
int *(*)(void)  func 
)

Opens an event, and returns its identifier Must be executed in a critical section.

Parameters
descNumerical cause descriptor
specNumerical event type
modeNumerical mode
funcFunction pointer to callback function
Returns
Numerical identifier for the event opened
int PAD_dr ( void  )
void PAD_init ( unsigned long  mode,
unsigned long *  pad_buf 
)
void RemoveRCntHandler ( int  spec)
void ResetEntryInt ( void  )
void SetRCntHandler ( void(*)()  callback,
int  spec,
unsigned short  target 
)
void SysDeqIntRP ( int  index,
unsigned int *  buf 
)
void SysEnqIntRP ( int  index,
unsigned int *  buf 
)
int TestEvent ( unsigned int  event)

Checks if the event specified by its identifier has occured.

Parameters
eventNumerical event identifier
Returns
1 if the event has occured, 0 if it has not
int WaitEvent ( unsigned int  event)

Waits until the event specified by identifier occurs.

Parameters
eventNumerical event identifier
Returns
1 on success, 0 on failure.