Introduction
The BIOS ROM holds a small kernel: file input and output, the C library’s string and memory functions, a heap, events and threads, joypad and memory card access, GPU helpers. A program does not link to it; it calls through three fixed entry points in the first bytes of RAM, which the BIOS fills in at start.
The calling convention
- The function number is put in
$t1(R9), and the program jumps to the vector at$A0(the A functions),$B0(B) or$C0(C), in KUSEG, KSEG0 or KSEG1 as it pleases. - Arguments go in
$a0–$a3(R4–R7), more on the stack; the result comes back in$v0(R2). - Programs usually write it as
jal $A0withli $t1, nin the delay slot, or through a three-instruction stubli $t2, $A0 / jr $t2 / li $t1, nthat a library links in.
The explorer names a call wherever it sees this: a jal to a vector (the vectors are named BIOS_A0, BIOS_B0, BIOS_C0), or a jr of a register
just set to one, with the number set in the delay slot or just before. A number that is not set nearby is reported as such; a value in the table’s unused ranges as “no name in the table”.
Two further mechanisms are not described here: the SYS functions through the syscall instruction (number in $a0) and the BREAK functions (number in the break code).
A functions ($A0)
| Numbers | Functions |
|---|---|
00–0F | 00 open, 01 lseek, 02 read, 03 write, 04 close, 05 ioctl, 06 exit, 07 isatty, 08 getc, 09 putc, 0A todigit, 0B atof, 0C strtoul, 0D strtol, 0E abs, 0F labs |
10–1F | 10 atoi, 11 atol, 12 atob, 13 setjmp, 14 longjmp, 15 strcat, 16 strncat, 17 strcmp, 18 strncmp, 19 strcpy, 1A strncpy, 1B strlen, 1C index, 1D rindex, 1E strchr, 1F strrchr |
20–2F | 20 strpbrk, 21 strspn, 22 strcspn, 23 strtok, 24 strstr, 25 toupper, 26 tolower, 27 bcopy, 28 bzero, 29 bcmp, 2A memcpy, 2B memset, 2C memmove, 2D memcmp, 2E memchr, 2F rand |
30–3F | 30 srand, 31 qsort, 32 strtod, 33 malloc, 34 free, 35 lsearch, 36 bsearch, 37 calloc, 38 realloc, 39 InitHeap, 3A _exit, 3B getchar, 3C putchar, 3D gets, 3E puts, 3F printf |
40–56 | 40 SystemErrorUnresolvedException, 41 LoadTest, 42 Load, 43 Exec, 44 FlushCache, 45 init_a0_b0_c0_vectors, 46 GPU_dw, 47 gpu_send_dma, 48 SendGP1Command, 49 GPU_cw, 4A GPU_cwp, 4B send_gpu_linked_list, 4C gpu_abort_dma, 4D GetGPUStatus, 4E gpu_sync, 4F SystemError, 50 SystemError, 51 LoadExec, 52 GetSysSp, 53 SystemError, 54 _96_init, 55 _bu_init, 56 _96_remove |
5B–72 | 5B dev_tty_init, 5C dev_tty_open, 5D dev_tty_in_out, 5E dev_tty_ioctl, 5F dev_cd_open, 60 dev_cd_read, 61 dev_cd_close, 62 dev_cd_firstfile, 63 dev_cd_nextfile, 64 dev_cd_chdir, 65 dev_card_open, 66 dev_card_read, 67 dev_card_write, 68 dev_card_close, 69 dev_card_firstfile, 6A dev_card_nextfile, 6B dev_card_erase, 6C dev_card_undelete, 6D dev_card_format, 6E dev_card_rename, 70 _bu_init, 71 _96_init, 72 _96_remove |
78–81 | 78 CdAsyncSeekL, 7C CdAsyncGetStatus, 7E CdAsyncReadSector, 81 CdAsyncSetMode |
90–9F | 90 CdromIoIrqFunc1, 91 CdromDmaIrqFunc1, 92 CdromIoIrqFunc2, 93 CdromDmaIrqFunc2, 94 CdromGetInt5errCode, 95 CdInitSubFunc, 96 AddCDROMDevice, 97 AddMemCardDevice, 98 AddDuartTtyDevice, 99 add_nullcon_driver, 9A SystemError, 9B SystemError, 9C SetConf, 9D GetConf, 9E SetCdromIrqAutoAbort, 9F SetMem |
A0–B4 | A0 _boot, A1 SystemError, A2 EnqueueCdIntr, A3 DequeueCdIntr, A4 CdGetLbn, A5 CdReadSector, A6 CdGetStatus, A7 bufs_cb_0, A8 bufs_cb_1, A9 bufs_cb_2, AA bufs_cb_3, AB _card_info, AC _card_load, AD _card_auto, AE bufs_cb_4, AF card_write_test, B2 ioabort_raw, B4 GetSystemInfo |
The numbers between these (57–5A, 73–77, 79–7B, 7D, 7F–80, 82–8F, B0, B1, B3) are placeholder entries that return 0, and 6F is listed with a question mark. Some names repeat on purpose (54 and 71 are both _96_init).
B functions ($B0)
| Numbers | Functions |
|---|---|
00–0F | 00 alloc_kernel_memory, 01 free_kernel_memory, 02 init_timer, 03 get_timer, 04 enable_timer_irq, 05 disable_timer_irq, 06 restart_timer, 07 DeliverEvent, 08 OpenEvent, 09 CloseEvent, 0A WaitEvent, 0B TestEvent, 0C EnableEvent, 0D DisableEvent, 0E OpenTh, 0F CloseTh |
10–20 | 10 ChangeTh, 12 InitPAD2, 13 StartPAD2, 14 StopPAD2, 15 PAD_init2, 16 PAD_dr, 17 ReturnFromException, 18 ResetEntryInt, 19 HookEntryInt, 20 UnDeliverEvent |
32–3F | 32 open, 33 lseek, 34 read, 35 write, 36 close, 37 ioctl, 38 exit, 39 isatty, 3A getc, 3B putc, 3C getchar, 3D putchar, 3E gets, 3F puts |
40–4F | 40 cd, 41 format, 42 firstfile2, 43 nextfile, 44 rename, 45 erase, 46 undelete, 47 AddDrv, 48 DelDrv, 49 PrintInstalledDevices, 4A InitCARD2, 4B StartCARD2, 4C StopCARD2, 4D _card_info_subfunc, 4E _card_write, 4F _card_read |
50–5D | 50 _new_card, 51 Krom2RawAdd, 53 Krom2Offset, 54 _get_errno, 55 _get_error, 56 GetC0Table, 57 GetB0Table, 58 _card_chan, 59 testdevice, 5B ChangeClearPAD, 5C _card_status, 5D _card_wait |
Numbers 11 and 24–31 jump to address 0; 1A–1F, 21–23, 2A, 2B, 52 and 5A are error slots; 5E–FF are unused.
C functions ($C0)
| Numbers | Functions |
|---|---|
00–0D | 00 EnqueueTimerAndVblankIrqs, 01 EnqueueSyscallHandler, 02 SysEnqIntRP, 03 SysDeqIntRP, 04 get_free_EvCB_slot, 05 get_free_TCB_slot, 06 ExceptionHandler, 07 InstallExceptionHandlers, 08 SysInitMemory, 09 SysInitKernelVariables, 0A ChangeClearRCnt, 0C InitDefInt, 0D SetIrqAutoAck |
12–1D | 12 InstallDevices, 13 FlushStdInOutPut, 15 _cdevinput, 16 _cdevscan, 17 _circgetc, 18 _circputc, 19 _ioabort, 1A set_card_find_mode, 1B KernelRedirect, 1C AdjustA0Table, 1D get_card_find_mode |
Number 0B is an error slot; 0E–11 and 14 return 0; 1E–7F jump to address 0.
How this page was checked
The tables were read from the Nocash PSX-SPX “Kernel (BIOS)” page through a fetch tool that returns a summary of the page, not its text, so every entry rests on that summary; no second source was read. The C library names (open, read, memcpy, printf) are the ones the functions are known to mirror, which is the only independent sense check. The call-site detection is tested on hand-encoded stubs and calls.
Not described
Known, not yet covered
- Reference: the arguments, return values and quirks of each function; the SYS and BREAK functions; which functions exist in which BIOS revision (the source marks some as missing in early boards).
- Viewer: only a call whose number is set by an immediate in the delay slot or just before, with the vector in a register set by an immediate, is named. A call through a computed table or a function pointer is not.
Links
Reference
- Kernel (BIOS) – PSX-SPX: the A, B and C function tables and the calling convention