#include <stdarg.h>
#include <psxbios.h>
#include <psxgpu.h>
#include <memcard.h>
#include <psxpad.h>
#include <psxspu.h>
#include <psxcdrom.h>
#include <psxsio.h>
#include <psxgte.h>
Go to the source code of this file.
Data Structures | |
struct | psx_info |
struct | psx_info::kernel |
struct | psx_info::system |
Macros | |
#define | true 1 |
#define | TRUE 1 |
#define | false 0 |
#define | FALSE 0 |
#define | PSXSDK_VERSION 0x0599 |
PSXSDK version information in hexadecimal format. | |
#define | PSXSDK_VERSION_STRING "0.5.99" |
PSXSDK version information in string format. | |
#define | PSXSDK_VERSION_DATE 0x20150729 |
PSXSDK version date (BCD YYYY-MM-DD) | |
Enumerations | |
enum | cop0_register_numbers { COP0_BADVADDR = 8, COP0_SR = 12, COP0_CAUSE = 13, COP0_EPC = 14, COP0_PRID = 15 } |
Coprocessor 0 register numbers. More... | |
enum | psx_rcnt_specs { RCntCNT0 = 0xf2000000, RCntCNT1 = 0xf2000001, RCntCNT2 = 0xf2000002, RCntCNT3 = 0xf2000003 } |
Root counter specifications. More... | |
enum | psx_rcnt_modes { RCntIntr = 0x1000, RCntNotar = 0x0100, RCntStop = 0x0010, RCntSC = 0x0001 } |
Root counter modes. More... | |
enum | psx_init_flags { PSX_INIT_CD = 1, PSX_INIT_SAVESTATE = 2, PSX_INIT_NOBIOS = 4 } |
Flags for PSX_Init. More... | |
Functions | |
void | PSX_Init (void) |
Initialize library. | |
void | PSX_DeInit (void) |
Deinitialize library. | |
void | PSX_InitEx (unsigned int flags) |
Initialize library (extended version) | |
void | PSX_ReadPad (unsigned short *padbuf, unsigned short *padbuf2) |
Reads the status of the buttons of the two joypads. | |
void | PSX_PollPad (int pad_num, psx_pad_state *pad_state) |
Polls a joypad for information. | |
void | PSX_GetSysInfo (struct psx_info *info) |
Takes a pointer to a struct psx_info structure, and fills it with information about the PlayStation on which the program is running. | |
unsigned int | get_cop0_status (void) |
Gets Coprocessor 0 status register. | |
unsigned int | set_cop0_status (unsigned int sreg) |
Sets Coprocessor 0 status register. | |
unsigned int | get_cop0_epc (void) |
Gets the contents of the program counter when the last exception happened. | |
unsigned int | get_cop0_register (unsigned char register_num) |
Get value of specified Coprocessor 0 register. | |
void | set_cop0_register (unsigned char register_num, unsigned int value) |
Set value of specified Coprocessor 0 register. | |
unsigned int | get_cop_register (unsigned char cop_num, unsigned char register_num) |
Get value of the specified (data) register of a specified coprocessor. | |
unsigned int | get_cop_ctrl_register (unsigned char cop_num, unsigned char register_num) |
Get value of the specified control register of a specified coprocessor. | |
void | set_cop_register (unsigned char cop_num, unsigned char register_num, unsigned int value) |
Set value of the specified (data) register of a specified coprocessor. | |
void | set_cop_ctrl_register (unsigned char cop_num, unsigned char register_num, unsigned int value) |
Set value of the specified control register of a specified coprocessor. | |
void | run_cop_instruction (unsigned char cop_num, unsigned int operation) |
Make the specified coprocessor run the specified instruction. | |
int | SetRCnt (int spec, unsigned short target, unsigned int mode) |
Set root counter (documentation TO DO) | |
int | GetRCnt (int spec) |
Get root counter (documentation TO DO) | |
int | StartRCnt (int spec) |
Start root counter (documentation TO DO) | |
int | StopRCnt (int spec) |
Stop root counter (documentation TO DO) | |
int | PSX_RestoreBiosState (void) |
Restores BIOS state to the one prior the initialization of the library. | |
unsigned int | PSX_GetInitFlags (void) |
Gets the bitmask for the flags passed to PSX_InitEx() | |
void | SetVBlankHandler (void(*h)()) |
Sets an handler function for the VBlank interrupt. | |
void | RemoveVBlankHandler (void) |
Removes a previously set VBlank handler. | |
Variables | |
unsigned char | __scratchpad [1024] |
Scratch pad - unused data cache, that can be used as "fast RAM". | |
#define false 0 |
#define FALSE 0 |
#define PSXSDK_VERSION 0x0599 |
PSXSDK version information in hexadecimal format.
An explanation of version numbers and how they relate to releases:
#define PSXSDK_VERSION_DATE 0x20150729 |
PSXSDK version date (BCD YYYY-MM-DD)
#define PSXSDK_VERSION_STRING "0.5.99" |
PSXSDK version information in string format.
#define true 1 |
#define TRUE 1 |
Coprocessor 0 register numbers.
enum psx_init_flags |
enum psx_rcnt_modes |
enum psx_rcnt_specs |
unsigned int get_cop0_epc | ( | void | ) |
Gets the contents of the program counter when the last exception happened.
unsigned int get_cop0_register | ( | unsigned char | register_num | ) |
Get value of specified Coprocessor 0 register.
register_num | Number of Coprocessor 0 register whose value must be retrieved |
unsigned int get_cop0_status | ( | void | ) |
Gets Coprocessor 0 status register.
unsigned int get_cop_ctrl_register | ( | unsigned char | cop_num, |
unsigned char | register_num | ||
) |
Get value of the specified control register of a specified coprocessor.
cop_num | Coprocessor number |
register_num | Number of coprocessor register whose value must be retrieved |
unsigned int get_cop_register | ( | unsigned char | cop_num, |
unsigned char | register_num | ||
) |
Get value of the specified (data) register of a specified coprocessor.
cop_num | Coprocessor number |
register_num | Number of coprocessor register whose value must be retrieved |
int GetRCnt | ( | int | spec | ) |
Get root counter (documentation TO DO)
spec | Spec |
void PSX_DeInit | ( | void | ) |
Deinitialize library.
unsigned int PSX_GetInitFlags | ( | void | ) |
Gets the bitmask for the flags passed to PSX_InitEx()
void PSX_GetSysInfo | ( | struct psx_info * | info | ) |
void PSX_Init | ( | void | ) |
Initialize library.
void PSX_InitEx | ( | unsigned int | flags | ) |
Initialize library (extended version)
flags contains a bitmask specifying which flags are enabled
PSX_Init() is the same as PSX_InitEx(PSX_INIT_CD)
flags | Flag bitmask (flags are to be OR'd) |
void PSX_PollPad | ( | int | pad_num, |
psx_pad_state * | pad_state | ||
) |
Polls a joypad for information.
pad_num | Number of the pad to poll (0 = pad #1, 1 = pad #2, etc.) |
pad_state | Pointer to a psx_pad_state structure in which to store information for the pad. |
void PSX_ReadPad | ( | unsigned short * | padbuf, |
unsigned short * | padbuf2 | ||
) |
Reads the status of the buttons of the two joypads.
Takes two pointers for 16-bit bitmasks, one for the first player's joypad, and one for the second one. Their bits are updated to show which buttons were pressed.
This function only supplies basic functionality, adequate for a normal digital pad.
If more advanced functionality is desired, use PSX_PollPad() instead of this function.
padbuf | Pointer to 16-bit variable where bitmask for pad #1 will be stored. If NULL is passed, this argument is ignored. |
padbuf2 | Pointer to 16-bit variable where bitmask for pad #2 will be stored If NULL is passed, this argument is ignored. |
int PSX_RestoreBiosState | ( | void | ) |
Restores BIOS state to the one prior the initialization of the library.
This function can only be used if PSX_InitEx() was called with the PSX_INIT_SAVESTATE flag. It is usually called by PSX_DeInit() automatically, so unless you know what you are doing, you do not need to call it yourself.
void RemoveVBlankHandler | ( | void | ) |
Removes a previously set VBlank handler.
If SetVBlankHandler() was not called before, calling this function has no effect.
void run_cop_instruction | ( | unsigned char | cop_num, |
unsigned int | operation | ||
) |
Make the specified coprocessor run the specified instruction.
operation | Operation number for the instruction |
void set_cop0_register | ( | unsigned char | register_num, |
unsigned int | value | ||
) |
Set value of specified Coprocessor 0 register.
register_num | Number of Coprocessor 0 register whose value must be set |
value | New value of specified Coprocessor 0 register |
unsigned int set_cop0_status | ( | unsigned int | sreg | ) |
Sets Coprocessor 0 status register.
sreg | New value of Coprocessor 0 status register |
void set_cop_ctrl_register | ( | unsigned char | cop_num, |
unsigned char | register_num, | ||
unsigned int | value | ||
) |
Set value of the specified control register of a specified coprocessor.
cop_num | Coprocessor number |
register_num | Number of Coprocessor 0 register whose value must be set |
value | New value of specified Coprocessor 0 register |
void set_cop_register | ( | unsigned char | cop_num, |
unsigned char | register_num, | ||
unsigned int | value | ||
) |
Set value of the specified (data) register of a specified coprocessor.
cop_num | Coprocessor number |
register_num | Number of Coprocessor 0 register whose value must be set |
value | New value of specified Coprocessor 0 register |
int SetRCnt | ( | int | spec, |
unsigned short | target, | ||
unsigned int | mode | ||
) |
Set root counter (documentation TO DO)
spec | Spec |
target | Target |
mode | mode |
void SetVBlankHandler | ( | void(*)() | h | ) |
Sets an handler function for the VBlank interrupt.
Used for simple, inaccurate timing - the handler function gets called 60 times a second in NTSC video mode and 50 times a second in PAL video mode.
While most games use the VBlank interrupt for timing as they don't require high precision and have mechanisms to keep up with the different speed in PAL or NTSC video mode, for precise timing VBlank is inadequate. It is better to look at root counters if you desire precision.
If there is already a VBlank handler set, this function replaces the current handler with the specified one.
h | Pointer to (new) VBlank handler function |
int StartRCnt | ( | int | spec | ) |
Start root counter (documentation TO DO)
spec | Spec |
int StopRCnt | ( | int | spec | ) |
Stop root counter (documentation TO DO)
spec | Spec |
unsigned char __scratchpad[1024] |
Scratch pad - unused data cache, that can be used as "fast RAM".